ilog.cpl.tree
Class IlpAbstractTreeAdapter

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

public abstract class IlpAbstractTreeAdapter
extends IlpAbstractHierarchyAdapter
implements IlpStylableAdapter

This class supports the adaptation of a data source in a tree.

This class is stylable using cascading style sheets. The CSS customization is done using files that are loaded in method 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 Comparator ARBITRARY_COMPARATOR
          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
protected IlpAbstractTreeAdapter()
          Constructor.
protected IlpAbstractTreeAdapter(IlpContext context)
          Constructor with a given context.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a listener on property modification.
protected  void customizeObject(IlpObject object)
          This method is automatically called by createExpansionStrategy to guarantee that every new object (or updated) is customized before being added to this adapter.
protected  void doApplyConfiguration(Map properties)
          Apply the new configuration to this adapter.
 Comparator getComparator()
          Returns the comparator used to sort the nodes.
protected  ilog.cpl.datasource.css.internal.IlpStylableAdapterSupport getCSSDelegate()
          Returns the context information needed to provide support to cascading style sheets.
protected  IlpExpansionType getDefaultExpansionType(IlpObject ilpObject)
          This internal method returns the default expansion type, which is IlpExpansionType.IN_PLACE.
 IlpExpansionType getExpansionType(IlpObject ilpObject)
          Retrieves the expansion type of a given business object.
 IlpTreeModel getModel()
          Returns the model.
 IlpMutableStyleSheet getMutableStyleSheet()
          Returns a mutable style sheet that can be used to change the adapter configuration dynamically.
 IlpTreeNodeHelper getRootInsertionNode()
          Returns the node under which top level nodes - roots - are inserted.
 int getStyleSheetDebugMask()
          Returns the current debug level.
 String[] getStyleSheets()
          Returns the cascaded style sheets.
 String getStyleSheets(int index)
          Returns one of the cascading style sheets.
 IlpTreeNode getTreeNode(IlpObject ilpObject)
          Returns the tree node representing ilpObject.
 IlpTreeNode getTreeNode(Object identifier)
          Returns the tree node representing identifier.
 IlpTreeNodeFactory getTreeNodeFactory()
          Returns the tree node factory used by this adapter.
protected  boolean hasConfigurationChanged(Map properties)
          Checks if the configuration has changed in comparison with the current configuration.
protected  boolean hasExpansionTypeChanged(IlpObject ilpObject, IlpExpansionType expansion)
          Checks if the expansion configuration has changed in comparison with the current configuration
 boolean hasModel()
          Returns true if the adapter is connected to a model.
 boolean hasStyleSheets()
           
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a listener on property modification.
protected  IlpRepresentationObject removeRepresentation(Object id)
          Removes the representation object that corresponds to the given identifier.
 void setComparator(Comparator comparator)
          Sets the comparator used to sort the nodes.
 void setModel(IlpTreeModel model)
          Sets the model.
 void setStyleSheetDebugMask(int mask)
          Sets the debug level while parsing the style sheets.
 void setStyleSheets(int index, String css)
          Changes one of the cascading style sheets.
 void setStyleSheets(int index, String css, int updateMask)
          Changes one of the cascading style sheets.
 void setStyleSheets(String[] css)
          Sets the cascading style sheets.
 void setStyleSheets(String[] css, int updateMask)
          Sets the cascading style sheets.
 void setTreeNodeFactory(IlpTreeNodeFactory nodeFactory)
          Sets the tree node factory used by this adapter.
 void sort()
          Sorts the model according to the current comparator.
 
Methods inherited from class ilog.cpl.datasource.IlpAbstractHierarchyAdapter
createExpansionStrategy, customizeAllObjects, getAcceptedClasses, getExpansionStrategyFactory, getOrigins, getPossibleRoots, getRoots, initializeAcceptedClasses, isEmptyOrigins, isOrigin, isShowingOrigin, loadChildren, releaseChildren, replaceAcceptedClasses, resetOrigins, setAcceptedClasses, setExpansionStrategyFactory, setExpansionType, setOrigins, testObject, testRootObject
 
