ilog.cpl.network
Class IlpNetworkAdapter

java.lang.Object
  extended by ilog.cpl.datasource.IlpAbstractAdapter
      extended by ilog.cpl.datasource.IlpAbstractHierarchyAdapter
          extended by ilog.cpl.graph.IlpAbstractNodeAdapter
              extended by ilog.cpl.network.IlpNetworkAdapter
All Implemented Interfaces:
IlpStylable, DataSourceListener, IlpStylableAdapter, IlpRepresentationObjectMapper, IlvStylable, EventListener

public class IlpNetworkAdapter
extends IlpAbstractNodeAdapter
implements IlpStylableAdapter

This class adapts a data source to a network.

The adapter gets IlpObjects 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.

Since:
JTGO 3.0

Field Summary
 
Fields inherited from class ilog.cpl.graph.IlpAbstractNodeAdapter
FILTER_BREADTH_FIRST_THRESHOLD
 
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
IlpNetworkAdapter()
          Default constructor.
IlpNetworkAdapter(IlpContext context)
          Constructor with a given context.
 
Method Summary
 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()
           
 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.
 
Methods inherited from class ilog.cpl.graph.IlpAbstractNodeAdapter
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
 
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, 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
 

Constructor Detail

IlpNetworkAdapter

public IlpNetworkAdapter()
Default constructor. This constructor initializes the network node factory with an IlpDefaultNetworkNodeFactory instance; the network link factory with an IlpDefaultNetworkLinkFactory and the expansion strategy factory with an instance of IlpDefaultNodeExpansionStrategyFactory.

See Also:
IlpDefaultNetworkNodeFactory, IlpDefaultNetworkLinkFactory, IlpDefaultNodeExpansionStrategyFactory

IlpNetworkAdapter

public IlpNetworkAdapter(IlpContext context)
Constructor with a given context. This constructor initializes the network node factory with an IlpDefaultNetworkNodeFactory instance; the network link factory with an IlpDefaultNetworkLinkFactory and the expansion strategy factory with an instance of IlpDefaultNodeExpansionStrategyFactory.

Parameters:
context - The context.
See Also:
IlpContext, IlpDefaultNetworkNodeFactory, IlpDefaultNetworkLinkFactory, IlpDefaultNodeExpansionStrategyFactory
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. 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 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.
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 or file name of the new style sheet file.
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 if you want to reapply this configuration immediately to the adapter and all the representation objects that are already being managed by this adapter.

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 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.
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 cascading 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. Sets this property before calling 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';
 }
 

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 to property modification.

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 from property modification.

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

applyObjectCustomization

protected IlpBusinessObjectCustomization applyObjectCustomization(IlpObject ilpObject)
Returns the object that contains all the customization properties of the given business object.

Overrides:
applyObjectCustomization in class IlpAbstractNodeAdapter
Parameters:
ilpObject - Business object
Returns:
Customization object or null if customization is not available.
Since:
JViews 7.5
Internal method or field: do not use!

hasConfigurationChanged

protected boolean hasConfigurationChanged(Map properties)
Checks if the new configuration has changed compared to the current configuration.

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

doApplyConfiguration

protected void doApplyConfiguration(Map properties)
Applies the new configuration.

Overrides:
doApplyConfiguration in class IlpAbstractHierarchyAdapter
Since:
JTGO 4.0
See Also:
IlpAbstractAdapter
Internal method or field: do not use!

createNode

protected IlpRepresentationNode createNode(IlpObject ilpObject)
Creates a representation node object from a given business object.

This method returns a representation object that is not a link.

Specified by:
createNode in class IlpAbstractNodeAdapter
Parameters:
ilpObject - The business object
Returns:
The representation node corresponding to the given business object.
Since:
JTGO 4.0
Internal method or field: do not use!

createLink

protected IlpRepresentationLink createLink(IlpObject ilpObject,
                                           IlpRepresentationNode fromNode,
                                           IlpRepresentationNode toNode)
Creates a representation link object from a given business object.

Specified by:
createLink in class IlpAbstractNodeAdapter
Parameters:
ilpObject - The business object.
fromNode - The from endpoint for the link.
toNode - The to endpoint for the link.
Returns:
The representation link corresponding to the given business object.
Since:
JTGO 4.0
Internal method or field: do not use!

clearRepresentationObjects

protected void clearRepresentationObjects()
Removes all objects created by this adapter

Overrides:
clearRepresentationObjects in class IlpAbstractNodeAdapter

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 IlpAbstractNodeAdapter
Parameters:
id - Object identifier

getModel

public IlpMutableNetworkModel getModel()
Returns the network model.

This is a bound property.

Returns:
The model in which the adapter places the representation objects.

setModel

public void setModel(IlpMutableNetworkModel model)
Sets the network model.

This is a bound property.

Parameters:
model - The model in which the adapter places the representation objects.

getNetworkNode

public IlpNetworkNode getNetworkNode(IlpObject ilpObject)
Returns the network node representing the IlpObject. All objects in a network model are network nodes, even network links.


getNetworkNode

public IlpNetworkNode getNetworkNode(Object identifier)
Returns the network node representing the IlpObject identified by identifier. All objects in a network model are network nodes, even network links.


setLinkFactory

public void setLinkFactory(IlpNetworkLinkFactory linkFactory)
Sets the network link factory.

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

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

Parameters:
linkFactory - The link representation object factory.

getLinkFactory

public IlpNetworkLinkFactory getLinkFactory()
Returns the network link factory.


setNodeFactory

public void setNodeFactory(IlpNetworkNodeFactory nodeFactory)
Sets the network node factory.

Note: This property can be customized using CSS.

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

Parameters:
nodeFactory - The node representation object factory.

getNodeFactory

public IlpNetworkNodeFactory getNodeFactory()
Returns the network node factory.


startChangingNetworkModel

public void startChangingNetworkModel()
Deprecated. Use IlpAbstractDataSource.startBatch() instead.

Tells the model temporarily not to send events.

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.

See Also:
endChangingNetworkModel(), IlpMutableNetworkModel.startChangingNetworkModel()
Deprecated Since:
JTGO 4.0

endChangingNetworkModel

public void endChangingNetworkModel()
Deprecated. Use IlpAbstractDataSource.endBatch() instead.

Tells the model that a temporary inhibition of events is terminated and sends the events buffered since the last call to 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.

See Also:
startChangingNetworkModel(), IlpMutableNetworkModel.endChangingNetworkModel()
Deprecated Since:
JTGO 4.0


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