Changeset 2269 in josm for trunk


Ignore:
Timestamp:
2009-10-10T20:35:13+02:00 (14 years ago)
Author:
stoecker
Message:

fix #3674 - patch by bastiK - empty dialogs area did not vanish

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

Legend:

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

    r2224 r2269  
    7878     */
    7979    private List<ToggleDialog> allDialogs = new ArrayList<ToggleDialog>();
    80     private DialogsPanel dialogsPanel = new DialogsPanel();
     80    private DialogsPanel dialogsPanel;
    8181
    8282    public final ButtonGroup toolGroup = new ButtonGroup();
     
    108108        toolGroup.setSelected(((AbstractButton)toolBarActions.getComponent(0)).getModel(), true);
    109109
    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);
    112114
    113115        /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r2224 r2269  
    1212import javax.swing.BoxLayout;
    1313import javax.swing.JPanel;
     14import javax.swing.JSplitPane;
    1415
    1516import org.openstreetmap.josm.gui.MultiSplitLayout;
     
    3031     */
    3132    private List<JPanel> panels = new ArrayList<JPanel>();
     33   
     34    final private JSplitPane parent;
     35    public DialogsPanel(JSplitPane parent) {
     36        this.parent = parent;
     37    }
    3238
    3339    private boolean initialized = false;
     
    259265        mSpltPane.getMultiSplitLayout().setFloatingDividers(true);
    260266        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        }
    261281    }
    262282
Note: See TracChangeset for help on using the changeset viewer.