    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class xm.xm_SimpleNodeFormatter

    java.lang.Object
       |
       +----xm.xm_NodeFormatter
               |
               +----xm.xm_SimpleNodeFormatter

public class xm_SimpleNodeFormatter
extends xm_NodeFormatter

To reformat an xg_Node (and its children) in a simple way, according to the following rules:

- Each node is to be preceded by a fixed piece of whitespace (by default just a carriage-return) and then another piece for each level deep in the node hierarchy (by default a single tab). Note that this is NOT done for the top-level node: it is given no preceding whitespace.
- If the node is an element, its end tag is given the same preceding whitespace as the node itself.
- If the node is an element, its attributes are split over multiple lines so as to prevent excessively long lines. (If one attribute name/value is excessively long, nothing is done about it.) [This feature is not yet supported.]

  ##

  DesiredMaxLineLength
    The source line length we would rather not exceed.
  FixedPrecedingWhitespace
    The piece of whitespace which always precedes a node (except the top-level node).
  PerLevelPrecedingWhitespace
    The piece of whitespace to precede a node for each level deep the node is in its hierarchy.

  ##

  xm_SimpleNodeFormatter()

  ##

  format(xg_Node, int)
    Format the given node, and its children.
  getDesiredMaxLineLength()
    Get the source line length we would rather not exceed.
  getFixedPrecedingWhitespace()
    Get the piece of whitespace which always precedes a node.
  getPerLevelPrecedingWhitespace()
    Get the piece of whitespace to precede a node for each level deep the node is in its hierarchy.
  setDesiredMaxLineLength(int)
    Set the source line length we would rather not exceed.
  setFixedPrecedingWhitespace(String)
    Set the piece of whitespace which always precedes a node.
  setPerLevelPrecedingWhitespace(String)
    Set the piece of whitespace to precede a node for each level deep the node is in its hierarchy.

  ##

  FixedPrecedingWhitespace

       protected String FixedPrecedingWhitespace

    The piece of whitespace which always precedes a node (except the top-level node).

  PerLevelPrecedingWhitespace

       protected String PerLevelPrecedingWhitespace

    The piece of whitespace to precede a node for each level deep the node is in its hierarchy. This whitespace follows the FixedPrecedingWhitespace.

  DesiredMaxLineLength

       protected int DesiredMaxLineLength

    The source line length we would rather not exceed.

  ##

  xm_SimpleNodeFormatter

       public xm_SimpleNodeFormatter()

  ##

  format

       public void format(xg_Node InputNode,
                          int InputOpeningDepth)

    Format the given node, and its children.

    Parameters:
      InputNode - The node to reformat
      InputOpeningDepth - The depth of the node in the hierarchy. This allows a node to be reformatted to fit in with its surroundings (its parent and siblings). For a top-level node, this should be 0.
    Overrides:
      format in class xm_NodeFormatter
  setFixedPrecedingWhitespace

       public void setFixedPrecedingWhitespace(String InputFixedPrecedingWhitespace)

    Set the piece of whitespace which always precedes a node.

    Parameters:
      InputFixedPrecedingWhitespace - The piece of whitespace to always precede a node
  setPerLevelPrecedingWhitespace

       public void setPerLevelPrecedingWhitespace(String InputPerLevelPrecedingWhitespace)

    Set the piece of whitespace to precede a node for each level deep the node is in its hierarchy.

    Parameters:
      InputPerLevelPrecedingWhitespace - The piece of whitespace to precede a node for each level deep
  setDesiredMaxLineLength

       public void setDesiredMaxLineLength(int InputDesiredMaxLineLength)

    Set the source line length we would rather not exceed.

    Parameters:
      InputDesiredMaxLineLength - The desired maximum source line length
  getFixedPrecedingWhitespace

       public String getFixedPrecedingWhitespace()

    Get the piece of whitespace which always precedes a node.

    Returns:
      InputFixedPrecedingWhitespace The piece of whitespace to always precede a node
  getPerLevelPrecedingWhitespace

       public String getPerLevelPrecedingWhitespace()

    Get the piece of whitespace to precede a node for each level deep the node is in its hierarchy.

    Returns:
      InputPerLevelPrecedingWhitespace The piece of whitespace to precede a node for each level deep
  getDesiredMaxLineLength

       public int getDesiredMaxLineLength()

    Get the source line length we would rather not exceed.

    Returns:
      InputDesiredMaxLineLength The desired maximum source line length

      All Packages  Class Hierarchy  This Package  Previous  Next  Index