com.waveset.workflow
Class Diagram

java.lang.Object
  extended bycom.waveset.util.AbstractXmlObject
      extended bycom.waveset.workflow.Diagram
All Implemented Interfaces:
javax.naming.Referenceable, XmlObject

public class Diagram
extends AbstractXmlObject

An abstract diagram model used to build a simplified representation of a workflow process. This in turn can be converted into a set of NetChart definitions to render the diagram.

An abstract model is necessary due to the complexity of the WFProcess.Activity and WFCase.Step models which have to be combined to form the resulting diagram. This also makes it possible for non-workflow things to build diagrams.


Nested Class Summary
static class Diagram.Node
          Class used to represe the graph of activity/step nodes.
static class Diagram.Transition
          Class used to represe the graph of activity/step nodes.
 
Field Summary
static java.lang.String code_id
           
static java.lang.String ELEMENT
          Name of our root element.
static int FONT_HEIGHT
           
static int FONT_WIDTH
           
static int MAX_CELL_WIDTH
           
 
Constructor Summary
Diagram()
           
Diagram(org.w3c.dom.Element e)
           
 
Method Summary
 Diagram.Node addNode(java.lang.String name)
           
 void addStrings(java.lang.StringBuffer b, java.lang.String[] strings)
           
static Diagram create(java.lang.String xml)
           
 void escape(java.lang.StringBuffer b, java.lang.String src)
          Similar method in XmlUtil but this one escapes both delimiters.
 Diagram.Node findNode(java.lang.Object attach)
          Look for a node that has an attachment.
 java.lang.String generateHtml(boolean isFragment)
           
 java.lang.String getElementName()
          Return the element name.
 Diagram.Node getNode(int id)
          Retrieve a node given its id.
 Diagram.Node getRootNode()
          Retrieve the root node.
 java.lang.String getTitle()
           
static void main(java.lang.String[] args)
           
 void placeNodes()
           
 void resetTraversal()
          Clear the traversal flags in all nodes.
 void rotate()
          Switch between horizontal or vertical orientation.
 void setLocale(java.util.Locale locale)
           
 void setNode(Diagram.Node node)
          Store a node.
 void setTitle(java.lang.String t)
           
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize into a buffer with optional indentation.
 
Methods inherited from class com.waveset.util.AbstractXmlObject
addXmlHeader, cloneObject, dump, dumpFile, getReference, println, setTrace, toIdentityString, toVerboseString, toVerboseString, toXml, toXml, toXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

ELEMENT

public static final java.lang.String ELEMENT
Name of our root element.

See Also:
Constant Field Values

FONT_WIDTH

public static final int FONT_WIDTH
See Also:
Constant Field Values

FONT_HEIGHT

public static final int FONT_HEIGHT
See Also:
Constant Field Values

MAX_CELL_WIDTH

public static final int MAX_CELL_WIDTH
See Also:
Constant Field Values
Constructor Detail

Diagram

public Diagram()

Diagram

public Diagram(org.w3c.dom.Element e)
Method Detail

create

public static Diagram create(java.lang.String xml)
                      throws WavesetException
Throws:
WavesetException

getElementName

public java.lang.String getElementName()
Description copied from class: AbstractXmlObject
Return the element name.

Specified by:
getElementName in interface XmlObject
Specified by:
getElementName in class AbstractXmlObject

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String t)

toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Description copied from class: AbstractXmlObject
Serialize into a buffer with optional indentation. This must be implemented by the subclass.

Specified by:
toXml in interface XmlObject
Specified by:
toXml in class AbstractXmlObject

addNode

public Diagram.Node addNode(java.lang.String name)

findNode

public Diagram.Node findNode(java.lang.Object attach)
Look for a node that has an attachment. If the node list gets big, it would be faster to allow them to have an alternate "id" that could be a hash key.


placeNodes

public void placeNodes()

resetTraversal

public void resetTraversal()
Clear the traversal flags in all nodes.


rotate

public void rotate()
Switch between horizontal or vertical orientation.


getNode

public Diagram.Node getNode(int id)
Retrieve a node given its id. We can assume these are array indices.


getRootNode

public Diagram.Node getRootNode()
Retrieve the root node. We'll define this as the lowest numbered node.


setNode

public void setNode(Diagram.Node node)
Store a node. We can assume node ids are array indexes.


addStrings

public void addStrings(java.lang.StringBuffer b,
                       java.lang.String[] strings)

generateHtml

public java.lang.String generateHtml(boolean isFragment)

setLocale

public void setLocale(java.util.Locale locale)

escape

public void escape(java.lang.StringBuffer b,
                   java.lang.String src)
Similar method in XmlUtil but this one escapes both delimiters. Should have a variant of this in XmlUtil.


main

public static void main(java.lang.String[] args)