Package com.dassault_systemes.catjdialog

   
Class CATTree

 
Class Hierarchy
java.lang.Object
  |
  +-com.dassault_systemes.catjdialog.CATCallbackSource
        |
        +-com.dassault_systemes.catjdialog.CATDialog
              |
              +-com.dassault_systemes.catjdialog.CATTree
Class Location

Framework : CATJDialog

Module : CATJDialog

Class Description

public class CATTree

The tree graphical component.

Description:

This component presents data in a hierarchical format.
We call nodes the unitary items displayed in the tree.
The tree component has the following features: The tree component should be feeded with presentation data by a data model that is either a CATKeyTreeModel or a CATKeyPathTreeModel (see doc).
Depending on the type of data model that is used, the tree component provides 2 distinct sets of methods to handle selection and collapse/expand.

CATTree Properties:

CATTree Notifications:

   All Implemented Interfaces:
CATIMenuProvider
CATIMenuFirer
See Also:
com.dassault_systemes.catjdialog.CATKeyTreeModel
com.dassault_systemes.catjdialog.CATKeyTreeModelBase
com.dassault_systemes.catjdialog.CATKeyPathTreeModel
com.dassault_systemes.catjdialog.CATKeyPathTreeModelBase
Field Summary

Constructor Summary
CATTree(CATDialog iParent, String iName)

Method Summary
void setModelURL(String iModelURL)
String getModelURL()
void setDisplayRoot(boolean iDisplay)
boolean getDisplayRoot()
void setScrollable(boolean iScollable)
boolean getScrollable()
void setMinRows(int iMinRows)
int getMinRows()
void setMinWidth(int iMinWidth)
int getMinWidth()
boolean getMultipleSelection()
void setMultipleSelection(boolean iMultiple)
void unselectAll()
boolean hasMenu()
CATMenuModel getMenu(Object iContext)
CATMenuNotification getMenuNotification()
CATTreeExpandNotification getExpandNotification()
CATNotification getSelectionNotification()
CATTreeCommandNotification getCommandNotification()
void setKeyModel(CATKeyTreeModel iModel)
CATKeyTreeModel getKeyModel()
void collapseKey(String iKey)
void expandKey(String iKey)
boolean isKeyExpanded(String iKey)
boolean isKeySelected(String iKey)
void selectKey(String iKey)
void unselectKey(String iKey)
void setSelectedKeys(String[] iKeys)
String getSelectedKey()
String[] getSelectedKeys()
void setKeyPathModel(CATKeyPathTreeModel iModel)
CATKeyPathTreeModel getKeyPathModel()
void collapseKeyPath(String[] iKeyPath)
void expandKeyPath(String[] iKeyPath)
boolean isKeyPathExpanded(String[] iKeyPath)
boolean isKeyPathSelected(String[] iKeyPath)
void selectKeyPath(String[] iKeyPath)
void unselectKeyPath(String[] iKeyPath)
void setSelectedKeyPaths(String[][] iKeyPaths)
String[] getSelectedKeyPath()
String[][] getSelectedKeyPaths()


Field Detail

Constructor Detail

CATTree

    CATTree(CATDialog iParent, String iName)

Creates a tree with the specified parent and name.

Parameters:
iParent
The parent component.
iName
This trees name. Here are some rules for this name:
  • It is set in the constructor, and cannot be changed afterwards.
  • The name must be unique for the parent (2 children with the same name are not allowed).
  • The name may not contain any ot the following characters: '.' (dot), ' ' (blank), '_' (underscore)

Method Detail

setModelURL

    void setModelURL(String iModelURL)

Sets the tree model URL.

The expected format is: <model classname>@<arg1>,<arg2>,...
<model classname> must have a constructor with the following signature:
    void <Constructor>(CATDialog iDialog, String[] iArgs)

Note: This method allows to set the tree model inline in the XMLDlg file.
Example: <Tree Name="MyTree" ModelURL="com.mypackage.MyKeyTreeModel@myarg"...

Parameters:
iModelURL
The tree model URL. A null value empties this tree.

getModelURL

    String getModelURL()

Returns the tree model URL (if any).

Returns:
The tree model URL that was set with setModelURL().

setDisplayRoot

    void setDisplayRoot(boolean iDisplay)

Sets whether or not the root node is displayed. By default it is displayed.

Parameters:
iDisplay
If true, the root node is displayed; otherwise it is hidden.

getDisplayRoot

    boolean getDisplayRoot()

Returns whether or not the root node is displayed.

Returns:
true if the root node is displayed; false otherwise.

setScrollable

    void setScrollable(boolean iScollable)

Enables/disables the tree scroll. By default it is enabled.

When the scroll is enabled, scrollbars are only displayed when necessary (condition is "available area < tree size")

Parameters:
iScollable
If true, the scroll is enabled; otherwise it is disabled.

getScrollable

    boolean getScrollable()

Determines whether the scroll is enabled or not.

Returns:
true if the scroll is enabled; false otherwise.

setMinRows

    void setMinRows(int iMinRows)

Set the minimum visible rows. Default is 13.

This is used to "ensure" a minimum height for rendering the tree.

Parameters:
iMinRows
The minimum number of rows this tree shows.

getMinRows

    int getMinRows()

Returns the minimum visible rows.

Returns:
The minimum number of rows this tree shows.

setMinWidth

    void setMinWidth(int iMinWidth)

Set the minimum width (in characters) of the tree. Default is 26.

This is used to "ensure" a minimum width for rendering the tree

Parameters:
iMinWidth
The minimum width of this tree.

getMinWidth

    int getMinWidth()

Returns the minimum width (in characters).

Returns:
The minimum width of this tree.

getMultipleSelection

    boolean getMultipleSelection()

Determines whether multiple selection is enabled or not. Default is disabled (false).

Returns:
true if multiple selection is enabled; false otherwise.

setMultipleSelection

    void setMultipleSelection(boolean iMultiple)

Enables/disables multipe selection. Default is disabled.

Parameters:
iMultiple
If true, multiple selection is enabled; otherwise it is disabled.

unselectAll

    void unselectAll()

Unselects all tree nodes.

Runs both for single and multiple selection.


hasMenu

    boolean hasMenu()

Determines whether this tree has a contextual menu.

This checks that the tree model is of type CATKeyTreeModelCtxMenuEx or CATKeyPathTreeModelCtxMenuEx

Returns:
true if this tree has a menu, false otherwise.
See Also:
CATIMenuProvider#hasMenu()
CATKeyTreeModelCtxMenuEx
CATKeyPathTreeModelCtxMenuEx

getMenu

    CATMenuModel getMenu(Object iContext)

Returns the menu model defining the tree contextual menu (may be null).

Invokes the menu from the tree model.

Parameters:
iContext
The context object. With a CATKeyTreeModel, it is the node key (String). With a CATKeyPathTreeModel, it is the node kay path (String[]).
See Also:
CATIMenuProvider#getMenu(Object)
CATKeyTreeModelCtxMenuEx#getContextualMenu(String)
CATKeyPathTreeModelCtxMenuEx#getContextualMenu(CATDialog, String[])

getMenuNotification

    CATMenuNotification getMenuNotification()

Returns the menu notification.

This notification is sent when a contextual menu command is triggered.

Returns:
The menu notification.
See Also:
CATIMenuProvider#getMenuNotification()

getExpandNotification

    CATTreeExpandNotification getExpandNotification()

Returns the expand notification.

This notification is sent when a tree node is expanded.
Note: this notification is only published for very specific needs. Trees should not have special behavior on expand.

Returns:
The expand notification.

getSelectionNotification

    CATNotification getSelectionNotification()

Returns the selection notification.

This notification is sent when the tree selection changes.

Returns:
The selection notification.

getCommandNotification

    CATTreeCommandNotification getCommandNotification()

Returns the menu notification.

This notification is sent when a contextual menu command is triggered.

Returns:
The menu notification.

setKeyModel

    void setKeyModel(CATKeyTreeModel iModel)

Sets the key tree model. A null value unsets the tree model.

Parameters:
iModel
The key tree model.

getKeyModel

    CATKeyTreeModel getKeyModel()

Returns the key tree model (may be null).

Returns:
The key tree model. A null value means either this tree has no tree model, or it has a keypath tree model.

collapseKey

    void collapseKey(String iKey)

Collapses a tree node.

This is reserved when using a tree model of type CATKeyTreeModel.

Parameters:
iKey
The key of the tree node to collapse.
See Also:
CATKeyTreeModel

expandKey

    void expandKey(String iKey)

Expands a tree node.

This is reserved when using a tree model of type CATKeyTreeModel.

Parameters:
iKey
The key of the tree node to expand.
See Also:
CATKeyTreeModel

isKeyExpanded

    boolean isKeyExpanded(String iKey)

Determines whether a tree node is expanded.

This is reserved when using a tree model of type CATKeyTreeModel.

Parameters:
iKey
The key of the tree node to check.
Returns:
true if the node is expanded; false otherwise.
See Also:
CATKeyTreeModel

isKeySelected

    boolean isKeySelected(String iKey)

Determines whether a tree node is selected or not.

This is reserved when using a tree model of type CATKeyTreeModel.

Parameters:
iKey
The key of the tree node to check.
Returns:
true if the node is selected; false otherwise.
See Also:
CATKeyTreeModel

selectKey

    void selectKey(String iKey)

Selects a tree node.

This is reserved when using a tree model of type CATKeyTreeModel.
In single selection mode, calling this method updates the selection,
In multiple selection mode, calling this method adds the key to the selection.

Parameters:
iKey
The key of the tree node to select.
See Also:
CATKeyTreeModel

