wt.clients.tools.transfer
Class ExportGraphModel

java.lang.Object
  extended bywt.clients.tools.transfer.ExportGraphModel
All Implemented Interfaces:
EventListener, GraphModel, PropertyChangeListener, Serializable

public class ExportGraphModel
extends Object
implements GraphModel, PropertyChangeListener, Serializable

See Also:
Serialized Form

Field Summary
(package private)  Vector FIFOVec
           
 Vector graphLinkVector
           
 Hashtable graphNodeHashtable
           
private  EventListenerList listenerList
           
(package private)  int numberOfGraphs
           
private static String RESOURCE
           
 
Constructor Summary
ExportGraphModel()
           
 
Method Summary
 void addGraphModelListener(GraphModelListener listener)
           
 void addLink(GraphLink pLink)
           
 void addNode(String key, GraphNode pNode)
           
 Enumeration allLinks()
           
 Vector allLinksVector()
           
 Enumeration allNodes()
           
 Vector allNodesVector()
           
 void CollapseLink(ExportGraphLink eLink, int nowMode, int nextMode)
          Collapse a link, recursively to handel descendants
 void CollapseNode(ExportGraphNode eNode, int nowMode, int nextMode)
          Collapse a node, recursively to handel descendants
 void computeExcluded()
          recompute the entities which are in effect excluded
 void excludeLink(ExportGraphLink eLink)
          Exclude a link, and its wholly owned sub components
 void excludeNode(ExportGraphNode eNode)
          Exclude a node, and its wholly owned sub components
 void expandAll()
          Expand all the nodes
 void expandAllOfNode(ExportGraphNode aNode)
          Expand the entire tree under a node
private  void expandAllThisNode(ExportGraphNode eNode, int level, Vector doneVec)
          Exclude a node, and its wholly owned sub components
 Enumeration findLinks(GraphNode pNode)
           
 Enumeration findPredecessorLinks(ExportGraphNode aNode)
           
 Enumeration findPredecessorLinks(GraphNode pNode)
           
 Enumeration findSuccessorLinks(ExportGraphNode aNode)
           
 Enumeration findSuccessorLinks(GraphNode pNode)
           
 void fireGraphModelChanged(int change, GraphModel source, GraphNode pNode, GraphLink pLink)
           
 GraphLink getLink(GraphNode pPredecessor, GraphNode pSuccessor)
           
 GraphLink getLink(GraphNode pPredecessor, GraphNode pSuccessor, String name)
           
 GraphLink getLink(String pPredecessor, String pSuccessor, String name)
           
 int getMaxLevel()
           
 GraphNode getNode(String pNodeKey)
           
 Vector getNodesInSafestImportOrder()
           
 Vector getNodesOnLevel(int level)
           
 int getNumberOfGraphs()
          determine how many subgraphs exist in the model
 void includeLink(ExportGraphLink pLink)
          Exclude a link, and its wholly owned sub components
 void includeNode(ExportGraphNode pNode)
          Include a node, and its wholly owned sub components
 void invert()
          invert the levels
 boolean isLinkInModel(GraphLink pLink)
           
 boolean isLinkInModel(String name1, String name2)
          determine if a link is in the model
 boolean isNodeInModel(GraphNode pNode)
           
 int maxIncrementForLink(String name1, String name2)
          determine how many links exist between two nodes
 void newCeiling(int thisSubGraph, int newCeiling)
           
private  int numberOfLinksNotUsed(Enumeration linkList, Vector doneVec)
           
 void printalledges()
           
 void printallnodes()
           
 void propertyChange(PropertyChangeEvent e)
           
private  void recursiveCompute(ExportGraphNode node1, Vector allNodes, Vector allLinks, Vector nodeDoneVec, Vector linkDoneVec)
          recursive recompute the entities which are in effect excluded
private  void recursiveMaxDistance(ExportGraphNode recNode, Vector donetable)
          recursively traverse graph given node, and do layout based on greatest distance from the root.
