Ignore:
Timestamp:
2010-04-11T20:29:30+02:00 (16 years ago)
Author:
bastiK
Message:
  • disable all filters if the filter dialog is not visible
  • show the number of hidden/disabled object on screen in the upper right corner
  • slightly different behaviour for showNotify and hideNotify in ToggleDialog (Now, expanding and collapsing a dialog does not trigger these notifications.)
File:
1 edited

Legend:

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

    r3087 r3178  
    108108        setMinimumSize(new Dimension(0,0));
    109109        this.preferredHeight = preferredHeight;
    110         toggleAction = new ToggleDialogAction(this, name, "dialogs/"+iconName, tooltip, shortcut, iconName);
     110        toggleAction = new ToggleDialogAction(name, "dialogs/"+iconName, tooltip, shortcut, iconName);
    111111        String helpId = "Dialog/"+getClass().getName().substring(getClass().getName().lastIndexOf('.')+1);
    112112        toggleAction.putValue("help", helpId.substring(0, helpId.length()-6));
     
    136136     *
    137137     */
    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) {
    143141            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;
    147142        }
    148143
    149144        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();
    154150            } else {
    155                 dialog.showDialog();
    156                 if (dialog.isDocked && dialog.isCollapsed) {
    157                     dialog.expand();
     151                showDialog();
     152                if (isDocked && isCollapsed) {
     153                    expand();
    158154                }
    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);
    161157                }
     158                showNotify();
    162159            }
    163160        }
     
    166163        public void destroy() {
    167164            super.destroy();
    168             dialog = null;
    169165        }
    170166    }
     
    185181        toggleAction.putValue("selected", false);
    186182        toggleAction.putValue("selected", true);
    187         showNotify();
    188183    }
    189184
     
    218213        setIsShowing(false);
    219214        toggleAction.putValue("selected", false);
    220         hideNotify();
    221215    }
    222216
     
    259253            setMinimumSize(new Dimension(Integer.MAX_VALUE,20));
    260254            lblMinimized.setIcon(ImageProvider.get("misc", "minimized"));
    261             hideNotify();
    262255        }
    263256        else throw new IllegalStateException();
     
    275268            setMaximumSize(new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
    276269            lblMinimized.setIcon(ImageProvider.get("misc", "normal"));
    277             showNotify();
    278270        }
    279271        else throw new IllegalStateException();
     
    402394                            hideDialog();
    403395                            dialogsPanel.reconstruct(Action.ELEMENT_SHRINKS, null);
     396                            hideNotify();
    404397                        }
    405398                    }
     
    441434                    } else {
    442435                        hideDialog();
     436                        hideNotify();
    443437                    }
    444438                }
Note: See TracChangeset for help on using the changeset viewer.