| Graphic Components > Tree Component > Tree Component Services > Interacting with the Tree Nodes |
Interacting with the Tree Nodes |
INDEX
PREVIOUS
NEXT
|
The section Interacting with the Tree View describes how to set an interactor for the entire tree view. You can also associate behavior with business objects (for a class or for individual objects), as well as with individual IlpTreeNode instances. To do so, you use object interactors, which provide the same options as the view interactor, that is:
The object interactor handles any events occurring on the object with which the interactor is associated, provided the view interactor has enabled the use of object interactors. You can check this by means of the isUsingObjectInteractor method or modify it with the setUsingObjectInteractor method. Object interactors are enabled by default.
No default interactor is associated with any object. To associate actions with mouse or keyboard events or to define a pop-up menu factory, you first have to create an IlpObjectInteractor. You may use the IlpDefaultObjectInteractor, extend it, or create your own implementation.
You can associate an object interactor with a representation object by using either CSS or the API. The following CSS extract shows how to proceed:
Tree {
interactor: true;
}
object."ilog.tgo.model.IltNetworkElement" {
interactor: @+objInteractor;
}
Subobject#objInteractor {
class: 'ilog.cpl.interactor.IlpDefaultObjectInteractor';
}
The same configuration can be achieved through the API, as follows:
IlpTree tree = // ... IlpTreeController treeController = tree.getController(); // Create an object interactor IlpObjectInteractor objectInteractor = new IlpDefaultObjectInteractor(); // Associate the object interactor with a given representation object IlpTreeNode treeNode = // ... treeController.setObjectInteractor( treeNode, objectInteractor); // Configuring the specific object interactor is similar to configuring // a view interactor. objectInteractor.setGestureAction(IlpGesture.BUTTON3_CLICKED, new MyAction());
Actions related to mouse and keyboard events can be customized in the same way as for the view interactor. A pop-up menu factory can also be defined in the same way as for the view interactor. Please refer to Interacting with the Tree View.
Please refer to Interacting with the Graphic Components for a detailed description of interactors and gestures.
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |