JGraphpad Pro
v6.0.5.0


com.jgraph.pad.action
Class JGraphpadEditAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended bycom.jgraph.editor.JGraphEditorAction
          extended bycom.jgraph.pad.action.JGraphpadEditAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable

public class JGraphpadEditAction
extends JGraphEditorAction

Implements all actions of the edit menu. The selectPath and selectTree actions are implemented by plugins.

See Also:
Serialized Form

Nested Class Summary
static class JGraphpadEditAction.AllActions
          Bundle of all actions in this class.
 
Nested classes inherited from class com.jgraph.editor.JGraphEditorAction
JGraphEditorAction.Bundle
 
Field Summary
protected  Action fallbackAction
          Fallback action if the focus-owner is not a graph.
protected static Object lastFoundCell
          Holds the last found cell for a search.
protected static Pattern lastSearchPattern
          Holds the last search expression.
static String NAME_CLEARSELECTION
          Specifies the name for the clearSelection action.
static String NAME_COPY
          Specifies the name for the copy action.
static String NAME_CUT
          Specifies the name for the cut action.
static String NAME_DELETE
          Specifies the name for the delete action.
static String NAME_DESELECTEDGES
          Specifies the name for the deselectEdges action.
static String NAME_DESELECTVERTICES
          Specifies the name for the deselectVertices action.
static String NAME_EDIT
          Specifies the name for the edit action.
static String NAME_FIND
          Specifies the name for the find action.
static String NAME_FINDAGAIN
          Specifies the name for the findAgain action.
static String NAME_INVERTSELECTION
          Specifies the name for the invertSelection action.
static String NAME_PASTE
          Specifies the name for the paste action.
static String NAME_REDO
          Specifies the name for the redo action.
static String NAME_SELECTALL
          Specifies the name for the selectAll action.
static String NAME_SELECTEDGES
          Specifies the name for the selectEdges action.
static String NAME_SELECTVERTICES
          Specifies the name for the selectVertices action.
static String NAME_UNDO
          Specifies the name for the undo action.
 
Fields inherited from class com.jgraph.editor.JGraphEditorAction
isToggleAction, PROPERTY_ISSELECTED, PROPERTY_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
JGraphpadEditAction(String name)
          Constructs a new edit action for the specified name.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Executes the action based on the action name.
protected  void doEdit(org.jgraph.JGraph graph)
          Starts editing the selection cell in the specified graph.
 void doFindAgain(org.jgraph.JGraph graph)
          Displays a dialog for lastSearchPattern if it is null and performs a search using regular expression matching starting at lastFoundCell.
 void doInvertSelection(org.jgraph.JGraph graph)
          Inverts the selection in the specified graph by selecting all cells for which isParentSelected(JGraph, Object) returns false.
protected  void doRedo(JGraphEditorDiagramPane diagramPane)
          Undos the last operation in the specified diagram pane.
protected  void doSelect(org.jgraph.JGraph graph, boolean all, boolean edges, boolean deselect)
          Adds or removes the specified cells to/from the selection.
protected  void doUndo(JGraphEditorDiagramPane diagramPane)
          Undos the last operation in the specified diagram pane.
 Action getFallbackAction()
          Returns the fallback action.
protected  boolean isParentSelected(org.jgraph.JGraph graph, Object cell)
          Helper method that returns true if either the cell or one of its parent is selected in graph.
 
Methods inherited from class com.jgraph.editor.JGraphEditorAction
getActiveFrame, getFrame, getJGraphpadPane, getJGraphpadPane, getName, getParentGraph, getPermanentFocusOwner, getPermanentFocusOwnerDiagram, getPermanentFocusOwnerDiagramPane, getPermanentFocusOwnerGraph, getPermanentFocusOwnerOrParent, getString, isSelected, isToggleAction, isVisible, setEnabled, setSelected, setToggleAction, setVisible
 
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
 

Field Detail

lastSearchPattern

protected static Pattern lastSearchPattern
Holds the last search expression. Note: In a multi application environment you may have to put this into the application instance.


lastFoundCell

protected static Object lastFoundCell
Holds the last found cell for a search.


NAME_CUT

public static final String NAME_CUT
Specifies the name for the cut action.

See Also:
Constant Field Values

NAME_COPY

public static final String NAME_COPY
Specifies the name for the copy action.

See Also:
Constant Field Values

NAME_PASTE

public static final String NAME_PASTE
Specifies the name for the paste action.

See Also:
Constant Field Values

NAME_DELETE

public static final String NAME_DELETE
Specifies the name for the delete action.

See Also:
Constant Field Values

NAME_EDIT

public static final String NAME_EDIT
Specifies the name for the edit action.

See Also:
Constant Field Values

NAME_FIND

public static final String NAME_FIND
Specifies the name for the find action.

See Also:
Constant Field Values

NAME_FINDAGAIN

public static final String NAME_FINDAGAIN
Specifies the name for the findAgain action.

See Also:
Constant Field Values

NAME_UNDO

public static final String NAME_UNDO
Specifies the name for the undo action.

See Also:
Constant Field Values

NAME_REDO

public static final String NAME_REDO
Specifies the name for the redo action.

See Also:
Constant Field Values

NAME_SELECTALL

public static final String NAME_SELECTALL
Specifies the name for the selectAll action.

See Also:
Constant Field Values

NAME_CLEARSELECTION

public static final String NAME_CLEARSELECTION
Specifies the name for the clearSelection action.

See Also:
Constant Field Values

NAME_SELECTVERTICES

public static final String NAME_SELECTVERTICES
Specifies the name for the selectVertices action.

See Also:
Constant Field Values

NAME_SELECTEDGES

public static final String NAME_SELECTEDGES
Specifies the name for the selectEdges action.

See Also:
Constant Field Values

NAME_DESELECTVERTICES

public static final String NAME_DESELECTVERTICES
Specifies the name for the deselectVertices action.

See Also:
Constant Field Values

NAME_DESELECTEDGES

public static final String NAME_DESELECTEDGES
Specifies the name for the deselectEdges action.

See Also:
Constant Field Values

NAME_INVERTSELECTION

public static final String NAME_INVERTSELECTION
Specifies the name for the invertSelection action.

See Also:
Constant Field Values

fallbackAction

protected Action fallbackAction
Fallback action if the focus-owner is not a graph. This is assigned internally for special action names, namely cut, copy, paste and delete for text components.

Constructor Detail

JGraphpadEditAction

public JGraphpadEditAction(String name)
Constructs a new edit action for the specified name. This constructs the fallbackAction for text components in case of supported actions.

Parameters:
name - The name of the action to be created.
Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
Executes the action based on the action name.

Parameters:
e - The object that describes the event.

doSelect

protected void doSelect(org.jgraph.JGraph graph,
                        boolean all,
                        boolean edges,
                        boolean deselect)
Adds or removes the specified cells to/from the selection. If all is true then edges is ignored.

Parameters:
graph - The graph to perform the operation in.
all - Whether all cells should be selected.
edges - Whether edges or vertices should be selected.
deselect - Whether to remove the cells from the selection.

doInvertSelection

public void doInvertSelection(org.jgraph.JGraph graph)
Inverts the selection in the specified graph by selecting all cells for which isParentSelected(JGraph, Object) returns false.

Parameters:
graph - The graph to perform the operation in.

isParentSelected

protected boolean isParentSelected(org.jgraph.JGraph graph,
                                   Object cell)
Helper method that returns true if either the cell or one of its parent is selected in graph.

Parameters:
graph - The graph to check if the cell is selected in.
cell - The cell that is to be tested for selection.
Returns:
Returns true if cell or one of its ancestors is selected.

doUndo

protected void doUndo(JGraphEditorDiagramPane diagramPane)
Undos the last operation in the specified diagram pane.

Parameters:
diagramPane - The diagram pane to perform the operation in.

doRedo

protected void doRedo(JGraphEditorDiagramPane diagramPane)
Undos the last operation in the specified diagram pane.

Parameters:
diagramPane - The diagram pane to perform the operation in.

doEdit

protected void doEdit(org.jgraph.JGraph graph)
Starts editing the selection cell in the specified graph.

Parameters:
graph - The graph to perform the operation in.

doFindAgain

public void doFindAgain(org.jgraph.JGraph graph)
Displays a dialog for lastSearchPattern if it is null and performs a search using regular expression matching starting at lastFoundCell. The found cell is selected and scrolled to. If no cell is found an error message is displayed.

Parameters:
graph - The graph to perform the operation in.

getFallbackAction

public Action getFallbackAction()
Returns the fallback action.

Returns:
Returns the fallbackAction.

JGraphpad Pro
v6.0.5.0


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