private  void recursiveMinDistance(ExportGraphNode recNode, Vector donetable)
          recursively traverse graph given node, and do default layout.
 void removeall()
          remove all nodes and links from the model
 void removeGraphModelListener(GraphModelListener listener)
           
 void removeLink(GraphLink pLink)
           
 void removeLink(GraphNode pPredecessor, GraphNode pSuccessor)
           
 void removeLinks(GraphNode pNode)
           
 void removeNode(GraphNode pNode)
           
 void removeNode(String pNodeKey)
           
 void resizeMaxDistance(int graphNum)
          Create a default layout given a new graph/subgraph and a ceiling in case of subgraph
 void resizeMinDistance(ExportGraphNode rNode, boolean DFS)
          Create a default layout given a new graph/subgraph and a ceiling in case of subgraph
 void setNumberOfGraphs(int aInt)
          set the number of subgraphs
 boolean shouldExclude(ExportGraphNode sNode, int level, Vector doneVec)
          determine if a node should be excluded by determinig which are wholly owned or not
 boolean shouldInclude(ExportGraphNode sNode, int level, Vector doneVec)
          determine if a node should be included by determinig which are wholly owned or not
 void showNode(ExportGraphNode aNode)
           
 void startCollapse(ExportGraphNode eNode)
          Collapse a node
private  void validateLinkExistence(GraphLink pLink)
           
private  void validateLinkInexistence(GraphLink pLink)
           
private  void validateNodeExistence(GraphNode pNode)
           
private  void validateNodeInexistence(GraphNode pNode)
           
 void Zoom(float zoominc)
          set a new zoom value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

graphNodeHashtable

public Hashtable graphNodeHashtable

listenerList

private EventListenerList listenerList

graphLinkVector

public Vector graphLinkVector

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

numberOfGraphs

int numberOfGraphs

FIFOVec

Vector FIFOVec
Constructor Detail

ExportGraphModel

public ExportGraphModel()
Method Detail

computeExcluded

public void computeExcluded()
recompute the entities which are in effect excluded


recursiveCompute

private void recursiveCompute(ExportGraphNode node1,
                              Vector allNodes,
                              Vector allLinks,
                              Vector nodeDoneVec,
                              Vector linkDoneVec)
recursive recompute the entities which are in effect excluded


excludeNode

public void excludeNode(ExportGraphNode eNode)
                 throws NodeDoesNotExistException
Exclude a node, and its wholly owned sub components

Parameters:
eNode - the Node to exclude
Throws:
NodeDoesNotExistException

excludeLink

public void excludeLink(ExportGraphLink eLink)
                 throws LinkDoesNotExistException
Exclude a link, and its wholly owned sub components

Parameters:
eLink - the Link to exclude
Throws:
LinkDoesNotExistException

shouldExclude

public boolean shouldExclude(ExportGraphNode sNode,
                             int level,
                             Vector doneVec)
determine if a node should be excluded by determinig which are wholly owned or not

Parameters:
sNode - the Node to exclude
level - level of node to check for
doneVec - list of already visited nodes

shouldInclude

public boolean shouldInclude(ExportGraphNode sNode,
                             int level,
                             Vector doneVec)
determine if a node should be included by determinig which are wholly owned or not

Parameters:
sNode - the Node to exclude
level - level of node to check for
doneVec - list of already visited nodes

includeNode

public void includeNode(ExportGraphNode pNode)
                 throws NodeDoesNotExistException
Include a node, and its wholly owned sub components

Throws:
NodeDoesNotExistException

includeLink

public void includeLink(ExportGraphLink pLink)
                 throws LinkDoesNotExistException
Exclude a link, and its wholly owned sub components

Throws:
LinkDoesNotExistException

startCollapse

public void startCollapse(ExportGraphNode eNode)
Collapse a node

Parameters:
eNode - node to collapse

CollapseNode

public void CollapseNode(ExportGraphNode eNode,
                         int nowMode,
                         int nextMode)
Collapse a node, recursively to handel descendants

Parameters:
eNode - node to collapse
nowMode - current show mode for this level
nextMode - mode for next level

CollapseLink

public void CollapseLink(ExportGraphLink eLink,
                         int nowMode,
                         int nextMode)
Collapse a link, recursively to handel descendants

Parameters:
nowMode - current show mode for this level
nextMode - mode for next level

Zoom

public void Zoom(float zoominc)
set a new zoom value

