JGraphpad Pro
v6.0.5.0


com.jgraph.editor
Class JGraphEditorAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended bycom.jgraph.editor.JGraphEditorAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable
Direct Known Subclasses:
JGraphpadEditAction, JGraphpadFileAction, JGraphpadFormatAction, JGraphpadHelpAction, JGraphpadViewAction

public abstract class JGraphEditorAction
extends AbstractAction

The base class for all actions in a JGraph editor kit. An action may be toggleable, in which case the UI factory will create an element that displays the action's selection state, and listen to changes of this state to update the element. The enabled state will also be listened to and the UI elements will be updated accordingly.

See Also:
Serialized Form

Nested Class Summary
static interface JGraphEditorAction.Bundle
          An interface to manage a set of actions as a single entity.
 
Field Summary
protected  boolean isToggleAction
          Holds the toggleable state.
static String PROPERTY_ISSELECTED
          Bean property name for isSelected
static String PROPERTY_ISVISIBLE
          Bean property name for isVisible
 
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
JGraphEditorAction(String name)
          Constructs a new action for the specified name
JGraphEditorAction(String name, boolean isToggleAction)
          Constructs a new action for the specified name and isToggleAction state.
 
Method Summary
static Frame getActiveFrame()
          Returns the first active frame.
static Frame getFrame(ActionEvent event)
          Returns the frame for event if the even source is a Component or the active frame.
static JGraphpadPane getJGraphpadPane()
          Returns the JGraphpadPane inside the active frame.
static JGraphpadPane getJGraphpadPane(JFrame frame)
          Returns the JGraphpadPane inside the given frame.
 String getName()
          Returns the name.
static org.jgraph.JGraph getParentGraph(Component component)
          Returns the parent diagram pane of the specified component, or the component itself if it is a editor diagram pane.
static Component getPermanentFocusOwner()
          Returns the permanent focus owner.
static JGraphEditorDiagram getPermanentFocusOwnerDiagram()
          Returns the diagram for the diagram pane that has the focus.
static JGraphEditorDiagramPane getPermanentFocusOwnerDiagramPane()
          Returns the diagram pane that contains the permanent focus owner.
static org.jgraph.JGraph getPermanentFocusOwnerGraph()
          Returns the permanent focus owner graph.
static Component getPermanentFocusOwnerOrParent()
          Returns the permanent focus owner or the parent scroll pane of it.
static String getString(String key)
          Shortcut method to JGraphEditorResources.getString(String).
 boolean isSelected()
          Returns the selection state.
 boolean isToggleAction()
          Returns whether the UI elements should display the selection state.
 boolean isVisible()
          Returns the visible state.
 void setEnabled(boolean newValue)
           
 void setSelected(boolean selected)
          Sets the selection state.
 void setToggleAction(boolean isToggleAction)
          Sets whether the UI elements should display the selection state.
 void setVisible(boolean visible)
          Sets the visible state.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.ActionListener
actionPerformed
 

Field Detail

PROPERTY_ISSELECTED

public static final String PROPERTY_ISSELECTED
Bean property name for isSelected


PROPERTY_ISVISIBLE

public static final String PROPERTY_ISVISIBLE
Bean property name for isVisible


isToggleAction

protected boolean isToggleAction
Holds the toggleable state.

Constructor Detail

JGraphEditorAction

public JGraphEditorAction(String name)
Constructs a new action for the specified name

Parameters:
name - The name of the new action.

JGraphEditorAction

public JGraphEditorAction(String name,
                          boolean isToggleAction)
Constructs a new action for the specified name and isToggleAction state.

Parameters:
name - The name of the new action.
isToggleAction - Whether the action is a toggle action.
Method Detail

setEnabled

public void setEnabled(boolean newValue)

getName

public String getName()
Returns the name.


isToggleAction

public boolean isToggleAction()
Returns whether the UI elements should display the selection state.

Returns:
Returns true if the action is toggleable.

setToggleAction

public void setToggleAction(boolean isToggleAction)
Sets whether the UI elements should display the selection state.

Parameters:
isToggleAction - The isToggleAction state to set.

isSelected

public boolean isSelected()
Returns the selection state.

Returns:
Returns true if the action is selected.

setSelected

public void setSelected(boolean selected)
Sets the selection state. Dispatches a change event.

Parameters:
selected - The selected state to set.
See Also:
Action.putValue(java.lang.String, java.lang.Object)

isVisible

public boolean isVisible()
Returns the visible state.

Returns:
Returns true if the action is visible.

setVisible

public void setVisible(boolean visible)
Sets the visible state. Dispatches a change event.

Parameters:
visible - The visible state to set.
See Also:
Action.putValue(java.lang.String, java.lang.Object)

getString

public static String getString(String key)
Shortcut method to JGraphEditorResources.getString(String).

Parameters:
key - The key to return the resource string for.

getFrame

public static Frame getFrame(ActionEvent event)
Returns the frame for event if the even source is a Component or the active frame.

Parameters:
event - The event to get the frame from.
Returns:
Returns the frame for event or the active frame.
See Also:
getActiveFrame()

getPermanentFocusOwner

public static Component getPermanentFocusOwner()
Returns the permanent focus owner.

Returns:
Returns the permanent focus owner.
See Also:
KeyboardFocusManager.getPermanentFocusOwner()

getPermanentFocusOwnerOrParent

public static Component getPermanentFocusOwnerOrParent()
Returns the permanent focus owner or the parent scroll pane of it.

Returns:
Returns the permanent focus owner or its parent scroll pane.
See Also:
KeyboardFocusManager.getPermanentFocusOwner()

getPermanentFocusOwnerGraph

public static org.jgraph.JGraph getPermanentFocusOwnerGraph()
Returns the permanent focus owner graph.

Returns:
Returns the permanent focus owner graph.
See Also:
KeyboardFocusManager.getPermanentFocusOwner()

getPermanentFocusOwnerDiagram

public static JGraphEditorDiagram getPermanentFocusOwnerDiagram()
Returns the diagram for the diagram pane that has the focus.

Returns:
Returns the focused diagram.

getPermanentFocusOwnerDiagramPane

public static JGraphEditorDiagramPane getPermanentFocusOwnerDiagramPane()
Returns the diagram pane that contains the permanent focus owner.


getActiveFrame

public static Frame getActiveFrame()
Returns the first active frame.

Returns:
Returns the active frame.
See Also:
Window.isActive()

getJGraphpadPane

public static JGraphpadPane getJGraphpadPane()
Returns the JGraphpadPane inside the active frame.

Returns:
Returns the JGraphpad pane for the given frame.

getJGraphpadPane

public static JGraphpadPane getJGraphpadPane(JFrame frame)
Returns the JGraphpadPane inside the given frame.

Returns:
Returns the JGraphpad pane for the given frame.

getParentGraph

public static org.jgraph.JGraph getParentGraph(Component component)
Returns the parent diagram pane of the specified component, or the component itself if it is a editor diagram pane.

Returns:
Returns the parent editor diagram pane of component.

JGraphpad Pro
v6.0.5.0


Copyright (C) 2005 JGraph.com. All rights reserved.