TWE 2.4-1 API

org.enhydra.jawe.components.graph
Class GraphManager

java.lang.Object
  extended byorg.enhydra.jawe.components.graph.GraphManager
All Implemented Interfaces:
java.io.Serializable

public class GraphManager
extends java.lang.Object
implements java.io.Serializable

Class intended to serve as a control center for creation, removal, resizing and changing position of Participants as well as for doing the same things with Activity objects and Transitions. Class manages this actions in such a way that undoing of operations are possible. It incorporates multiple view and model changes into one by doing them virtually, and after all changes are done, in interaction with JaWEGraphModel class applies this changes so that undo is possible. Instance of this class is joined to to all objects of classes derived from Graph class.

This class also handles the relationships between visual and logical representation of workflow graph.

When reading a package from an XML file, this class creates imported objects and establishes relationship between graph objects (classes within jawe and jawe.graph package) and 'graph logic' objects ( classes within jawe.xml package).

Author:
Sasa Bojanic, Miroslav Popov
See Also:
Serialized Form

Field Summary
private  boolean creatingGraph
           
private static int defActivityHeight
          Variable that holds height of activities
private static int defActivityWidth
          Variable that holds width of activities
private static int defParNameWidth
          Variable that holds the width for participant name section
private  Graph graph
          Graph reference
private  int horizontalOffset
          Offset for drawing - no meaning (it was used in previous versions)
private static int minParHeight
          Variable that holds minimum height for any participant
private static int minParWidth
          Variable that holds minimum width for any participant
protected  boolean pLoaded
           
private  int verticalOffset
           
 
Constructor Summary
GraphManager(Graph g)
          Creates new workflow manager for given graph.
 
Method Summary
 java.util.List addOrRemoveBreakPoint(GraphTransitionInterface gtra, java.awt.Point p, boolean toAdd)
           
 void arrangeActivityPosition(org.enhydra.shark.xpdl.elements.Activity act)
           
 void arrangeBubblePosition(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea, GraphParticipantInterface newPar)
           
