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)
Creates a tree with the specified parent and name.

Method Summary
public void collapseKey(String iKey)
Collapses a tree node.
public void collapseKeyPath(String[] iKeyPath)
Collapses a tree node.
public void expandKey(String iKey)
Expands a tree node.
public void expandKeyPath(String[] iKeyPath)
Expands a tree node.
public CATTreeCommandNotification getCommandNotification()
Returns the menu notification.
public boolean getDisplayRoot()
Returns whether or not the root node is displayed.
public CATTreeExpandNotification getExpandNotification()
Returns the expand notification.
public CATKeyTreeModel getKeyModel()
Returns the key tree model (may be null).
public CATKeyPathTreeModel getKeyPathModel()
Returns the key-path tree model (may be null).
public CATMenuModel getMenu(Object iContext)
Returns the menu model defining the tree contextual menu (may be null).
public CATMenuNotification getMenuNotification()
Returns the menu notification.
public int getMinRows()
Returns the minimum visible rows.
public int getMinWidth()
Returns the minimum width (in characters).
public String getModelURL()
Returns the tree model URL (if any).
public boolean getMultipleSelection()
Determines whether multiple selection is enabled or not.
public boolean getScrollable()
Determines whether the scroll is enabled or not.
public String getSelectedKey()
Returns the selected tree node key (may be null).
public String[] getSelectedKeyPath()
Returns the selected tree node key (may be null).
public String[][] getSelectedKeyPaths()
Returns the selected tree nodes keys (may be null).
public String[] getSelectedKeys()
Returns the selected tree nodes keys (may be null).
public CATNotification getSelectionNotification()
Returns the selection notification.
public boolean hasMenu()
Determines whether this tree has a contextual menu.
public boolean isKeyExpanded(String iKey)
Determines whether a tree node is expanded.
public boolean isKeyPathExpanded(String[] iKeyPath)
Determines whether a tree node is expanded.
public boolean isKeyPathSelected(String[] iKeyPath)
Determines whether a tree node is selected or not.
public boolean isKeySelected(String iKey)
Determines whether a tree node is selected or not.
public void selectKey(String iKey)
Selects a tree node.
public void selectKeyPath(String[] iKeyPath)
Selects a tree node.
public void setDisplayRoot(boolean iDisplay)
Sets whether or not the root node is displayed.
public void setKeyModel(CATKeyTreeModel iModel)
Sets the key tree model.
public void setKeyPathModel(CATKeyPathTreeModel iModel)
Sets the key-path tree model.
public void setMinRows(int iMinRows)
Set the minimum visible rows.
public void setMinWidth(int iMinWidth)
Set the minimum width (in characters) of the tree.
public void setModelURL(String iModelURL)
Sets the tree model URL.
public void setMultipleSelection(boolean iMultiple)
Enables/disables multipe selection.
public void setScrollable(boolean iScollable)
Enables/disables the tree scroll.
public void setSelectedKeyPaths(String[][] iKeyPaths)
Selects a bunch of tree nodes (a null value unselects all nodes).
public void setSelectedKeys(String[] iKeys)
Selects a bunch of tree nodes (a null value unselects all nodes).
public void unselectAll()
Unselects all tree nodes.
public void unselectKey(String iKey)
Unselects a tree node.
public void unselectKeyPath(String[] iKeyPath)
Unselects a tree node.


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

collapseKey

    public 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

collapseKeyPath

    public 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

expandKey

    public 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

expandKeyPath

    public 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

getCommandNotification

    public CATTreeCommandNotification getCommandNotification()

Returns the menu notification.

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

Return:
The menu notification.

getDisplayRoot

    public boolean getDisplayRoot()

Returns whether or not the root node is displayed.

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

getExpandNotification

    public 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.

Return:
The expand notification.

getKeyModel

    public CATKeyTreeModel getKeyModel()

Returns the key tree model (may be null).

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

getKeyPathModel

    public CATKeyPathTreeModel getKeyPathModel()

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

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

getMenu

    public 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

    public CATMenuNotification getMenuNotification()

Returns the menu notification.

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

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

getMinRows

    public int getMinRows()

Returns the minimum visible rows.

Return:
The minimum number of rows this tree shows.

getMinWidth

    public int getMinWidth()

Returns the minimum width (in characters).

Return:
The minimum width of this tree.

getModelURL

    public String getModelURL()

Returns the tree model URL (if any).

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

getMultipleSelection

    public boolean getMultipleSelection()

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

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

getScrollable

    public boolean getScrollable()

Determines whether the scroll is enabled or not.

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

getSelectedKey

    public 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.

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

getSelectedKeyPath

    public 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.

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

getSelectedKeyPaths

    public 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.

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

getSelectedKeys

    public 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.

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

getSelectionNotification

    public CATNotification getSelectionNotification()

Returns the selection notification.

This notification is sent when the tree selection changes.

Return:
The selection notification.

hasMenu

    public boolean hasMenu()

Determines whether this tree has a contextual menu.

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

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

isKeyExpanded

    public 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.
Return:
true if the node is expanded; false otherwise.
See Also:
CATKeyTreeModel

isKeyPathExpanded

    public 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.
Return:
true if the node is expanded; false otherwise.
See Also:
CATKeyPathTreeModel

isKeyPathSelected

    public 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.
Return:
true if the node is selected; false otherwise.
See Also:
CATKeyPathTreeModel

isKeySelected

    public 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.
Return:
true if the node is selected; false otherwise.
See Also:
CATKeyTreeModel

selectKey

    public 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

selectKeyPath

    public 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

setDisplayRoot

    public 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.

setKeyModel

    public void setKeyModel(CATKeyTreeModel iModel)

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

Parameters:
iModel
The key tree model.

setKeyPathModel

    public void setKeyPathModel(CATKeyPathTreeModel iModel)

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

Parameters:
iModel
The key-path tree model.

setMinRows

    public 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.

setMinWidth

    public 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.

setModelURL

    public 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.

setMultipleSelection

    public void setMultipleSelection(boolean iMultiple)

Enables/disables multipe selection. Default is disabled.

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

setScrollable

    public 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.

setSelectedKeyPaths

    public 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

setSelectedKeys

    public 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

unselectAll

    public void unselectAll()

Unselects all tree nodes.

Runs both for single and multiple selection.


unselectKey

    public 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

unselectKeyPath

    public 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


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