ilog.cpl.tree
Class IlpContainmentTreeAdapter

java.lang.Object
  extended by ilog.cpl.datasource.IlpAbstractAdapter
      extended by ilog.cpl.datasource.IlpAbstractHierarchyAdapter
          extended by ilog.cpl.tree.IlpAbstractTreeAdapter
              extended by ilog.cpl.tree.IlpContainmentTreeAdapter
All Implemented Interfaces:
IlpStylable, DataSourceListener, IlpStylableAdapter, IlpRepresentationObjectMapper, IlvStylable, EventListener

public class IlpContainmentTreeAdapter
extends IlpAbstractTreeAdapter

This class adapts a data source to a containment tree.

This adapter gets IlpObjects from a data source and creates corresponding tree nodes in a tree model.

This class is stylable using cascading style sheets. The CSS customization is done using files that are loaded in method IlpAbstractTreeAdapter.setStyleSheets(java.lang.String[]).

The following extract illustrates the adapter customization of the tree component:

 Tree {
   adapter: true;
 }
 
 Adapter {
   origins[0]: id0;
   origins[1]: id1;
   showOrigin: true;
   filter: @+myFilter;
   ...
 }
 
 Subobject#myFilter {
   class: ...;
 }
 

Please refer to the properties defined by this adapter class for information about how each property can be customized using cascading style sheets.

Since:
JTGO 3.0

Field Summary
static int FILTER_BREADTH_FIRST_THRESHOLD
          This parameter is used by the tree adapter to identify the algorithm that should be used when refiltering objects.
 
Fields inherited from class ilog.cpl.tree.IlpAbstractTreeAdapter
ARBITRARY_COMPARATOR
 
Fields inherited from interface ilog.cpl.css.IlpStylable
UPDATE_ALL_MASK, UPDATE_COMPONENT_MASK, UPDATE_NONE_MASK, UPDATE_OBJECTS_MASK
 
Fields inherited from interface ilog.views.util.styling.IlvStylable
APPLIED_RULE_MASK, BAD_CLASS_MASK, BAD_PROP_MASK, BAD_PROP_WITH_STACK_MASK, CREATED_MASK, DECL_MASK, DECL_VALUE_MASK, FAILED_CONVERSIONS_MASK, TIME_REPORT_MASK, WARNING_PROP_MASK
 
Constructor Summary
IlpContainmentTreeAdapter()
          Constructor.
IlpContainmentTreeAdapter(IlpContext context)
          Constructor with a given context.
 
Method Summary
protected  void clearRepresentationObjects()
          Called when all representation objects should be cleared.
protected  IlpTreeNode createNode(IlpObject ilpObject)
          This method creates a tree node and registers it in the adapter structures.
protected  IlpRepresentationObject createRepresentationObject(IlpObject ilpObject)
          Creates a representation object and registers it in the adapter structure.
protected  void customizeAllObjects()
          Apply CSS configuration to all objects.
protected  void fillModel()
          Fill the model with the representation objects.
 void loadChildren(IlpRepresentationObject representation)
          Loads the child objects of the given object, if they are not yet present in the representation model.
 void objectAttributeChanged(DataSourceObjectEvent e)
          Called when an object attribute has changed.
 void objectsAdded(DataSourceEvent e)
          Called when objects have been added to the data source.
 void objectsRemoved(DataSourceEvent e)
          Called when objects have been removed from the data source.
 void objectStructureChanged(DataSourceObjectEvent e)
          Called when an object structure has changed.
protected  void refilterObjects()
          Reapplies the filter to the objects that exist in the attached data source.
 void releaseChildren(IlpRepresentationObject representation)
          Signals that the model and the attached views do not need the child objects of the given object anymore.
 
Methods inherited from class ilog.cpl.tree.IlpAbstractTreeAdapter
addPropertyChangeListener, customizeObject, doApplyConfiguration, getComparator, getCSSDelegate, getDefaultExpansionType, getExpansionType, getModel, getMutableStyleSheet, getRootInsertionNode, getStyleSheetDebugMask, getStyleSheets, getStyleSheets, getTreeNode, getTreeNode, getTreeNodeFactory, hasConfigurationChanged, hasExpansionTypeChanged, hasModel, hasStyleSheets, removePropertyChangeListener, removeRepresentation, setComparator, setModel, setStyleSheetDebugMask, setStyleSheets, setStyleSheets, setStyleSheets, setStyleSheets, setTreeNodeFactory, sort
 
Methods inherited from class ilog.cpl.datasource.IlpAbstractHierarchyAdapter
createExpansionStrategy, getAcceptedClasses, getExpansionStrategyFactory, getOrigins, getPossibleRoots, getRoots, initializeAcceptedClasses, isEmptyOrigins, isOrigin, isShowingOrigin, replaceAcceptedClasses, resetOrigins, setAcceptedClasses, setExpansionStrategyFactory, setExpansionType, setOrigins, testObject, testRootObject
 
