public class DocumentDataSource extends Object implements TreeDataSource
TreeDataSource
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 (|):
Here is an example entry:
book-closed.gif|book-open.gif|+|API Specification|api
ResourceManager
,
DocumentBrowserView
,
DocumentBrowserFrame
Modifier and Type | Class and Description |
---|---|
class |
DocumentDataSource.DocumentNode |
Modifier and Type | Field and Description |
---|---|
private String |
basePath |
private static Icon |
BOOK_CLOSED_ICON |
private static Icon |
BOOK_OPEN_ICON |
private static Icon |
BOOKS_ICON |
static String |
DEFAULT_BASEPATH
The default relative document base path.
|
static String |
DEFAULT_DESCRIPTION
The default description of this set of documents.
|
private static Icon |
DOCUMENT_ICON |
private static String |
INDEX_FILE |
private ResourceManager |
resmgr |
private DocumentDataSource.DocumentNode |
root |
private static Icon |
UNKNOWN_ICON |
COLUMN_NAMES_PROPERTY, COLUMN_TYPES_PROPERTY
Constructor and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
Object[] |
getChildren(Object node)
Get the children of a given node.
|
Icon |
getIcon(Object node,
boolean isExpanded)
Get the icon for a node.
|
String |
getLabel(Object node)
Get the label for a node.
|
Object |
getRoot()
Get the root object.
|
Object |
getValueForProperty(Object node,
String property)
Get the value for a given property.
|
boolean |
isExpandable(Object node)
Determine if this node is expandable.
|
private DocumentDataSource.DocumentNode |
parseLine(DocumentDataSource.DocumentNode parent,
String line) |
private ResourceManager resmgr
private DocumentDataSource.DocumentNode root
private static Icon DOCUMENT_ICON
private static Icon BOOKS_ICON
private static Icon UNKNOWN_ICON
private static Icon BOOK_OPEN_ICON
private static Icon BOOK_CLOSED_ICON
private static final String INDEX_FILE
public static final String DEFAULT_DESCRIPTION
public static final String DEFAULT_BASEPATH
public DocumentDataSource(ResourceManager manager)
DocumentDataSource
with a default
description and base path.manager
- the ResourceManager
that will be used to load
index files for the tree.public DocumentDataSource(ResourceManager manager, String description, String basePath)
DocumentDataSource
with the specified
description and base path.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.public Object getRoot()
getRoot
in interface TreeDataSource
public Object[] getChildren(Object node)
getChildren
in interface TreeDataSource
node
- The node that children are being requested for.public boolean isExpandable(Object node)
TreeDataSource
isExpandable
in interface TreeDataSource
node
- The node.public Icon getIcon(Object node, boolean isExpanded)
TreeDataSource
getIcon
in interface TreeDataSource
node
- The node.isExpanded
- The current expanded state of the node.public String getLabel(Object node)
TreeDataSource
getLabel
in interface TreeDataSource
node
- The node.public Object getValueForProperty(Object node, String property)
getValueForProperty
in interface TreeDataSource
node
- The node.property
- The name of the property; one of the constants defined
above, or some arbitrary application-defined property.null
if
there is no value for this property.private DocumentDataSource.DocumentNode parseLine(DocumentDataSource.DocumentNode parent, String line)
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses