- Timestamp:
- 2011-08-27T16:03:35+02:00 (13 years ago)
- 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 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.BorderLayout;7 6 import java.awt.Color; 8 7 import java.awt.Component; … … 18 17 import java.beans.PropertyChangeListener; 19 18 import java.util.ArrayList; 19 import java.util.Arrays; 20 20 import java.util.Collections; 21 21 import java.util.List; … … 31 31 import javax.swing.JLabel; 32 32 import javax.swing.JMenuItem; 33 import javax.swing.JPanel;34 33 import javax.swing.JPopupMenu; 35 import javax.swing.JScrollPane;36 34 import javax.swing.JSlider; 37 35 import javax.swing.JTable; … … 114 112 115 113 ActivateLayerAction activateLayerAction; 116 117 protected JPanel createButtonPanel() {118 JPanel buttonPanel = getButtonPanel(5);119 120 // -- move up action121 MoveUpAction moveUpAction = new MoveUpAction();122 adaptTo(moveUpAction, model);123 adaptTo(moveUpAction,selectionModel);124 buttonPanel.add(new SideButton(moveUpAction));125 126 // -- move down action127 MoveDownAction moveDownAction = new MoveDownAction();128 adaptTo(moveDownAction, model);129 adaptTo(moveDownAction,selectionModel);130 buttonPanel.add(new SideButton(moveDownAction));131 132 // -- activate action133 activateLayerAction = new ActivateLayerAction();134 adaptTo(activateLayerAction, selectionModel);135 buttonPanel.add(new SideButton(activateLayerAction));136 137 // -- show hide action138 ShowHideLayerAction showHideLayerAction = new ShowHideLayerAction();139 adaptTo(showHideLayerAction, selectionModel);140 buttonPanel.add(new SideButton(showHideLayerAction));141 142 //-- layer opacity action143 LayerOpacityAction layerOpacityAction = new LayerOpacityAction();144 adaptTo(layerOpacityAction, selectionModel);145 opacityButton = new SideButton(layerOpacityAction);146 buttonPanel.add(opacityButton);147 148 // -- merge layer action149 MergeAction mergeLayerAction = new MergeAction();150 adaptTo(mergeLayerAction, model);151 adaptTo(mergeLayerAction,selectionModel);152 buttonPanel.add(new SideButton(mergeLayerAction));153 154 // -- duplicate layer action155 DuplicateAction duplicateLayerAction = new DuplicateAction();156 adaptTo(duplicateLayerAction, model);157 adaptTo(duplicateLayerAction, selectionModel);158 buttonPanel.add(new SideButton(duplicateLayerAction));159 160 //-- delete layer action161 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 }168 114 169 115 /** stores which layer index to toggle and executes the ShowHide action if the layer is present */ … … 254 200 } 255 201 256 add(new JScrollPane(layerList), BorderLayout.CENTER);257 258 202 // init the model 259 203 // … … 275 219 ); 276 220 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 278 270 createVisibilityToggleShortcuts(); 279 271 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r4335 r4356 764 764 JScrollPane scrollPane = new JScrollPane(bothTables); 765 765 scrollPane.addMouseListener(dblClickWatch); 766 add(scrollPane, BorderLayout.CENTER);767 766 768 767 selectSth.setPreferredSize(scrollPane.getSize()); 769 768 presets.setSize(scrollPane.getSize()); 770 771 JPanel buttonPanel = getButtonPanel(3);772 769 773 770 // -- add action and shortcut 774 771 this.btnAdd = new SideButton(addAction); 775 772 btnAdd.setFocusable(true); 776 buttonPanel.add(this.btnAdd);777 773 btnAdd.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "onEnter"); 778 774 btnAdd.getActionMap().put("onEnter", addAction); … … 784 780 membershipTable.getSelectionModel().addListSelectionListener(editAction); 785 781 this.btnEdit = new SideButton(editAction); 786 buttonPanel.add(this.btnEdit);787 782 788 783 // -- delete action … … 796 791 ); 797 792 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 })); 800 797 801 798 // -- help action
Note:
See TracChangeset
for help on using the changeset viewer.