public abstract class AbstractState extends java.lang.Object implements State
| Modifier and Type | Field and Description |
|---|---|
protected StateManager |
manager
The state manager where we are registered.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
properties
Property list.
|
protected java.beans.PropertyChangeSupport |
propertyChangeSupport
Property change support for standard handling of property changes.
|
ACTIVATION_PROPERTY, ACTIVE_ICON_PROPERTY, DISABLED_ICON_PROPERTY, ENABLE_PROPERTY, INACTIVE_ICON_PROPERTY, LABEL_TEXT_PROPERTY, POPUP_PROPERTY, TOOLTIP_TEXT_PROPERTY| Constructor and Description |
|---|
AbstractState()
Create a new abstract state.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
An action is performed.
|
boolean |
activate()
Activate this state.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener.
|
void |
addPropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
Add a property change listener for a special property.
|
javax.swing.JComponent[] |
addToToolBar(javax.swing.JToolBar toolBar)
Add this element to the toolbar.
|
javax.swing.JComponent[] |
addToToolBar(javax.swing.JToolBar toolBar,
int index)
Add this element to the toolbar.
|
void |
deactivate()
Deactivate this state.
|
java.lang.Object |
getValue(java.lang.String name)
Get the value of a given property.
|
boolean |
isActivated()
Is this state activated?
|
boolean |
isEnabled()
Is this state enabled?
|
boolean |
isToggleEnabled()
Is it possible to switch this state off by clicking on it with the mouse?
|
void |
putValue(java.lang.String key,
java.lang.Object value)
Set the value of a given property,
|
void |
refresh()
Refresh state.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener.
|
void |
removePropertyChangeListener(java.lang.String property,
java.beans.PropertyChangeListener listener)
Remove a property change listener for a special property.
|
void |
setEnabled(boolean state)
Enable or disable this state.
|
void |
setManager(StateManager stateManager)
Set the state manager which handles this state.
|
protected void |
setProperty(java.lang.String name,
java.lang.Object value)
Set a property to a new value.
|
void |
showPopup(java.awt.Component comp,
int x,
int y)
Show a popup menu.
|
protected final java.beans.PropertyChangeSupport propertyChangeSupport
protected final java.util.Map<java.lang.String,java.lang.Object> properties
protected StateManager manager
public void setManager(@NotNull StateManager stateManager)
setManager in interface StatestateManager - state managerpublic void addPropertyChangeListener(@NotNull java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface javax.swing.Actionlistener - listener to addpublic void addPropertyChangeListener(@NotNull java.lang.String property, @NotNull java.beans.PropertyChangeListener listener)
addPropertyChangeListener in interface Stateproperty - property identifierlistener - listener to addpublic void removePropertyChangeListener(@NotNull java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface javax.swing.Actionlistener - listener to removepublic void removePropertyChangeListener(@NotNull java.lang.String property, @NotNull java.beans.PropertyChangeListener listener)
removePropertyChangeListener in interface Stateproperty - property identifierlistener - listener to removepublic boolean activate()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - unusedpublic boolean isActivated()
isActivated in interface Statepublic void deactivate()
deactivate in interface Statepublic void setEnabled(boolean state)
setEnabled in interface javax.swing.Actionstate - if true enable this state, otherwise disable itpublic boolean isEnabled()
isEnabled in interface javax.swing.Actionpublic java.lang.Object getValue(@NotNull java.lang.String name)
getValue in interface javax.swing.Actionname - property namepublic void putValue(@NotNull java.lang.String key, java.lang.Object value)
putValue in interface javax.swing.Actionkey - property keyvalue - new value of propertyprotected void setProperty(@NotNull java.lang.String name, java.lang.Object value)
name - property namevalue - new valuepublic void showPopup(@NotNull java.awt.Component comp, int x, int y)
showPopup in interface Statecomp - component where to show the popup menux - x position in componenty - y position in componentState.hasPopup()@NotNull public javax.swing.JComponent[] addToToolBar(@NotNull javax.swing.JToolBar toolBar)
addToToolBar in interface ToolBarElementtoolBar - toolbar to add to@NotNull public javax.swing.JComponent[] addToToolBar(@NotNull javax.swing.JToolBar toolBar, int index)
addToToolBar in interface ToolBarElementtoolBar - toolbar to add toindex - position where to add the itempublic boolean isToggleEnabled()
isToggleEnabled in interface State