|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.sdm.IlvSDMEngine
public class IlvSDMEngine
IlvSDMEngine is the main class in the
Stylable Data Mapper package. An SDM engine controls
the process of rendering a set of application objects
as a graph in an ILOG JViews grapher.
An SDM engine has two input sources: a data model, and a style sheet. The engine matches the data against the style sheet to produce a graphic view of the data.
IlvSDMModel.
The SDM data model is similar to the JFC/Swing Table, Tree, or List models.
It is the interface between the SDM engine and the application data.
It contains the methods that let the engine fetch the data objects
and retrieve their properties. The data model also allows the
application to notify the engine of changes in the data set.
The SDM package contains a predefined implementation of the
data model: the class IlvDefaultSDMModel.
This simple data model stores data objects in memory. The objects
are instances of the classes IlvDefaultSDMNode
and IlvDefaultSDMLink.
Instead of using the predefined model, you can implement the
IlvSDMModel interface directly to wrap existing
data of your application. For this, you
can use IlvBasicSDMModel as a base class.
The SDM engine provides support for reading and writing the contents
of a data model in XML, through the methods
setXMLFile(java.lang.String) and
writeXML(String).
Style sheets conform to the CSS syntax (which is a recommendation of the W3C). The semantics, though, are slightly different from the original use of CSS: instead of styling web documents in a browser, the SDM engine styles a data model in an ILOG JViews grapher.
A style sheet contains a set of style rules. Each rule is formed by a left-hand part (the "selector"), and a right-hand part (the "declarations"). The selector specifies which objects match the rule. The declarations specify the properties of the graphic objects that will represent the matching data objects. Here is a simple example:
node.activity {
class : "ilog.views.sdm.graphic.IlvGeneralNode";
shapeType : "RoundRectangle";
foreground : "black";
background : "blue";
}
Node.activity is the selector, the
rest of the rule forms the declarations.
"node" if
the object is a node, or "link" if the object is a link between
two nodes.
getTag.
node | Matches all the nodes. |
node.activity | Matches all the nodes whose tag is "activity". |
node.activity.style1 | Matches all the nodes whose tag is "activity"
and whose style class is "style1". |
node:selected | Matches all the nodes whose pseudo-class is "selected". |
node.activity[implementation="manual"] | Matches all the nodes whose
tag is "activity" and whose implementation property has the value
"manual". |
property : value;. These assignments define an ILOG JViews graphic
object that will represent the data object matched by the rule's selector.
The class of the graphic object must be specified by the special property
class. The other properties specify either the graphic object
properties (in the sense of JavaBean properties), or special properties
that are interpreted by the SDM engine.
Example:
node.activity {
class : "ilog.views.sdm.graphic.IlvGeneralNode";
icon : "activity.gif";
label : "@name";
layer : 10;
}
These declarations tell the SDM engine that the activity nodes
must be represented by graphic objects of the class
IlvGeneralNode. When the graphic object is
created, the engine will set its icon and
label properties to the specified values. The
"@name" notation means that the label
of the node must be set to the value of the name
property of the data object. The layer property
is a special property, which is interpreted by the SDM engine,
and which specifies the manager layer in which the graphic
object will be added.
These options are defined by an SDM rule, and possibly by additional option rules.
The SDM rule must have the selector SDM
(or #SDM). It defines the options for the SDM engine.
The declarations of the SDM rule can either affect the properties
of the SDM engine (in the sense of JavaBean properties), or they
can be special properties interpreted internally by the SDM engine.
Example:
SDM {
baseURL : "file:/home/user/mydata/";
Map : "usa.ivl"
LinkLayout : true;
}
In this example, the baseURL
declaration calls the method setBaseURL
of the SDM engine. On the other hand,
the Map and LinkLayout declarations
are interpreted internally by the SDM engine. The Map
option tells the SDM engine that it must display a background map,
and that the objects must be placed on the map according to
their latitude and longitude properties. The LinkLayout
options tells the engine to apply an automatic layout algorithm
to reshape the links orthogonally and to avoid crossings.
Some options can be further customized through additional
rules. For example, the LinkLayout option
has additional parameters that can be configured as follows:
LinkLayout {
linkOffset : 5;
}
The SDM engine provides many other predefined rendering options.
Here is a list of the available options:
| Animation | Shows an animation during the rendering process. |
| Coloring | Allocates colors to objects automatically. |
| Decoration | Adds decoration objects to the grapher. |
| ExpandCollapse | Allows you to expand and collapse subgraphs. |
| HalfZooming | Prevents the nodes from zooming past a given level. |
| InfoBalloon | Opens an info balloon showing some property values of the objects. |
| Legend | Displays a legend for the graphic objects. |
| DrillDown | Shows more and more objects when zooming in. |
| Map | Displays a background map and places objects in a geo-referenced way. |
| GraphLayout | Applies a layout algorithm to the nodes. |
| LinkLayout | Applies a layout algorithm to the links. |
| LabelLayout | Minimizes the overlap of labels attached to nodes and links. |
| StyleSheet | Allows you to customize the style sheet engine. |
IlvSDMRenderer. The renderers attached
to an SDM engine form a chained list. It is possible to create and
configure the renderers by code (see the method setRenderer,
but the preferred way is by setting options in the style sheet
as explained above.
Read the user documentation for a more detailed description of each renderer and its parameters.
The XML data file simply contains two nodes of tag
"activity" connected by a link of tag
"transition":
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE SDM>
<SDM>
<activity id="1">
<property name="label">Activity 1</property>
<property name="x">291.125</property>
<property name="y">56.375</property>
</activity>
<activity id="2">
<property name="label">Activity 2</property>
<property name="x">195.33594</property>
<property name="y">87.375</property>
</acivity>
<transition id="3" islink="true" from="1" to="2" />
</SDM>
Here is an example of a style sheet file:
SDM {
LinkLayout : true;
}
node.activity {
class : "ilog.views.sdm.graphic.IlvGeneralNode";
shapeType : RoundRectangle;
icon : "activity.gif";
label : "@label";
fillColor1 : brown;
}
link.transition {
class : "ilog.views.sdm.graphic.IlvGeneralLink";
mode : "MODE_GRADIENT";
foreground : orange;
oriented : true;
}
node:selected {
fillColor1 : red;
}
link:selected {
foreground : red;
mode : "MODE_NEON";
}
Finally, here is the code needed to set up the engine:
// Create the SDM engine:
IlvSDMEngine engine = new IlvSDMEngine();
// Set up a manager view:
IlvManagerView view = new IlvManagerView(engine.getGrapher());
// ... create GUI around the manager view...
// Set style sheet and XML data file:
try {
engine.setStyleSheets(new String[] { "file:example.css" });
engine.setXMLFile("file:example.xml");
} catch(IOException ex){
ex.printStackTrace();
} catch(IlvSDMException ex){
ex.printStackTrace();
}
To make things even simpler, rather than creating an IlvSDMEngine,
you can create an IlvSDMView
that will create an instance of IlvSDMEngine
internally.
IlvSDMModel,
IlvSDMView,
IlvGeneralNode,
IlvGeneralLink,
Serialized Form| Field Summary | |
|---|---|
static int |
ALWAYS
Used as a parameter to setRenderingDoneMode(int), specifies that
the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method must always be called on selection or property changes. |
static String |
HIGH_DETAIL_LEVEL
The pseudoclass "high-detail-level" that indicates a high level of detail. |
static int |
IF_BBOX_CHANGED
Used as a parameter to setRenderingDoneMode(int), specifies that
the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method must called on selection or property changes only when the bounding
box of a graphic object has changed. |
static String |
LOW_DETAIL_LEVEL
The pseudoclass "low-detail-level" that indicates a low level of detail. |
static String |
MEDIUM_DETAIL_LEVEL
The pseudoclass "medium-detail-level" that indicates a medium level of detail. |
static int |
NEVER
Used as a parameter to setRenderingDoneMode(int), specifies that
the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method must never be called on selection or property changes. |
| 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 | |
|---|---|
IlvSDMEngine()
Creates an SDM engine for a new grapher with a default data model, which is an instance of the class IlvDefaultSDMModel. |
|
IlvSDMEngine(IlvGrapher grapher,
IlvSDMModel model)
Creates an SDM engine with a specified grapher and data model. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener on property modification. |
void |
addPseudoClass(Object object,
String pseudoClass)
Adds a pseudo-class to the specified data object. |
void |
addSDMEngineDataLoadingListener(SDMEngineDataLoadingListener listener)
Adds an SDMEngineDataLoadingListener
to this SDM engine. |
void |
addSDMEngineSelectionListener(SDMEngineSelectionListener listener)
Adds an SDMEngineSelectionListener
to this SDM engine. |
void |
addSDMEngineStyleSheetListener(SDMEngineStyleSheetListener listener)
Adds an SDMEngineStyleSheetListener
to this SDM engine. |
Object |
applyStyle(Object bean,
Object nodeOrLink,
String[] pseudoClasses)
Applies the current style sheet(s) of this SDM engine to a bean. |
Object |
applyStyle(Object bean,
String ruleName,
String[] pseudoClasses)
Applies the current style sheet(s) of this SDM engine to a bean. |
boolean |
canPaste()
Returns true if data has been copied to the clipboard through
the cut() or copy() methods. |
void |
clearAdjusting()
Stops an editing sequence and prevents JViews Diagrammer from performing any computation regarding the changes. |
void |
copy()
Copies the selected objects of the data model to the system clipboard. |
void |
customizeAllObjects()
Recustomizes all the graphic objects corresponding to the data objects returned by the SDM model. |
void |
cut()
Copies the selected objects of the data model to the system clipboard, and removes them from the data model. |
void |
delete()
Removes the selected data objects from the model. |
void |
deselectAllObjects()
Deselects all the graphic objects that represent objects of the data model. |
void |
duplicate()
Duplicates the selected data objects. |
Enumeration |
getAllObjects()
Returns an enumeration of all the objects of the model (including all descendants of the top-level objects) in pre-order (that is, a parent is returned before its children). |
String |
getBaseURL()
Returns the base URL used by this SDM engine to find its resources, such as the map files or the bitmap files. |
Object |
getCSSInternal()
This method is for internal use; you should not call it directly. |
String |
getDetailLevel()
Returns the pseudoclass that represents the current level of detail. |
IlvGrapher |
getGrapher()
Returns the grapher associated with this SDM engine. |
ilog.views.sdm.internal.IlvGrapherCleanerHandler |
getGrapherCleanerHandler()
Returns the current grapher cleaner handler. |
IlvGraphic |
getGraphic(Object object,
boolean createIfNeeded)
Returns the JViews graphic object associated with an application object. |
String |
getID(Object obj)
Returns the identifier of a data object. |
IlvLabelLayoutRenderer |
getLabelLayoutRenderer()
Returns the graph layout renderer that is responsible for the layout of labels. |
IlvGraphLayoutRenderer |
getLinkLayoutRenderer()
Returns the graph layout renderer that is responsible for the layout of links. |
IlvSDMModel |
getModel()
Returns the current data model. |
IlvGraphLayoutRenderer |
getNodeLayoutRenderer()
Returns the graph layout renderer that is responsible for the layout of nodes. |
Object |
getObject(IlvGraphic graphic)
Returns the data object (that is, the object returned by the SDM model) associated with a graphic object, or null if the specified graphic object
does not represent an object of the data model. |
Object |
getObject(IlvPoint p,
IlvManagerView view)
Returns the data object associated with the graphic object at a specified point in a manager view. |
Object |
getObject(IlvPoint p,
IlvManagerView view,
boolean traverse)
Returns the data object associated with the graphic object at a specified point in a manager view. |
Object |
getObject(String id)
Looks up the data model for an object with the specified identifier. |
Enumeration |
getObjectsWithPseudoClass(String pseudoClass)
Returns all the objects of the model that have a given pseudo-class. |
Object |
getParent(IlvManagerView view,
float x,
float y,
boolean managerCoordinates)
Returns the parent object located at the specified coordinates in the view. |
String[] |
getPseudoClasses()
Returns the pseudoclasses associated with all data objects. |
String[] |
getPseudoClasses(Object object)
Returns the pseudo-classes associated with the specified data object. |
IlvManagerView |
getReferenceView()
Returns the reference view of this SDM engine. |
double |
getReferenceZoom()
Returns the reference zoom factor. |
IlvSDMRenderer |
getRenderer()
Returns the root of the renderer chain. |
int |
getRenderingDoneMode()
Returns the flag that determines the way the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method is called on selection or property changes. |
static IlvSDMEngine |
getSDMEngine(IlvGrapher grapher)
Returns the SDM engine associated with the specified grapher, or null if no SDM engine is associated
with the specified grapher. |
static IlvSDMEngine |
getSDMEngine(IlvGraphic graphic)
Returns the SDM engine associated with the grapher in which the specified graphic object is contained, or null if the graphic is not contained in
a grapher or if the grapher has no associated SDM engine. |
Enumeration |
getSelectedObjects()
Returns an enumeration containing the data objects represented by the graphic objects that are currently selected in the grapher. |
String |
getSelectionPseudoClass()
Returns the pseudo-class used to style selected objects. |
String |
getStringFromClipboard()
For internal use only. |
int |
getStyleSheetDebugMask()
Returns the debug level of the current configuration style sheet. |
String[] |
getStyleSheets()
Returns the style sheet(s) used by this SDM engine to map the data model to ILOG JViews graphic objects. |
String |
getStyleSheets(int index)
Returns one of the style sheets used by this SDM engine to map the data model to ILOG JViews graphic objects. |
IlvXMLConnector |
getXMLConnector()
Returns the IlvXMLConnector
object used to read and write the contents of the
SDM data model from/to XML files. |
String |
getXMLFile()
Returns the URL of the XML file currently being displayed by the SDM engine. |
String |
getXMLProcessingInstructionProperty(String property)
Returns a property to be saved in the XML processing instruction for SDM. |
void |
group(Object parent)
Groups the selected objects. |
boolean |
hasPseudoClass(Object object,
String pseudoClass)
Returns true if and only if the specified object has
the specified pseudo-class. |
boolean |
isAdjusting()
Returns true if and only if the SDM engine
is currently in an editing sequence. |
boolean |
isDropToGroupEnabled()
Returns true if dropping or duplicating a node in
an existing subgraph will make the node a child of this
subgraph, or false otherwise. |
boolean |
isHighlightingSelection()
Returns true if "selection by highlighting" is enabled,
or false if the usual selection handles are used to show
selected objects. |
boolean |
isJavaColorNamesFirst()
Returns true if Java color names are to be used instead of SVG color names when there is a conflict. |
boolean |
isLabelLayoutEnabled()
Returns the enabled state of the automatic layout algorithm for labels. |
boolean |
isLayoutRunning()
Returns the flag indicating that a layout algorithm is running. |
boolean |
isLinkLayoutEnabled()
Returns the enabled state of the automatic layout algorithm for links. |
boolean |
isLinkLayoutEnabledWhileMoving()
Returns true if the automatic link layout is enabled while
moving a node. |
boolean |
isLinkNodeVisibilityCoupled()
Returns true if the links are visible (if and only if origin and
destination nodes are visible). |
boolean |
isMetadataEnabled()
Returns true if metadata are enabled. |
boolean |
isNodeLayoutEnabled()
Returns the enabled state of the automatic layout algorithm for nodes. |
boolean |
isOpaqueMove()
Returns the Opaque Move mode of the select interactor attached to the views of this SDM engine. |
boolean |
isResizingAllowed()
Returns true if the user is allowed to resize nodes
interactively. |
boolean |
isSelected(Object object)
Returns true if and only if the graphic
representation of the specified object is selected. |
void |
loadData()
Loads the data described by the current model using the current renderer. |
void |
moveObject(Object object,
float x,
float y,
IlvTransformer t,
int alignment,
boolean redraw)
Deprecated. Beginning with JViews 2002, this method is deprecated because it does not work properly when the object is contained in a subgraph. Use the method moveObject(java.lang.Object,ilog.views.IlvManagerView,float,float,boolean,int,boolean)
instead. |
void |
moveObject(Object object,
IlvManagerView view,
float x,
float y,
boolean translate,
int alignment,
boolean redraw)
Moves or translates an object to a specified view position. |
void |
paste()
Reads the data objects currently contained in the system clipboard (as an XML string) and adds them to the data model. |
void |
performLabelLayout()
Performs a graph layout algorithm on the labels of the graph. |
void |
performLinkLayout()
Performs a layout algorithm on the links of the graph. |
void |
performNodeLayout()
Performs a layout algorithm on the nodes of the graph. |
boolean |
processServerAction(int x,
int y,
IlvManagerView view)
This method can be called when the SDM engine is used on the server-side of a web application, to process an action sent by the client-side. |
protected void |
processXMLProcessingInstructionProperty(String property,
String value,
String url,
boolean insert)
Processes a property read from the SDM processing instruction in an XML file. |
void |
putStringToClipboard(String data)
For internal use only. |
void |
readDOM(Document document)
Reads an SDM data model from a DOM document. |
void |
readDOM(Document document,
boolean add)
Reads an SDM data model from a DOM document. |
void |
readXML(InputStream stream)
Reads an XML description of an SDM data model from an input stream. |
void |
readXML(InputStream stream,
boolean add)
Reads an XML description of an SDM data model from an input stream. |
void |
readXML(Reader reader)
Reads an XML description of an SDM data model from a Reader. |
void |
readXML(Reader reader,
boolean add)
Reads an XML description of an SDM data model from a Reader. |
void |
readXML(String url)
Reads an XML description of an SDM data model from a URL. |
void |
readXML(String url,
boolean add)
Reads an XML description of an SDM data model from a URL. |
IlvGraphic |
recreateObject(Object object,
boolean redraw,
boolean oneLevel)
Re-creates a graphic representation of a model object. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener on property modification. |
void |
removePseudoClass(Object object,
String pseudoClass)
Removes a pseudo-class from the specified data object. |
void |
removeSDMEngineDataLoadingListener(SDMEngineDataLoadingListener listener)
Removes an SDMEngineDataLoadingListener
from this SDM engine. |
void |
removeSDMEngineSelectionListener(SDMEngineSelectionListener listener)
Removes an SDMEngineSelectionListener
from this SDM engine. |
void |
removeSDMEngineStyleSheetListener(SDMEngineStyleSheetListener listener)
Removes an SDMEngineStyleSheetListener
from this SDM engine. |
void |
renderingDone()
This method calls the renderingDone
method of the renderer. |
void |
scrollToObject(Object object)
Makes sure that an object is visible in the reference view of this SDM engine. |
void |
selectAllObjects()
Selects all the graphic objects that represent objects of the data model. |
void |
setAdjusting(boolean adjusting)
Starts or stops an editing sequence. |
void |
setBaseURL(String url)
Sets the base URL used by this SDM engine to find its resources, such as the map files or the bitmap files. |
void |
setDetailLevel(String level)
Sets the current level of detail. |
void |
setDropToGroupEnabled(boolean enabled)
Specifies whether or not dropping or duplicating a node in an existing subgraph will make the node a child of this subgraph. |
void |
setGrapher(IlvGrapher grapher)
Sets the grapher associated with this SDM engine. |
void |
setGrapherCleanerHandler(ilog.views.sdm.internal.IlvGrapherCleanerHandler handler)
Sets the grapher cleaner handler, which is called when SDM wants to remove its objects. |
void |
setHighlightingSelection(boolean yes)
Enables "selection by highlighting". |
void |
setJavaColorNamesFirst(boolean val)
Specifies whether to use Java color names or SVG color names when there is a conflict. |
void |
setLabelLayoutEnabled(boolean enabled)
Enables or disables the automatic layout of labels. |
void |
setLayoutRunning(boolean running)
Sets the flag indicating that a layout algorithm is running. |
void |
setLinkLayoutEnabled(boolean enabled)
Enables or disables the automatic layout of links. |
void |
setLinkLayoutEnabledWhileMoving(boolean enabled)
Enables or disables the automatic link layout while moving nodes. |
void |
setLinkNodeVisibilityCoupled(boolean coupled)
Sets whether link visibility is coupled to node visibility. |
void |
setMetadataEnabled(boolean on)
Controls whether metadata are enabled or not. |
void |
setModel(IlvSDMModel model)
Changes the data model used by this SDM engine. |
void |
setModel(IlvSDMModel model,
boolean reload)
Changes the data model used by this SDM engine. |
void |
setNodeLayoutEnabled(boolean enabled)
Enables or disables the automatic layout of nodes. |
void |
setOpaqueMove(boolean opaque)
Sets the Opaque Move mode of the select interactor attached to the views of this SDM engine. |
void |
setPseudoClasses(String[] classes)
Sets the pseudoclasses associated with all data objects. |
void |
setReferenceView(IlvManagerView view)
Sets the reference view of this SDM engine. |
void |
setReferenceZoom(double zoom)
Sets the initial zoom factor that is used as a reference to compute zoom-related behavior. |
void |
setRenderer(IlvSDMRenderer renderer)
Changes the root of the renderer chain. |
void |
setRenderingDoneMode(int renderingDoneMode)
Determines the way the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method is called on selection or property changes. |
void |
setResizingAllowed(boolean allowed)
Allows or forbids the user to resize nodes interactively. |
static void |
setSDMEngine(IlvGrapher grapher,
IlvSDMEngine engine)
Associates an SDM engine with the specified grapher. |
void |
setSelected(Object[] objects,
boolean selected)
Selects or deselects the graphic objects representing the specified array of data objects. |
void |
setSelected(Object object,
boolean selected)
Selects or deselects the graphic object representing a specified data object. |
void |
setSelectionPseudoClass(String selectionPseudoClass)
Changes the pseudo-class used to style selected objects. |
void |
setStyleSheetDebugMask(int v)
Sets the debug flag while parsing the configuration style sheet. |
void |
setStyleSheets(int index,
String css)
Changes one of the cascading style sheets. |
void |
setStyleSheets(int index,
String css,
boolean reload)
Same as setStyleSheets(int, String), with the possibility to not recreate
the diagram. |
void |
setStyleSheets(String[] css)
Sets the style sheet(s) used by this SDM engine to map the data model to ILOG JViews graphic objects. |
void |
setStyleSheets(String[] css,
boolean reload,
boolean recreate)
Sets the style sheet(s) used by this SDM engine to map the data model to ILOG JViews graphic objects. |
void |
setXMLConnector(IlvXMLConnector connector)
Sets the IlvXMLConnector
object used to read and write the contents of the
SDM data model from/to XML files. |
void |
setXMLFile(String xmlFile)
Sets the XML file containing the data to display. |
void |
setXMLProcessingInstructionProperty(String property,
String value)
Sets a property to be saved in the XML processing instruction for SDM. |
void |
ungroup()
Ungroups the selected objects. |
void |
updateNodePositions()
Saves the positions of all the nodes in the data. |
void |
updateObjectProperties(Object object,
String property,
Object value,
String[] pseudoClasses)
This method calls IlvSDMRenderer.updateObjectProperties(ilog.views.sdm.IlvSDMEngine, java.lang.Object, java.lang.String, java.lang.Object, java.lang.String[])
on the root renderer of the SDM engine. |
void |
writeDOM(Document document)
Writes the data contained in the current data model to a DOM document. |
void |
writeXML(OutputStream stream)
Writes the data contained in the current data model to a stream. |
void |
writeXML(String filename)
Writes the data contained in the current data model to an XML file. |
void |
writeXML(Writer writer)
Writes the data contained in the current data model to a Writer. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String HIGH_DETAIL_LEVEL
public static final String MEDIUM_DETAIL_LEVEL
public static final String LOW_DETAIL_LEVEL
public static final int IF_BBOX_CHANGED
setRenderingDoneMode(int), specifies that
the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method must called on selection or property changes only when the bounding
box of a graphic object has changed.
public static final int NEVER
setRenderingDoneMode(int), specifies that
the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method must never be called on selection or property changes.
public static final int ALWAYS
setRenderingDoneMode(int), specifies that
the IlvSDMRenderer.renderingDone(ilog.views.sdm.IlvSDMEngine)
method must always be called on selection or property changes.
| Constructor Detail |
|---|
public IlvSDMEngine(IlvGrapher grapher,
IlvSDMModel model)
grapher - The grapher.model - The data model.public IlvSDMEngine()
IlvDefaultSDMModel.
The default model is initially empty.
IlvDefaultSDMModel,
IlvStyleSheetRenderer| Method Detail |
|---|
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener in interface IlvStylablelistener - The listener to add.public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener in interface IlvStylablelistener - The listener to remove.
public void setStyleSheets(String[] css)
throws IlvSDMException
The CSS documents in
the css array are concatenated. The
style sheets with a higher index in the array have
a higher priority.
This call will re-create the SDM renderers and
all the graphic objects. See also the variant
setStyleSheets(java.lang.String[],boolean,boolean)
that lets you control how the style sheets are applied.
See the class description for an explanation of the contents of the style sheet files.
setStyleSheets in interface IlvStylablecss - An array of strings containing the URLs
or the file names of CSS files (usually with a .css
suffix). A direct String representing the CSS document itself is allowed,
too.
IlvSDMExceptionsetStyleSheets(int,java.lang.String),
setStyleSheets(java.lang.String[],boolean,boolean)
public void setStyleSheets(String[] css,
boolean reload,
boolean recreate)
throws IlvSDMException
This method is similar to setStyleSheets(java.lang.String[])
but provides two additional parameters, reload and recreate,
that control how the new style sheets are applied.
The reload parameter specifies whether or not the graphic objects
representing the SDM data model will be updated.
The recreate parameter specifies whether the graphic objects
representing the SDM data model will be re-created or if the new style sheets
will simply be applied to the existing graphic objects. This also applies to
the SDM renderers: if recreate is true, the renderers
defined in the style sheet are re-created; otherwise their properties are simply
set according to the new style sheets.
Setting recreate to false lets you update the display
much more quickly, but there are some limitations:
"@#" construct) will be re-created as usual.
css - An array of strings representing the CSS document (usually
with a file or URL with .css suffix).reload - If this parameter is true, the graphic objects
representing the current SDM data model are updated according
to the new style sheets. If this parameter is false, the graphic objects
are not updated. They can be updated later by calling loadData() or
customizeAllObjects().
The way the graphic objects are updated depends on the
recreate parameter.recreate - If this parameter is true, all the graphic objects
and the SDM renderers are re-created according to the new style sheets.
If this parameter is false, the graphic objects and the SDM renderers
are not re-created. Instead, their properties are set according to the new style sheets.
IlvSDMException - if an SDM exception occurs
public void setStyleSheets(int index,
String css)
throws IlvSDMException
setStyleSheets(java.lang.String[]).
It lets you change one particular style sheet file, instead of setting
the whole style sheet array.
This call will reload the data model and re-create all the graphic objects. Warning, this method will override the current renderers.
This is a bound property. It means the implementation should
fire a PropertyChange event to all registered
PropertyChangeListeners after setting the new value.
The old and new value arguments of the event represent the whole array.
setStyleSheets in interface IlvStylableindex - The index of the style sheet to replace.css - A String representing the CSS document (usually
a file name or URL with .css suffix).
IlvSDMException - if there is a problem with the specified
CSS.setStyleSheets(java.lang.String[])
public void setStyleSheets(int index,
String css,
boolean reload)
throws IlvSDMException
setStyleSheets(int, String), with the possibility to not recreate
the diagram.
index - The index of the style sheet to replace.css - A String representing the CSS document (usually
a filename or a URL with the .css suffix).reload - If false, do not recreate the diagram.
IlvSDMException - if there is a problem with the specified
CSS.public String getStyleSheets(int index)
getStyleSheets in interface IlvStylableindex - The position of the style sheet.
index-th
style sheet.setStyleSheets(java.lang.String[]),
getStyleSheets()public String[] getStyleSheets()
getStyleSheets in interface IlvStylablesetStyleSheets(java.lang.String[]),
getStyleSheets(int)public void setStyleSheetDebugMask(int v)
setStyleSheets to debug problems during
configuration. The default value traces bad class names and
"set" methods that raise an exception.
setStyleSheetDebugMask in interface IlvStylablev - The debug mask, as defined in IlvStyleSheetRenderer.IlvStyleSheetRenderer.setDebugMask(int),
setStyleSheets(String[]),
getStyleSheetDebugMask()public int getStyleSheetDebugMask()
getStyleSheetDebugMask in interface IlvStylablesetStyleSheetDebugMask(int)
public Object applyStyle(Object bean,
String ruleName,
String[] pseudoClasses)
This method gives direct access to the styling engine and is useful to style any JavaBean of an application.
This variant styles a bean independently of the SDM data model, that
is, a bean that is not associated with any node or link of
the graph. The rule that is used to style the bean is specified by
the ruleName parameter. See also the other variant
applyStyle(java.lang.Object,java.lang.Object,java.lang.String[])
that styles a bean using a node or link rule.
Example
Here is how you could style a JTree of your GUI:
IlvSDMEngine engine = ...
JTree tree = new JTree();
engine.applyStyle(tree, "JTree", null);
And here is a rule that could be used in the style sheet:
JTree {
editable : "true"; // calls tree.setEditable(true);
rootVisible : "false"; // calls tree.setRootVisible(false);
}
bean - The JavaBean to which the style sheets will be applied.
If this parameter is null, and if the rule contains a
declaration for the "class" property, an instance
of this class will be created and returned by this method.ruleName - The name of the style rule that will be applied.pseudoClasses - The pseudo-classes used to select the style rule to
apply. This parameter can be null.
bean parameter, or the new bean created if the
bean parameter was null and rule contained a
declaration for the "class" property.