JGraphpad Pro
v6.0.5.0


com.jgraph.pad.action
Class JGraphpadCellAction

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

public class JGraphpadCellAction
extends JGraphpadFormatAction

Implements all actions of the cell menu. Extends format action to use some of the helper methods.

See Also:
Serialized Form

Nested Class Summary
static class JGraphpadCellAction.AllActions
          Bundle of all actions in this class.
 
Nested classes inherited from class com.jgraph.editor.JGraphEditorAction
JGraphEditorAction.Bundle
 
Field Summary
static int ALIGN_BOTTOM
          Defines the constants to be passed to doAlignCells(JGraph, int).
static int ALIGN_CENTER
          Defines the constants to be passed to doAlignCells(JGraph, int).
static int ALIGN_LEFT
          Defines the constants to be passed to doAlignCells(JGraph, int).
static int ALIGN_MIDDLE
          Defines the constants to be passed to doAlignCells(JGraph, int).
static int ALIGN_RIGHT
          Defines the constants to be passed to doAlignCells(JGraph, int).
static int ALIGN_TOP
          Defines the constants to be passed to doAlignCells(JGraph, int).
static String KEY_PROTOTYPE
          Key under which the cell prototype is stored in the actions values.
static String NAME_ADDPROPERTY
          Specifies the name for the addProperty action.
static String NAME_ALLSELECTABLE
          Specifies the name for the allSelectable action.
static String NAME_CELLSALIGNBOTTOM
          Specifies the name for the cellsAlignBottom action.
static String NAME_CELLSALIGNCENTER
          Specifies the name for the cellsAlignCenter action.
static String NAME_CELLSALIGNLEFT
          Specifies the name for the cellsAlignLeft action.
static String NAME_CELLSALIGNMIDDLE
          Specifies the name for the cellsAlignMiddle action.
static String NAME_CELLSALIGNRIGHT
          Specifies the name for the cellsAlignRight action.
static String NAME_CELLSALIGNTOP
          Specifies the name for the cellsAlignTop action.
static String NAME_CLONEATTRIBUTES
          Specifies the name for the cloneAttributes action.
static String NAME_CLONESIZE
          Specifies the name for the cloneSize action.
static String NAME_CLONEVALUE
          Specifies the name for the cloneValue action.
static String NAME_COLLAPSE
          Specifies the name for the collapse action.
static String NAME_CONNECT
          Specifies the name for the connect action.
static String NAME_DISCONNECT
          Specifies the name for the disconnect action.
static String NAME_EXPAND
          Specifies the name for the expand action.
static String NAME_EXPANDALL
          Specifies the name for the expandAll action.
static String NAME_GROUP
          Specifies the name for the group action.
static String NAME_GROUPASEDGE
          Specifies the name for the groupAsEdge action.
static String NAME_INVERT
          Specifies the name for the invert action.
static String NAME_REMOVEFROMGROUP
          Specifies the name for the removeFromGroup action.
static String NAME_REMOVEPROPERTY
          Specifies the name for the removeProperty action.
static String NAME_TOBACK
          Specifies the name for the toBack action.
static String NAME_TOFRONT
          Specifies the name for the toFront action.
static String NAME_TOGGLECHILDRENSELECTABLE
          Specifies the name for the toggleChildrenSelectable action.
static String NAME_TOGGLECOLLAPSED
          Specifies the name for the collapse action.
static String NAME_TOGGLESELECTABLE
          Specifies the name for the toggleSelectable action.
static String NAME_UNGROUP
          Specifies the name for the ungroup action.
 
