Changeset 4356 in josm for trunk


Ignore:
Timestamp:
2011-08-27T16:03:35+02:00 (13 years ago)
Author:
stoecker
Message:

convert some more ToggleDialog's

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r4350 r4356  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    6 import java.awt.BorderLayout;
    76import java.awt.Color;
    87import java.awt.Component;
     
    1817import java.beans.PropertyChangeListener;
    1918import java.util.ArrayList;
     19import java.util.Arrays;
    2020import java.util.Collections;
    2121import java.util.List;
     
    3131import javax.swing.JLabel;
    3232import javax.swing.JMenuItem;
    33 import javax.swing.JPanel;
    3433import javax.swing.JPopupMenu;
    35 import javax.swing.JScrollPane;
    3634import javax.swing.JSlider;
    3735import javax.swing.JTable;
     
    114112
    115113    ActivateLayerAction activateLayerAction;
    116 
    117     protected JPanel createButtonPanel() {
    118         JPanel buttonPanel = getButtonPanel(5);
    119 
    120         // -- move up action
    121         MoveUpAction moveUpAction = new MoveUpAction();
    122         adaptTo(moveUpAction, model);
    123         adaptTo(moveUpAction,selectionModel);
    124         buttonPanel.add(new SideButton(moveUpAction));
    125 
    126         // -- move down action
    127         MoveDownAction moveDownAction = new MoveDownAction();
    128         adaptTo(moveDownAction, model);
    129         adaptTo(moveDownAction,selectionModel);
    130         buttonPanel.add(new SideButton(moveDownAction));
    131 
    132         // -- activate action
    133         activateLayerAction = new ActivateLayerAction();
    134         adaptTo(activateLayerAction, selectionModel);
    135         buttonPanel.add(new SideButton(activateLayerAction));
    136 
    137         // -- show hide action
    138         ShowHideLayerAction showHideLayerAction = new ShowHideLayerAction();
    139         adaptTo(showHideLayerAction, selectionModel);
    140         buttonPanel.add(new SideButton(showHideLayerAction));
    141 
    142         //-- layer opacity action
    143         LayerOpacityAction layerOpacityAction = new LayerOpacityAction();
    144         adaptTo(layerOpacityAction, selectionModel);
    145         opacityButton = new SideButton(layerOpacityAction);
    146         buttonPanel.add(opacityButton);
    147 
    148         // -- merge layer action
    149         MergeAction mergeLayerAction = new MergeAction();
    150         adaptTo(mergeLayerAction, model);
    151         adaptTo(mergeLayerAction,selectionModel);
    152         buttonPanel.add(new SideButton(mergeLayerAction));
    153 
    154         // -- duplicate layer action
    155         DuplicateAction duplicateLayerAction = new DuplicateAction();
    156         adaptTo(duplicateLayerAction, model);
    157         adaptTo(duplicateLayerAction, selectionModel);
    158         buttonPanel.add(new SideButton(duplicateLayerAction));
    159 
    160         //-- delete layer action
    161         DeleteLayerAction deleteLayerAction = new DeleteLayerAction();
    162         layerList.getActionMap().put("deleteLayer", deleteLayerAction);
    163         adaptTo(deleteLayerAction, selectionModel);
    164         buttonPanel.add(new SideButton(deleteLayerAction, false));
    165 
    166         return buttonPanel;
    167     }
    168114
    169115    /** stores which layer index to toggle and executes the ShowHide action if the layer is present */
     
    254200        }
    255201
    256         add(new JScrollPane(layerList), BorderLayout.CENTER);
    257 
    258202        // init the model
    259203        //
     
    275219                );
    276220
    277         add(createButtonPanel(), BorderLayout.SOUTH);
     221        // -- move up action
     222        MoveUpAction moveUpAction = new MoveUpAction();
     223        adaptTo(moveUpAction, model);
     224        adaptTo(moveUpAction,selectionModel);
     225
     226        // -- move down action
     227        MoveDownAction moveDownAction = new MoveDownAction();
     228        adaptTo(moveDownAction, model);
     229        adaptTo(moveDownAction,selectionModel);
     230
     231        // -- activate action
     232        activateLayerAction = new ActivateLayerAction();
     233        adaptTo(activateLayerAction, selectionModel);
     234
     235        // -- show hide action
     236        ShowHideLayerAction showHideLayerAction = new ShowHideLayerAction();
     237        adaptTo(showHideLayerAction, selectionModel);
     238
     239        //-- layer opacity action
     240        LayerOpacityAction layerOpacityAction = new LayerOpacityAction();
     241        adaptTo(layerOpacityAction, selectionModel);
     242        opacityButton = new SideButton(layerOpacityAction);
     243
     244        // -- merge layer action
     245        MergeAction mergeLayerAction = new MergeAction();
     246        adaptTo(mergeLayerAction, model);
     247        adaptTo(mergeLayerAction,selectionModel);
     248
     249        // -- duplicate layer action
     250        DuplicateAction duplicateLayerAction = new DuplicateAction();
     251        adaptTo(duplicateLayerAction, model);
     252        adaptTo(duplicateLayerAction, selectionModel);
     253
     254        //-- delete layer action
     255        DeleteLayerAction deleteLayerAction = new DeleteLayerAction();
     256        layerList.getActionMap().put("deleteLayer", deleteLayerAction);
     257        adaptTo(deleteLayerAction, selectionModel);
     258
     259        createLayout(layerList, true, Arrays.asList(new SideButton[] {
     260            new SideButton(moveUpAction),
     261            new SideButton(moveDownAction),
     262            new SideButton(activateLayerAction),
     263            new SideButton(showHideLayerAction),
     264            opacityButton,
     265            new SideButton(mergeLayerAction),
     266            new SideButton(duplicateLayerAction),
     267            new SideButton(deleteLayerAction, false)
     268        }));
     269
    278270        createVisibilityToggleShortcuts();
    279271    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r4335 r4356  
    764764        JScrollPane scrollPane = new JScrollPane(bothTables);
    765765        scrollPane.addMouseListener(dblClickWatch);
    766         add(scrollPane, BorderLayout.CENTER);
    767766
    768767        selectSth.setPreferredSize(scrollPane.getSize());
    769768        presets.setSize(scrollPane.getSize());
    770 
    771         JPanel buttonPanel = getButtonPanel(3);
    772769
    773770        // -- add action and shortcut
    774771        this.btnAdd = new SideButton(addAction);
    775772        btnAdd.setFocusable(true);
    776         buttonPanel.add(this.btnAdd);
    777773        btnAdd.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter");
    778774        btnAdd.getActionMap().put("onEnter", addAction);
     
    784780        membershipTable.getSelectionModel().addListSelectionListener(editAction);
    785781        this.btnEdit = new SideButton(editAction);
    786         buttonPanel.add(this.btnEdit);
    787782
    788783        // -- delete action
     
    796791        );
    797792        getActionMap().put("delete", deleteAction);
    798         buttonPanel.add(this.btnDel);
    799         add(buttonPanel, BorderLayout.SOUTH);
     793
     794        createLayout(scrollPane, false, Arrays.asList(new SideButton[] {
     795            this.btnAdd, this.btnEdit, this.btnDel
     796        }));
    800797
    801798        // -- help action
Note: See TracChangeset for help on using the changeset viewer.