Changeset 6956 in josm for trunk


Ignore:
Timestamp:
2014-04-05T14:51:42+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #9898 - fix NPE for toggle dialogs not calling createLayout()

File:
1 edited

Legend:

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

    r6938 r6956  
    159159    protected JCheckBoxMenuItem windowMenuItem;
    160160
     161    private final JRadioButtonMenuItem alwaysShown  = new JRadioButtonMenuItem(new AbstractAction(tr("Always shown")) {
     162        @Override
     163        public void actionPerformed(ActionEvent e) {
     164            setIsButtonHiding(ButtonHidingType.ALWAYS_SHOWN);
     165        }
     166    });
     167
     168    private final JRadioButtonMenuItem dynamic      = new JRadioButtonMenuItem(new AbstractAction(tr("Dynamic")) {
     169        @Override
     170        public void actionPerformed(ActionEvent e) {
     171            setIsButtonHiding(ButtonHidingType.DYNAMIC);
     172        }
     173    });
     174
     175    private final JRadioButtonMenuItem alwaysHidden = new JRadioButtonMenuItem(new AbstractAction(tr("Always hidden")) {
     176        @Override
     177        public void actionPerformed(ActionEvent e) {
     178            setIsButtonHiding(ButtonHidingType.ALWAYS_HIDDEN);
     179        }
     180    });
     181   
    161182    /**
    162183     * The linked preferences class (optional). If set, accessible from the title bar with a dedicated button
     
    508529                        @Override
    509530                        public void actionPerformed(ActionEvent e) {
    510                             JRadioButtonMenuItem item = (buttonHiding == ButtonHidingType.DYNAMIC) ? popupMenu.alwaysShown : popupMenu.dynamic;
     531                            JRadioButtonMenuItem item = (buttonHiding == ButtonHidingType.DYNAMIC) ? alwaysShown : dynamic;
    511532                            item.setSelected(true);
    512533                            item.getAction().actionPerformed(null);
     
    586607            private final JMenu buttonHidingMenu = new JMenu(tr("Side buttons"));
    587608
    588             public final JRadioButtonMenuItem alwaysShown  = new JRadioButtonMenuItem(new AbstractAction(tr("Always shown")) {
    589                 @Override public void actionPerformed(ActionEvent e) {
    590                     setIsButtonHiding(ButtonHidingType.ALWAYS_SHOWN);
    591                 }
    592             });
    593 
    594             public final JRadioButtonMenuItem dynamic      = new JRadioButtonMenuItem(new AbstractAction(tr("Dynamic")) {
    595                 @Override public void actionPerformed(ActionEvent e) {
    596                     setIsButtonHiding(ButtonHidingType.DYNAMIC);
    597                 }
    598             });
    599 
    600             public final JRadioButtonMenuItem alwaysHidden = new JRadioButtonMenuItem(new AbstractAction(tr("Always hidden")) {
    601                 @Override public void actionPerformed(ActionEvent e) {
    602                     setIsButtonHiding(ButtonHidingType.ALWAYS_HIDDEN);
    603                 }
    604             });
    605 
    606609            public DialogPopupMenu() {
    607610                alwaysShown.setSelected(buttonHiding == ButtonHidingType.ALWAYS_SHOWN);
     
    714717
    715718    /**
    716      * Sets the dialogsPanel managing all toggle dialogs
     719     * Sets the dialogsPanel managing all toggle dialogs.
     720     * @param dialogsPanel The panel managing all toggle dialogs
    717721     */
    718722    public void setDialogsPanel(DialogsPanel dialogsPanel) {
     
    766770    }
    767771
     772    /**
     773     * Returns the preferred height of this dialog.
     774     * @return The preferred height if the toggle dialog is expanded
     775     */
    768776    public int getPreferredHeight() {
    769777        return preferredHeight;
     
    783791
    784792    /**
    785      * Replies true if this dialog is showing either as docked or as detached dialog
     793     * Determines if this dialog is showing either as docked or as detached dialog.
     794     * @return {@code true} if this dialog is showing either as docked or as detached dialog
    786795     */
    787796    public boolean isDialogShowing() {
     
    790799
    791800    /**
    792      * Replies true if this dialog is docked and expanded
     801     * Determines if this dialog is docked and expanded.
     802     * @return {@code true} if this dialog is docked and expanded
    793803     */
    794804    public boolean isDialogInDefaultView() {
     
    797807
    798808    /**
    799      * Replies true if this dialog is docked and collapsed
     809     * Determines if this dialog is docked and collapsed.
     810     * @return {@code true} if this dialog is docked and collapsed
    800811     */
    801812    public boolean isDialogInCollapsedView() {
Note: See TracChangeset for help on using the changeset viewer.