Fields inherited from class com.jgraph.pad.action.JGraphpadFormatAction
FONT_UNDERLINE, lastDirectory, NAME_BEGINSIZE, NAME_CELLBACKGROUNDCOLOR, NAME_CELLBORDERCOLOR, NAME_CELLBORDERWIDTH, NAME_CELLGRADIENTCOLOR, NAME_CELLIMAGE, NAME_CELLIMAGEURL, NAME_CELLINSET, NAME_CLEARBEGIN, NAME_CLEARCELLBORDER, NAME_CLEARCELLIMAGE, NAME_CLEAREND, NAME_DASHOFFSET, NAME_DASHPATTERN, NAME_ENDSIZE, NAME_FONT, NAME_FONTBOLD, NAME_FONTCOLOR, NAME_FONTITALIC, NAME_FONTPLAIN, NAME_FONTSIZE, NAME_FONTUNDERLINE, NAME_LINECOLOR, NAME_LINEWIDTH, NAME_RESIZE, NAME_SWITCHALIGNBOTTOM, NAME_SWITCHALIGNCENTER, NAME_SWITCHALIGNLEFT, NAME_SWITCHALIGNMIDDLE, NAME_SWITCHALIGNRIGHT, NAME_SWITCHALIGNTOP, NAME_SWITCHLABELBOTTOM, NAME_SWITCHLABELCENTER, NAME_SWITCHLABELLEFT, NAME_SWITCHLABELMIDDLE, NAME_SWITCHLABELRIGHT, NAME_SWITCHLABELTOP, NAME_SWITCHLOCKHEIGHT, NAME_SWITCHLOCKWIDTH, NAME_SWITCHLOCKX, NAME_SWITCHLOCKY, NAME_SWITCHROUTINGNONE, NAME_SWITCHROUTINGPARALLEL, NAME_SWITCHROUTINGPARALLELSPLINE, NAME_SWITCHROUTINGSIMPLE, NAME_SWITCHSHAPECIRCLE, NAME_SWITCHSHAPECYLINDER, NAME_SWITCHSHAPEDIAMOND, NAME_SWITCHSHAPERECTANGLE, NAME_SWITCHSHAPEROUNDED, NAME_SWITCHSHAPETRIANGLE, NAME_SWITCHSTYLEBEZIER, NAME_SWITCHSTYLEORTHOGONAL, NAME_SWITCHSTYLESPLINE, NAME_TOGGLEAUTOSIZE, NAME_TOGGLECELLEDITABLE, NAME_TOGGLECELLMOVEABLE, NAME_TOGGLECELLOPAQUE, NAME_TOGGLECELLSIZEABLE, NAME_TOGGLECONNECTABLE, NAME_TOGGLECONSTRAINED, NAME_TOGGLEDISCONNECTABLE, NAME_TOGGLEEDGEBENDABLE, NAME_TOGGLEGROUPOPAQUE, NAME_TOGGLEGROUPREPOSITION, NAME_TOGGLELABELALONGEDGE, NAME_TOGGLESTRETCHCELLIMAGE
 
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
JGraphpadCellAction(String name)
          Constructs a new cell action for the specified name.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Executes the action based on the action name.
protected  void alignRectangle2D(Rectangle2D cellBounds, Rectangle2D outerBounds, int constraint)
          Helper methods that aligns cellBounds inside outerBounds according to constraint.
protected  void doAlignCells(org.jgraph.JGraph graph, int constraint)
          Aligns the selection vertices according to constraint.
protected  void doCellProperty(org.jgraph.JGraph graph, boolean add)
          Displays a value dialog and adds or removes the entered value as a property to/from the user objects of the selection cells.
protected  void doClone(org.jgraph.JGraph graph, boolean value, boolean size)
          Clones the value, size or attributes of the first selection cell to the other selection cells.
protected  void doConnect(org.jgraph.JGraph graph, Object prototype)
          Connects the selection vertices using clones of prototype as edges.
protected  void doDisconnect(org.jgraph.JGraph graph)
          Disconnects the selection vertices by removing all edges between them.
protected  void doGroup(org.jgraph.JGraph graph, Object prototype)
          Creates a new group cell that contains the selection cells as children using a clone of prototype as the group cell.
protected  void doGroupAsEdge(org.jgraph.JGraph graph, Object prototype)
          Creates a new group cell that contains the selection cells as children using a clone of prototype as the group cell.
protected  void doInvert(org.jgraph.JGraph graph)
          Inverts all selected cells by swapping the source and target of edges and inverting all control points, or by swapping width and height of vertices.
 
Methods inherited from class com.jgraph.pad.action.JGraphpadFormatAction
doAskColorAttribute, doAskColorAttribute, doAskFloatAttribute, doAskImageAttribute, doAskIntAttribute, doSetDashPattern, doSetFont, doSetHorizontalAlignment, doToggleAttribute, fontDialog, getAttribute, getBooleanAttribute, getIntAttribute, setAttribute, setAttributes, setRouting
 
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

ALIGN_LEFT

public static final int ALIGN_LEFT
Defines the constants to be passed to doAlignCells(JGraph, int).

See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
Defines the constants to be passed to doAlignCells(JGraph, int).

See Also:
Constant Field Values

ALIGN_TOP

