Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.javatest.util
Class HelpTree

    java.lang.Object
      com.sun.javatest.util.HelpTree

    public class HelpTree

extends java.lang.Object

A class that provides a tree of information nodes that can be selectively printed, suitable for simple command line help.

Nested Class Summary
`static class` | `HelpTree.Node` A node within a HelpTree.
`class` | `HelpTree.Selection` A selection of nodes within a HelpTree.

Constructor Summary
`HelpTree()` Create an empty HelpTree object.
`HelpTree(HelpTree.Node[] nodes)` Create a HelpTree object containing a given set of nodes.

Method Summary
`void` | `addNode(HelpTree.Node node)` Add a node to a help tree.
`HelpTree.Selection` | `find(java.lang.String[] words)` Get a selection representing the nodes that match the given words.
`HelpTree.Selection` | `findAll(java.lang.String[] words)` Get a selection representing the nodes that match all of the given words.
`HelpTree.Selection` | `findAny(java.lang.String[] words)` Get a selection representing the nodes that each match at least one of the given words.
`int` | `getDescriptionIndent()` Get the indentation used to adjust the left margin when writing the description of a node.
`int` | `getNodeIndent()` Get the indentation used to adjust the left margin when writing the child nodes for a node.
`void` | `setDescriptionIndent(int n)` Set the indentation used to adjust the left margin when writing the description of a node.
`void` | `setNodeIndent(int n)` Set the indentation used to adjust the left margin when writing the child nodes for a node.
`void` | `write(java.io.Writer out)` Write out all the nodes in this HelpTree.
`void` | `write(java.io.Writer out, HelpTree.Selection s)` Write out selected nodes in this HelpTree.
`void` | `writeSummary(java.io.Writer out)` Write out a summary of all the nodes in this HelpTree.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HelpTree

    public HelpTree()

  Create an empty HelpTree object.

### HelpTree

    public HelpTree(HelpTree.Node[] nodes)

  Create a HelpTree object containing a given set of nodes.

  Parameters:
    `nodes` - the contents of the HelpTree

Method Detail

### addNode

    public void addNode(HelpTree.Node node)

  Add a node to a help tree.

  Parameters:
    `node` - the node to be added to the tree

### getNodeIndent

    public int getNodeIndent()

  Get the indentation used to adjust the left margin when writing the child nodes for a node.

  Returns:
    the indentation used to adjust the left margin when writing the child nodes for a node
  See Also:
    `setNodeIndent(int)`

### setNodeIndent

    public void setNodeIndent(int n)

  Set the indentation used to adjust the left margin when writing the child nodes for a node.

  Parameters:
    `n` - the indentation used to adjust the left margin when writing the child nodes for a node
  See Also:
    `getNodeIndent()`

### getDescriptionIndent

    public int getDescriptionIndent()

  Get the indentation used to adjust the left margin when writing the description of a node.

  Returns:
    the indentation used to adjust the left margin when writing the description of a node
  See Also:
    `setDescriptionIndent(int)`

### setDescriptionIndent

    public void setDescriptionIndent(int n)

  Set the indentation used to adjust the left margin when writing the description of a node.

  Parameters:
    `n` - the indentation used to adjust the left margin when writing the description of a node
  See Also:
    `getDescriptionIndent()`

### find

    public HelpTree.Selection find(java.lang.String[] words)

  Get a selection representing the nodes that match the given words. If there are nodes whose name or description contain all of the given words, then those nodes will be returned. Otherwise, all nodes whose name or description contain at least one of the given words will be returned.

  Parameters:
    `words` - the words to be searched for
  Returns:
    a Selection containing the matching nodes

### findAll

    public HelpTree.Selection findAll(java.lang.String[] words)

  Get a selection representing the nodes that match all of the given words.

  Parameters:
    `words` - the words to be searched for
  Returns:
    a Selection containing the matching nodes

### findAny

    public HelpTree.Selection findAny(java.lang.String[] words)

  Get a selection representing the nodes that each match at least one of the given words.

  Parameters:
    `words` - the words to be searched for
  Returns:
    a Selection containing the matching nodes

### write

    public void write(java.io.Writer out)
               throws java.io.IOException

  Write out all the nodes in this HelpTree.

  Parameters:
    `out` - the writer to which to write the nodes. If out is a com.sun.javatest.util.WrapWriter, it will be used directly, otherwise a WrapWriter will be created that will write to the given writer.
  Throws:
    `java.io.IOException` - if the is a problem writing the nodes.
  See Also:
    `WrapWriter`

### write

    public void write(java.io.Writer out,
                      HelpTree.Selection s)
               throws java.io.IOException

  Write out selected nodes in this HelpTree.

  Parameters:
    `out` - the writer to which to write the nodes. If out is a com.sun.javatest.util.WrapWriter, it will be used directly, otherwise a WrapWriter will be created that will write to the given writer.
    `s` - a Selection object containing the nodes to be written
  Throws:
    `java.io.IOException` - if the is a problem writing the nodes.
  See Also:
    `WrapWriter`

### writeSummary

    public void writeSummary(java.io.Writer out)
                      throws java.io.IOException

  Write out a summary of all the nodes in this HelpTree. The summary will contain the name and description of the top level nodes, but not any of their children.

  Parameters:
    `out` - the writer to which to write the nodes. If out is a com.sun.javatest.util.WrapWriter, it will be used directly, otherwise a WrapWriter will be created that will write to the given writer.
  Throws:
    `java.io.IOException` - if the is a problem writing the nodes.
  See Also:
    `WrapWriter`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.