Ticket #3674: hide-dialogspanel.patch
File hide-dialogspanel.patch, 2.7 KB (added by , 16 years ago) |
---|
-
src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
11 11 12 12 import javax.swing.BoxLayout; 13 13 import javax.swing.JPanel; 14 import javax.swing.JSplitPane; 14 15 15 16 import org.openstreetmap.josm.gui.MultiSplitLayout; 16 17 import org.openstreetmap.josm.gui.MultiSplitLayout.Node; … … 29 30 * Panels that are added to the multisplitpane. 30 31 */ 31 32 private List<JPanel> panels = new ArrayList<JPanel>(); 33 34 final private JSplitPane parent; 35 public DialogsPanel(JSplitPane parent) { 36 this.parent = parent; 37 } 32 38 33 39 private boolean initialized = false; 34 40 public void initialize(List<ToggleDialog> allDialogs) { … … 258 264 mSpltPane.getMultiSplitLayout().setDividerSize(DIVIDER_SIZE); 259 265 mSpltPane.getMultiSplitLayout().setFloatingDividers(true); 260 266 mSpltPane.revalidate(); 267 268 /** 269 * Hide the Panel, if there is nothing to show 270 */ 271 if (numPanels == 1 && panels.get(N-1).getComponents().length == 0) 272 { 273 this.setVisible(false); 274 } else { 275 if (this.getWidth() != 0) { // only if josm started with hidden panel 276 this.setPreferredSize(new Dimension(this.getWidth(), 0)); 277 } 278 this.setVisible(true); 279 parent.resetToPreferredSizes(); 280 } 261 281 } 262 282 263 283 public void destroy() { -
src/org/openstreetmap/josm/gui/MapFrame.java
77 77 * instead of adding directly to this list. 78 78 */ 79 79 private List<ToggleDialog> allDialogs = new ArrayList<ToggleDialog>(); 80 private DialogsPanel dialogsPanel = new DialogsPanel();80 private DialogsPanel dialogsPanel; 81 81 82 82 public final ButtonGroup toolGroup = new ButtonGroup(); 83 83 … … 107 107 108 108 toolGroup.setSelected(((AbstractButton)toolBarActions.getComponent(0)).getModel(), true); 109 109 110 JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, 111 mapView, dialogsPanel); 110 JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true); 111 dialogsPanel = new DialogsPanel(splitPane); 112 splitPane.setLeftComponent(mapView); 113 splitPane.setRightComponent(dialogsPanel); 112 114 113 115 /** 114 116 * All additional space goes to the mapView