- Timestamp:
- 2009-11-19T08:51:27+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/dialogs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r2317 r2475 3 3 package org.openstreetmap.josm.gui.dialogs; 4 4 5 import static org.openstreetmap.josm.tools.I18n.tr;6 7 5 import java.awt.Dimension; 8 9 6 import java.util.ArrayList; 10 7 import java.util.List; … … 14 11 import javax.swing.JSplitPane; 15 12 16 import org.openstreetmap.josm.gui.MultiSplitLayout; 13 import org.openstreetmap.josm.gui.MultiSplitPane; 14 import org.openstreetmap.josm.gui.MultiSplitLayout.Divider; 15 import org.openstreetmap.josm.gui.MultiSplitLayout.Leaf; 17 16 import org.openstreetmap.josm.gui.MultiSplitLayout.Node; 18 import org.openstreetmap.josm.gui.MultiSplitLayout.Leaf;19 import org.openstreetmap.josm.gui.MultiSplitLayout.Divider;20 17 import org.openstreetmap.josm.gui.MultiSplitLayout.Split; 21 import org.openstreetmap.josm.gui.MultiSplitPane;22 import org.openstreetmap.josm.Main;23 18 24 19 public class DialogsPanel extends JPanel { … … 31 26 */ 32 27 private List<JPanel> panels = new ArrayList<JPanel>(); 33 28 34 29 final private JSplitPane parent; 35 30 public DialogsPanel(JSplitPane parent) { … … 39 34 private boolean initialized = false; 40 35 public void initialize(List<ToggleDialog> allDialogs) { 41 if (initialized) {36 if (initialized) 42 37 throw new IllegalStateException(); 43 }44 38 initialized = true; 45 39 this.allDialogs = allDialogs; … … 56 50 * entire Window is resized. 57 51 */ 52 @Override 58 53 public Dimension getMinimumSize() { 59 54 return new Dimension(0, 40); … … 88 83 INVISIBLE_TO_DEFAULT, 89 84 COLLAPSED_TO_DEFAULT, 90 /* INVISIBLE_TO_COLLAPSED, does not happen */85 /* INVISIBLE_TO_COLLAPSED, does not happen */ 91 86 ELEMENT_SHRINKS /* else. (Remaining elements have more space.) */ 92 87 }; … … 157 152 } 158 153 } else { 159 if (triggeredBy == null) {154 if (triggeredBy == null) 160 155 throw new IllegalArgumentException(); 161 }162 156 163 157 int sumP = 0; // sum of preferred heights of dialogs in default view (without the triggering dialog) … … 285 279 public void destroy() { 286 280 for (ToggleDialog t : allDialogs) { 287 t. closeDetachedDialog();281 t.destroy(); 288 282 } 289 283 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r2364 r2475 163 163 toggleAction.putValue("selected", false); 164 164 toggleAction.putValue("selected", true); 165 showNotify(); 165 166 } 166 167 … … 173 174 setIsShowing(false); 174 175 toggleAction.putValue("selected", false); 176 hideNotify(); 175 177 } 176 178 … … 204 206 */ 205 207 public void collapse() { 206 setContentVisible(false); 207 setIsCollapsed(true); 208 setPreferredSize(new Dimension(0,20)); 209 setMaximumSize(new Dimension(Integer.MAX_VALUE,20)); 210 setMinimumSize(new Dimension(Integer.MAX_VALUE,20)); 211 lblMinimized.setIcon(ImageProvider.get("misc", "minimized")); 208 if (isShowing && isDocked && !isCollapsed) { 209 setContentVisible(false); 210 setIsCollapsed(true); 211 setPreferredSize(new Dimension(0,20)); 212 setMaximumSize(new Dimension(Integer.MAX_VALUE,20)); 213 setMinimumSize(new Dimension(Integer.MAX_VALUE,20)); 214 lblMinimized.setIcon(ImageProvider.get("misc", "minimized")); 215 hideNotify(); 216 } 212 217 } 213 218 … … 216 221 */ 217 222 protected void expand() { 218 setContentVisible(true); 219 setIsCollapsed(false); 220 setPreferredSize(new Dimension(0,preferredHeight)); 221 setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); 222 lblMinimized.setIcon(ImageProvider.get("misc", "normal")); 223 if (isShowing && isDocked && isCollapsed) { 224 setContentVisible(true); 225 setIsCollapsed(false); 226 setPreferredSize(new Dimension(0,preferredHeight)); 227 setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE)); 228 lblMinimized.setIcon(ImageProvider.get("misc", "normal")); 229 showNotify(); 230 } 223 231 } 224 232 … … 237 245 } 238 246 247 public void destroy() { 248 closeDetachedDialog(); 249 hideNotify(); 250 } 251 239 252 /** 240 253 * Closes the the detached dialog if this toggle dialog is currently displayed … … 248 261 detachedDialog.dispose(); 249 262 } 263 } 264 265 /** 266 * Called when toggle dialog is shown (after it was created or expanded). Descendants may overwrite this 267 * method, it's a good place to register listeners needed to keep dialog updated 268 */ 269 public void showNotify() { 270 271 } 272 273 /** 274 * Called when toggle dialog is hidden (collapsed, removed, MapFrame is removed, ...). Good place to unregister 275 * listeners 276 */ 277 public void hideNotify() { 278 250 279 } 251 280
Note:
See TracChangeset
for help on using the changeset viewer.