wt.part
Class BOMHierarchyVisitor

java.lang.Object
  extended by wt.visitor.VisitorAdapter
      extended by wt.visitor.TextOutputVisitor
          extended by wt.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

Method Summary
 String getMessageKey()
          By default this method returns the PART_USAGE message key from partResource.
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
getPrintWriter, getResourceBundle, printLocalizedMessage, printLocalizedMessage, printLocalizedMessage, 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
 

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