public void addMapMode(IconToggleButton b) { toolBarActions.add(b); toolGroup.add(b); allMapModeButtons.add(b); if (b.getAction() instanceof MapMode) { mapModes.add((MapMode) b.getAction()); } else throw new IllegalArgumentException("MapMode action must be subclass of MapMode"); addHideContextMenu(b); b.applyButtonHiddenPreferences(); }
/** * Call this to add new toggle dialogs to the left button-list * * @param dlg The toggle dialog. It must not be in the list already. */ public IconToggleButton addToggleDialog(final ToggleDialog dlg, boolean isExpert) { final IconToggleButton button = new IconToggleButton(dlg.getToggleAction(), isExpert); button.setShowHideButtonListener(dlg); addHideContextMenu(button); dlg.setButton(button); toolBarToggle.add(button); allDialogs.add(dlg); allDialogButtons.add(button); button.applyButtonHiddenPreferences(); if (dialogsPanel.initialized) { dialogsPanel.add(dlg); } return button; }