Package io.guise.framework.prototype
Class AbstractActionPrototype
- java.lang.Object
-
- com.globalmentor.beans.BoundPropertyObject
-
- io.guise.framework.model.AbstractModel
-
- io.guise.framework.model.DefaultLabelModel
-
- io.guise.framework.model.DefaultInfoModel
-
- io.guise.framework.prototype.AbstractPrototype
-
- io.guise.framework.prototype.AbstractEnableablePrototype
-
- io.guise.framework.prototype.AbstractActionPrototype
-
- All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,ActionListenable
,ActionModel
,Enableable
,InfoModel
,LabelModel
,Model
,ActionPrototype
,Prototype
- Direct Known Subclasses:
MenuPrototype
,NavigateActionPrototype
public abstract class AbstractActionPrototype extends AbstractEnableablePrototype implements ActionPrototype
Abstract prototype information for an action control. If a subclass wants to perform some action, it should overrideaction(int, int)
.- Author:
- Garret Wilson
-
-
Field Summary
-
Fields inherited from class com.globalmentor.beans.BoundPropertyObject
NO_PROPERTY_CHANGE_LISTENERS, NO_VETOABLE_CHANGE_LISTENERS
-
Fields inherited from interface io.guise.framework.model.Enableable
ENABLED_PROPERTY
-
Fields inherited from interface io.guise.framework.model.InfoModel
DESCRIPTION_CONTENT_TYPE_PROPERTY, DESCRIPTION_PROPERTY, INFO_CONTENT_TYPE_PROPERTY, INFO_PROPERTY
-
Fields inherited from interface io.guise.framework.model.LabelModel
GLYPH_URI_PROPERTY, LABEL_CONTENT_TYPE_PROPERTY, LABEL_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description AbstractActionPrototype()
Default constructor.AbstractActionPrototype(java.lang.String label)
Label constructor.AbstractActionPrototype(java.lang.String label, java.net.URI icon)
Label and icon constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
action(int force, int option)
Performs whatever is necessary.void
addActionListener(ActionListener actionListener)
Adds an action listener.protected void
fireActionPerformed(int force, int option)
Fires an action event to all registered action listeners.protected void
fireActionPerformed(ActionEvent actionEvent)
Fires a given action event to all registered action listeners.java.lang.Iterable<ActionListener>
getActionListeners()
void
performAction()
Performs the action with default force and default option.void
performAction(int force, int option)
Performs the action with the given force and option.void
removeActionListener(ActionListener actionListener)
Removes an action listener.-
Methods inherited from class io.guise.framework.prototype.AbstractEnableablePrototype
isEnabled, setEnabled
-
Methods inherited from class io.guise.framework.model.DefaultInfoModel
getDescription, getDescriptionContentType, getInfo, getInfoContentType, setDescription, setDescriptionContentType, setInfo, setInfoContentType
-
Methods inherited from class io.guise.framework.model.DefaultLabelModel
getGlyphURI, getLabel, getLabelContentType, setGlyphURI, setLabel, setLabelContentType, toString
-
Methods inherited from class io.guise.framework.model.AbstractModel
getEventListenerManager, getPlainText
-
Methods inherited from class com.globalmentor.beans.BoundPropertyObject
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, createPostponedPropertyChangeEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, fireVetoableChange, getForwardPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeSupport, getRepeatPropertyChangeListener, getRepeatVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, getVetoableChangeSupport, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.guise.framework.model.Enableable
isEnabled, setEnabled
-
Methods inherited from interface io.guise.framework.model.InfoModel
getDescription, getDescriptionContentType, getInfo, getInfoContentType, setDescription, setDescriptionContentType, setInfo, setInfoContentType
-
Methods inherited from interface io.guise.framework.model.LabelModel
getGlyphURI, getLabel, getLabelContentType, setGlyphURI, setLabel, setLabelContentType
-
-
-
-
Constructor Detail
-
AbstractActionPrototype
public AbstractActionPrototype()
Default constructor.
-
AbstractActionPrototype
public AbstractActionPrototype(java.lang.String label)
Label constructor.- Parameters:
label
- The text of the label, ornull
if there should be no label.
-
AbstractActionPrototype
public AbstractActionPrototype(java.lang.String label, java.net.URI icon)
Label and icon constructor.- Parameters:
label
- The text of the label, ornull
if there should be no label.icon
- The icon URI, which may be a resource URI, ornull
if there is no icon URI.
-
-
Method Detail
-
addActionListener
public void addActionListener(ActionListener actionListener)
Description copied from interface:ActionListenable
Adds an action listener.- Specified by:
addActionListener
in interfaceActionListenable
- Parameters:
actionListener
- The action listener to add.
-
removeActionListener
public void removeActionListener(ActionListener actionListener)
Description copied from interface:ActionListenable
Removes an action listener.- Specified by:
removeActionListener
in interfaceActionListenable
- Parameters:
actionListener
- The action listener to remove.
-
getActionListeners
public java.lang.Iterable<ActionListener> getActionListeners()
- Specified by:
getActionListeners
in interfaceActionModel
- Returns:
- all registered action listeners.
-
performAction
public void performAction()
Description copied from interface:ActionModel
Performs the action with default force and default option. AnActionEvent
is fired to all registeredActionListener
s. This method delegates toActionModel.performAction(int, int)
.- Specified by:
performAction
in interfaceActionModel
-
performAction
public void performAction(int force, int option)
Description copied from interface:ActionModel
Performs the action with the given force and option. AnActionEvent
is fired to all registeredActionListener
s.- Specified by:
performAction
in interfaceActionModel
- Parameters:
force
- The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.option
- The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiated by a mouse right button click.
-
action
protected abstract void action(int force, int option)
Performs whatever is necessary. This method is guaranteed to be called before any action event is fired to any listeners.- Parameters:
force
- The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.option
- The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.
-
fireActionPerformed
protected void fireActionPerformed(int force, int option)
Fires an action event to all registered action listeners. This method delegates tofireActionPerformed(ActionEvent)
.- Parameters:
force
- The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.option
- The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiaged by a mouse right button click.- See Also:
ActionListener
,ActionEvent
-
fireActionPerformed
protected void fireActionPerformed(ActionEvent actionEvent)
Fires a given action event to all registered action listeners.- Parameters:
actionEvent
- The action event to fire.
-
-