Package com.dassault_systemes.catjdialog |
|
Interface CATKeyTreeModel
|
com.dassault_systemes.catjdialog.CATKeyTreeModel
Framework : CATJDialog
Module : CATJDialog
public interface CATKeyTreeModel
The key tree model is an interface used to feed a tree component with content.
Data Model: a JDialog pattern
When using a tree or a table component, the application has to provide
a data model object, that is in charge of feeding the
component with presentation data.
This design allows JDialog to request presentation data only when rendering
the tree or table component to the Graphical User Interface (GUI), and to forget it
right after that.
The Key: a common language between JDialog and the application
The key tree model identifies tree nodes with a key (that is a
string identifier).
At render time, the model is asked for presentation data and keys.
When an event occurs on the GUI, the source tree node(s) is (are)
identified with its (their) key(s).
Example: a Tree with a CATKeyTreeModel and a controller listening to node selection notifications
- At render time, the key tree model is asked for each node:
- its key (a string that identifies the application data represented by this node),
- the node label
- the node icon
- the node type: node (has children) or leaf (no child)
- its children nodes keys (if any)
- Later on, the user selects a tree node:
- the application receives a 'selection' notification from the Tree component, with the key identifying the source node.
How to choose the key?
Basically, the key should contain enough information for the application
to identify clearly the related data.
CATTree methods related to the key tree model
- setKeyModel(), getKeyModel()
- collapseKey(), expandKey(), isKeyExpanded()
- selectKey(), unselectKey(), isKeySelected()
- setSelectedKeys(), getSelectedKeys()
See the CAA technical article "Writing Stateless Controllers" for
a stateless design sample.
- See Also:
- com.dassault_systemes.catjdialog.CATTree
getRootKey
String getRootKey()
Returns the tree root node key.
- Returns:
The root node key.
getNodeInfo
CATTreeNodeInfo getNodeInfo(String iKey, boolean iGetChildren)
Returns node info (label, icon ...)
- Parameters:
iKey
- A node key.
iGetChildren
- If
true
, the model is expected to return children keys (this is only required for expandable and expanded nodes).
- Returns:
CATTreeNodeInfo An object that contains node information (type, label, icon, children, ...).
Copyright © 2000, Dassault Systèmes. All rights reserved