<?xml version="1.0"?> <tgo xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation = "ilog/cpl/schema/project.xsd" style="configurationFile1.css,configurationFile2.css"> <datasource javaClass="ilog.tgo.datasource.IltDefaultDataSource" fileName="tree.xml"/> </tgo>
IlpTree.setStyleSheets
as follows:
treeComponent = new IlpTree(); try { treeComponent.setStyleSheets(new String[] { myConfigurationFile1,myConfigurationFile2 }); } catch (Exception e) { }
<installdir>
is the directory where you have installed JViews TGO.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Tree Component configuration // Type: Tree // The following list shows all possible properties for // the tree component. // - view : enables the tree view configuration // - interactor: enables the interactor configuration // - adapter: enables the adapter configuration // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tree { view: true; adapter: true; } View { background: #FFFFDF; selectionLookAndFeel: Highlight; }
adapter
is not taken into account unless
adapter: true
is declared in the Tree rule.
CSS
Property |
Type
of Value |
Default
|
Usage
|
---|---|---|---|
view
|
boolean
|
false
|
Enables
the customization of the tree view. |
interactor
|
boolean
|
false
|
Enables
the customization of the tree interactors. |
adapter
|
boolean
|
false
|
Enables
the customization of the tree adapter. |
CSS
Property |
Type
of Value |
Default
|
Usage
|
---|---|---|---|
background
|
Color
|
null
|
Color to be used in the background of the tree view. If the
value is
null
, the color of the active look-and-feel is used.
|
cellRenderer
|
TreeCellRenderer
|
IlpTreeCellRenderer
|
Renders
the tree nodes. |
scrollsOnExpand
|
boolean
|
true
|
When a node is expanded, this property determines whether or
not the node scrolls up, so that the maximum number of
descendants are visible. The default is
true
.
|
selectionLookAndFeel
|
int
|
HIGHLIGHT
|
Sets the way the selection is rendered to/manipulated by the
end-user. Two possible values:
HIGHLIGHT
or
CHECKBOX
|
toggleClickCount
|
int
|
2
|
Number
of mouse clicks before a node expands or collapses. The
default is 2. |
rootVisible
|
boolean
|
false
|
Defines
whether the root nodes in the tree are visible or not. |
showsRootHandles
|
boolean
|
true
|
Defines
whether the handles that enable nodes to be expanded by the
user are visible or not. |
rowHeight
|
int
|
-1
|
Defines
the row height. If the value is -1, the row height depends on
the tree node rendering. If the value is greater than 0, the
tree node height corresponds to the value defined by the
user. |
expandsSelectedPaths
|
boolean
|
true
|
Defines whether the parent path of the selected node is
expanded or not. If
true
, all the parents of the selected node are expanded, although
they may not all be visible in the
JTree
. If
false
, the parent nodes are not expanded and thus not made visible
in the
JTree
.
|
Property
Name |
Property
Type |
---|---|
viewInteractor
|
ilog.cpl.interactor.IlpViewInteractor
|
Tree { interactor: true; }
Interactor { viewInteractor: @+viewInt; } Subobject#viewInt { class: 'ilog.cpl.interactor.IlpDefaultViewInteractor;' popupMenuFactory: @+viewPopupMenuFactory; action[0]: @+viewAction0; } Subobject#viewPopupMenuFactory { class: 'AlarmPopupMenuFactory'; } Subobject#viewAction0 { class: 'ilog.cpl.interactor.IlpGestureAction'; gesture: BUTTON2_CLICKED; action: @=showDetailsAction; }
interactor
. For more information, refer to IlpInteractorRenderer.
Property
Name |
Property
Type |
---|---|
filter
|
ilog.cpl.util.IlpFilter
|
origins
|
list
of object identifiers |
comparator
|
java.util.Comparator
|
nodeFactory
|
ilog.cpl.tree.IlpTreeNodeFactory
|
expansionStrategyFactory
|
ilog.cpl.util.IlpExpansionStrategy
Factory
|
acceptedClasses
|
list of IlpClass
|
excludedClasses
|
list of IlpClass
|
objectAttributeChangedFilter
|
ilog.cpl.util.IlpFilter
|
Tree { adapter: true; }
Adapter { filter: @+treeFilter; comparator: @+treeComparator; expansionStrategyFactory: @+treeExpStrategyFactory; nodeFactory: @+treeNodeFactory; objectAttributeChangedfilter: @+eventFilter; origins[0]: ROOT1; origins[1]: ROOT2; } Subobject#treeFilter { class: MyTreeFilter; } Subobject#treeComparator { class: MyTreeComparator; } Subobject#treeExpStrategyFactory { class: MyTreeExpansionStrategyFactory; } Subobject#treeNodeFactory { class: MyTreeNodeFactory; adapter: @adapter; } Subobject#eventFilter { class: MyTreeEventFilter; }
getMutableStyleSheet()
method in the tree adapter API:
IlpMutableStyleSheet mutable = adapter.getMutableStyleSheet();
setStyleSheet()
API:
IlpMutableStyleSheet mutable = new IlpMutableStyleSheet(adapter); try { adapter.setStyleSheets(new String[] { mutable.toString() }); } catch (Exception x) { x.printStackTrace(); }
mutable.setDeclaration("#myObjectId", "expansion", "NO_EXPANSION");
#myObjectId { expansion: NO_EXPANSION; }
setStyleSheet()
method:
try { adapter.setStyleSheets(new String[] { mutable.toString() }); } catch (Exception x) { x.printStackTrace(); }
// Update the expansion type for 'myObjectId' mutable.setDeclaration("#myObjectId", "expansion", "IN_PLACE"); // Add a new declaration mutable.setDeclaration("#myOtherId", "expansion", "IN_PLACE");
setStyleSheet()
API is invoked and a new set of style sheets is applied to
the adapter.
Adapter { origins[0]: id0; origins[1]: id1; showOrigin: true; filter: @+myFilter; }
#myObjectId { expansion: IN_PLACE; }
setUpdateMask()
are:
IlpStylable.UPDATE_COMPONENT_MASK
: Only the adapter part is recustomized.
IlpStylable.UPDATE_OBJECTS_MASK
: Only the representation object part is recustomized.
IlpStylable.UPDATE_ALL_MASK
: Bot the adapter and representation object parts are
recustomized.
IlpStylable.UPDATE_NONE_MASK
: Nothing is recustomized.
UPDATE_OBJECTS_MASK
as there is no need to reapply the CSS configuration for the
adapter part:
mutable.setUpdateMask(IlpStylable.UPDATE_OBJECTS_MASK); mutable.setDeclaration("object", "expansion", "IN_PLACE");
true
, the mutable style sheet puts all the calls to
setDeclaration()
into a queue. When the method is set back to
false
, all the queued declarations are processed in a batch:
mutable.setAdjusting(true); mutable.setDeclaration("#myObjectId", "expansion", "IN_PLACE"); mutable.setDeclaration("#myOtherId", "expansion", "IN_PLACE"); mutable.setAdjusting(false);