public abstract class IlpAbstractTreeAdapter extends IlpAbstractHierarchyAdapter implements IlpStylableAdapter
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.
| Modifier and Type | Field and Description |
|---|---|
static Comparator |
ARBITRARY_COMPARATOR
Arbitrary comparator.
|
UPDATE_ALL_MASK, UPDATE_COMPONENT_MASK, UPDATE_NONE_MASK, UPDATE_OBJECTS_MASKAPPLIED_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| Modifier | Constructor and Description |
|---|---|
protected |
IlpAbstractTreeAdapter()
Constructor.
|
protected |
IlpAbstractTreeAdapter(IlpContext context)
Constructor with a given context.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
IlpFilter |
getObjectAttributeChangedFilter()
Returns the filter that defines which attribute value change notifications
should be propagated to the tree model.
|
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()
Returns whether style sheets have been set in this context or not.
|
protected boolean |
notifyObjectAttributeChangedEvent(DataSourceObjectEvent event)
Returns if the event should be notified or not.
|
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 |
setObjectAttributeChangedFilter(IlpFilter f)
Specifies a new filter that defines which attribute value change
notifications should be propagated to the tree 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.
|
createExpansionStrategy, customizeAllObjects, getAcceptedClasses, getExpansionStrategyFactory, getOrigins, getPossibleRoots, getRoots, initializeAcceptedClasses, isEmptyOrigins, isOrigin, isShowingOrigin, loadChildren, releaseChildren, replaceAcceptedClasses, resetOrigins, setAcceptedClasses, setExpansionStrategyFactory, setExpansionType, setOrigins, testObject, testRootObjectaddAdapterListener, 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, stopRepresentationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitobjectAttributeChanged, objectsAdded, objectsRemoved, objectStructureChangedpublic static final 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.
protected IlpAbstractTreeAdapter()
protected IlpAbstractTreeAdapter(IlpContext context)
context - The context.public void setStyleSheets(String[] css) throws IlvStylingException
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.
setStyleSheets in interface IlvStylablecss - An array of strings containing the URLs or the file names of
CSS files (usually with a .css suffix).IlvStylingExceptiongetStyleSheets()public void setStyleSheets(String[] css, int updateMask) throws IlvStylingException
Each element can be a URL, a filename, or directly the style sheet string. The order is by priority (the last CSS takes precedence).
setStyleSheets in interface IlpStylablecss - 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.IlvStylingExceptionIlpStylable.UPDATE_COMPONENT_MASK,
IlpStylable.UPDATE_OBJECTS_MASK,
getStyleSheets()public void setStyleSheets(int index,
String css)
throws IlvStylingException
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.
setStyleSheets in interface IlvStylableindex - The index of the style sheet to replace.css - The URL, file name of the new style sheet file or CSS extract directly.IlvStylingExceptionsetStyleSheets(java.lang.String[]),
getStyleSheets(int)public void setStyleSheets(int index,
String css,
int updateMask)
throws IlvStylingException
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.
setStyleSheets in interface IlpStylableindex - 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.IlvStylingException.IlvStylingExceptionIlpStylable.UPDATE_COMPONENT_MASK,
IlpStylable.UPDATE_OBJECTS_MASK,
getStyleSheets(int)public String getStyleSheets(int index)
getStyleSheets in interface IlvStylableindex - The position of the cascading style sheet to return.index-th position.setStyleSheets(int, String),
setStyleSheets(String[])public String[] getStyleSheets()
getStyleSheets in interface IlvStylablesetStyleSheets(String[])public boolean hasStyleSheets()
true if style sheets have been set in this contextpublic void setStyleSheetDebugMask(int mask)
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";
}
setStyleSheetDebugMask in interface IlvStylablemask - The debug mask, expressed as an OR combination of the
predefined flags.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_MASKpublic int getStyleSheetDebugMask()
getStyleSheetDebugMask in interface IlvStylablesetStyleSheetDebugMask(int)public void addPropertyChangeListener(PropertyChangeListener listener)
For now this method does nothing.
addPropertyChangeListener in interface IlvStylableaddPropertyChangeListener in class IlpAbstractAdapterlistener - The listener to add.public void removePropertyChangeListener(PropertyChangeListener listener)
For now this method does nothing.
removePropertyChangeListener in interface IlvStylableremovePropertyChangeListener in class IlpAbstractAdapterlistener - The listener to remove.public IlpMutableStyleSheet getMutableStyleSheet()
IlpStylableAdapterThe 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.
getMutableStyleSheet in interface IlpStylableAdapterprotected ilog.cpl.datasource.css.internal.IlpStylableAdapterSupport getCSSDelegate()
protected void customizeObject(IlpObject object)
createExpansionStrategy to guarantee that every new
object (or updated) is customized before being added to this
adapter.customizeObject in class IlpAbstractHierarchyAdapterobject - The object to be customized.protected boolean hasExpansionTypeChanged(IlpObject ilpObject, IlpExpansionType expansion)
ilpObject - The business object being customizedexpansion - The customized expansion typetrue if the expansion type has changed;
false otherwise.protected boolean hasConfigurationChanged(Map properties)
hasConfigurationChanged in class IlpAbstractHierarchyAdapterproperties - true if one of the properties being set is
different from the value currently set in the adapter.IlpAdapterCSSConfigurationprotected void doApplyConfiguration(Map properties)
doApplyConfiguration in class IlpAbstractHierarchyAdapterproperties - IlpAdapterCSSConfigurationpublic IlpExpansionType getExpansionType(IlpObject ilpObject)
IlpAbstractHierarchyAdapterCompatibility Note: In JViews 8.0,
ilog.cpl.model.IlpObject.ExpansionType
has been replaced by IlpExpansionType.
getExpansionType in class IlpAbstractHierarchyAdapterilpObject - The business object containing the expansion type.protected IlpExpansionType getDefaultExpansionType(IlpObject ilpObject)
IlpExpansionType.IN_PLACE. This value is overridden by
the value in expansionType structure (or, the value
set through the API).ilpObject - The business object.protected IlpRepresentationObject removeRepresentation(Object id)
IlpAbstractAdapterremoveRepresentation in class IlpAbstractHierarchyAdapterid - Object identifierpublic void setModel(IlpTreeModel model)
This is a bound property.
model - The model where the adapter will put the representation
objects.public IlpTreeModel getModel()
public boolean hasModel()
true if the adapter is connected to a model.hasModel in class IlpAbstractAdapterpublic IlpTreeNode getTreeNode(IlpObject ilpObject)
ilpObject.public IlpTreeNode getTreeNode(Object identifier)
identifier.public IlpTreeNodeFactory getTreeNodeFactory()
public void setTreeNodeFactory(IlpTreeNodeFactory nodeFactory)
Note: This property can be set using CSS, as illustrated below:
Adapter {
treeNodeFactory: @+factoryDef;
}
Subobject#factoryDef {
class: ...;
}
nodeFactory - The factory of tree nodes.public IlpTreeNodeHelper getRootInsertionNode()
public void setComparator(Comparator comparator)
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: ...;
}
comparator - The comparator used to sort the nodes.public Comparator getComparator()
setComparator(Comparator)public void sort()
This method can be used, for example, if the comparator behavior has changed.
public IlpFilter getObjectAttributeChangedFilter()
AttributeValueEventpublic void setObjectAttributeChangedFilter(IlpFilter f)
If the filter is null, all notifications are
propagated to the tree model.
The filter is called with an argument of type DataSourceObjectEvent
that represents an DataSourceObjectEvent.Type.ObjectAttributeChanged.
This is a bound property.
Note: This property can be customized using CSS, as illustrated below:
Adapter {
attributeValueChangeFilter: @+filterDef;
}
Subobject#filterDef {
...
}
f - Attribute value change filterprotected boolean notifyObjectAttributeChangedEvent(DataSourceObjectEvent event)
event - Event to be verifiedtrue if notification must be propagated.© Copyright Rogue Wave Software, Inc. 1997, 2017. All Rights Reserved.