|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--javax.swing.AbstractAction
|
+--org.fopps.ui.actions.BaseAction
BaseAction is the base class of all actions. In comparison to AbstractAction it provides the following extensions
acceptSelection(). Most actions will override this method to ensure that the
action can operate on the existing selection. This implementation accepts every selection.
In collaboration with ActionHandler every instance of BaseAction will be considered
in a context menu, if the action can operate on the current selection. Therefore BaseAction provides a group attribute,
which enables the action handler to group similar actions together.
PopupMenuFactory,
ActionHandler,
Serialized Form| Field Summary | |
static java.lang.String |
GROUP
Group key |
protected static java.lang.Object[] |
selectedItems
|
| Fields inherited from class javax.swing.AbstractAction |
changeSupport, enabled |
| Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON |
| Constructor Summary | |
BaseAction(ActionHandler pListener)
Constructor for BaseAction |
|
BaseAction(java.lang.String pName,
ActionHandler pListener)
Constructor for BaseAction. |
|
BaseAction(java.lang.String name,
javax.swing.Icon icon,
ActionHandler pListener)
Constructor for BaseAction. |
|
| Method Summary | |
boolean |
acceptSelection()
Indicates, if an action is able to work with the selected items. |
abstract void |
actionPerformed(java.awt.event.ActionEvent e)
|
boolean |
addToMenu()
Return true, if action should be added to menu. |
abstract boolean |
addToPopup()
Determines, if action should appear in popup menu |
boolean |
addToToolBar()
Return true, if action should be added to toolbar. |
static void |
clearSelection()
Clear selection. |
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
javax.swing.KeyStroke |
getAccelerator()
Returns the accelerator |
ActionHandler |
getActionHandler()
Returns the underlying action handler |
Application |
getApplication()
Returns the application object |
ProjectContainer |
getContainer()
Returns the current project container |
java.lang.String |
getGroup()
Returns the name of the group. |
javax.swing.Icon |
getIcon()
Returns the icon of the action |
java.lang.String |
getLocaleName()
|
java.lang.String |
getLongDescription()
|
java.lang.Integer |
getMnemonic()
|
java.lang.String |
getName()
Convenience method to access the name of the action |
java.lang.Object[] |
getSelectedItems()
Returns the selectedItems. |
int |
getSelectionSize()
Returns the number of selected items |
java.lang.String |
getShortDescription()
|
boolean |
isStringPropertySet(java.lang.String pKey)
Return true, if string property is set (property not null and length > 0) |
boolean |
isTogglable()
Returns true, if action is a toggle action (behaves similar to a checkbox). |
boolean |
itemInSelection(java.lang.Object pItem)
Checks if selection contains an item |
void |
itemStateChanged(java.awt.event.ItemEvent e)
Handler of itemListener |
void |
setAccelerator(int keyChar)
Convenience method to simplify the less intuitive setting in Swing :-) |
void |
setAccelerator(int keyChar,
int pModifier)
Convenience method to simplify the less intuitive setting in Swing :-) |
void |
setAcceleratorWithAlt(int keyChar)
Sets an accelerator with alt modifier |
void |
setAcceleratorWithCtrl(int keyChar)
Sets an accelerator with ctrl modifier |
void |
setAcceleratorWithShift(int keyChar)
Sets an accelerator with shift modifier |
protected void |
setGroup(java.lang.String group)
Setter for group. |
void |
setLocaleName(java.lang.String localeName)
|
void |
setLongDescription(java.lang.String longDescription)
Covenience method to simplify the less intuitive setting in Swing :-) |
void |
setMnemonic(int keyChar)
Covenience method to simplify the less intuitive setting in Swing :-) |
void |
setMnemonic(int keyChar,
int pModifier)
Covenience method to simplify the less intuitive setting in Swing :-) |
void |
setShortDescription(java.lang.String shortDescription)
Covenience method to simplify the less intuitive setting in Swing :-) |
java.lang.String |
toString()
Returns a string representation of the object. |
void |
updateState()
Force refresh of action |
| Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String GROUP
protected static java.lang.Object[] selectedItems
| Constructor Detail |
public BaseAction(ActionHandler pListener)
pListener - Action handler to connect to
public BaseAction(java.lang.String pName,
ActionHandler pListener)
pName - Name of the actionpListener - Action handler to connect to
public BaseAction(java.lang.String name,
javax.swing.Icon icon,
ActionHandler pListener)
pListener - Action handler to connect toname - Name of the actionicon - Icon to show in toolbar| Method Detail |
public boolean acceptSelection()
public static void clearSelection()
public ProjectContainer getContainer()
public final java.lang.String getGroup()
protected final void setGroup(java.lang.String group)
public java.lang.String getLocaleName()
public void setLocaleName(java.lang.String localeName)
public final Application getApplication()
public ActionHandler getActionHandler()
public java.lang.String getLongDescription()
public void setLongDescription(java.lang.String longDescription)
public java.lang.String getShortDescription()
public void setShortDescription(java.lang.String shortDescription)
public void setMnemonic(int keyChar)
public void setMnemonic(int keyChar,
int pModifier)
public java.lang.Integer getMnemonic()
public void setAccelerator(int keyChar)
public void setAccelerator(int keyChar,
int pModifier)
public void setAcceleratorWithCtrl(int keyChar)
public void setAcceleratorWithAlt(int keyChar)
public void setAcceleratorWithShift(int keyChar)
public javax.swing.KeyStroke getAccelerator()
public javax.swing.Icon getIcon()
public boolean addToToolBar()
public boolean addToMenu()
public boolean isTogglable()
public final boolean isStringPropertySet(java.lang.String pKey)
public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged in interface java.awt.event.ItemListenerpublic int getSelectionSize()
public java.lang.Object[] getSelectedItems()
public boolean itemInSelection(java.lang.Object pItem)
pItem - Item to search forpublic java.lang.String getName()
public int compareTo(java.lang.Object o)
The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)
The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."
compareTo in interface java.lang.Comparableo - the Object to be compared.
java.lang.ClassCastException - if the specified object's type prevents it
from being compared to this Object.public void updateState()
public java.lang.String toString()
toString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString in class java.lang.Objectpublic abstract boolean addToPopup()
public abstract void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerActionListener.actionPerformed(ActionEvent)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||