protected  void arrangeParticipantHorizontally(java.lang.Object par, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  void arrangeParticipantRelationsOnly(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  void arrangeParticipants(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Arranges participants according to the given property and parent maps.
protected  void arrangeParticipantsHorizontally(java.lang.Object[] pars, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  void arrangeParticipantsVertically(java.lang.Object[] pars, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Arranging heights and positions of given participants and positions of participants that must be translated due to a change of given participants.
protected  void arrangeParticipantVertically(java.lang.Object par, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Resizing participant par and it's parents to appropriate height, and translating other participants accordingly to changes of participant par.
protected  void changeBounds(java.lang.Object cell, java.util.Map propertyMap, java.awt.Rectangle r)
          Replaces bounding rectangle of given cell in propertyMap object with rectangle r if cell is contained within the propertyMap object, otherwise adds new entry to the propertyMap that consists of given cell and a map containing given rectangle r.
 GraphTransitionInterface connectStartOrEndBubble(GraphBubbleActivityInterface startOrEnd, java.lang.String actId)
           
protected static boolean containsBubble(java.util.Set gacts, boolean start)
           
 void createWorkflowGraph(org.enhydra.shark.xpdl.XMLCollectionElement wpOrAs)
          Creates graph representation of given workflow process.
 boolean doesRootParticipantExist()
           
 java.lang.Object findNearestCell(java.lang.Object selectedCell, int direction)
          Finds the nearest cell to the given cell in given direction.
 GraphParticipantInterface findParentActivityParticipantForLocation(java.awt.Point loc, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Finds new participant for activity after it's position changes.
 GraphParticipantInterface findParentForLocation(java.awt.Point loc)
           
 java.awt.Rectangle getBounds(java.lang.Object cell, java.util.Map propertyMap)
          Gets bounding rectangle of given cell.
protected  java.awt.Rectangle getBoundsOfParticipantFutureActivities(GraphParticipantInterface par, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Gets the bounding rectangle of future children activities of given Participant par (that will be participants activities after parent map is applied).
 GraphBubbleActivityInterface getBubble(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea)
          Returns start/end graph bubble object which represents start/end ext.
protected static java.awt.Point getBubbleOffsetPoint(java.awt.Point actOffs, boolean start, java.awt.Dimension defActDim, boolean isGraphRotated)
           
 java.awt.Point getCenter(java.lang.Object go)
          Returns the central point of given graph object.
 java.util.List getDisplayedParticipants()
           
protected  java.util.Set getEnds()
          Returns end bubbles.
 Graph getGraph()
          Returns the graph which is managed.
 GraphActivityInterface getGraphActivity(org.enhydra.shark.xpdl.elements.Activity act)
           
 GraphActivityInterface getGraphActivity(java.lang.String id)
          Returns graph Activity object which represents XPDL activity with given Id attribute.
 GraphController getGraphController()
           
 GraphParticipantInterface getGraphParticipant(org.enhydra.shark.xpdl.elements.Participant par)
           
 GraphParticipantInterface getGraphParticipant(java.lang.String id)
          Returns graph Participant object which represents XPDL participant with given Id attribute.
 java.awt.Dimension getGraphsPreferredSize()
           
 GraphTransitionInterface getGraphTransition(java.lang.String id)
          Returns graph Transition object which represents XPDL transition with given Id attribute.
 GraphTransitionInterface getGraphTransition(org.enhydra.shark.xpdl.elements.Transition tra)
           
 int getHorizontalOffset()
          Returns horizontal offset for inserting participants.
protected  GraphParticipantInterface getLeafParticipantForXPos(int xPos, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  GraphParticipantInterface getLeafParticipantForYPos(int yPos, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Returns leaf participant that bounds given y-coordinate.
protected  int getNewRootParXPos(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  int getNewRootParYPos(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Gets the insertation point (y-coordinate) of new root participant.
 java.awt.Point getOffset(GraphActivityInterface a, java.util.Map propertyMap)
          Returns the point within the graph where the upper-left corner of given graph activity is placed.
 java.awt.Point getOffset(java.awt.Point actPoint)
           
protected  java.util.Set getParticipantFutureActivities(GraphParticipantInterface par, org.jgraph.graph.ParentMap parentMap)
          Gets future children activities of given participant par (that will be par's activities after parent map is applied).
protected  int getParticipantHeight(java.lang.Object par, java.util.Map propertyMap)
          Gets height of given participant (from it's current view or from propertyMap).
 java.lang.String getParticipantId(java.awt.Point pos)
           
protected  GraphParticipantInterface[] getParticipantsForXPos(int xPos, int direction, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  GraphParticipantInterface[] getParticipantsForYPos(int yPos, int direction, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Returns participants that are under or above given yPos, or contains that y-position:
direction=0 -> under,
direction=1 -> above,
direction=2 -> contains.
protected  int getParticipantWidth(java.lang.Object par, java.util.Map propertyMap)
          Gets width of given participant (from it's current view or from propertyMap).
protected  java.util.List getPoints(GraphTransitionInterface cell, java.util.Map propertyMap)
           
 java.awt.Point getRealPosition(GraphActivityInterface a, GraphParticipantInterface gpar)
           
protected  int getRootParticipantHeight(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  int getRootParticipantWidth(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Gets the width of root participants.
protected  java.util.Set getStarts()
          Returns start bubbles.
 java.awt.Rectangle getUnionBounds(java.awt.Rectangle[] rects)
          Gets union of given rectangles.
 org.jgraph.graph.CellView getView(java.lang.Object cell)
          Gets view of given object.
private  org.enhydra.shark.xpdl.elements.WorkflowProcess getWorkflowProcess()
          Returns the (XML logic) WorkflowProcess object that is represented by the manager's graph, or (if the graph represents the (XML logic) BlockActivity content) the WorkflowProcess object that holds BlockActivity represented by manager's graph.
 org.enhydra.shark.xpdl.XMLCollectionElement getXPDLOwner()
          Returns the object (part of mapped XML logic) that is represented by the graph managed by WorklowManager.
 JaWEGraphModel graphModel()
          Returns the graph model - the model that represents the graph view.
protected  boolean hasAnyActivity(GraphParticipantInterface par, org.jgraph.graph.ParentMap parentMap)
          Checks if given participant par has activities.
protected  boolean hasAnyParticipant(GraphParticipantInterface par, org.jgraph.graph.ParentMap parentMap)
          Checks if given participant par has other participants.
static boolean hasConnectedEndBubble(GraphActivityInterface act)
           
static boolean hasConnectedStartBubble(GraphActivityInterface act)
           
 void init()
           
 GraphActivityInterface insertActivity(org.enhydra.shark.xpdl.elements.Activity xpdla)
           
 GraphActivityInterface insertEnd(org.enhydra.shark.xpdl.elements.ExtendedAttribute eea)
           
 java.util.List insertMissingStartEndBubbles()
           
 GraphParticipantInterface insertParticipantAndArrangeParticipants(org.enhydra.shark.xpdl.elements.Participant par)
          Inserts new Participant cell into model.
 GraphActivityInterface insertStart(org.enhydra.shark.xpdl.elements.ExtendedAttribute sea)
           
 GraphTransitionInterface insertTransition(org.enhydra.shark.xpdl.elements.Transition xpdltra)
           
 boolean isFreeTextExpressionParticipantShown()
           
protected  boolean isGraphRotated()
           
 void moveCellsAndArrangeParticipants(java.util.Map propertyMap)
           
 boolean moveParticipants(java.util.List partsToMove, boolean direction, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
 void moveParticipants(java.lang.Object[] cellsToMove, boolean direction)
           
protected  int optimalParticipantHeight(GraphParticipantInterface par, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Calculates minimal participant height, which depends of position of all of its Activity cells.
protected  int optimalParticipantWidth(GraphParticipantInterface par, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  int optimalRootParticipantHeight(java.util.List participants, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  int optimalRootParticipantWidth(java.util.List participants, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Calculates the minimal width of root participants.
 void removeActivity(org.enhydra.shark.xpdl.elements.Activity xpdla)
           
 void removeBubble(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea)
           
 void removeCells(java.lang.Object[] cellsToDelete)
           
 void removeCellsAndArrangeParticipants(java.lang.Object[] cellsToDelete)
          Removes cells cellsToDelete from model.
 void removeStartEndBubbles()
           
protected  void removeTransition(GraphTransitionInterface gtra)
           
 void removeTransition(org.enhydra.shark.xpdl.elements.Transition xpdltra)
           
protected  void resize(java.lang.Object[] cells, java.util.Map propertyMap, int dw, int dh)
          Resizes given participants.
protected  void resizeAllParticipantsHorizontally(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Method that resizes all participants horizontally to get there minimal needed sizes.
protected  void resizeAllParticipantsVertically(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
           
protected  void translateHorizontally(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap, int xPos, int dv)
           
protected  void translateParticipant(GraphParticipantInterface par, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap, int dx, int dy)
          Translates single participant and its children.The method checks for bounds of cells within propertyMap and uses parentMap to translate right children (the children that will be it's after applying parentMap).
protected  void translateParticipants(GraphParticipantInterface[] cells, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap, int dx, int dy)
          Translates given participants using propertyMap for bounds checking and parentMap for future children checking.
protected  void translateVertically(java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap, int yPos, int dv)
          Translates participants under given position yPos vertically for a value of dv.
protected  java.util.Set updateActivityParent(GraphActivityInterface ac, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap)
          Determines old and new participant for activity, adjusts activities position if needed and properly changes parent of activity (adds entry into the parentMap).
 void updateBreakPoints(GraphTransitionInterface gtra, java.util.Map propertyMap)
           
 void updateBubble(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea)
           
protected  void updateModelAndArrangeParticipants(java.lang.Object[] insert, java.util.Map propertyMap, org.jgraph.graph.ParentMap parentMap, java.util.Map viewMap, java.lang.String actionName, org.jgraph.graph.ConnectionSet cs, boolean arrangeParticipants)
          Inserts new activities into model, changes positions and sizes of participants due to a insertion of new activities or due to a moving of activities.
 void updateStyle(GraphTransitionInterface gtra)
           
protected  void updateStyle(GraphTransitionInterface gtra, java.util.Map propertyMap)
           
 void updateTransition(org.enhydra.shark.xpdl.elements.Transition xpdltra)
           
protected  java.util.List updateXPDLActivitiesPosition(java.util.Map propertyMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graph

private transient Graph graph
Graph reference


horizontalOffset

private int horizontalOffset
Offset for drawing - no meaning (it was used in previous versions)


verticalOffset

private int verticalOffset

minParWidth

private static int minParWidth
Variable that holds minimum width for any participant


minParHeight

private static int minParHeight
Variable that holds minimum height for any participant


defParNameWidth

private static int defParNameWidth
Variable that holds the width for participant name section


defActivityWidth

private static int defActivityWidth
Variable that holds width of activities


defActivityHeight

private static int defActivityHeight
Variable that holds height of activities


creatingGraph

private boolean creatingGraph

pLoaded

protected boolean pLoaded
Constructor Detail

GraphManager

public GraphManager(Graph g)
Creates new workflow manager for given graph.

Parameters:
g - The graph that manager manages.
Method Detail

init

public void init()

getGraph

public Graph getGraph()
Returns the graph which is managed.


getGraphController

public GraphController getGraphController()

graphModel

public JaWEGraphModel graphModel()
Returns the graph model - the model that represents the graph view. (See JGraph documentation).


createWorkflowGraph

public void createWorkflowGraph(org.enhydra.shark.xpdl.XMLCollectionElement wpOrAs)
Creates graph representation of given workflow process. It creates a graph entities (participants, activities, transitions) and associates the workflow logic to it. The graph entities are inserted according to the data that wp object holds (the data from XML file).

This is used when reading a workflow definition from an XML file.

Parameters:
wpOrAs - Object that mapps the logic of WorkflowProcess element of XML - defines a particular Workflow process.

getXPDLOwner

public org.enhydra.shark.xpdl.XMLCollectionElement getXPDLOwner()
Returns the object (part of mapped XML logic) that is represented by the graph managed by WorklowManager. That object can be instance of the Package, WorkflowProcess or ...xml.elements.BlockActivity class, and is held as a property of the manager's graph object.

Returns:
The object (representing XML logic) that is represented by this manager's graph.

getWorkflowProcess

private org.enhydra.shark.xpdl.elements.WorkflowProcess getWorkflowProcess()
Returns the (XML logic) WorkflowProcess object that is represented by the manager's graph, or (if the graph represents the (XML logic) BlockActivity content) the WorkflowProcess object that holds BlockActivity represented by manager's graph. If graph represents (XML logic) Package object, null is returned.


getDisplayedParticipants

public java.util.List getDisplayedParticipants()

doesRootParticipantExist

public boolean doesRootParticipantExist()

getParticipantId

public java.lang.String getParticipantId(java.awt.Point pos)

insertActivity

public GraphActivityInterface insertActivity(org.enhydra.shark.xpdl.elements.Activity xpdla)

removeActivity

public void removeActivity(org.enhydra.shark.xpdl.elements.Activity xpdla)

arrangeActivityPosition

public void arrangeActivityPosition(org.enhydra.shark.xpdl.elements.Activity act)

insertTransition

public GraphTransitionInterface insertTransition(org.enhydra.shark.xpdl.elements.Transition xpdltra)

removeTransition

public void removeTransition(org.enhydra.shark.xpdl.elements.Transition xpdltra)

updateTransition

public void updateTransition(org.enhydra.shark.xpdl.elements.Transition xpdltra)

updateBreakPoints

public void updateBreakPoints(GraphTransitionInterface gtra,
                              java.util.Map propertyMap)

addOrRemoveBreakPoint

public java.util.List addOrRemoveBreakPoint(GraphTransitionInterface gtra,
                                            java.awt.Point p,
                                            boolean toAdd)

updateStyle

public void updateStyle(GraphTransitionInterface gtra)

updateStyle

protected void updateStyle(GraphTransitionInterface gtra,
                           java.util.Map propertyMap)

removeTransition

protected void removeTransition(GraphTransitionInterface gtra)

insertStart

public GraphActivityInterface insertStart(org.enhydra.shark.xpdl.elements.ExtendedAttribute sea)

insertEnd

public GraphActivityInterface insertEnd(org.enhydra.shark.xpdl.elements.ExtendedAttribute eea)

removeBubble

public void removeBubble(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea)

connectStartOrEndBubble

public GraphTransitionInterface connectStartOrEndBubble(GraphBubbleActivityInterface startOrEnd,
                                                        java.lang.String actId)

updateBubble

public void updateBubble(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea)

arrangeBubblePosition

public void arrangeBubblePosition(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea,
                                  GraphParticipantInterface newPar)

insertParticipantAndArrangeParticipants

public GraphParticipantInterface insertParticipantAndArrangeParticipants(org.enhydra.shark.xpdl.elements.Participant par)
Inserts new Participant cell into model. First, the parent of new Participant is searched, and if found, put into ParentMap (it is not inserted into model at ones). If parent participant isn't found -> root participant will be inserted. After that model's view is arranged (Participants are moved and translated along with it's children cells) to suite to the new model state - this is done "virtually" which means that changes are not directly applied to view until all changes are made. At the end, all changes are applied to model and view. Such procedure enables compound undo support.
This method is called when inserting new Participant into model.


removeCellsAndArrangeParticipants

public void removeCellsAndArrangeParticipants(java.lang.Object[] cellsToDelete)
Removes cells cellsToDelete from model. This means that given cells and all of their descendants as well as all transitions that connects given cells, will be removed from model. First, all remained participants are moved and resized according to participants that are beeing removed and ParentMap for all removed cells is created (all these things are made "virtually" - not applied to model and view). After that model's new view is arranged (Participants are moved and translated (along with it's children cells) according to the remained children - this is also done "virtually". At the end, all changes are applied to model and view. Such procedure enables compound undo support.
This method is called when deleting or cutting cells from graph.


getHorizontalOffset

public int getHorizontalOffset()
Returns horizontal offset for inserting participants.


getOffset

public java.awt.Point getOffset(GraphActivityInterface a,
                                java.util.Map propertyMap)
Returns the point within the graph where the upper-left corner of given graph activity is placed. The point origin is the upper-left corner of participant graph object that holds given activity.


getOffset

public java.awt.Point getOffset(java.awt.Point actPoint)

getRealPosition

public java.awt.Point getRealPosition(GraphActivityInterface a,
                                      GraphParticipantInterface gpar)

updateModelAndArrangeParticipants

protected void updateModelAndArrangeParticipants(java.lang.Object[] insert,
                                                 java.util.Map propertyMap,
                                                 org.jgraph.graph.ParentMap parentMap,
                                                 java.util.Map viewMap,
                                                 java.lang.String actionName,
                                                 org.jgraph.graph.ConnectionSet cs,
                                                 boolean arrangeParticipants)
Inserts new activities into model, changes positions and sizes of participants due to a insertion of new activities or due to a moving of activities. Also, finds and changes parent's of inserted/changed-position activities. This method is called when inserting new activities, when pasting activities, and when moving activities. All changes to the model and to the view are at first made virtually (to the parentMap and to the propertyMap) and when all is done, method insertAndEdit of PEGraphModel class is called to actually make changes. The updateCollection parameter is used when some objects are inserted into model, to update collection of XML elements.

Parameters:
arrangeParticipants - TODO

arrangeParticipants

protected void arrangeParticipants(java.util.Map propertyMap,
                                   org.jgraph.graph.ParentMap parentMap)
Arranges participants according to the given property and parent maps.


arrangeParticipantRelationsOnly

protected void arrangeParticipantRelationsOnly(java.util.Map propertyMap,
                                               org.jgraph.graph.ParentMap parentMap)

updateActivityParent

protected java.util.Set updateActivityParent(GraphActivityInterface ac,
                                             java.util.Map propertyMap,
                                             org.jgraph.graph.ParentMap parentMap)
Determines old and new participant for activity, adjusts activities position if needed and properly changes parent of activity (adds entry into the parentMap).


findParentForLocation

public GraphParticipantInterface findParentForLocation(java.awt.Point loc)

findParentActivityParticipantForLocation

public GraphParticipantInterface findParentActivityParticipantForLocation(java.awt.Point loc,
                                                                          java.util.Map propertyMap,
                                                                          org.jgraph.graph.ParentMap parentMap)
Finds new participant for activity after it's position changes. WARNING: this method changes it's argument loc if not appropriate.


arrangeParticipantsHorizontally

protected void arrangeParticipantsHorizontally(java.lang.Object[] pars,
                                               java.util.Map propertyMap,
                                               org.jgraph.graph.ParentMap parentMap)

arrangeParticipantsVertically

protected void arrangeParticipantsVertically(java.lang.Object[] pars,
                                             java.util.Map propertyMap,
                                             org.jgraph.graph.ParentMap parentMap)
Arranging heights and positions of given participants and positions of participants that must be translated due to a change of given participants.


arrangeParticipantHorizontally

protected void arrangeParticipantHorizontally(java.lang.Object par,
                                              java.util.Map propertyMap,
                                              org.jgraph.graph.ParentMap parentMap)

arrangeParticipantVertically

protected void arrangeParticipantVertically(java.lang.Object par,
                                            java.util.Map propertyMap,
                                            org.jgraph.graph.ParentMap parentMap)
Resizing participant par and it's parents to appropriate height, and translating other participants accordingly to changes of participant par. The size's and positions are calculated considering propertyMap and parentMap - which means for future children state, and for bounds that are constantly changed during other calculations. If propertyMap and parentMap are null, size's and positions are calculated for current state. Also, if par that is to be arranged has entry in parentMap as removed participant, it will not be arranged.


resizeAllParticipantsHorizontally

protected void resizeAllParticipantsHorizontally(java.util.Map propertyMap,
                                                 org.jgraph.graph.ParentMap parentMap)
Method that resizes all participants horizontally to get there minimal needed sizes. The size is calculated considering propertyMap and parentMap - which means for future children state, and for bounds that are constantly changed during other calculations. If propertyMap and parentMap are null, size is calculated for current state.


resizeAllParticipantsVertically

protected void resizeAllParticipantsVertically(java.util.Map propertyMap,
                                               org.jgraph.graph.ParentMap parentMap)

optimalRootParticipantHeight

protected int optimalRootParticipantHeight(java.util.List participants,
                                           java.util.Map propertyMap,
                                           org.jgraph.graph.ParentMap parentMap)

optimalRootParticipantWidth

protected int optimalRootParticipantWidth(java.util.List participants,
                                          java.util.Map propertyMap,
                                          org.jgraph.graph.ParentMap parentMap)
Calculates the minimal width of root participants. It depends of minimal allowed width of leaf participants, which depends on the position of Activity cells in them. The width is calculated considering propertyMap and parentMap - which means for future children state, and for bounds that are constantly changed during other calculations. If propertyMap and parentMap are null, size is calculated for current state.


optimalParticipantWidth

protected int optimalParticipantWidth(GraphParticipantInterface par,
                                      java.util.Map propertyMap,
                                      org.jgraph.graph.ParentMap parentMap)

optimalParticipantHeight

protected int optimalParticipantHeight(GraphParticipantInterface par,
                                       java.util.Map propertyMap,
                                       org.jgraph.graph.ParentMap parentMap)
Calculates minimal participant height, which depends of position of all of its Activity cells. The height is calculated considering propertyMap and parentMap - which means for future children state, and for bounds that are constantly changed during other calculations. If propertyMap and parentMap are null, size is calculated for current state.


resize

protected void resize(java.lang.Object[] cells,
                      java.util.Map propertyMap,
                      int dw,
                      int dh)
Resizes given participants. The resizing is done to propertyMap which will later (after all needed operation) be applied.


translateHorizontally

protected void translateHorizontally(java.util.Map propertyMap,
                                     org.jgraph.graph.ParentMap parentMap,
                                     int xPos,
                                     int dv)

translateVertically

protected void translateVertically(java.util.Map propertyMap,
                                   org.jgraph.graph.ParentMap parentMap,
                                   int yPos,
                                   int dv)
Translates participants under given position yPos vertically for a value of dv. The translating is done to propertyMap which will later (after all needed operation) be applied.

See Also:
translateParticipants(org.enhydra.jawe.components.graph.GraphParticipantInterface[], java.util.Map, org.jgraph.graph.ParentMap, int, int)

translateParticipants

protected void translateParticipants(GraphParticipantInterface[] cells,
                                     java.util.Map propertyMap,
                                     org.jgraph.graph.ParentMap parentMap,
                                     int dx,
                                     int dy)
Translates given participants using propertyMap for bounds checking and parentMap for future children checking. The translating is done to propertyMap which will later (after all needed operation) be applied.

See Also:
translateParticipant(org.enhydra.jawe.components.graph.GraphParticipantInterface, java.util.Map, org.jgraph.graph.ParentMap, int, int)

translateParticipant

protected void translateParticipant(GraphParticipantInterface par,
                                    java.util.Map propertyMap,
                                    org.jgraph.graph.ParentMap parentMap,
                                    int dx,
                                    int dy)
Translates single participant and its children.The method checks for bounds of cells within propertyMap and uses parentMap to translate right children (the children that will be it's after applying parentMap). The translating is done to propertyMap which will later (after all needed operation) be applied.


getBoundsOfParticipantFutureActivities

protected java.awt.Rectangle getBoundsOfParticipantFutureActivities(GraphParticipantInterface par,
                                                                    java.util.Map propertyMap,
                                                                    org.jgraph.graph.ParentMap parentMap)
Gets the bounding rectangle of future children activities of given Participant par (that will be participants activities after parent map is applied). Bounding rectangle is union of previous mentioned activities.


getParticipantFutureActivities

protected java.util.Set getParticipantFutureActivities(GraphParticipantInterface par,
                                                       org.jgraph.graph.ParentMap parentMap)
Gets future children activities of given participant par (that will be par's activities after parent map is applied).


getLeafParticipantForXPos

protected GraphParticipantInterface getLeafParticipantForXPos(int xPos,
                                                              java.util.Map propertyMap,
                                                              org.jgraph.graph.ParentMap parentMap)

getLeafParticipantForYPos

protected GraphParticipantInterface getLeafParticipantForYPos(int yPos,
                                                              java.util.Map propertyMap,
                                                              org.jgraph.graph.ParentMap parentMap)
Returns leaf participant that bounds given y-coordinate. If y-coordinate is at boundary of two participants, method returns one that is above. The method checks for bounds of cells within propertyMap.


getParticipantsForXPos

protected GraphParticipantInterface[] getParticipantsForXPos(int xPos,
                                                             int direction,
                                                             java.util.Map propertyMap,
                                                             org.jgraph.graph.ParentMap parentMap)

getParticipantsForYPos

protected GraphParticipantInterface[] getParticipantsForYPos(int yPos,
                                                             int direction,
                                                             java.util.Map propertyMap,
                                                             org.jgraph.graph.ParentMap parentMap)
Returns participants that are under or above given yPos, or contains that y-position:
direction=0 -> under,
direction=1 -> above,
direction=2 -> contains. The method checks for bounds of cells within propertyMap. If some of model's participants is entered in parentMap as removed participant, this method doesn't consider that participant.


getNewRootParXPos

protected int getNewRootParXPos(java.util.Map propertyMap,
                                org.jgraph.graph.ParentMap parentMap)

getNewRootParYPos

protected int getNewRootParYPos(java.util.Map propertyMap,
                                org.jgraph.graph.ParentMap parentMap)
Gets the insertation point (y-coordinate) of new root participant.


getRootParticipantHeight

protected int getRootParticipantHeight(java.util.Map propertyMap,
                                       org.jgraph.graph.ParentMap parentMap)

getRootParticipantWidth

protected int getRootParticipantWidth(java.util.Map propertyMap,
                                      org.jgraph.graph.ParentMap parentMap)
Gets the width of root participants. The method checks for bounds of cells within propertyMap. If some of model's participants has entry within propertyMap as removed, this participant doesn't count.


hasAnyParticipant

protected boolean hasAnyParticipant(GraphParticipantInterface par,
                                    org.jgraph.graph.ParentMap parentMap)
Checks if given participant par has other participants. If parentMap is null, or there is no entry for this this participant within a parentMap, the current state is checked, elsewhere parentMap is checked-in other words future state of participant participants (state after aplying parentMap) is returned.

This method has meaning in previous versions of JaWE, now it always returns false.


hasAnyActivity

protected boolean hasAnyActivity(GraphParticipantInterface par,
                                 org.jgraph.graph.ParentMap parentMap)
Checks if given participant par has activities. If parentMap is null, or there is no entry for this this participant within a parentMap, the current state is checked, elsewhere parentMap is checked-in other words future state of participant activities (state after aplying parentMap) is returned.


hasConnectedStartBubble

public static boolean hasConnectedStartBubble(GraphActivityInterface act)

hasConnectedEndBubble

public static boolean hasConnectedEndBubble(GraphActivityInterface act)

getStarts

protected java.util.Set getStarts()
Returns start bubbles.


getEnds

protected java.util.Set getEnds()
Returns end bubbles.


getView

public org.jgraph.graph.CellView getView(java.lang.Object cell)
Gets view of given object.


getParticipantWidth

protected int getParticipantWidth(java.lang.Object par,
                                  java.util.Map propertyMap)
Gets width of given participant (from it's current view or from propertyMap).


getParticipantHeight

protected int getParticipantHeight(java.lang.Object par,
                                   java.util.Map propertyMap)
Gets height of given participant (from it's current view or from propertyMap).


changeBounds

protected void changeBounds(java.lang.Object cell,
                            java.util.Map propertyMap,
                            java.awt.Rectangle r)
Replaces bounding rectangle of given cell in propertyMap object with rectangle r if cell is contained within the propertyMap object, otherwise adds new entry to the propertyMap that consists of given cell and a map containing given rectangle r.


getBounds

public java.awt.Rectangle getBounds(java.lang.Object cell,
                                    java.util.Map propertyMap)
Gets bounding rectangle of given cell. The rectangle is either current rectangle of cellView either from propertyMap where are held bounding rectangles of various cells during multiple resizing and/or translating of cells.


getUnionBounds

public java.awt.Rectangle getUnionBounds(java.awt.Rectangle[] rects)
Gets union of given rectangles.


getCenter

public java.awt.Point getCenter(java.lang.Object go)
Returns the central point of given graph object.


getGraphActivity

public GraphActivityInterface getGraphActivity(java.lang.String id)
Returns graph Activity object which represents XPDL activity with given Id attribute.


getGraphActivity

public GraphActivityInterface getGraphActivity(org.enhydra.shark.xpdl.elements.Activity act)

getBubble

public GraphBubbleActivityInterface getBubble(org.enhydra.shark.xpdl.elements.ExtendedAttribute ea)
Returns start/end graph bubble object which represents start/end ext. attrib.


getGraphTransition

public GraphTransitionInterface getGraphTransition(java.lang.String id)
Returns graph Transition object which represents XPDL transition with given Id attribute.


getGraphTransition

public GraphTransitionInterface getGraphTransition(org.enhydra.shark.xpdl.elements.Transition tra)

getGraphParticipant

public GraphParticipantInterface getGraphParticipant(java.lang.String id)
Returns graph Participant object which represents XPDL participant with given Id attribute.


getGraphParticipant

public GraphParticipantInterface getGraphParticipant(org.enhydra.shark.xpdl.elements.Participant par)

isFreeTextExpressionParticipantShown

public boolean isFreeTextExpressionParticipantShown()

findNearestCell

public java.lang.Object findNearestCell(java.lang.Object selectedCell,
                                        int direction)
Finds the nearest cell to the given cell in given direction.

Parameters:
selectedCell - first currently selected cell
direction - 0-Up, 1-Down, 2-Left, 3-Right (if given some other no, the Up is assumed)
Returns:
The nearest cell to the given one in given direction, or null if no such cell.

moveParticipants

public boolean moveParticipants(java.util.List partsToMove,
                                boolean direction,
                                java.util.Map propertyMap,
                                org.jgraph.graph.ParentMap parentMap)

getGraphsPreferredSize

public java.awt.Dimension getGraphsPreferredSize()

getPoints

protected java.util.List getPoints(GraphTransitionInterface cell,
                                   java.util.Map propertyMap)

isGraphRotated

protected boolean isGraphRotated()

moveCellsAndArrangeParticipants

public void moveCellsAndArrangeParticipants(java.util.Map propertyMap)

updateXPDLActivitiesPosition

protected java.util.List updateXPDLActivitiesPosition(java.util.Map propertyMap)

removeCells

public void removeCells(java.lang.Object[] cellsToDelete)

moveParticipants

public void moveParticipants(java.lang.Object[] cellsToMove,
                             boolean direction)

removeStartEndBubbles

public void removeStartEndBubbles()

insertMissingStartEndBubbles

public java.util.List insertMissingStartEndBubbles()

containsBubble

protected static boolean containsBubble(java.util.Set gacts,
                                        boolean start)

getBubbleOffsetPoint

protected static java.awt.Point getBubbleOffsetPoint(java.awt.Point actOffs,
                                                     boolean start,
                                                     java.awt.Dimension defActDim,
                                                     boolean isGraphRotated)

TWE 2.4-1 API