unselectKey

    void unselectKey(String iKey)

Unselects a tree node.

This is reserved when using a tree model of type CATKeyTreeModel.
In single selection mode, calling this method updates the selection,
In multiple selection mode, calling this method removes the key from the selection.

Parameters:
iKey
The key of the tree node to unselect.
See Also:
CATKeyTreeModel

setSelectedKeys

    void setSelectedKeys(String[] iKeys)

Selects a bunch of tree nodes (a null value unselects all nodes).

This is reserved when using a tree model of type CATKeyTreeModel in multiple selection mode.
Calling this method replaces the current selection with the specified one.

Parameters:
iKeys
An array of the keys of the tree nodes to select (a null value unselects all nodes).
See Also:
CATKeyTreeModel

getSelectedKey

    String getSelectedKey()

Returns the selected tree node key (may be null).

This is reserved when using a tree model of type CATKeyTreeModel in single selection mode.

Returns:
The selected tree node key (may be null if no selection).
See Also:
CATKeyTreeModel

getSelectedKeys

    String[] getSelectedKeys()

Returns the selected tree nodes keys (may be null).

This is reserved when using a tree model of type CATKeyTreeModel in multiple selection mode.

Returns:
The selected tree nodes keys (may be null if no selection).
See Also:
CATKeyTreeModel

setKeyPathModel

    void setKeyPathModel(CATKeyPathTreeModel iModel)

Sets the key-path tree model. A null value unsets the tree model.

Parameters:
iModel
The key-path tree model.

getKeyPathModel

    CATKeyPathTreeModel getKeyPathModel()

Returns the key-path tree model (may be null).

Returns:
The key-path tree model. A null value means either this tree has no tree model, or it has a key tree model.

collapseKeyPath

    void collapseKeyPath(String[] iKeyPath)

Collapses a tree node.

This is reserved when using a tree model of type CATKeyPathTreeModel.

Parameters:
iKeyPath
The key-path of the tree node to collapse.
See Also:
CATKeyPathTreeModel

expandKeyPath

    void expandKeyPath(String[] iKeyPath)

Expands a tree node.

This is reserved when using a tree model of type CATKeyPathTreeModel.

Parameters:
iKeyPath
The key-path of the tree node to expand.
See Also:
CATKeyPathTreeModel

isKeyPathExpanded

    boolean isKeyPathExpanded(String[] iKeyPath)

Determines whether a tree node is expanded.

This is reserved when using a tree model of type CATKeyPathTreeModel.

Parameters:
iKeyPath
The key-path of the tree node to check.
Returns:
true if the node is expanded; false otherwise.
See Also:
CATKeyPathTreeModel

isKeyPathSelected

    boolean isKeyPathSelected(String[] iKeyPath)

Determines whether a tree node is selected or not.

This is reserved when using a tree model of type CATKeyPathTreeModel.

Parameters:
iKeyPath
The key-path of the tree node to check.
Returns:
true if the node is selected; false otherwise.
See Also:
CATKeyPathTreeModel

selectKeyPath

    void selectKeyPath(String[] iKeyPath)

Selects a tree node.

This is reserved when using a tree model of type CATKeyPathTreeModel.
In single selection mode, calling this method updates the selection,
In multiple selection mode, calling this method adds the key to the selection.

Parameters:
iKeyPath
The key-path of the tree node to select.
See Also:
CATKeyPathTreeModel

unselectKeyPath

    void unselectKeyPath(String[] iKeyPath)

Unselects a tree node.

This is reserved when using a tree model of type CATKeyPathTreeModel.
In single selection mode, calling this method updates the selection,
In multiple selection mode, calling this method removes the key from the selection.

Parameters:
iKeyPath
The key-path of the tree node to unselect.
See Also:
CATKeyPathTreeModel

setSelectedKeyPaths

    void setSelectedKeyPaths(String[][] iKeyPaths)

Selects a bunch of tree nodes (a null value unselects all nodes).

This is reserved when using a tree model of type CATKeyPathTreeModel in multiple selection mode.
Calling this method replaces the current selection with the specified one.

Parameters:
iKeyPaths
An array of the key-paths of the tree nodes to select (a null value unselects all nodes).
See Also:
CATKeyPathTreeModel

getSelectedKeyPath

    String[] getSelectedKeyPath()

Returns the selected tree node key (may be null).

This is reserved when using a tree model of type CATKeyPathTreeModel in single selection mode.

Returns:
The selected tree node key-path (may be null if no selection).
See Also:
CATKeyPathTreeModel

getSelectedKeyPaths

    String[][] getSelectedKeyPaths()

Returns the selected tree nodes keys (may be null).

This is reserved when using a tree model of type CATKeyPathTreeModel in multiple selection mode.

Returns:
The selected tree nodes key-paths (may be null if no selection);
See Also:
CATKeyPathTreeModel


Copyright © 2000, Dassault Systèmes. All rights reserved