Viewer Class

 

Package com.tssap.util.ui.viewer.tree

 

GenericDataModelFilteredTreeViewer

 

This class implements methods that are used to make the basic functions of a model viewer available.

 

Factory Methods

 

GenericDataModelFilteredTreeViewer createFilteredTreeViewer(Composite parent, PropertyMap[] roots, IFilter filter)

Creates a new model viewer for a specified parent control and assigns it the roots objects as root nodes and also assigns a filter.

 

GenericDataModelFilteredTreeViewer createFilteredTreeViewer(

                                        Composite parent, IFilter filter)

Creates a new model viewer for a specified parent control and assigns it to the filter. The created viewer uses a default assignment for the roots such that the existing models are assigned to the viewer as root nodes.

 

GenericDataModelFilteredTreeViewer createFilteredTreeViewer(

                                                      Composite parent)

Creates a new model viewer for a specified parent control. The created viewer has a default filter and a standard assignment of the roots. The default filter lets all existing nodes through. Additionally, all models are assigned to the viewer as root nodes.

 

GenericDataModelTreeViewer createTreeViewer(Composite parent, PropertyMap[] roots)

Creates a new model viewer without a filter for a specified parent control and assigns it the roots objects as root nodes.

 

GenericDataModelTreeViewer createTreeViewer(Composite parent)

Creates a new model viewer without a filter for a specified parent control. The created viewer uses a standard assignment for the roots and the existing models are assigned to the viewer as root nodes.

 

Root Methods

 

void setRoots(PropertyMap[] roots)

Assigns all roots objects to the model viewer as root nodes. Any root nodes already assigned are removed.

 

PropertyMap[] getRoots()

Returns the set of all objects that are assigned to the model viewer as root nodes.

 

void addRoot(PropertyMap root)

Adds the root object as an additional root node of the model viewer.

 

void removeRoot(PropertyMap root)

Removes the root object as root node of the model viewer.

 

Context Menu Methods

 

void setContextMenu(IContextMenu contextMenu)

Sets the contextMenu for the model viewer. If a context menu assignment already exists, it is removed.

 

IContextMenu getContextMenu()

Returns the context menu that is currently linked with the model.

 

Filter Methods

 

void setFilter(IFilter filter)

Sets the filter for the model viewer. The existing filter assignment is dissolved.

 

IFilter getFilter()

Returns the filter that is currently linked with the model.

 

References and Reference Collections

 

void setDissolveReferences(boolean dissolveReferences)

Defines whether all existing references should be dissolved.

If the dissolveReferences parameter has the value true, references are to be dissolved. As a result, all references, reference collection nodes, and referenced elements are displayed in the tree display.

However, if the dissolveReferences parameter has the value false, no references are to be dissolved. As a result, all references, reference collection nodes, and referenced elements are removed from the tree display.

 

boolean isDissolveReferences()

Specifies whether the references in the tree of a model viewer are to be dissolved (return value true) or not (return value false).

 

 

Skip Methods

 

void setSkipReferences(boolean skipReferences)

Hides all reference nodes in the model viewer if the skipReferences parameter has the value true. Instead of the references, the system displays the referenced elements in the tree.

 

void setSkipReferenceCollections(Boolean skipReferenceCollections)

Hides all reference collection nodes in the model viewer if the skipReferenceCollections parameter has the value true. Instead of the reference collection nodes, the system now displays all subordinate reference nodes.

 

boolean isSkipReferences()

Specifies whether the reference nodes in the tree are hidden (return value true) or not (return value false).

 

boolean isSkipReferenceCollections()

Specifies whether the reference collection nodes in the tree are hidden (return value true) or not (return value false).

 

 

Refresh

 

void refresh()

Updates the contents of the model viewer.

 

 

Tree and TreeViewer

 

TreeViewer getTreeViewer()

Returns the JFace tree viewer of the model viewer.

 

Tree getTree()

Returns the SWT tree control for the model viewer.

This method enables direct access to every TreeItem of the SWT tree control. You can also use the tree instance to add new SWT tree listeners.

Example:

The getTree() method is used to access the selected TreeItem of the SWT tree control directly. To ascertain the items selected in the model viewer, you only need to call the getSelection() method for the tree instance:

TreeItem[] selectedItems = modelViewer.getTree().getSelection();

 

 

Additional Methods

 

void setOptimisticChildrenCheck(boolean optimisticChildrenCheck)

Has the effect (for the value optimisticChildrenCheck = true) that for the whole tree, no check is executed to ascertain whether any node has subnodes. You can use these methods to optimize performance, if necessary.

 

boolean isOptimisticChildrenCheck()

Specifies whether the check for the existence of subnodes is activated (return value true) or not (return value false).