Methods inherited from class ilog.cpl.datasource.IlpAbstractAdapter
addAdapterListener, addPropertyChangeListener, addRepresentation, applyConfiguration, batchEnded, batchStarted, beginRepresentation, clearIdToRepresentationObjectMap, clearRepresentationObjects, createRepresentationObject, endBatch, fillModel, firePropertyChange, fireRepresentationObjectsAdded, fireRepresentationObjectsRemoved, getContext, getDataSource, getExcludedClasses, getFilter, getRepresentationObject, getRepresentationObject, getRepresentationObjects, getSyncStrategy, hasRepresentationObject, hasRepresentationObjects, initializeExcludedClasses, initializeRepresentationObjects, isRepresenting, refilter, refilterObjects, 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
 
Methods inherited from interface ilog.cpl.datasource.DataSourceListener
objectAttributeChanged, objectsAdded, objectsRemoved, objectStructureChanged
 

Field Detail

ARBITRARY_COMPARATOR

public static final Comparator ARBITRARY_COMPARATOR
Arbitrary comparator.

This comparator is used by default. It works only with representation objects that contain a business object (IlpObject.

This comparator tests whether two object identifiers are of the same class.

If they are of the same class and this class implements the Comparable interface, it returns the result given by the compareTo method of the Comparable interface.

If the class does not implement the Comparable interface, the hashcodes are compared, thus producing an arbitrary order.

If they are not of the same class, two class names are compared.

Constructor Detail

IlpAbstractTreeAdapter

protected IlpAbstractTreeAdapter()
Constructor.


IlpAbstractTreeAdapter

protected IlpAbstractTreeAdapter(IlpContext context)
Constructor with a given context.

Parameters:
context - The context.
Method Detail

setStyleSheets

public void setStyleSheets(String[] css)
                    throws IlvStylingException
Sets the cascading style sheets.

Each element can be a URL, a filename, or the style sheet string directly. The order is by priority (the last CSS takes precedence).

This method uses the context URL Access Service to convert file names into URLs.

Specified by:
setStyleSheets in interface IlvStylable
Parameters:
css - An array of strings containing the URLs or the file names of CSS files (usually with a .css suffix).
Throws:
IlvStylingException
Since:
JTGO 4.0
See Also:
getStyleSheets()

setStyleSheets

public void setStyleSheets(String[] css,
                           int updateMask)
                    throws IlvStylingException
Sets the cascading style sheets.

Each element can be a URL, a filename, or directly the style sheet string. The order is by priority (the last CSS takes precedence).

Specified by:
setStyleSheets in interface IlpStylable
Parameters:
css - An array of strings containing the URLs, the file names of CSS files (usually with a .css suffix) or CSS extracts directly.
updateMask - Flag that indicates whether the adapter and/or the business objects have to be updated to use this new configuration. When IlpStylable.UPDATE_COMPONENT_MASK is set, the adapter is reconfigured with the new style sheets. When IlpStylable.UPDATE_OBJECTS_MASK is set, the representation objects that are managed by this adapter are reconfigured according to the new style sheets.
Throws:
IlvStylingException
Since:
JTGO 4.0
See Also:
IlpStylable.UPDATE_COMPONENT_MASK, IlpStylable.UPDATE_OBJECTS_MASK, getStyleSheets()

setStyleSheets

public void setStyleSheets(int index,
                           String css)
                    throws IlvStylingException
Changes one of the cascading style sheets.

This method is an alternative to setStyleSheets(java.lang.String[]).

It lets you change one particular style sheet file, instead of setting the whole style sheet array.

This method uses the context URL Access Service to convert file names into URLs.

Specified by:
setStyleSheets in interface IlvStylable
Parameters:
index - The index of the style sheet to replace.
css - The URL, file name of the new style sheet file or CSS extract directly.
Throws:
IlvStylingException
Since:
JTGO 4.0
See Also:
setStyleSheets(java.lang.String[]), getStyleSheets(int)

setStyleSheets

public void setStyleSheets(int index,
                           String css,
                           int updateMask)
                    throws IlvStylingException
Changes one of the cascading style sheets.

This method is an alternative to setStyleSheets(java.lang.String[]). It lets you change one particular style sheet file, instead of setting the whole style sheet array. When this method is used, you can indicate whether you want to reapply this configuration immediately to the adapter and to all the representation objects that are already being managed by it.

Specified by:
setStyleSheets in interface IlpStylable
Parameters:
index - The index of the style sheet to replace.
css - The URL, file name or CSS extract of the new style sheet.
updateMask - Flag that indicates whether the adapter and/or the business objects need to be updated to use this new configuration. When IlpStylable.UPDATE_COMPONENT_MASK is set, the adapter is reconfigured with the new style sheets. When IlpStylable.UPDATE_OBJECTS_MASK is set, the representation objects that are managed by this adapter are reconfigured according to the new style sheets.
Throws:
IlvStylingException.
IlvStylingException
Since:
JTGO 4.0
See Also:
IlpStylable.UPDATE_COMPONENT_MASK, IlpStylable.UPDATE_OBJECTS_MASK, getStyleSheets(int)

getStyleSheets

public String getStyleSheets(int index)
Returns one of the cascading style sheets.

Specified by:
getStyleSheets in interface IlvStylable
Parameters:
index - The position of the cascading style sheet to return.
Returns:
The URL, file name or CSS extract set on this component in the index-th position.
Since:
JTGO 4.0
See Also:
setStyleSheets(int, String), setStyleSheets(String[])

getStyleSheets

public String[] getStyleSheets()
Returns the cascaded style sheets.

Specified by:
getStyleSheets in interface IlvStylable
Returns:
An array containing the URLs, file names of the style sheets or CSS extracts directly.
Since:
JTGO 4.0
See Also:
setStyleSheets(String[])

hasStyleSheets

public boolean hasStyleSheets()
Returns:
true if style sheets have been set in this context.
Since:
JTGO 4.0

setStyleSheetDebugMask

public void setStyleSheetDebugMask(int mask)
Sets the debug level while parsing the style sheets. Set this property before calling setStyleSheets(java.lang.String[]) to debug problems during configuration.

Note: You can also set the style sheet debug mask directly in the style sheet files. The following example illustrates a style sheet extract with this configuration:

 StyleSheet {
   styleSheetDebugMask: "BAD_CLASS_MASK|BAP_PROP_MASK";
 }
 

Specified by:
setStyleSheetDebugMask in interface IlvStylable
Parameters:
mask - The debug mask, expressed as an OR combination of the predefined flags.
Since:
JTGO 4.0
See Also:
setStyleSheets(java.lang.String[]), getStyleSheetDebugMask(), IlvStylable.APPLIED_RULE_MASK, IlvStylable.BAD_CLASS_MASK, IlvStylable.BAD_PROP_MASK, IlvStylable.CREATED_MASK, IlvStylable.DECL_MASK, IlvStylable.DECL_VALUE_MASK, IlvStylable.FAILED_CONVERSIONS_MASK, IlvStylable.TIME_REPORT_MASK, IlvStylable.WARNING_PROP_MASK

getStyleSheetDebugMask

public int getStyleSheetDebugMask()
Returns the current debug level.

Specified by:
getStyleSheetDebugMask in interface IlvStylable
Since:
JTGO 4.0
See Also:
setStyleSheetDebugMask(int)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener on property modification.

For now this method does nothing.

Specified by:
addPropertyChangeListener in interface IlvStylable
Overrides:
addPropertyChangeListener in class IlpAbstractAdapter
Parameters:
listener - The listener to add.
Since:
JTGO 4.0

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener on property modification.

For now this method does nothing.

Specified by:
removePropertyChangeListener in interface IlvStylable
Overrides:
removePropertyChangeListener in class IlpAbstractAdapter
Parameters:
listener - The listener to remove.
Since:
JTGO 4.0

getMutableStyleSheet

public IlpMutableStyleSheet getMutableStyleSheet()
Description copied from interface: IlpStylableAdapter
Returns a mutable style sheet that can be used to change the adapter configuration dynamically.

The mutable style sheet is created and registered in this adapter when this method is called for the first time.

Note: if you replace the existing style sheets, the mutable style sheet will no longer be connected to this adapter. Once this happens, a future call to this method will then create a new mutable style sheet and register it.

Specified by:
getMutableStyleSheet in interface IlpStylableAdapter
Since:
JViews 8.1

getCSSDelegate

protected ilog.cpl.datasource.css.internal.IlpStylableAdapterSupport getCSSDelegate()
Returns the context information needed to provide support to cascading style sheets.

Since:
JTGO 4.0
Internal method or field: do not use!

customizeObject

protected void customizeObject(IlpObject object)
This method is automatically called by createExpansionStrategy to guarantee that every new object (or updated) is customized before being added to this adapter.

Specified by:
customizeObject in class IlpAbstractHierarchyAdapter
Parameters:
object - The object to be customized.
Since:
JTGO 4.0
Internal method or field: do not use!

hasExpansionTypeChanged

protected boolean hasExpansionTypeChanged(IlpObject ilpObject,
                                          IlpExpansionType expansion)
Checks if the expansion configuration has changed in comparison with the current configuration

Parameters:
ilpObject - The business object being customized
expansion - The customized expansion type
Returns:
true if the expansion type has changed; false otherwise.
Since:
JViews 8.1
Internal method or field: do not use!

hasConfigurationChanged

protected boolean hasConfigurationChanged(Map properties)
Checks if the configuration has changed in comparison with the current configuration.

Overrides:
hasConfigurationChanged in class IlpAbstractHierarchyAdapter
Parameters:
properties -
Returns:
true if one of the properties being set is different from the value currently set in the adapter.
Since:
JTGO 4.0
See Also:
IlpAdapterCSSConfiguration
Internal method or field: do not use!

doApplyConfiguration

protected void doApplyConfiguration(Map properties)
Apply the new configuration to this adapter.

Overrides:
doApplyConfiguration in class IlpAbstractHierarchyAdapter
Parameters:
properties -
Since:
JTGO 4.0
See Also:
IlpAdapterCSSConfiguration
Internal method or field: do not use!

getExpansionType

public IlpExpansionType getExpansionType(IlpObject ilpObject)
Description copied from class: IlpAbstractHierarchyAdapter
Retrieves the expansion type of a given business object.

Compatibility Note: In JViews 8.0, ilog.cpl.model.IlpObject.ExpansionType has been replaced by IlpExpansionType.

Overrides:
getExpansionType in class IlpAbstractHierarchyAdapter
Parameters:
ilpObject - The business object containing the expansion type.
Returns:
The expansion type for this object.

getDefaultExpansionType

protected IlpExpansionType getDefaultExpansionType(IlpObject ilpObject)
This internal method returns the default expansion type, which is IlpExpansionType.IN_PLACE. This value is overridden by the value in expansionType structure (or, the value set through the API).

Parameters:
ilpObject - The business object.
Since:
JViews 8.1
Internal method or field: do not use!

removeRepresentation

protected IlpRepresentationObject removeRepresentation(Object id)
Description copied from class: IlpAbstractAdapter
Removes the representation object that corresponds to the given identifier.

Overrides:
removeRepresentation in class IlpAbstractHierarchyAdapter
Parameters:
id - Object identifier

setModel

public void setModel(IlpTreeModel model)
Sets the model.

This is a bound property.

Parameters:
model - The model where the adapter will put the representation objects.

getModel

public IlpTreeModel getModel()
Returns the model.

Returns:
The model where the adapter puts the representation objects.

hasModel

public boolean hasModel()
Returns true if the adapter is connected to a model.

Specified by:
hasModel in class IlpAbstractAdapter

getTreeNode

public IlpTreeNode getTreeNode(IlpObject ilpObject)
Returns the tree node representing ilpObject.


getTreeNode

public IlpTreeNode getTreeNode(Object identifier)
Returns the tree node representing identifier.


getTreeNodeFactory

public IlpTreeNodeFactory getTreeNodeFactory()
Returns the tree node factory used by this adapter.

Returns:
The factory of tree nodes.

setTreeNodeFactory

public void setTreeNodeFactory(IlpTreeNodeFactory nodeFactory)
Sets the tree node factory used by this adapter.

Note: This property can be set using CSS, as illustrated below:

 Adapter {
   treeNodeFactory: @+factoryDef;
 }
 Subobject#factoryDef {
   class: ...;
 }
 

Parameters:
nodeFactory - The factory of tree nodes.

getRootInsertionNode

public IlpTreeNodeHelper getRootInsertionNode()
Returns the node under which top level nodes - roots - are inserted. Here it returns the root of the tree model, but it can be redefined to return another node contained in the tree model.

Since:
JTGO 3.1

setComparator

public void setComparator(Comparator comparator)
Sets the comparator used to sort the nodes.

The comparator will be used with IlpTreeNodes as parameters, that is representation objects not business objects. Of course, from an IlpTreeNode you can retrieve the business object.

Note: This property can be customized using CSS, as illustrated below:

 Adapter {
   comparator: @+comparatorDef;
 }
 Subobject#comparatorDef {
   class: ...;
 }
 

Parameters:
comparator - The comparator used to sort the nodes.

getComparator

public Comparator getComparator()
Returns the comparator used to sort the nodes.

Returns:
The comparator used to sort the nodes.
See Also:
setComparator(Comparator)

sort

public void sort()
Sorts the model according to the current comparator.

This method can be used, for example, if the comparator behavior has changed.

Since:
JTGO 3.1


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