Changeset 3178 in josm for trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
- Timestamp:
- 2010-04-11T20:29:30+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r3087 r3178 108 108 setMinimumSize(new Dimension(0,0)); 109 109 this.preferredHeight = preferredHeight; 110 toggleAction = new ToggleDialogAction( this,name, "dialogs/"+iconName, tooltip, shortcut, iconName);110 toggleAction = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortcut, iconName); 111 111 String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1); 112 112 toggleAction.putValue("help", helpId.substring(0, helpId.length()-6)); … … 136 136 * 137 137 */ 138 public final static class ToggleDialogAction extends JosmAction { 139 140 private ToggleDialog dialog; 141 142 private ToggleDialogAction(ToggleDialog dialog, String name, String iconName, String tooltip, Shortcut shortcut, String prefname) { 138 public final class ToggleDialogAction extends JosmAction { 139 140 private ToggleDialogAction(String name, String iconName, String tooltip, Shortcut shortcut, String prefname) { 143 141 super(name, iconName, tooltip, shortcut, false); 144 if (dialog == null)145 throw new IllegalArgumentException("The ToggleDialog supplied for " + name + " cannot be null.");146 this.dialog = dialog;147 142 } 148 143 149 144 public void actionPerformed(ActionEvent e) { 150 dialog.toggleButtonHook(); 151 if (dialog.isShowing) { 152 dialog.hideDialog(); 153 dialog.dialogsPanel.reconstruct(Action.ELEMENT_SHRINKS, null); 145 toggleButtonHook(); 146 if (isShowing) { 147 hideDialog(); 148 dialogsPanel.reconstruct(Action.ELEMENT_SHRINKS, null); 149 hideNotify(); 154 150 } else { 155 dialog.showDialog();156 if ( dialog.isDocked &&dialog.isCollapsed) {157 dialog.expand();151 showDialog(); 152 if (isDocked && isCollapsed) { 153 expand(); 158 154 } 159 if ( dialog.isDocked) {160 dialog .dialogsPanel.reconstruct(Action.INVISIBLE_TO_DEFAULT,dialog);155 if (isDocked) { 156 dialogsPanel.reconstruct(Action.INVISIBLE_TO_DEFAULT, ToggleDialog.this); 161 157 } 158 showNotify(); 162 159 } 163 160 } … … 166 163 public void destroy() { 167 164 super.destroy(); 168 dialog = null;169 165 } 170 166 } … … 185 181 toggleAction.putValue("selected", false); 186 182 toggleAction.putValue("selected", true); 187 showNotify();188 183 } 189 184 … … 218 213 setIsShowing(false); 219 214 toggleAction.putValue("selected", false); 220 hideNotify();221 215 } 222 216 … … 259 253 setMinimumSize(new Dimension(Integer.MAX_VALUE,20)); 260 254 lblMinimized.setIcon(ImageProvider.get("misc", "minimized")); 261 hideNotify();262 255 } 263 256 else throw new IllegalStateException(); … … 275 268 setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); 276 269 lblMinimized.setIcon(ImageProvider.get("misc", "normal")); 277 showNotify();278 270 } 279 271 else throw new IllegalStateException(); … … 402 394 hideDialog(); 403 395 dialogsPanel.reconstruct(Action.ELEMENT_SHRINKS, null); 396 hideNotify(); 404 397 } 405 398 } … … 441 434 } else { 442 435 hideDialog(); 436 hideNotify(); 443 437 } 444 438 }
Note:
See TracChangeset
for help on using the changeset viewer.
