|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.AbstractAction
org.openpermis.editor.policy.gui.SelectableAction
public abstract class SelectableAction
Extended swing Action
that provides selection support.
Field Summary | |
---|---|
private static String |
SELECTED_KEY
The property key used to indicate that an action is selected. |
private static long |
serialVersionUID
|
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 | |
---|---|
SelectableAction(String name,
Icon icon)
Defines an Action with the specified name and small icon. |
Method Summary | ||
---|---|---|
abstract void |
actionPerformed(ActionEvent e)
|
|
private static
|
configure(T button,
Action action)
Configures the specified button for use with the given action. |
|
JCheckBox |
createCheckBox()
Convenience factory method to create a check box that is bound to this action. |
|
static JCheckBox |
createCheckBox(Action action)
Creates a check box where properties are taken from the Action supplied. |
|
JCheckBoxMenuItem |
createCheckBoxMenuItem()
Convenience factory method to create a check box menu item that is bound to this action. |
|
static JCheckBoxMenuItem |
createCheckBoxMenuItem(Action action)
Creates a check box menu item where properties are taken from the Action supplied. |
|
JToggleButton |
createToggleButton()
Convenience factory method to create a toggle button that is bound to this action. |
|
static JToggleButton |
createToggleButton(Action action)
Creates a toggle button where properties are taken from the Action supplied. |
|
boolean |
isSelected()
Check if the specified action is selected. |
|
boolean |
isSelected(Action action)
Check if the specified action is selected. |
|
boolean |
isSelectionEvent(PropertyChangeEvent event)
Checks if the event is a selection change event fired by this action. |
|
void |
itemStateChanged(ItemEvent e)
Synchronizes the selection state of this action with the one of the button. |
|
void |
setSelected(boolean selected)
Sets the selection state of this 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, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
-7232379579443222905L
private static final String SELECTED_KEY
The value of this property is of type Boolean
.
"_selected"
Constructor Detail |
---|
public SelectableAction(String name, Icon icon)
Action
with the specified name and small icon.
name
- the description of the action.icon
- the small icon of the action.Method Detail |
---|
private static <T extends AbstractButton> T configure(T button, Action action)
If the action is a selectable action then selection support will be added.
T
- the type of button to configure.button
- the button to configure.action
- the action to configure to button from.
public static JCheckBox createCheckBox(Action action)
Also provides selection support if the action specified is a selectable action.
action
- the action to create the check box.
public static JToggleButton createToggleButton(Action action)
Also provides selection support if the action specified is a selectable action.
action
- the action to create the toggle button.
public static JCheckBoxMenuItem createCheckBoxMenuItem(Action action)
Also provides selection support if the action specified is a selectable action.
action
- the action to create the check box menu item.
public boolean isSelected(Action action)
Only selectable actions can have the selected state, all others return false
.
action
- the action to check.
true
if it is selected, false
otherwise.public JCheckBox createCheckBox()
public JToggleButton createToggleButton()
public JCheckBoxMenuItem createCheckBoxMenuItem()
public boolean isSelectionEvent(PropertyChangeEvent event)
Use isSelected()
to check the value or inspect the event values
which are of type Boolean
.
event
- the event to check, may be null
.
true
if the event is a selection change event on this action.public boolean isSelected()
true
if it is selected, false
otherwise.public void setSelected(boolean selected)
selected
- the new selection state of this action.public abstract void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
public void itemStateChanged(ItemEvent e)
If the button changes, the action will change as well.
itemStateChanged
in interface ItemListener
e
- the item state change event.
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:48
Copyright (c) 2002-2007 Ergon Informatik AG