|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.neu.ccs.gui.DisplayPanel
edu.neu.ccs.gui.ActionsPanel
A panel containing Action objects represented
by buttons that initiate their respective actions. Aspects of
the action's user interface representation, for example,
the button's label or icon, are extracted from the properties
of the action object and updated if the properties of the
action object are later changed.
An actions panel is designed to drive a GUI by containing buttons that cause actions to be performed by the program that makes use of the graphical interface.
The functionality of the ActionsPanel class is
based on the functionality of Java JToolBar class.
An ActionsPanel may be added to a
JToolBar in order to make use of its floating and
docking functionality.
Action,
Serialized Form| Nested Class Summary |
| Nested classes inherited from class javax.swing.JPanel |
JPanel.AccessibleJPanel |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
private Hashtable |
map
Maps actions to their automatically created buttons, and vice-versa. |
| Fields inherited from class edu.neu.ccs.gui.DisplayPanel |
background, codec, CODEC |
| Fields inherited from class javax.swing.JPanel |
|
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface edu.neu.ccs.gui.Displayable |
DEFAULT_VIEW_STATE, VIEW_STATE |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
ActionsPanel()
Constructs an actions panel that contains no actions and uses the default layout manager for a JPanel. |
|
ActionsPanel(Action[] actions)
Constructs an actions panel that contains the given actions and uses the default layout manager for a JPanel. |
|
ActionsPanel(Action[] actions,
LayoutManager layout)
Constructs an actions panel that contains the given actions and uses the given layout manager. |
|
ActionsPanel(Action[] actions,
Object[] constraints,
LayoutManager layout)
Constructs an actions panel that contains the given actions and uses the given layout manager with the given constraints. |
|
ActionsPanel(LayoutManager layout)
Constructs an actions panel that contains no actions and uses the given layout manager. |
|
| Method Summary | |
JButton |
addAction(Action action)
Adds the given action to the ActionsPanel
by creating a JButton that, when clicked,
will cause the performance of the given action. |
JButton |
addAction(Action action,
Object constraint)
Adds the given action to the ActionsPanel
with the given layout constraint. |
JButton[] |
addActions(Action[] actions)
Adds the given array of actions to this ActionsPanel
by creating JButtons that, when clicked, will cause
the performance of the corresponding action. |
JButton[] |
addActions(Action[] actions,
Object[] constraints)
Adds the given actions to this ActionsPanel
with the given layout constraints. |
Action |
findMatchedAction(Action action)
Returns the base action in this ActionsPanel
that represents the given action, or null
if there is no such base action. |
Action |
findMatchedAction(String name)
Returns the first action in this ActionsPanel
whose NAME property is equal to the given name. |
JButton |
findMatchedButton(Action action)
Returns the button in this ActionsPanel
associated with the base action for the given action,
or null if there is no such button. |
JButton |
findMatchedButton(String name)
Returns the button in this ActionsPanel
associated with the first action found in this panel
whose NAME property is equal to the given name. |
Action |
getAction(JButton button)
Returns the action in this ActionsPanel
corresponding with the given button,
or null if the given button
is null or not in this panel. |
JButton[] |
getActionButtons()
Returns an array containing the buttons in this ActionsPanel created as a result of
addAction or addActions. |
Action[] |
getActions()
Returns an array containing the actions in this ActionsPanel. |
JButton |
getButton(Action action)
Returns the button in this ActionsPanel
corresponding with the given action,
or null if the given action
is null or not in this panel. |
static Icon |
getIcon(Action action)
Returns the icon ( SMALL_ICON)
associated with the given action. |
static String |
getText(Action action)
Returns the text ( NAME)
associated with the given action. |
static String |
getToolTipText(Action action)
Returns the tool tip text ( SHORT_DESCRIPTION)
associated with the given action. |
void |
setDefaultButton(Action action)
Sets the button associated with the given action to be the default button for the root pane containing this ActionsPanel
if this panel has a root pane parent,
and the given button is in this panel. |
void |
setDefaultButton(JButton button)
Sets the given button to be the default button for the root pane containing this ActionsPanel
if this panel has a root pane parent,
and the given button is in this panel. |
void |
setDefaultButton(String name)
Sets the button associated with the first action found in this ActionsPanel
whose NAME property is equal to the given name
to be the default button for the root pane
containing this ActionsPanel
if this panel has a root pane parent,
and the given button is in this panel. |
static void |
setIcon(Action action,
Icon icon)
Sets the icon ( SMALL_ICON)
associated with the given action
to the given icon. |
static void |
setText(Action action,
String text)
Sets the text ( NAME)
associated with the given action
to the given text. |
static void |
setToolTipText(Action action,
String text)
Sets the tool tip text ( SHORT_DESCRIPTION)
associated with the given action
to the given text. |
| Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private Hashtable map
| Constructor Detail |
public ActionsPanel()
JPanel.
ActionsPanel(LayoutManager),
ActionsPanel(Action[]),
ActionsPanel(Action[], LayoutManager),
ActionsPanel(Action[], Object[], LayoutManager)public ActionsPanel(LayoutManager layout)
null, the
default layout manager for a JPanel is used.
layout - the desired layout manager for the panelActionsPanel(),
ActionsPanel(Action[]),
ActionsPanel(Action[], LayoutManager),
ActionsPanel(Action[], Object[], LayoutManager)public ActionsPanel(Action[] actions)
JPanel.
If the given array of actions is null, no actions
are added to the panel.
actions - the actions to be added to the panelActionsPanel(),
ActionsPanel(LayoutManager),
ActionsPanel(Action[], LayoutManager),
ActionsPanel(Action[], Object[], LayoutManager)
public ActionsPanel(Action[] actions,
LayoutManager layout)
null, no actions
are added to the panel.
If the given layout manager is null, the
default layout manager for a JPanel is used.
actions - the actions to be added to the panellayout - the desired layout manager for the panelActionsPanel(),
ActionsPanel(LayoutManager),
ActionsPanel(Action[]),
ActionsPanel(Action[], Object[], LayoutManager)
public ActionsPanel(Action[] actions,
Object[] constraints,
LayoutManager layout)
null, no actions
are added to the panel.
If the given layout manager is null, the
default layout manager for a JPanel is used.
actions - the actions to be added to the panelconstraints - the layout constraints for the buttonlayout - the desired layout manager for the panelActionsPanel(),
ActionsPanel(LayoutManager),
ActionsPanel(Action[]),
ActionsPanel(Action[], LayoutManager)| Method Detail |
public JButton addAction(Action action)
ActionsPanel
by creating a JButton that, when clicked,
will cause the performance of the given action.
action - the action to be added to the panel
addAction(Action, Object),
addActions(Action[]),
addActions(Action[], Object[])
public JButton addAction(Action action,
Object constraint)
ActionsPanel
with the given layout constraint.
action - the action to be added to the panelconstraint - the layout constraint for the button
addAction(Action),
addActions(Action[]),
addActions(Action[], Object[])public JButton[] addActions(Action[] actions)
ActionsPanel
by creating JButtons that, when clicked, will cause
the performance of the corresponding action.
actions - the actions to be added to the panel
addAction(Action),
addAction(Action, Object),
addActions(Action[], Object[])
public JButton[] addActions(Action[] actions,
Object[] constraints)
ActionsPanel
with the given layout constraints.
actions - the action to be added to the panelconstraints - the layout constraints for the button
addAction(Action),
addAction(Action, Object),
addActions(Action[])public Action getAction(JButton button)
ActionsPanel
corresponding with the given button,
or null if the given button
is null or not in this panel.
button - the button whose action is desired
getButton(Action),
getActions(),
getActionButtons()public JButton getButton(Action action)
ActionsPanel
corresponding with the given action,
or null if the given action
is null or not in this panel.
action - the action whose button is desired
getAction(JButton),
getActions(),
getActionButtons()public Action[] getActions()
ActionsPanel.
getAction(JButton),
getButton(Action),
getActionButtons()public JButton[] getActionButtons()
ActionsPanel created as a result of
addAction or addActions.
getAction(JButton),
getButton(Action),
getActions()public Action findMatchedAction(Action action)
ActionsPanel
that represents the given action, or null
if there is no such base action.
If the given action is itself in this panel,
the given action is returned.
action - the action that we seek to match in the panelfindMatchedButton(Action),
ActionWrapper.getBaseAction(Action)public JButton findMatchedButton(Action action)
ActionsPanel
associated with the base action for the given action,
or null if there is no such button.
action - the action that we seek to match in the panelfindMatchedAction(Action),
ActionWrapper.getBaseAction(Action)public Action findMatchedAction(String name)
ActionsPanel
whose NAME property is equal to the given name.
name - the name that we seek to match in the panelfindMatchedButton(String)public JButton findMatchedButton(String name)
ActionsPanel
associated with the first action found in this panel
whose NAME property is equal to the given name.
name - the name that we seek to match in the panelfindMatchedAction(String)public void setDefaultButton(JButton button)
ActionsPanel
if this panel has a root pane parent,
and the given button is in this panel.
button - the button to install as the default buttonsetDefaultButton(Action),
setDefaultButton(String)public void setDefaultButton(Action action)
ActionsPanel
if this panel has a root pane parent,
and the given button is in this panel.
action - the action whose matched button
will be the default buttonsetDefaultButton(JButton),
setDefaultButton(String)public void setDefaultButton(String name)
ActionsPanel
whose NAME property is equal to the given name
to be the default button for the root pane
containing this ActionsPanel
if this panel has a root pane parent,
and the given button is in this panel.
name - the name whose matched button
will be the default buttonsetDefaultButton(JButton),
setDefaultButton(Action)
public static void setText(Action action,
String text)
NAME)
associated with the given action
to the given text.
action - the action to modifytext - the text to setgetText(Action),
setIcon(Action, Icon),
setToolTipText(Action, String),
getIcon(Action),
getToolTipText(Action),
Action.NAME
public static void setIcon(Action action,
Icon icon)
SMALL_ICON)
associated with the given action
to the given icon.
action - the action to modifyicon - the icon to setgetIcon(Action),
setText(Action, String),
setToolTipText(Action, String),
getText(Action),
getToolTipText(Action),
Action.SMALL_ICON
public static void setToolTipText(Action action,
String text)
SHORT_DESCRIPTION)
associated with the given action
to the given text.
action - the action to modifytext - the tool tip text to setgetToolTipText(Action),
setText(Action, String),
setIcon(Action, Icon),
getText(Action),
getIcon(Action),
Action.SHORT_DESCRIPTIONpublic static String getText(Action action)
NAME)
associated with the given action.
If the given action is null,
the NAME property is not set,
or it is not set to a String,
this method returns null.
action - the action to querysetText(Action, String),
getIcon(Action),
getToolTipText(Action),
setIcon(Action, Icon),
setToolTipText(Action, String),
Action.NAMEpublic static Icon getIcon(Action action)
SMALL_ICON)
associated with the given action.
If the given action is null,
the SMALL_ICON property is not set,
or it is not set to an Icon,
this method returns null.
action - the action to querysetIcon(Action, Icon),
getText(Action),
getToolTipText(Action),
setText(Action, String),
setToolTipText(Action, String),
Action.SMALL_ICONpublic static String getToolTipText(Action action)
SHORT_DESCRIPTION)
associated with the given action.
If the given action is null,
the SHORT_DESCRIPTION property is not set,
or it is not set to a String,
this method returns null.
action - the action to querysetToolTipText(Action, String),
getText(Action),
getIcon(Action),
setText(Action, String),
setIcon(Action, Icon),
Action.SHORT_DESCRIPTION
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||