public abstract class ToggleAction extends JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter| Modifier and Type | Field and Description |
|---|---|
private java.util.Set<javax.swing.ButtonModel> |
buttonModels |
sc| Constructor and Description |
|---|
ToggleAction(java.lang.String name,
ImageProvider icon,
java.lang.String tooltip,
Shortcut shortcut,
boolean registerInToolbar,
java.lang.String toolbarId,
boolean installAdapters)
Constructs a
ToggleAction. |
ToggleAction(java.lang.String name,
java.lang.String iconName,
java.lang.String tooltip,
Shortcut shortcut,
boolean registerInToolbar)
Constructs a
ToggleAction. |
| Modifier and Type | Method and Description |
|---|---|
void |
addButtonModel(javax.swing.ButtonModel model)
Adds a button model
|
boolean |
isSelected()
Determines if this action is currently being selected.
|
protected void |
notifySelectedState() |
void |
removeButtonModel(javax.swing.ButtonModel model)
Removes a button model
|
protected void |
setSelected(boolean selected) |
protected void |
toggleSelectedState(java.awt.event.ActionEvent e)
Toggles the selcted action state, if needed according to the ActionEvent that trigerred the action.
|
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setTooltip, updateEnabledState, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFutureaddPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledprivate final transient java.util.Set<javax.swing.ButtonModel> buttonModels
public ToggleAction(java.lang.String name, ImageProvider icon, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar, java.lang.String toolbarId, boolean installAdapters)
ToggleAction.name - the action's text as displayed on the menu (if it is added to a menu)icon - the icon to usetooltip - a longer description of the action that will be displayed in the tooltip. Please note
that html is not supported for menu actions on some platforms.shortcut - a ready-created shortcut object or null if you don't want a shortcut. But you always
do want a shortcut, remember you can always register it with group=none, so you
won't be assigned a shortcut unless the user configures one. If you pass null here,
the user CANNOT configure a shortcut for your action.registerInToolbar - register this action for the toolbar preferences?toolbarId - identifier for the toolbar preferences. The iconName is used, if this parameter is nullinstallAdapters - false, if you don't want to install layer changed and selection changed adapterspublic ToggleAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean registerInToolbar)
ToggleAction.name - the action's text as displayed on the menu (if it is added to a menu)iconName - the name of icon to usetooltip - a longer description of the action that will be displayed in the tooltip. Please note
that html is not supported for menu actions on some platforms.shortcut - a ready-created shortcut object or null if you don't want a shortcut. But you always
do want a shortcut, remember you can always register it with group=none, so you
won't be assigned a shortcut unless the user configures one. If you pass null here,
the user CANNOT configure a shortcut for your action.registerInToolbar - register this action for the toolbar preferences?protected final void setSelected(boolean selected)
public final boolean isSelected()
true if this action is currently being selected, false otherwisepublic final void addButtonModel(javax.swing.ButtonModel model)
model - The button model to addpublic final void removeButtonModel(javax.swing.ButtonModel model)
model - The button model to removeprotected void notifySelectedState()
protected final void toggleSelectedState(java.awt.event.ActionEvent e)
e - ActionEvent that trigerred the action