All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCOutliner

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----jclass.bwt.JCContainer
                                   |
                                   +----jclass.bwt.JCScrolledWindow
                                           |
                                           +----jclass.bwt.JCMultiColumnWindow
                                                   |
                                                   +----jclass.bwt.JCOutliner

public class JCOutliner
extends JCMultiColumnWindow
implements JCOutlinerInterface
JCOutliner provides an easy way to display hierarchically-organized data. The data items can be organized into columns for easier display. The data is assumed to be in the form of a tree. Each item is either a folder (a tree branch) or an item (a tree leaf). Each folder or item is displayed with an icon to its left. The appearance of each node is specified by a style . Column labels can also be optionally added.

The user can control whether the data contained in a folder is to be displayed. The user can collapse or uncollapse a folder by either double-clicking on the folder, hitting the space key, or clicking on the optional shortcut button displayed to the left of the folder. Typing a character will cause the first item which starts with the character to be made visible and selected. If no item can be found, no action is taken.

The shortcut button contains a character that indicates whether a folder is collapsed by displaying either a "+" (collapsed), or "-" (uncollapsed).

Properties

Name Method
AutoSelect setAutoSelect
Background setBackground
Batched setBatched
ColumnAlignments setColumnAlignments
ColumnButtons setColumnButtons
ColumnLabels setColumnLabels
ColumnLabelSort setColumnLabelSort
ColumnLabelSortMethod setColumnLabelSortMethod
ColumnLeftMargin setColumnLeftMargin
ColumnRightMargin setColumnRightMargin
ColumnWidths setColumnWidths
Font setFont
Foreground setForeground
Insets setInsets
NodeHeight setNodeHeight
NodeIndent setNodeIndent
NumColumns setNumColumns
PreferredSize setPreferredSize
RootVisible setRootVisible
ScrollbarDisplay setScrollbarDisplay
ScrollbarOffset setScrollbarOffset
Spacing setSpacing
StateList setStateList
UserData setUserData
VisibleRows setVisibleRows

Events

Class Listener Description
JCActionEvent addActionListener Posted when an item is double-clicked, or the ENTER key is hit
JCOutlinerEvent addItemListener Posted when an item is clicked or the space key is hit


Variable Index

 o FOLDER_CLOSED
 o FOLDER_OPEN_ALL
 o FOLDER_OPEN_FOLDERS
 o FOLDER_OPEN_ITEMS
 o FOLDER_OPEN_NONE

Constructor Index

 o JCOutliner()
Creates an empty outliner.
 o JCOutliner(JCOutlinerNode)
Creates an outliner with the specified root node.
 o JCOutliner(JCOutlinerNode, Applet, String)
Creates a outliner which reads parameters from the applet's HTML file.

Method Index

 o addActionListener(JCActionListener)
Adds the specified action listener to receive action events.
 o addItemListener(JCItemListener)
Adds the specified item listener to receive item events.
 o calculateNodeHeight(JCOutlinerNode)