public static final int ALIGN_TOP
Defines the constants to be passed to doAlignCells(JGraph, int).

See Also:
Constant Field Values

ALIGN_BOTTOM

public static final int ALIGN_BOTTOM
Defines the constants to be passed to doAlignCells(JGraph, int).

See Also:
Constant Field Values

ALIGN_CENTER

public static final int ALIGN_CENTER
Defines the constants to be passed to doAlignCells(JGraph, int).

See Also:
Constant Field Values

ALIGN_MIDDLE

public static final int ALIGN_MIDDLE
Defines the constants to be passed to doAlignCells(JGraph, int).

See Also:
Constant Field Values

KEY_PROTOTYPE

public static final String KEY_PROTOTYPE
Key under which the cell prototype is stored in the actions values. This is used to store the prototype for connect and group actions, which require to create new edges and groups respectively.

See Also:
Constant Field Values

NAME_CLONEVALUE

public static final String NAME_CLONEVALUE
Specifies the name for the cloneValue action.

See Also:
Constant Field Values

NAME_CLONESIZE

public static final String NAME_CLONESIZE
Specifies the name for the cloneSize action.

See Also:
Constant Field Values

NAME_CLONEATTRIBUTES

public static final String NAME_CLONEATTRIBUTES
Specifies the name for the cloneAttributes action.

See Also:
Constant Field Values

NAME_CELLSALIGNTOP

public static final String NAME_CELLSALIGNTOP
Specifies the name for the cellsAlignTop action.

See Also:
Constant Field Values

NAME_CELLSALIGNMIDDLE

public static final String NAME_CELLSALIGNMIDDLE
Specifies the name for the cellsAlignMiddle action.

See Also:
Constant Field Values

NAME_CELLSALIGNBOTTOM

public static final String NAME_CELLSALIGNBOTTOM
Specifies the name for the cellsAlignBottom action.

See Also:
Constant Field Values

NAME_CELLSALIGNLEFT

public static final String NAME_CELLSALIGNLEFT
Specifies the name for the cellsAlignLeft action.

See Also:
Constant Field Values

NAME_CELLSALIGNCENTER

public static final String NAME_CELLSALIGNCENTER
Specifies the name for the cellsAlignCenter action.

See Also:
Constant Field Values

NAME_CELLSALIGNRIGHT

public static final String NAME_CELLSALIGNRIGHT
Specifies the name for the cellsAlignRight action.

See Also:
Constant Field Values

NAME_TOGGLESELECTABLE

public static final String NAME_TOGGLESELECTABLE
Specifies the name for the toggleSelectable action.

See Also:
Constant Field Values

NAME_ALLSELECTABLE

public static final String NAME_ALLSELECTABLE
Specifies the name for the allSelectable action.

See Also:
Constant Field Values

NAME_TOGGLECHILDRENSELECTABLE

public static final String NAME_TOGGLECHILDRENSELECTABLE
Specifies the name for the toggleChildrenSelectable action.

See Also:
Constant Field Values

NAME_COLLAPSE

public static final String NAME_COLLAPSE
Specifies the name for the collapse action.

See Also:
Constant Field Values

NAME_TOGGLECOLLAPSED

public static final String NAME_TOGGLECOLLAPSED
Specifies the name for the collapse action.

See Also:
Constant Field Values

NAME_EXPAND

public static final String NAME_EXPAND
Specifies the name for the expand action.

See Also:
Constant Field Values

NAME_EXPANDALL

public static final String NAME_EXPANDALL
Specifies the name for the expandAll action.

See Also:
Constant Field Values

NAME_TOBACK

public static final String NAME_TOBACK
Specifies the name for the toBack action.

See Also:
Constant Field Values

NAME_TOFRONT

public static final String NAME_TOFRONT
Specifies the name for the toFront action.

See Also:
Constant Field Values

NAME_GROUP

public static final String NAME_GROUP
Specifies the name for the group action.

See Also:
Constant Field Values

NAME_GROUPASEDGE

public static final String NAME_GROUPASEDGE
Specifies the name for the groupAsEdge action.

See Also:
Constant Field Values

NAME_UNGROUP

public static final String NAME_UNGROUP
Specifies the name for the ungroup action.

See Also:
Constant Field Values

NAME_REMOVEFROMGROUP

public static final String NAME_REMOVEFROMGROUP
Specifies the name for the removeFromGroup action.

See Also:
Constant Field Values

NAME_CONNECT

public static final String NAME_CONNECT
Specifies the name for the connect action.

