| Graphic Components > Equipment Component > Configuring the Equipment Component > Configuring an Equipment Component through the API |
Configuring an Equipment Component through the API |
INDEX
PREVIOUS
NEXT
|
This section shows you how to configure an equipment component by coding. Architecture of the Equipment Component later in this section goes into the details of the classes involved in the architecture of the equipment component.
The following example shows how to configure the equipment view through the API. See Equipment Component Services for programming details on the individual services.
// Instantiates equipment component IlpEquipment equipment = new IlpEquipment(); // Sets Toolbar visible equipment.setToolBarVisible(true); // Set overview window visible equipment.setOverviewVisible(true); // Set default view interactor IlpSelectInteractor select = new IlpSelectInteractor(); select.setEditingAllowed(true); equipment.setViewInteractor(select); // Set zoom policy to mixed IltMixedZoomPolicy mixed = new IltMixedZoomPolicy(); mixed.setZoomThreshold(2.0); equipment.setZoomPolicy(mixed); // Sets Horizontal Scroll Bar invisible equipment.setHorizontalScrollBarVisible(false);
The following example shows how to configure the equipment adapter through the API. See Equipment Component Services for programming details on the individual services.
IlpEquipmentAdapter adapter = equipment.getAdapter(); // Filter IlpFilter myFilter = new MyFilter(); // (it is the same as equipment.setFilter(myFilter);) adapter.setFilter(myFilter); // Origin List myOrigins = new ArrayList(); myOrigins.add(objectID_1); myOrigins.add(objectID_2); : : myOrigins.add(objectID_n); // in this case we want to display the origins boolean showOrigin = true; adapter.setOrigins(myOrigins, showOrigin); // Expansion Strategy Factory // Usually the expansion strategy factory relies // on the adapter to access the data source and // to load/release objects IlpExpansionStrategyFactory myExpFactory = new MyExpansionStrategyFactory(adapter); adapter.setExpansionStrategyFactory(myExpFactory); // Position Attribute // Here, imagine that MyObject implements IlpObject // interface and defines "Placement" as the // IlpAttribute that defines the object position IlpClass myObjectClass = MyObject.getIlpClass(); IlpAttribute myPosAttrib = MyObject.Placement; adapter.setPositionAttribute(myObjectClass, myPosAttrib); // Node Factory IlpEquipmentNodeFactory myNodeFactory = new MyNodeFactory(); adapter.setNodeFactory(myNodeFactory);
| Copyright © 1987-2007 ILOG S.A. All rights reserved. Documentation homepage. All rights reserved. Legal terms. | PREVIOUS NEXT |