Parameters:
zoominc - factor to zoom

isLinkInModel

public boolean isLinkInModel(String name1,
                             String name2)
determine if a link is in the model

Parameters:
name1 - name of the origin node
name2 - name of the neighbor node

maxIncrementForLink

public int maxIncrementForLink(String name1,
                               String name2)
determine how many links exist between two nodes

Parameters:
name1 - name of the origin node
name2 - name of the neighbor node
Returns:
number to use for the new link

findPredecessorLinks

public Enumeration findPredecessorLinks(ExportGraphNode aNode)
Returns:
Enumeration

findSuccessorLinks

public Enumeration findSuccessorLinks(ExportGraphNode aNode)
Returns:
Enumeration

getLink

public GraphLink getLink(GraphNode pPredecessor,
                         GraphNode pSuccessor)
                  throws LinkDoesNotExistException
Parameters:
pPredecessor -
pSuccessor -
Returns:
GraphLink
Throws:
LinkDoesNotExistException

getLink

public GraphLink getLink(GraphNode pPredecessor,
                         GraphNode pSuccessor,
                         String name)
                  throws LinkDoesNotExistException
Parameters:
pPredecessor -
pSuccessor -
Returns:
GraphLink
Throws:
LinkDoesNotExistException

getLink

public GraphLink getLink(String pPredecessor,
                         String pSuccessor,
                         String name)
                  throws LinkDoesNotExistException
Parameters:
pPredecessor -
pSuccessor -
Returns:
GraphLink
Throws:
LinkDoesNotExistException

newCeiling

public void newCeiling(int thisSubGraph,
                       int newCeiling)

getNumberOfGraphs

public int getNumberOfGraphs()
determine how many subgraphs exist in the model

Returns:
number of subgraphs

setNumberOfGraphs

public void setNumberOfGraphs(int aInt)
set the number of subgraphs


printalledges

public void printalledges()

printallnodes

public void printallnodes()

addLink

public void addLink(GraphLink pLink)
             throws NodeDoesNotExistException,
                    InvalidLinkException
Specified by:
addLink in interface GraphModel
Parameters:
pLink -
Throws:
NodeDoesNotExistException
LinkAlreadyExistException
InvalidLinkException

removeall

public void removeall()
remove all nodes and links from the model


validateNodeExistence

private void validateNodeExistence(GraphNode pNode)
                            throws NodeDoesNotExistException
Parameters:
pNode -
Throws:
NodeDoesNotExistException

allNodesVector

public Vector allNodesVector()

allLinksVector

public Vector allLinksVector()

addNode

public void addNode(String key,
                    GraphNode pNode)
             throws NodeAlreadyExistException,
                    InvalidNodeException
Specified by:
addNode in interface GraphModel
Parameters:
key -
pNode -
Throws:
NodeAlreadyExistException
InvalidNodeException

removeNode

public void removeNode(GraphNode pNode)
                throws NodeDoesNotExistException
Specified by:
removeNode in interface GraphModel
Parameters:
pNode -
Throws:
NodeDoesNotExistException

removeNode

public void removeNode(String pNodeKey)
                throws NodeDoesNotExistException
Parameters:
pNodeKey -
Throws:
NodeDoesNotExistException

removeLinks

public void removeLinks(GraphNode pNode)
                 throws NodeDoesNotExistException
Parameters:
pNode -
Throws:
NodeDoesNotExistException

removeLink

public void removeLink(GraphLink pLink)
                throws LinkDoesNotExistException
Specified by:
removeLink in interface GraphModel
Parameters:
pLink -
Throws:
LinkDoesNotExistException

removeLink

public void removeLink(GraphNode pPredecessor,
                       GraphNode pSuccessor)
                throws LinkDoesNotExistException,
                       NodeDoesNotExistException
Parameters:
pPredecessor -
pSuccessor -
Throws:
LinkDoesNotExistException
NodeDoesNotExistException

isNodeInModel

public boolean isNodeInModel(GraphNode pNode)
Parameters:
pNode -
Returns:
boolean

isLinkInModel

public boolean isLinkInModel(GraphLink pLink)
Parameters:
pLink -
Returns:
boolean

