|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.cpl.datasource.IlpAbstractAdapter
public abstract class IlpAbstractAdapter
Abstract adapter.
Provides support for the association with a data source, filtering, and JavaBean property change events.
This abstract adapter assumes that representation objects are created only when there is a data source AND a model. If one of those is removed, all representation objects are cleared.
| Constructor Summary | |
|---|---|
IlpAbstractAdapter()
Default constructor. |
|
IlpAbstractAdapter(IlpContext context)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addAdapterListener(AdapterListener l)
Adds a listener to the adapter. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. |
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Adds a PropertyChangeListener for a specific property. |
protected void |
addRepresentation(IlpRepresentationObject ro)
Adds the representation object. |
void |
applyConfiguration(Map properties)
Applies the given configuration to the adapter. |
void |
batchEnded(DataSourceEvent e)
Called when a batch of modifications of the data source has ended. |
void |
batchStarted(DataSourceEvent e)
Called when a batch of modifications of the data source has started. |
protected void |
beginRepresentation()
Will start representing objects if this was not being done and there is a model and a data source. |
protected void |
clearIdToRepresentationObjectMap()
Clears all the representation objects from the adapter. |
protected abstract void |
clearRepresentationObjects()
Called when all representation objects should be cleared. |
protected abstract IlpRepresentationObject |
createRepresentationObject(IlpObject ilpObject)
This method creates a representation object and stores it in the identifier-to-RO map. |
protected void |
doApplyConfiguration(Map properties)
Applies the new configuration to this adapter. |
protected void |
endBatch()
Tells the model that a temporary inhibition of events is terminated and sends the events buffered since the last call to startBatch. |
protected abstract void |
fillModel()
Fills the model with the representation objects. |
protected void |
firePropertyChange(String property,
Object oldValue,
Object newValue)
Fires a property change event. |
void |
fireRepresentationObjectsAdded(List representationObjects)
Fires a representation object added event for a list of objects. |
void |
fireRepresentationObjectsRemoved(List representationObjects)
Fires a representation object removed event for a list of objects. |
IlpContext |
getContext()
Returns the context. |
IlpDataSource |
getDataSource()
Returns the data source. |
List |
getExcludedClasses()
Returns the list of excluded classes. |
IlpFilter |
getFilter()
Returns the filter. |
protected Collection |
getPossibleRoots()
This method returns a list of possible root objects. |
IlpRepresentationObject |
getRepresentationObject(IlpObject ilpObject)
Returns the IlpRepresentationObject used to
represent the given IlpObject. |
IlpRepresentationObject |
getRepresentationObject(Object identifier)
Returns the IlpRepresentationObject used to
represent a business object identified by the given identifier. |
Collection |
getRepresentationObjects()
Returns all the representation objects. |
protected IlSynchronizationStrategy |
getSyncStrategy()
Returns the synchronization strategy used by this adapter. |
protected boolean |
hasConfigurationChanged(Map properties)
Checks if the configuration has changed in comparison with the current configuration. |
abstract boolean |
hasModel()
Returns true if the adapter is connected to a model. |
boolean |
hasRepresentationObject(IlpRepresentationObject ro)
Returns trueif the given
IlpRepresentationObject is contained in this map. |
boolean |
hasRepresentationObjects()
Returns true if the adapter contains representation objects. |
protected void |
initializeExcludedClasses()
Initializes the predefined list of excluded classes. |
protected void |
initializeRepresentationObjects()
Identifies all root objects and creates their representation, starting to feed the representation model with new objects. |
boolean |
isRepresenting()
Returns true if the adapter is active, that is, representing
objects from a data source in a model. |
void |
refilter()
Applies the current filter to the adapter objects. |
protected void |
refilterObjects()
Applies the filter to the objects that exist in the attached datasource. |
void |
removeAdapterListener(AdapterListener l)
Removes a listener from the adapter. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. |
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
Removes a PropertyChangeListener for a specific property. |
protected IlpRepresentationObject |
removeRepresentation(Object id)
Removes the representation object that corresponds to the given identifier. |
protected void |
replaceExcludedClasses(List newExclusion)
This method is called to replace the existing excluded class list with a new one. |
protected void |
setBatchable(IlvBatchable batchable)
Sets the batch modification delegate used by this adapter. |
void |
setDataSource(IlpDataSource dataSource)
Sets the data source. |
void |
setExcludedClasses(List newExclusion)
Sets the list of business classes that should be excluded by this adapter. |
void |
setFilter(IlpFilter newfilter)
Sets the filter. |
protected void |
startBatch()
Tells the model temporarily not to send events. |
protected void |
stopRepresentation()
Will stop representing objects. |
protected boolean |
testObject(IlpObject ilpObject)
Returns true if an object of the data source should be
represented. |
protected boolean |
testRootObject(IlpObject ilpObject)
Returns true if an object of the data source should be
represented when iterating on all data source objects. |
| 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 |
| Constructor Detail |
|---|
public IlpAbstractAdapter(IlpContext context)
Creates an adapter that uses the context.
context - The context used by this adapter.public IlpAbstractAdapter()
Creates an adapter using the default context.
IlpSystem.GetDefaultContext()| Method Detail |
|---|
public IlpContext getContext()
public void addAdapterListener(AdapterListener l)
l - The listener to add.public void removeAdapterListener(AdapterListener l)
l - The listener to remove.public void fireRepresentationObjectsAdded(List representationObjects)
representationObjects - The representation objects that have been
added.
Cannot be null.public void fireRepresentationObjectsRemoved(List representationObjects)
representationObjects - The representation objects that have been
removed.
Cannot be null).public IlpRepresentationObject getRepresentationObject(Object identifier)
IlpRepresentationObject used to
represent a business object identified by the given identifier.
identifier - The identifier of the IlpObject
for which the representation object is required.public IlpRepresentationObject getRepresentationObject(IlpObject ilpObject)
IlpRepresentationObject used to
represent the given IlpObject.
getRepresentationObject in interface IlpRepresentationObjectMapperilpObject - The IlpObject for which the representation
object is required.public boolean hasRepresentationObject(IlpRepresentationObject ro)
trueif the given
IlpRepresentationObject is contained in this map.
hasRepresentationObject in interface IlpRepresentationObjectMapperro - The IlpRepresentationObject.public boolean hasRepresentationObjects()
true if the adapter contains representation objects.
protected void clearIdToRepresentationObjectMap()
public Collection getRepresentationObjects()
protected void addRepresentation(IlpRepresentationObject ro)
ro - Representation objectprotected IlpRepresentationObject removeRepresentation(Object id)
id - Object identifierpublic boolean isRepresenting()
true if the adapter is active, that is, representing
objects from a data source in a model.
This is a bound property.
public abstract boolean hasModel()
true if the adapter is connected to a model.
public void setDataSource(IlpDataSource dataSource)
The representation objects are created if the adapter also has model. Note that the adapter also waits for a model to listen to data source events.
This is a bound property.
dataSource - The data source used by adapter.public IlpDataSource getDataSource()
This is a bound property.
public void setFilter(IlpFilter newfilter)
The new filter is only applied if it is different from the existing
filter. To perform this validation, the method equals is
used in the filter instances.
The data source objects are filtered, so only IlpObjects
that pass through the filter are added to the model.
This is a bound property.
Note: This property can be customized using CSS, as illustrated below:
Adapter {
filter: @+filterDef;
}
Subobject#filterDef {
...
}
newfilter - The filter to use to filter business objects. This
parameter may be null, meaning the business
objects are not filtered.public IlpFilter getFilter()
This is a bound property.
setFilter(IlpFilter)public void setExcludedClasses(List newExclusion)
By default, the list is empty. This means that all business objects will be converted to representation objects. However, this does not include the ones that do not match the current filter criteria.
If you specify business classes in the list, business objects from the given classes or from one of its subclasses will be automatically filtered. Their representation will not be created in the associated representation model.
The current implementation is not very efficient, as it removes all representation objects and recreates them.
Note:This property can be customized using CSS, as illustrated below:
Adapter {
excludedClasses: "business class A, business class B";
}
To represent all classes:
Adapter {
excludedClasses: '';
}
newExclusion - The list of IlpClass. Note that
this list is copied to the internal list of excluded
classes.public List getExcludedClasses()
It may well be an empty list.
protected void initializeExcludedClasses()
protected void replaceExcludedClasses(List newExclusion)
newExclusion - New exclusion list.setExcludedClasses(java.util.List)public void batchStarted(DataSourceEvent e)
batchStarted in interface DataSourceListenerpublic void batchEnded(DataSourceEvent e)
batchEnded in interface DataSourceListenerprotected void setBatchable(IlvBatchable batchable)
protected void startBatch()
endBatch.
This method ensures that the startBatch method of the
model is called with the correct synchronization strategy; that is, in
the event thread in a regular application.
Note: The adapter needs a model for this method to work.
Note: Use
IlpAbstractDataSource.startBatch() instead.
IlpAbstractDataSource.startBatch(),
endBatch()protected void endBatch()
startBatch.
This method ensures that the endBatch method of the
model is called with the correct synchronization strategy; that is, in
the event thread in a regular application.
Note:The adapter needs a model for this method to work.
Note:Use
IlpAbstractDataSource.endBatch() instead.
IlpAbstractDataSource.endBatch(),
startBatch()
protected void firePropertyChange(String property,
Object oldValue,
Object newValue)
property - Property that was changedoldValue - Old valuenewValue - New valuepublic void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener to the listener list.
The listener is registered for all properties.
listener - The PropertyChangeListener to be added.public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.
listener - The PropertyChangeListener to be removed.
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener listener)
PropertyChangeListener for a specific property. The
listener will be invoked only when a call to
firePropertyChange names that specific property.
propertyName - The name of the property to listen to.listener - The PropertyChangeListener to be added.
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener listener)
PropertyChangeListener for a specific property.
propertyName - The name of the property that was listened to.listener - The PropertyChangeListener to be removed.protected IlSynchronizationStrategy getSyncStrategy()
The synchronization strategy is used each time an object is inserted into or removed from the model.
The synchronization strategy is obtained from the context.
protected boolean testObject(IlpObject ilpObject)
true if an object of the data source should be
represented.
By default, it returns true if there is no filtering or
if the IlpObject passes through the filter and the
excluded class list.
setFilter(ilog.cpl.util.IlpFilter),
setExcludedClasses(java.util.List)protected boolean testRootObject(IlpObject ilpObject)
true if an object of the data source should be
represented when iterating on all data source objects.
An object is represented during this iteration if this method
returns true and the testObject(IlpObject)
method returns true.
By default, this method returns true.
protected void refilterObjects()
The default implementation calls clearRepresentationObject
and then initializeRepresentationObject.
public void refilter()
The filter is only applied if the objects are being
represented (isRepresenting()).
The default implementation calls refilterObjects.
protected Collection getPossibleRoots()
protected void stopRepresentation()
protected void beginRepresentation()
protected void initializeRepresentationObjects()
beginRepresentation()protected abstract void fillModel()
protected abstract void clearRepresentationObjects()
protected abstract IlpRepresentationObject createRepresentationObject(IlpObject ilpObject)
null in which case it does
not store anything in the map.
public void applyConfiguration(Map properties)
properties - protected boolean hasConfigurationChanged(Map properties)
properties -
true if one of the properties being set is different
from the current value in the adapter.protected void doApplyConfiguration(Map properties)
properties -
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||