Calculates the height of a node (by looking at the node's style).
 o eventInShortcut(Event, JCOutlinerNode)
Returns true if the node is a folder and the event is within the folder's shortcut button.
 o eventToNode(Event)
Gets the node in which the event occurred.
 o folderChanged(JCOutlinerNode)
Notifies the outliner that the number of a folder's children has changed.
 o getAutoSelect()
Gets the AutoSelect value.
 o getBatched()
Gets the Batched value.
 o getBounds(JCOutlinerNode, Rectangle)
Gets the physical bounding rectangle of a node (icon and label) (ie adjusted for scrolling and insets).
 o getDefaultNodeStyle()
Gets the default node style.
 o getFocusNode()
Returns the node which currently has focus, or null.
 o getNextNode(JCOutlinerNode)
Returns the next visible node, or null if none was found.
 o getNodeHeight()
Gets the NodeHeight value.
 o getNodeIndent()
Gets the NodeIndent value.
 o getNumNodes()
Gets the current number of non-collapsed nodes (ie the number of open folders and their children).
 o getOutliner()
Gets the internal outliner component.
 o getPreviousNode(JCOutlinerNode)
Returns the previous visible node, or null if none was found.
 o getRootNode()
Gets the root node.
 o getRootVisible()
Gets the RootVisible value.
 o getSelectedIndexes()
Returns an array (length 1) containing the selected index (0), or null if no items are selected.
 o getSelectedNode()
Returns the currently selected node, or null.
 o getSelectedObjects()
Returns the an array (length 1) containing the label of the selected node, or null if no node is selected.
 o getSpacing()
Gets the spacing between items.
 o getStateList()
Gets the current StateList.
 o getStyleList()
Gets the current StyleList.
 o getTree()
Gets the current node hierarchy as a String list.
 o getViewportHeight()
Sets the work area height to be the outliner's virtual height.
 o getVisibleNodes()
Gets a list of the nodes which are currently displayed.
 o getVisibleRows()
Returns the number of visible lines.
 o makeNodeVisible(JCOutlinerNode)
Scrolls the display if necessary to make the node visible.
 o removeActionListener(JCActionListener)
Removes the specified action listener so it no longer receives action events.
 o removeItemListener(JCItemListener)
Removes the specified item listener so it no longer receives item events.
 o scrollVertical(JCScrollableInterface, JCAdjustmentEvent, int)
Scrolls the list vertically.
 o selectNode(JCOutlinerNode, Event)
Selects a node, and posts a JCOutlinerEvent.
 o setAutoSelect(boolean)
If true (default), the node which currently has focus is also selected.

HTML param name/value: "AutoSelect"/boolean

 o setBatched(boolean)
If false (default), the component is repainted every time an item is changed.
 o setFocusNode(JCOutlinerNode, Event)
Sets a node to have the keyboard focus.
 o setHorizScrollbarValues()
This method may be overriden by a subclass to change the default values of the horizontal scrollbar.
 o setNodeHeight(int)
Sets the height of each node (pixels).
 o setNodeIndent(int)
Sets the indentation of each node relative to its parent (pixels).

HTML param name/value: "NodeIndent"/int

 o setNodeState(JCOutlinerNode, int, boolean)
Sets the state of a folder.
 o setOutliner(JCOutlinerComponent)
Replaces the current outliner.
 o setRootNode(JCOutlinerNode)
Sets the root node.
 o setRootVisible(boolean)
If true (default), the root node is drawn.

HTML param name/value: "RootVisible"/boolean

 o setSpacing(int)
Sets the spacing between items (default: 0).
 o setStateList(int[])
Sets a list of values used for double-clicking on a folder or clicking its shortcut button.
 o setStyleList(JCOutlinerNodeStyle[])
Sets the list of node styles.
 o setTree(String[])
Sets the node hierarchy by parsing the string list.
 o setVertScrollbarValues()
This method may be overriden by a subclass to change the default values of the vertical scrollbar.
 o setVisibleRows(int)
Sets the number of visible rows.
 o sortByColumn(int, JCSortInterface)
Sorts the nodes in the list in ascending order based on a specified column, using the String equivalents of each value.
 o sortByColumn(int, JCSortInterface, int)
Sorts the nodes in the list based on a specified column, using the String equivalents of each value.

Variables

 o FOLDER_CLOSED
  public final static int FOLDER_CLOSED
 o FOLDER_OPEN_NONE
  public final static int FOLDER_OPEN_NONE
 o FOLDER_OPEN_FOLDERS
  public final static int FOLDER_OPEN_FOLDERS
 o FOLDER_OPEN_ITEMS
  public final static int FOLDER_OPEN_ITEMS
 o FOLDER_OPEN_ALL
  public final static int FOLDER_OPEN_ALL

Constructors

 o JCOutliner
  public JCOutliner()
Creates an empty outliner. No parameters are read from an HTML file

 o JCOutliner
  public JCOutliner(JCOutlinerNode root)
Creates an outliner with the specified root node. No parameters are read from an HTML file

See Also:
setRootNode
 o JCOutliner
  public JCOutliner(JCOutlinerNode root,
                    Applet applet,
                    String name)
Creates a outliner which reads parameters from the applet's HTML file.

Parameters:
items - the initial items This may be a String, JCString or any object (in which case the object's toString() method is called to obtain a string).
applet - the applet whose PARAM tags are to be read
name - if this is not null, only parameters preceded by this name are read
See Also:
getParameter, JCString

Methods

 o getOutliner
  public JCOutlinerComponent getOutliner()
Gets the internal outliner component.

 o setOutliner
  public void setOutliner(JCOutlinerComponent outliner)
Replaces the current outliner.

 o setVertScrollbarValues
  protected void setVertScrollbarValues()
This method may be overriden by a subclass to change the default values of the vertical scrollbar.

Overrides:
setVertScrollbarValues in class JCScrolledWindow
 o setHorizScrollbarValues
  protected void setHorizScrollbarValues()
This method may be overriden by a subclass to change the default values of the horizontal scrollbar.

Overrides:
setHorizScrollbarValues in class JCScrolledWindow
 o getViewportHeight
  protected int getViewportHeight()
Sets the work area height to be the outliner's virtual height.

Overrides:
getViewportHeight in class JCScrolledWindow
 o scrollVertical
  protected void scrollVertical(JCScrollableInterface scrollable,
                                JCAdjustmentEvent ev,
                                int value)
Scrolls the list vertically.

Overrides:
scrollVertical in class JCScrolledWindow
 o addItemListener
  public void addItemListener(JCItemListener l)
Adds the specified item listener to receive item events. If the listener implements JCOutlinerListener (an JCItemListener subclass), it will be passed JCOutlinerEvents.

See Also:
JCItemEvent, JCOutlinerEvent, JCOutlinerListener
 o removeItemListener
  public void removeItemListener(JCItemListener l)
Removes the specified item listener so it no longer receives item events.

 o addActionListener
  public void addActionListener(JCActionListener l)
Adds the specified action listener to receive action events. Action events occur when a node is double-clicked.

See Also:
JCActionEvent
 o removeActionListener
  public void removeActionListener(JCActionListener l)
Removes the specified action listener so it no longer receives action events.

See Also:
addActionListener
 o folderChanged
  public void folderChanged(JCOutlinerNode node)
Notifies the outliner that the number of a folder's children has changed.

 o getBatched
  public boolean getBatched()
Gets the Batched value.

See Also:
setBatched
 o setBatched
  public void setBatched(boolean v)
If false (default), the component is repainted every time an item is changed. If set to true, the component is only repainted (if necessary) when the value is again set to false.

 o getRootNode
  public JCOutlinerNode getRootNode()
Gets the root node.

See Also:
setRootNode
 o setRootNode
  public void setRootNode(JCOutlinerNode node)
Sets the root node.

 o getTree
  public String[] getTree()
Gets the current node hierarchy as a String list.

See Also:
setTree
 o setTree
  public void setTree(String s[])
Sets the node hierarchy by parsing the string list. Each line in the list represents a node's label. Spaces or tabs at the start of each line supply the tree hierarchy. Lines with the same indentation level are children. Nodes without children are assumed to be items. To create a folder without children, append the string "(FOLDER)" to the line.

HTML param name/value: "Tree"/comma-separated lines

 o getRootVisible
  public boolean getRootVisible()
Gets the RootVisible value.

See Also:
setRootVisible
 o setRootVisible
  public void setRootVisible(boolean v)
If true (default), the root node is drawn.

HTML param name/value: "RootVisible"/boolean

 o getNumNodes
  public int getNumNodes()
Gets the current number of non-collapsed nodes (ie the number of open folders and their children).

 o calculateNodeHeight
  public int calculateNodeHeight(JCOutlinerNode node)
Calculates the height of a node (by looking at the node's style).

 o getNodeHeight
  public int getNodeHeight()
Gets the NodeHeight value.

See Also:
setNodeHeight
 o setNodeHeight
  public void setNodeHeight(int v)
Sets the height of each node (pixels). If 0 (default), the height is determined using the largest font and image height in the list of node styles.

HTML param name/value: "NodeHeight"/int

 o getAutoSelect
  public boolean getAutoSelect()
Gets the AutoSelect value.

See Also:
setAutoSelect
 o setAutoSelect
  public void setAutoSelect(boolean v)
If true (default), the node which currently has focus is also selected.

HTML param name/value: "AutoSelect"/boolean

See Also:
setFocusNode, selectNode
 o getNodeIndent
  public int getNodeIndent()
Gets the NodeIndent value.

See Also:
setNodeIndent
 o setNodeIndent
  public void setNodeIndent(int v)
Sets the indentation of each node relative to its parent (pixels).

HTML param name/value: "NodeIndent"/int

 o getStateList
  public int[] getStateList()
Gets the current StateList.

See Also:
setStateList
 o setStateList
  public void setStateList(int list[])
Sets a list of values used for double-clicking on a folder or clicking its shortcut button. The folder's state is cycled through the list. Valid values:
FOLDER_CLOSED        Folder closed; no children visible
FOLDER_OPEN_NONE     Folder open; no children visible
FOLDER_OPEN_FOLDERS  Folder open; only folder children visible
FOLDER_OPEN_ITEMS    Folder open; only non-folder children visible
FOLDER_OPEN_ALL      Folder open; all children visible
 

HTML param name/value: "StateList"/comma-separated list of enums

 o getStyleList
  public JCOutlinerNodeStyle[] getStyleList()
Gets the current StyleList.

See Also:
setStyleList
 o setStyleList
  public void setStyleList(JCOutlinerNodeStyle list[])
Sets the list of node styles. The list is only used for determining the node height if it has not been set.

See Also:
setNodeHeight
 o getDefaultNodeStyle
  public JCOutlinerNodeStyle getDefaultNodeStyle()
Gets the default node style.

 o getSpacing
  public int getSpacing()
Gets the spacing between items.

See Also:
setSpacing
 o setSpacing
  public void setSpacing(int v)
Sets the spacing between items (default: 0). This value increases the HighlightThickness value.

HTML param name/value: "Spacing"/int

See Also:
setHighlightThickness
 o getVisibleRows
  public int getVisibleRows()
Returns the number of visible lines.

See Also:
setVisibleRows
 o setVisibleRows
  public void setVisibleRows(int v)
Sets the number of visible rows. If set to 0 (default), the list will attempt to resize itself so that all its items are visible.

HTML param name/value: "VisibleRows"/int

 o getSelectedIndexes
  public int[] getSelectedIndexes()
Returns an array (length 1) containing the selected index (0), or null if no items are selected.

 o getSelectedObjects
  public Object[] getSelectedObjects()
Returns the an array (length 1) containing the label of the selected node, or null if no node is selected.

 o getSelectedNode
  public JCOutlinerNode getSelectedNode()
Returns the currently selected node, or null.

 o selectNode
  public void selectNode(JCOutlinerNode node,
                         Event ev)
Selects a node, and posts a JCOutlinerEvent.

Parameters:
node - if null, the currently selected node is deselected
ev - event which caused the selection (passed to callback)
See Also:
addItemListener
 o getFocusNode
  public JCOutlinerNode getFocusNode()
Returns the node which currently has focus, or null.

 o setFocusNode
  public void setFocusNode(JCOutlinerNode node,
                           Event ev)
Sets a node to have the keyboard focus.

Parameters:
node - if null, no the current focus node is unchanged
ev - event which caused the focus change
 o getVisibleNodes
  public JCVector getVisibleNodes()
Gets a list of the nodes which are currently displayed.

 o setNodeState
  public boolean setNodeState(JCOutlinerNode node,
                              int state,
                              boolean notify)
Sets the state of a folder.

Parameters:
node - if not a folder, no action is taken
state - one of:
FOLDER_CLOSED        Folder closed; no children visible
FOLDER_OPEN_NONE     Folder open; no children visible
FOLDER_OPEN_FOLDERS  Folder open; only folder children visible
FOLDER_OPEN_ITEMS    Folder open; only non-folder children visible
FOLDER_OPEN_ALL      Folder open; all children visible
 
notify - if true, a JCOutlinerEvent is posted for the node
Returns:
false if the app disallowed the state change
Throws: IllegalArgumentException
If the value is invalid
See Also:
addItemListener
 o makeNodeVisible
  public boolean makeNodeVisible(JCOutlinerNode node)
Scrolls the display if necessary to make the node visible.

Returns:
false if the node could not be made visible due to its parents state
 o getNextNode
  public JCOutlinerNode getNextNode(JCOutlinerNode node)
Returns the next visible node, or null if none was found.

 o getPreviousNode
  public JCOutlinerNode getPreviousNode(JCOutlinerNode node)
Returns the previous visible node, or null if none was found.

 o getBounds
  public Rectangle getBounds(JCOutlinerNode node,
                             Rectangle rect)
Gets the physical bounding rectangle of a node (icon and label) (ie adjusted for scrolling and insets).

Parameters:
rect - if not null, its members are set
Returns:
null if rect is null, otherwise the bounding rectangle
 o eventToNode
  public JCOutlinerNode eventToNode(Event ev)
Gets the node in which the event occurred.

 o eventInShortcut
  public boolean eventInShortcut(Event ev,
                                 JCOutlinerNode node)
Returns true if the node is a folder and the event is within the folder's shortcut button.

 o sortByColumn
  public void sortByColumn(int column,
                           JCSortInterface sort_if)
Sorts the nodes in the list in ascending order based on a specified column, using the String equivalents of each value.

Parameters:
sort_if - An optional interface whose compare method is called during sorting, to provide a mechanism for the application to specify whether one object is greater than another (similar to qsort's compare function). If this parameter is null, the column is sorted by numerical or string comparison as applicable.
Overrides:
sortByColumn in class JCMultiColumnWindow
 o sortByColumn
  public void sortByColumn(int column,
                           JCSortInterface sort_if,
                           int direction)
Sorts the nodes in the list based on a specified column, using the String equivalents of each value.

Parameters:
sort_if - An optional interface whose compare method is called during sorting, to provide a mechanism for the application to specify whether one object is greater than another (similar to qsort's compare function). If this parameter is null, the column is sorted by numerical or string comparison as applicable.
direction - sort direction: ASCENDING or DESCENDING
Overrides:
sortByColumn in class JCMultiColumnWindow

All Packages  Class Hierarchy  This Package  Previous  Next  Index