public class IlpNetworkAdapter extends IlpAbstractNodeAdapter implements IlpStylableAdapter
The adapter gets IlpObject
s from a data source
and creates corresponding network nodes and network links in a
network model.
This class can be customized using cascading style sheets. The
CSS customization is done using files that are loaded in the method
setStyleSheets(java.lang.String[])
.
The following extract illustrates the customization of the adapter of the network component:
Network { 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.
FILTER_BREADTH_FIRST_THRESHOLD
UPDATE_ALL_MASK, UPDATE_COMPONENT_MASK, UPDATE_NONE_MASK, UPDATE_OBJECTS_MASK
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 and Description |
---|
IlpNetworkAdapter()
Default constructor.
|
IlpNetworkAdapter(IlpContext context)
Constructor with a given context.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to property modification.
|
protected IlpBusinessObjectCustomization |
applyObjectCustomization(IlpObject ilpObject)
Returns the object that contains all the customization properties
of the given business object.
|
protected void |
clearRepresentationObjects()
Removes all objects created by this adapter
|
protected IlpRepresentationLink |
createLink(IlpObject ilpObject,
IlpRepresentationNode fromNode,
IlpRepresentationNode toNode)
Creates a representation link object from a given business object.
|
protected IlpRepresentationNode |
createNode(IlpObject ilpObject)
Creates a representation node object from a given business object.
|
protected void |
doApplyConfiguration(Map properties)
Applies the new configuration.
|
void |
endChangingNetworkModel()
Deprecated.
Use
IlpAbstractDataSource.endBatch()
instead. |
IlpNetworkLinkFactory |
getLinkFactory()
Returns the network link factory.
|
IlpMutableNetworkModel |
getModel()
Returns the network model.
|
IlpMutableStyleSheet |
getMutableStyleSheet()
Returns a mutable style sheet that can be used to change the adapter
configuration dynamically.
|
IlpNetworkNode |
getNetworkNode(IlpObject ilpObject)
Returns the network node representing the
IlpObject . |
IlpNetworkNode |
getNetworkNode(Object identifier)
Returns the network node representing the
IlpObject
identified by identifier . |
IlpNetworkNodeFactory |
getNodeFactory()
Returns the network node factory.
|
int |
getStyleSheetDebugMask()
Returns the current debug level.
|
String[] |
getStyleSheets()
Returns the cascading style sheets.
|
String |
getStyleSheets(int index)
Returns one of the cascading style sheets.
|
protected boolean |
hasConfigurationChanged(Map properties)
Checks if the new configuration has changed compared to the current
configuration.
|
boolean |
hasStyleSheets()
Returns whether style sheets have been set or not.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener from property modification.
|
protected IlpRepresentationObject |
removeRepresentation(Object id)
Removes the representation object that corresponds to the given
identifier.
|
void |
setLinkFactory(IlpNetworkLinkFactory linkFactory)
Sets the network link factory.
|
void |
setModel(IlpMutableNetworkModel model)
Sets the network model.
|
void |
setNodeFactory(IlpNetworkNodeFactory nodeFactory)
Sets the network node factory.
|
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 |
startChangingNetworkModel()
Deprecated.
Use
IlpAbstractDataSource.startBatch()
instead. |
clearTemporaryRepresentationObjects, createRepresentationObject, customizeAllObjects, customizeObject, fillModel, getDefaultExpansionType, getExpansionType, getPendingLinksCount, getPositionAttribute, getPositionAttribute, getRepresentationModel, getRepresentationNode, getRepresentationNode, hasModel, hasTemporaryRepresentationObject, initializeExcludedClasses, isPendingLink, loadChildren, objectAttributeChanged, objectsAdded, objectsRemoved, objectStructureChanged, refilterObjects, releaseChildren, removeTemporaryRepresentationObject, setPositionAttribute, setRepresentationModel, storeTemporaryRepresentationObject
createExpansionStrategy, getAcceptedClasses, getExpansionStrategyFactory, getOrigins, getPossibleRoots, getRoots, initializeAcceptedClasses, isEmptyOrigins, isOrigin, isShowingOrigin, replaceAcceptedClasses, resetOrigins, setAcceptedClasses, setExpansionStrategyFactory, setExpansionType, setOrigins, testObject, testRootObject
addAdapterListener, addPropertyChangeListener, addRepresentation, applyConfiguration, batchEnded, batchStarted, beginRepresentation, clearIdToRepresentationObjectMap, endBatch, firePropertyChange, fireRepresentationObjectsAdded, fireRepresentationObjectsRemoved, getContext, getDataSource, getExcludedClasses, getFilter, getRepresentationObject, getRepresentationObject, getRepresentationObjects, getSyncStrategy, hasRepresentationObject, hasRepresentationObjects, initializeRepresentationObjects, isRepresenting, refilter, removeAdapterListener, removePropertyChangeListener, replaceExcludedClasses, setBatchable, setDataSource, setExcludedClasses, setFilter, startBatch, stopRepresentation
public IlpNetworkAdapter()
IlpDefaultNetworkNodeFactory
instance; the network
link factory with an IlpDefaultNetworkLinkFactory
and the expansion strategy factory with an instance of
IlpDefaultNodeExpansionStrategyFactory
.public IlpNetworkAdapter(IlpContext context)
IlpDefaultNetworkNodeFactory
instance; the network
link factory with an IlpDefaultNetworkLinkFactory
and the expansion strategy factory with an instance of
IlpDefaultNodeExpansionStrategyFactory
.context
- The context.IlpContext
,
IlpDefaultNetworkNodeFactory
,
IlpDefaultNetworkLinkFactory
,
IlpDefaultNodeExpansionStrategyFactory
public void setStyleSheets(String[] css) throws IlvStylingException
This method uses the context URL Access Service to convert file names into URLs.
setStyleSheets
in interface IlvStylable
css
- An array of strings containing the URLs or the file names of
CSS files (usually with a .css
suffix).IlvStylingException
getStyleSheets()
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 IlpStylable
css
- An array of strings containing the URLs
or the file names of CSS files
(usually with a .css
suffix).updateMask
- Flag that indicates if 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 handled by this adapter are
reconfigured according to the new style sheets.IlvStylingException
IlpStylable.UPDATE_COMPONENT_MASK
,
IlpStylable.UPDATE_OBJECTS_MASK
,
getStyleSheets()
public void setStyleSheets(int index, String css) throws IlvStylingException
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 IlvStylable
index
- The index of the style sheet to replace.css
- The URL or file name of the new style sheet file.IlvStylingException
setStyleSheets(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 if you want to
reapply this configuration immediately to the adapter and all the
representation objects that are already being managed by this adapter.
setStyleSheets
in interface IlpStylable
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 if the adapter and/or the business
objects must 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 handled by this
adapter are reconfigured according to the new style
sheets.IlvStylingException.
IlvStylingException
IlpStylable.UPDATE_COMPONENT_MASK
,
IlpStylable.UPDATE_OBJECTS_MASK
,
getStyleSheets(int)
public String getStyleSheets(int index)
getStyleSheets
in interface IlvStylable
index
- The position of the cascading style sheet to return.index
-th position.setStyleSheets(int, String)
,
setStyleSheets(String[])
public String[] getStyleSheets()
getStyleSheets
in interface IlvStylable
setStyleSheets(String[])
public boolean hasStyleSheets()
true
if style sheets have been set in this context.public void setStyleSheetDebugMask(int mask)
setStyleSheets(java.lang.String[])
to debug
problems during configuration.
Note: This property can be set using CSS, as illustrated below:
StyleSheet { styleSheetDebugMask: 'BAD_PROP_MASK|BAD_CLASS_MASK'; }
setStyleSheetDebugMask
in interface IlvStylable
mask
- 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_MASK
public int getStyleSheetDebugMask()
getStyleSheetDebugMask
in interface IlvStylable
setStyleSheetDebugMask(int)
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface IlvStylable
addPropertyChangeListener
in class IlpAbstractAdapter
listener
- The listener to add.public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface IlvStylable
removePropertyChangeListener
in class IlpAbstractAdapter
listener
- The listener to remove.public IlpMutableStyleSheet getMutableStyleSheet()
IlpStylableAdapter
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.
getMutableStyleSheet
in interface IlpStylableAdapter
protected IlpBusinessObjectCustomization applyObjectCustomization(IlpObject ilpObject)
applyObjectCustomization
in class IlpAbstractNodeAdapter
ilpObject
- Business objectnull
if customization is
not available.protected boolean hasConfigurationChanged(Map properties)
hasConfigurationChanged
in class IlpAbstractHierarchyAdapter
true
if one of the properties being set is different
from the current value in the adapter.IlpAbstractAdapter
protected void doApplyConfiguration(Map properties)
doApplyConfiguration
in class IlpAbstractHierarchyAdapter
IlpAbstractAdapter
protected IlpRepresentationNode createNode(IlpObject ilpObject)
This method returns a representation object that is not a link.
createNode
in class IlpAbstractNodeAdapter
ilpObject
- The business objectprotected IlpRepresentationLink createLink(IlpObject ilpObject, IlpRepresentationNode fromNode, IlpRepresentationNode toNode)
createLink
in class IlpAbstractNodeAdapter
ilpObject
- The business object.fromNode
- The from endpoint for the link.toNode
- The to endpoint for the link.protected void clearRepresentationObjects()
clearRepresentationObjects
in class IlpAbstractNodeAdapter
protected IlpRepresentationObject removeRepresentation(Object id)
IlpAbstractAdapter
removeRepresentation
in class IlpAbstractNodeAdapter
id
- Object identifierpublic IlpMutableNetworkModel getModel()
This is a bound property.
public void setModel(IlpMutableNetworkModel model)
This is a bound property.
model
- The model in which the adapter places the representation
objects.public IlpNetworkNode getNetworkNode(IlpObject ilpObject)
IlpObject
.
All objects in a network model are network nodes, even network links.public IlpNetworkNode getNetworkNode(Object identifier)
IlpObject
identified by identifier
.
All objects in a network model are network nodes, even network links.public void setLinkFactory(IlpNetworkLinkFactory linkFactory)
Note: This property can be customized using a CSS, as illustrated below:
Adapter { linkFactory: @+factoryDef; } Subobject#factoryDef { class: ...; }
linkFactory
- The link representation object factory.public IlpNetworkLinkFactory getLinkFactory()
public void setNodeFactory(IlpNetworkNodeFactory nodeFactory)
Note: This property can be customized using CSS.
Adapter { nodeFactory: @+factoryDef; } Subobject#factoryDef { class: ...; }
nodeFactory
- The node representation object factory.public IlpNetworkNodeFactory getNodeFactory()
@Deprecated public void startChangingNetworkModel()
IlpAbstractDataSource.startBatch()
instead.
After this call, the model notification events are delayed
until the next call to endChangingNetworkModel
.
Contrary to the method IlpMutableNetworkModel
,
this method ensures that the startChangingNetworkModel
method
of the model is called using the correct synchronization strategy; that is,
in the Swing event thread in a regular application.
Note: The adapter needs a model for this method to work.
endChangingNetworkModel()
,
IlpMutableNetworkModel.startChangingNetworkModel()
@Deprecated public void endChangingNetworkModel()
IlpAbstractDataSource.endBatch()
instead.startChangingNetworkModel
.
Contrary to the method IlpMutableNetworkModel
,
this method ensures that the
endChangingNetworkModel
method of the model is called using
the correct synchronization strategy; that is, in the Swing event thread
in a regular application.
Note:The adapter needs a model for this method to work.
startChangingNetworkModel()
,
IlpMutableNetworkModel.endChangingNetworkModel()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.