See Also:
Constant Field Values

NAME_DISCONNECT

public static final String NAME_DISCONNECT
Specifies the name for the disconnect action.

See Also:
Constant Field Values

NAME_ADDPROPERTY

public static final String NAME_ADDPROPERTY
Specifies the name for the addProperty action.

See Also:
Constant Field Values

NAME_REMOVEPROPERTY

public static final String NAME_REMOVEPROPERTY
Specifies the name for the removeProperty action.

See Also:
Constant Field Values

NAME_INVERT

public static final String NAME_INVERT
Specifies the name for the invert action.

See Also:
Constant Field Values
Constructor Detail

JGraphpadCellAction

public JGraphpadCellAction(String name)
Constructs a new cell action for the specified name. If the action name starts with toggle or switch then the action is configured to be a toggle action.

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.

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class JGraphpadFormatAction
Parameters:
e - The object that describes the event.

doInvert

protected void doInvert(org.jgraph.JGraph graph)
Inverts all selected cells by swapping the source and target of edges and inverting all control points, or by swapping width and height of vertices.

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

doCellProperty

protected void doCellProperty(org.jgraph.JGraph graph,
                              boolean add)
Displays a value dialog and adds or removes the entered value as a property to/from the user objects of the selection cells.

Parameters:
graph - The graph to perform the operation in.
add - Whether the property should be added or removed.

doClone

protected void doClone(org.jgraph.JGraph graph,
                       boolean value,
                       boolean size)
Clones the value, size or attributes of the first selection cell to the other selection cells. If value is true then the value is cloned, if size if true then the size is cloned. If both are false, then the attributes (except the bounds and points) are cloned.
Note: If value and size are true at the same time, then the value is cloned.

Parameters:
graph - The graph to perform the operation in.
value - Whether to clone the value.
size - Whether to clone the size.

doConnect

protected void doConnect(org.jgraph.JGraph graph,
                         Object prototype)
Connects the selection vertices using clones of prototype as edges. JGraph.getDefaultPortForCell(Object) is used to find the connection points of the vertices.

Parameters:
graph - The graph to perform the operation in.
prototype - The cell to be cloned for creating edges.
See Also:
GraphLayoutCache.getCells(boolean, boolean, boolean, boolean), DefaultGraphModel.cloneCell(GraphModel, Object), DefaultGraphModel.containsEdgeBetween(GraphModel, Object, Object)

doDisconnect

protected void doDisconnect(org.jgraph.JGraph graph)
Disconnects the selection vertices by removing all edges between them.

Parameters:
graph - The graph to perform the operation in.
See Also:
GraphLayoutCache.getCells(boolean, boolean, boolean, boolean), DefaultGraphModel.getEdgesBetween(GraphModel, Object, Object, boolean)

doGroup

protected void doGroup(org.jgraph.JGraph graph,
                       Object prototype)
Creates a new group cell that contains the selection cells as children using a clone of prototype as the group cell.

Parameters:
graph - The graph to perform the operation in.
prototype - The cell to be cloned for creating groups.
See Also:
DefaultGraphModel.cloneCell(GraphModel, Object), JGraph.order(Object[]), GraphLayoutCache.insertGroup(Object, Object[])

doGroupAsEdge

protected void doGroupAsEdge(org.jgraph.JGraph graph,
                             Object prototype)
Creates a new group cell that contains the selection cells as children using a clone of prototype as the group cell. The prototype is assumed to be an edge.

Parameters:
graph - The graph to perform the operation in.
prototype - The cell to be cloned for creating groups.

doAlignCells

protected void doAlignCells(org.jgraph.JGraph graph,
                            int constraint)
Aligns the selection vertices according to constraint. Valid constraints are: ALIGN_TOP, ALIGN_MIDDLE, ALIGN_BOTTOM, ALIGN_LEFT, ALIGN_CENTER and ALIGN_RIGHT.

Parameters:
graph - The graph to perform the operation in.
constraint - The constraint that describes the alignment.
See Also:
alignRectangle2D(Rectangle2D, Rectangle2D, int), GraphLayoutCache.getCells(boolean, boolean, boolean, boolean)

alignRectangle2D

protected void alignRectangle2D(Rectangle2D cellBounds,
                                Rectangle2D outerBounds,
                                int constraint)
Helper methods that aligns cellBounds inside outerBounds according to constraint.


JGraphpad Pro
v6.0.5.0


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