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.]


    Variable Index

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

    Constructor Index

     o xm_SimpleNodeFormatter()

    Method Index

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

    Variables

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

     o 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.

     o DesiredMaxLineLength
     protected int DesiredMaxLineLength
    
    The source line length we would rather not exceed.

    Constructors

     o xm_SimpleNodeFormatter
     public xm_SimpleNodeFormatter()
    

    Methods

     o 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
     o 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
     o 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
     o setDesiredMaxLineLength
     public void setDesiredMaxLineLength(int InputDesiredMaxLineLength)
    
    Set the source line length we would rather not exceed.

    Parameters:
    InputDesiredMaxLineLength - The desired maximum source line length
     o 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
     o 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
     o 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