kiwi.ui.model
Class DocumentDataSource

java.lang.Object
  |
  +--kiwi.ui.model.DocumentDataSource

public class DocumentDataSource
extends Object
implements HierarchicalDataSource

This class is an implementation of HierarchicalDataSource in which tree nodes represent HTML documents that are loaded as system resources.

Documents are loaded using the provided ResourceManager. The default base path for the documents is "docs/", and since they are loaded as URL resources, they should be located relative to "html/docs/" which in turn will be relative to the ResourceManager's resource anchor class. One form of the constructor allows an alternate base path to be specified.

Documents may be organized in a hierarchy; each expandable node in the hierarchy corresponds to a directory in the resource file tree. Each directory (including the root directory, "docs/") is expected to contain an index file named "_index.txt" describing the child nodes of that directory. Nodes are listed in this file, one per line. Each line should include the following fields, delimited by vertical bar characters (|):

Icon name
The name of the icon for this node. If an asterisk (*) is specified for the name, a default icon will be used.
Alternate Icon name
The name of an alternate icon for this node. This is the icon that is used to display expanded nodes. If an asterisk (*) is specified for the name, a default icon will be used. If a dash (-) is specified for the name, the alternate icon will be the same as the normal icon (above).
Expandability flag
One of the characters '+' or '-', denoting expandable and non-expandable, respectively.
Node label
A human-readable, brief textual description of the node.
File
The file corresponding to this resource--either a directory name if this is an expandable node, or a filename if this is a leaf (document) node.

Here is an example entry:

book-closed.gif|book-open.gif|+|API Specification|api

Version:
1.1 (11/98)
Author:
Mark Lindner, PING Software Group
See Also:
ResourceManager, DocumentBrowserView, DocumentBrowserFrame

Inner Class Summary
 class DocumentDataSource.DocumentNode
           
 
Field Summary
static String DEFAULT_BASEPATH
          The default relative document base path.
static String DEFAULT_DESCRIPTION
          The default description of this set of documents.
 
Constructor Summary
DocumentDataSource(ResourceManager manager)
          Construct a new DocumentDataSource with a default description and base path.
DocumentDataSource(ResourceManager manager, String description, String basePath)
          Construct a new DocumentDataSource with the specified description and base path.
 
Method Summary
 Object[] getChildren(ITreeNode node)
          Get the children of a given node.
 Object getRoot()
          Get the root object.
 Object getValueForProperty(ITreeNode node, String property)
          Get the value for a given property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DESCRIPTION

public static final String DEFAULT_DESCRIPTION
The default description of this set of documents.

DEFAULT_BASEPATH

public static final String DEFAULT_BASEPATH
The default relative document base path.
Constructor Detail

DocumentDataSource

public DocumentDataSource(ResourceManager manager)
Construct a new DocumentDataSource with a default description and base path.
Parameters:
manager - the ResourceManager that will be used to load index files for the tree.

DocumentDataSource

public DocumentDataSource(ResourceManager manager,
                          String description,
                          String basePath)
Construct a new DocumentDataSource with the specified description and base path.
Parameters:
manager - The ResourceManager that will be used to load index files for the tree.
description - A brief description of this set of documents; this becomes the label for the root node in the tree.
Method Detail

getRoot

public Object getRoot()
Get the root object.
Specified by:
getRoot in interface HierarchicalDataSource

getChildren

public Object[] getChildren(ITreeNode node)
Get the children of a given node.
Specified by:
getChildren in interface HierarchicalDataSource

getValueForProperty

public Object getValueForProperty(ITreeNode node,
                                  String property)
Get the value for a given property.
Specified by:
getValueForProperty in interface HierarchicalDataSource