validateNodeInexistence

private void validateNodeInexistence(GraphNode pNode)
                              throws NodeAlreadyExistException
Parameters:
pNode -
Throws:
NodeAlreadyExistException

validateLinkExistence

private void validateLinkExistence(GraphLink pLink)
                            throws LinkDoesNotExistException
Parameters:
pLink -
Throws:
LinkDoesNotExistException

validateLinkInexistence

private void validateLinkInexistence(GraphLink pLink)
                              throws LinkAlreadyExistException
Parameters:
pLink -
Throws:
LinkAlreadyExistException

fireGraphModelChanged

public void fireGraphModelChanged(int change,
                                  GraphModel source,
                                  GraphNode pNode,
                                  GraphLink pLink)
Parameters:
change -
source -
pNode -
pLink -

propertyChange

public void propertyChange(PropertyChangeEvent e)
Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e -

getNode

public GraphNode getNode(String pNodeKey)
Specified by:
getNode in interface GraphModel
Parameters:
pNodeKey -
Returns:
GraphNode

allNodes

public Enumeration allNodes()
Specified by:
allNodes in interface GraphModel
Returns:
Enumeration

allLinks

public Enumeration allLinks()
Specified by:
allLinks in interface GraphModel
Returns:
Enumeration

findLinks

public Enumeration findLinks(GraphNode pNode)
Specified by:
findLinks in interface GraphModel
Parameters:
pNode -
Returns:
Enumeration

findPredecessorLinks

public Enumeration findPredecessorLinks(GraphNode pNode)
Specified by:
findPredecessorLinks in interface GraphModel
Parameters:
pNode -
Returns:
Enumeration

findSuccessorLinks

public Enumeration findSuccessorLinks(GraphNode pNode)
Specified by:
findSuccessorLinks in interface GraphModel
Parameters:
pNode -
Returns:
Enumeration

addGraphModelListener

public void addGraphModelListener(GraphModelListener listener)
Specified by:
addGraphModelListener in interface GraphModel
Parameters:
listener -

removeGraphModelListener

public void removeGraphModelListener(GraphModelListener listener)
Specified by:
removeGraphModelListener in interface GraphModel
Parameters:
listener -

expandAll

public void expandAll()
Expand all the nodes


expandAllOfNode

public void expandAllOfNode(ExportGraphNode aNode)
Expand the entire tree under a node


expandAllThisNode

private void expandAllThisNode(ExportGraphNode eNode,
                               int level,
                               Vector doneVec)
Exclude a node, and its wholly owned sub components

Parameters:
eNode - the Node to exclude

showNode

public void showNode(ExportGraphNode aNode)

resizeMinDistance

public void resizeMinDistance(ExportGraphNode rNode,
                              boolean DFS)
Create a default layout given a new graph/subgraph and a ceiling in case of subgraph

Parameters:
rNode - node to use for origin
DFS - boolean to decide whether to use DFS traverse (DFS=true) or BFS traverse (false)

recursiveMinDistance

private void recursiveMinDistance(ExportGraphNode recNode,
                                  Vector donetable)
recursively traverse graph given node, and do default layout. Used only by resize graph

Parameters:
recNode - node to use for origin
donetable - the list of already traversed nodes

resizeMaxDistance

public void resizeMaxDistance(int graphNum)
Create a default layout given a new graph/subgraph and a ceiling in case of subgraph


recursiveMaxDistance

private void recursiveMaxDistance(ExportGraphNode recNode,
                                  Vector donetable)
recursively traverse graph given node, and do layout based on greatest distance from the root. Used Import delegate so ensure that during import, the already persisted objects will not have to be re-edited to update references to objects that were later persisted and had a change in reference. This ensures connectivity in the graph after import.

Parameters:
recNode - node to use for origin
donetable - the list of already traversed nodes

invert

public void invert()
invert the levels


getNodesOnLevel

public Vector getNodesOnLevel(int level)

getMaxLevel

public int getMaxLevel()

getNodesInSafestImportOrder

public Vector getNodesInSafestImportOrder()

numberOfLinksNotUsed

private int numberOfLinksNotUsed(Enumeration linkList,
                                 Vector doneVec)