Methods inherited from class ilog.cpl.datasource.IlpAbstractAdapter
addAdapterListener, addPropertyChangeListener, addRepresentation, applyConfiguration, batchEnded, batchStarted, beginRepresentation, clearIdToRepresentationObjectMap, endBatch, firePropertyChange, fireRepresentationObjectsAdded, fireRepresentationObjectsRemoved, getContext, getDataSource, getExcludedClasses, getFilter, getRepresentationObject, getRepresentationObject, getRepresentationObjects, getSyncStrategy, hasRepresentationObject, hasRepresentationObjects, initializeExcludedClasses, initializeRepresentationObjects, isRepresenting, refilter, removeAdapterListener, removePropertyChangeListener, replaceExcludedClasses, setBatchable, setDataSource, setExcludedClasses, setFilter, startBatch, stopRepresentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTER_BREADTH_FIRST_THRESHOLD

public static int FILTER_BREADTH_FIRST_THRESHOLD
This parameter is used by the tree adapter to identify the algorithm that should be used when refiltering objects.

If the threshold is set to -1, breadth-first is always applied, no matter the number of objects that are present in the data source.

If the number of objects in the data source is below the given threshold, the refiltering is applied through a breadth-first algorithm. If the number of objects is above the given threshold, the refiltering is applied by removing and recreating the objects.

Since:
JTGO 4.0
See Also:
refilterObjects()
Constructor Detail

IlpContainmentTreeAdapter

public IlpContainmentTreeAdapter()
Constructor. This constructor initializes the representation object factory with an IlpDefaultTreeNodeFactory instance.

See Also:
IlpDefaultTreeNodeFactory

IlpContainmentTreeAdapter

public IlpContainmentTreeAdapter(IlpContext context)
Constructor with a given context.

Parameters:
context - The context. This constructor initializes the representation object factory with an IlpDefaultTreeNodeFactory instance.
See Also:
IlpDefaultTreeNodeFactory
Method Detail

customizeAllObjects

protected void customizeAllObjects()
Apply CSS configuration to all objects. This method should be called whenever a new style sheet is applied.

The method will check for changes in the expansion type of each object represented by this adapter. In case of change, the object will be removed and recreated.

Overrides:
customizeAllObjects in class IlpAbstractHierarchyAdapter
Since:
JTGO 4.0
Internal method or field: do not use!

clearRepresentationObjects

protected void clearRepresentationObjects()
Called when all representation objects should be cleared.

Specified by:
clearRepresentationObjects in class IlpAbstractAdapter

fillModel

protected void fillModel()
Fill the model with the representation objects. This method is called only when there is a model.

Specified by:
fillModel in class IlpAbstractAdapter
Internal method or field: do not use!

refilterObjects

protected void refilterObjects()
Reapplies the filter to the objects that exist in the attached data source.

The default implementation performs a breadth-first search on the tree nodes. It tests each node that is currently displayed against the new filter criteria. The worst case performance of the algorithm is o(n), where n is the number of objects in the data source.

If the number of objects present in the attached data source is large, the performance of this algorithm may not be good. In this case, instead of performing a systematic breadth-first search, you can configure the threshold of the breadth-first algorithm.

Overrides:
refilterObjects in class IlpAbstractAdapter
Since:
JTGO 4.0

createNode

protected IlpTreeNode createNode(IlpObject ilpObject)
This method creates a tree node and registers it in the adapter structures.

The tree node is created by the registered tree node factory.

See Also:
IlpAbstractTreeAdapter.getTreeNodeFactory()
Internal method or field: do not use!

createRepresentationObject

protected IlpRepresentationObject createRepresentationObject(IlpObject ilpObject)
Creates a representation object and registers it in the adapter structure.

Specified by:
createRepresentationObject in class IlpAbstractAdapter
Internal method or field: do not use!

loadChildren

public void loadChildren(IlpRepresentationObject representation)
Loads the child objects of the given object, if they are not yet present in the representation model.

This implementation executes the following steps:

Specified by:
loadChildren in class IlpAbstractHierarchyAdapter
Since:
JTGO 4.0
See Also:
IlpExpansionStrategy

releaseChildren

public void releaseChildren(IlpRepresentationObject representation)
Signals that the model and the attached views do not need the child objects of the given object anymore. The child objects can be removed (but need not be) from the working memory.

This implementation executes the following steps:

Specified by:
releaseChildren in class IlpAbstractHierarchyAdapter
Since:
JTGO 4.0
See Also:
IlpExpansionStrategy

objectsAdded

public void objectsAdded(DataSourceEvent e)
Called when objects have been added to the data source.


objectsRemoved

public void objectsRemoved(DataSourceEvent e)
Called when objects have been removed from the data source.


objectStructureChanged

public void objectStructureChanged(DataSourceObjectEvent e)
Called when an object structure has changed.

Parameters:
e - The event containing data on the change.

objectAttributeChanged

public void objectAttributeChanged(DataSourceObjectEvent e)
Called when an object attribute has changed.

Parameters:
e - The event containing data on the change.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.