Changeset 1332 in josm for trunk/src


Ignore:
Timestamp:
2009-01-24T23:45:58+01:00 (15 years ago)
Author:
stoecker
Message:

better handling of ToggleDialog docking

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r1326 r1332  
    475475        String s = get(key);
    476476        if(s != null && s.length() != 0)
    477         {
    478             /* handle old comma separated stuff - remove in future */
    479             if(s.indexOf(',') >= 0)
    480                 return Arrays.asList(s.split(","));
    481             /* handle space separated stuff - remove in future */
    482             else if(s.indexOf(' ') >= 0)
    483                 return Arrays.asList(s.split(" "));
    484             else
    485                 return Arrays.asList(s.split(";"));
    486         }
     477           return Arrays.asList(s.split(";"));
    487478        return def;
    488479    }
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r1231 r1332  
    66import java.awt.Component;
    77import java.awt.Container;
     8import java.util.ArrayList;
    89
    910import javax.swing.AbstractButton;
     
    7071     */
    7172    public JPanel toggleDialogs = new JPanel();
     73    public ArrayList<ToggleDialog> allDialogs = new ArrayList<ToggleDialog>();
    7274
    7375    public final ButtonGroup toolGroup = new ButtonGroup();
     
    116118     */
    117119    public void destroy() {
     120        for (ToggleDialog t : allDialogs)
     121            t.close();
    118122        for (int i = 0; i < toolBarActions.getComponentCount(); ++i)
    119123            if (toolBarActions.getComponent(i) instanceof Destroyable)
     
    154158        toolBarToggle.add(button);
    155159        toggleDialogs.add(dlg);
     160        allDialogs.add(dlg);
    156161        return button;
    157162    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r1316 r1332  
    6060            if(!selected && winadapter != null)
    6161                winadapter.windowClosing(null);
     62            else if (!Main.pref.getBoolean(action.prefname+".docked", true)) {
     63                EventQueue.invokeLater(new Runnable(){
     64                    public void run() {
     65                        stickyActionListener.actionPerformed(null);
     66                    }
     67                });
     68            }
    6269        }
    6370    }
     
    7178    public JPanel parent;
    7279    WindowAdapter winadapter;
     80    private ActionListener stickyActionListener;
    7381    private final JPanel titleBar = new JPanel(new GridBagLayout());
    7482    public JLabel label = new JLabel();
     
    151159        sticky.setToolTipText(tr("Undock the panel"));
    152160        sticky.setBorder(BorderFactory.createEmptyBorder());
    153         final ActionListener stickyActionListener = new ActionListener(){
     161        stickyActionListener = new ActionListener(){
    154162            public void actionPerformed(ActionEvent e) {
    155163                final JFrame f = new JFrame(name);
     
    169177                            setVisible(true);
    170178                        titleBar.setVisible(true);
    171                         Main.pref.put(action.prefname+".docked", true);
     179                        if(e != null)
     180                            Main.pref.put(action.prefname+".docked", true);
    172181                    }
    173182                }));
     
    230239    }
    231240
     241    public void close()
     242    {
     243        if(winadapter != null)
     244            winadapter.windowClosing(null);
     245    }
     246
    232247    public void setTitle(String title, boolean active) {
    233248        if(active) {
Note: See TracChangeset for help on using the changeset viewer.