Release Notes > JTGO 4.0 Release Notes > New Features > CSS Configuration |
CSS Configuration |
PREVIOUS NEXT |
It is now possible to customize view and object interactors through a CSS file, along with the graphic component configuration. Each graphic component has its own set of customizable properties. Refer to the Graphic Components User's Documentation for detailed information.
The interactor customization can be enabled or disabled through the interactor selector within the graphic component configuration. For example:
Tree { interactor: true; }
When the interactor selector is enabled, you can create a specific selector where you declare your view interactor configuration, as follows:
Interactor { viewInteractor: @+viewInt; }
The following tables provide a short description of the interactor-related properties of each graphic component.
Note |
When customizing the view interactor, you should use either the name or the view interactor instance. The equipment component has the same configuration as the network component. |
Property |
Description |
---|---|
viewInteractor |
Defines the view interactor. This property accepts a bean that implements IlpViewInteractor. |
View interactors, as well as pop-up menu factories and actions, are customized as beans. You can either create your own specific view interactor class and use it in the CSS file, or use one of the JTGO classes that support this feature.
To create view interactors, JTGO provides the following classes that can be directly used in the graphic components:
The following example illustrates the use of these properties:
#viewInt { class: 'ilog.cpl.table.interactor.IlpDefaultTableViewInteractor'; popupMenuFactory: @=viewPopupMenuFactory; action[0]: @=viewAction0; }
To create pop-up menus, JTGO provides the class IlpDefaultPopupMenuFactory
.
Property |
Description |
---|---|
menuItem |
Indexed property that defines the items that will be present in the pop-up menu.This property accepts a bean that is an instance of JMenuItem. |
The following example illustrates the use of this bean to create pop-up menus:
#viewPopupMenuFactory { class: 'ilog.cpl.interactor.IlpDefaultPopupMenuFactory'; menuItem[0]: @+viewItem1; } #viewItem1 { class: 'javax.swing.JMenuItem'; label: "Item 0"; action: @+viewItemAction1; }
The default table header menu factory, ilog.cpl.table.IlpDefaultTableHeaderMenuFactory
has the following CSS property:
The following example illustrates the use of this bean to configure the table header menu:
Table { interactor: true; } Interactor { headerInteractor: @=headerInt; } #headerInt { class: 'ilog.cpl.table.interactor.IlpDefaultTableHeaderInteractor'; popupMenuFactory: @=headerPopupMenuFactory; } #headerPopupMenuFactory { class: 'ilog.cpl.table.IlpDefaultTableHeaderMenuFactory'; sortAttributes: true; }
To customize gesture or keystroke actions, you can create beans that are instances of the classes IlpGestureAction
or IlpKeyStrokeAction
. Using these classes, you specify the events and the underlying action that will be performed once these events are recognized by the interactor.
The following example illustrates how you can define a gesture action and a keystroke action in a view interactor:
#viewInt { class: 'ilog.cpl.table.interactor.IlpDefaultTableViewInteractor'; action[0]: @=viewAction0; action[1]: @=viewAction1; } #viewAction0 { class: 'ilog.cpl.interactor.IlpGestureAction'; gesture: BUTTON1_DOUBLE_CLICKED; action: @=showDetailsAction; } #showDetailsAction { class: 'ShowDetailsAction'; } #viewAction1 { class: 'ilog.cpl.interactor.IlpKeyStrokeAction'; keyStroke: 'typed a'; action: @=printDetailsAction; }
Besides the view interactor, you can also customize object interactors through CSS. Their configuration can also be accomplished by the use of beans. The principle is the same as for other object properties: You declare an object selector and define the value of the property interactor
, as illustrated in the following example:
object."ilog.tgo.model.IltObject" { interactor: @+objInter; } #objInter { class: 'ilog.cpl.interactor.IlpDefaultObjectInteractor; popupMenuFactory: @+objPopupMenuFactory; action[0]: @+objAction0; } #objPopupMenuFactory { class: 'ilog.cpl.interactor.IlpDefaultPopupMenuFactory'; } #objAction0 { class: 'ilog.cpl.interactor.IlpGestureAction'; gesture: BUTTON1_DOUBLE_CLICKED; action: @+showDetailsAction; }
In the network, equipment and table components, you can define interactors to specific decorations or table cells. To customize these interactors, you must specify the object and the attribute to be attached to the interactor. The following example illustrates this feature:
object."ilog.tgo.model.IltObject/name" { interactor: @+objNameInteractor; } #objNameInteractor { class: 'ilog.cpl.interactor.IlpDefaultObjectInteractor'; }
Note |
To use object interactors, you must customize your view interactor accordingly by setting the property usingObjectInteractor to true .
|
Copyright © Rogue Wave Software, Inc. 1997, 2015. All rights reserved. Legal terms. | PREVIOUS NEXT |