wt.part
Class BOMHierarchyVisitor

java.lang.Object
  extended bywt.visitor.VisitorAdapter
      extended bywt.visitor.TextOutputVisitor
          extended bywt.part.BOMHierarchyVisitor
All Implemented Interfaces:
Serializable, Visitor
Direct Known Subclasses:
HtmlHeadingHierarchyVisitor, HtmlPreformattedHierarchyVisitor

public abstract class BOMHierarchyVisitor
extends TextOutputVisitor
implements Serializable

This class is a Visitor that generates text ouptut for a product structure hierarchy. The node identity, the usage links' attributes and an indication of the hierarchal level of the node are included in the text output.

Supported API: true

Extendable: true

See Also:
Serialized Form

Field Summary
protected static String BLANK_SPACE
           
private static String CLASSNAME
           
private static String LINE_NUMBER_SEPARATOR
           
private  DecimalFormat quantityFormat
           
private static String RESOURCE
           
private static boolean SHOW_ORGID
           
 
Fields inherited from class wt.visitor.TextOutputVisitor
 
Constructor Summary
BOMHierarchyVisitor()
           
 
Method Summary
 String getMessageKey()
          By default this method returns the PART_USAGE message key from partResource.
protected  String getNodeIdentity(Persistable node)
          Returns a String representation of the identity for the given node.
protected  Object[] midVisitParams(Persistable fromNode, Link link, Persistable toNode, int level, boolean previouslyVisited)
          By deafult midVisitParams returns an array of five values.
 void postNavigateWrite()
          This method should be called after navigating the structure.
protected abstract  void postVisitWrite(int a_level)
          This method is called from the visit() method after the node text is written.
 void preNavigateWrite()
          This method should be called prior to navigating the structure.
protected abstract  void preVisitWrite(int a_level)
          This method is called from the visit() method before the node text is written.
 boolean visit(Persistable fromNode, Link link, Persistable toNode, int level, boolean previouslyVisited)
          Visit a node.
 
Methods inherited from class wt.visitor.TextOutputVisitor
getLocale, getPrintWriter, getResourceBundle, printLocalizedMessage, printLocalizedMessage, printLocalizedMessage, setLocale, setPrintWriter, setPrintWriter, setResourceBundle
 
Methods inherited from class wt.visitor.VisitorAdapter
visitLevel, visitLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

BLANK_SPACE

protected static final String BLANK_SPACE
See Also:
Constant Field Values

LINE_NUMBER_SEPARATOR

private static final String LINE_NUMBER_SEPARATOR
See Also:
Constant Field Values

quantityFormat

private DecimalFormat quantityFormat

SHOW_ORGID

private static boolean SHOW_ORGID
Constructor Detail

BOMHierarchyVisitor

public BOMHierarchyVisitor()
Method Detail

visit

public final boolean visit(Persistable fromNode,
                           Link link,
                           Persistable toNode,
                           int level,
                           boolean previouslyVisited)
                    throws WTException
Visit a node. This method performs two ways. If the link passed in is null, then the node's identification is printed as text. Otherwise, if the link is not null, then the midVisitParams and getMessageKey methods are called on. A boolean true value is always returned so that every node is visited.

Supported API: true

Specified by:
visit in interface Visitor
Overrides:
visit in class VisitorAdapter
Parameters:
fromNode -
link -
toNode -
level -
previouslyVisited -
Returns:
boolean
Throws:
WTException

preVisitWrite

protected abstract void preVisitWrite(int a_level)
This method is called from the visit() method before the node text is written.

Supported API: true

Parameters:
a_level -

midVisitParams

protected Object[] midVisitParams(Persistable fromNode,
                                  Link link,
                                  Persistable toNode,
                                  int level,
                                  boolean previouslyVisited)
By deafult midVisitParams returns an array of five values. In order they are line number, line number separator, quantity, unit and part identity. This works in conjunction with the default value of the getMessageKey method. To customize this behavior call super.midVisitParams and modify the return array as needed and overide the getMessageKey method to return the message key that correlates to the new return array.

Supported API: true

Parameters:
fromNode -
link -
toNode -
level -
previouslyVisited -
Returns:
Object[]

postVisitWrite

protected abstract void postVisitWrite(int a_level)
This method is called from the visit() method after the node text is written.

Supported API: true

Parameters:
a_level -

preNavigateWrite

public void preNavigateWrite()
This method should be called prior to navigating the structure. This default implementation does nothing.

Supported API: true


postNavigateWrite

public void postNavigateWrite()
This method should be called after navigating the structure. This default implementation does nothing.

Supported API: true


getMessageKey

public String getMessageKey()
By default this method returns the PART_USAGE message key from partResource. Over-ride this method to define a custom message key to work in conjuntion with any customizations made to the midVisitParams method.

Supported API: true

Returns:
String

getNodeIdentity

protected String getNodeIdentity(Persistable node)
Returns a String representation of the identity for the given node. This method attempts to build the identity by getting the name, number and version information of the node, if available. If a name or number is not found for the given node, this method uses the IdentityFactory to get the identity of the given node.

Parameters:
node - the Persistable whose identity is returned
Returns:
the String representation of the identity of the given node
See Also:
IdentityFactory