Package org.openstreetmap.josm.actions
Class ExpertToggleAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.JosmAction
-
- org.openstreetmap.josm.actions.ToggleAction
-
- org.openstreetmap.josm.actions.ExpertToggleAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener,java.io.Serializable,java.lang.Cloneable,java.util.EventListener,javax.swing.Action,Destroyable
public class ExpertToggleAction extends ToggleAction
This action toggles the Expert mode.- Since:
- 4840
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceExpertToggleAction.ExpertModeChangeListenerThis listener is notified whenever the expert mode setting changed.-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
-
-
Field Summary
Fields Modifier and Type Field Description private static ExpertToggleActionINSTANCEprivate static ListenerList<ExpertToggleAction.ExpertModeChangeListener>listenersprivate static BooleanPropertyPREF_EXPERTprivate static ListenerList<java.awt.Component>visibilityToggleListeners-
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
-
-
Constructor Summary
Constructors Constructor Description ExpertToggleAction()Constructs a newExpertToggleAction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)static voidaddExpertModeChangeListener(ExpertToggleAction.ExpertModeChangeListener listener)Register a expert mode change listener.static voidaddExpertModeChangeListener(ExpertToggleAction.ExpertModeChangeListener listener, boolean fireWhenAdding)Register a expert mode change listener, and optionally fires it.static voidaddVisibilitySwitcher(java.awt.Component c)Marks a component to be only visible when expert mode is enabled.private static voidfireExpertModeChanged(boolean isExpert)static ExpertToggleActiongetInstance()Replies the unique instance of this action.static booleanhasVisibilitySwitcher(java.awt.Component c)Determines if the given component tracks visibility changes.static booleanisExpert()Determines if expert mode is enabled.protected voidnotifySelectedState()static voidremoveExpertModeChangeListener(ExpertToggleAction.ExpertModeChangeListener listener)Removes a expert mode change listenerstatic voidremoveVisibilitySwitcher(java.awt.Component c)Stops tracking visibility changes for the given component.voidsetExpert(boolean isExpert)Forces the expert mode state to the given state.-
Methods inherited from class org.openstreetmap.josm.actions.ToggleAction
addButtonModel, isSelected, removeButtonModel, setSelected, toggleSelectedState
-
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
listeners
private static final ListenerList<ExpertToggleAction.ExpertModeChangeListener> listeners
-
visibilityToggleListeners
private static final ListenerList<java.awt.Component> visibilityToggleListeners
-
PREF_EXPERT
private static final BooleanProperty PREF_EXPERT
-
INSTANCE
private static final ExpertToggleAction INSTANCE
-
-
Constructor Detail
-
ExpertToggleAction
public ExpertToggleAction()
Constructs a newExpertToggleAction.
-
-
Method Detail
-
fireExpertModeChanged
private static void fireExpertModeChanged(boolean isExpert)
-
addExpertModeChangeListener
public static void addExpertModeChangeListener(ExpertToggleAction.ExpertModeChangeListener listener)
Register a expert mode change listener.- Parameters:
listener- the listener. Ignored if null.
-
addExpertModeChangeListener
public static void addExpertModeChangeListener(ExpertToggleAction.ExpertModeChangeListener listener, boolean fireWhenAdding)
Register a expert mode change listener, and optionally fires it.- Parameters:
listener- the listener. Ignored if null.fireWhenAdding- if true, the listener will be fired immediately after added
-
removeExpertModeChangeListener
public static void removeExpertModeChangeListener(ExpertToggleAction.ExpertModeChangeListener listener)
Removes a expert mode change listener- Parameters:
listener- the listener. Ignored if null.
-
addVisibilitySwitcher
public static void addVisibilitySwitcher(java.awt.Component c)
Marks a component to be only visible when expert mode is enabled. The visibility of the component is changed automatically.- Parameters:
c- The component.
-
removeVisibilitySwitcher
public static void removeVisibilitySwitcher(java.awt.Component c)
Stops tracking visibility changes for the given component.- Parameters:
c- The component.- See Also:
addVisibilitySwitcher(Component)
-
hasVisibilitySwitcher
public static boolean hasVisibilitySwitcher(java.awt.Component c)
Determines if the given component tracks visibility changes.- Parameters:
c- The component.- Returns:
trueif the given component tracks visibility changes- Since:
- 15649
-
notifySelectedState
protected final void notifySelectedState()
- Overrides:
notifySelectedStatein classToggleAction
-
setExpert
public void setExpert(boolean isExpert)
Forces the expert mode state to the given state.- Parameters:
isExpert- if expert mode should be used.- Since:
- 11224
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
-
getInstance
public static ExpertToggleAction getInstance()
Replies the unique instance of this action.- Returns:
- The unique instance of this action
-
isExpert
public static boolean isExpert()
Determines if expert mode is enabled.- Returns:
trueif expert mode is enabled,falseotherwise.
-
-