cwi.GraphXML
Interface GraphSemantics

All Known Implementing Classes:
DebugGraphSemantics, GraphSemanticsAdapter

public interface GraphSemantics

Semantic methods for the interpretation of an xmlgraph. This interface has to be implemented by the application, and handed over to the parser.

Important warning: all methods have to be programmed very defensively with regard to null values. Anything which is not specified by the xmlgraph file is forwarded through null values, instead of creating essentially empty objects. For example, application values are collected in a separate object, but if no application value is specified for a given element, the corresponding object reference in the call is null. Although this is a bit disagreeable for the application programmer, this avoid the creation of unnecessary objects, which could significantly slow down the parser for a large graph file.

Note that the function replaceNodeComponent should be implemented even if the application does not implement the full editing semantics. Indeed, this method is called if there are postdefinite nodes, like in the following example:

     <edge name="something" source="name1" target="name2">
     <node name="name1">
       .
       .
       .
     </node>
 
The parser will create the node "name1" first as a simple (empty) node, and will then invoke the replaceNodeComponent to fill in the components.

Author:
Ivan Herman

Method Summary
 void closeEditBundle()
          Close edit bundle.
 void closeGraph()
          Close current graph
 void closeGraphXML()
          Close GraphXML.
 void closeRemoveBlock()
          Close remove block
 void closeReplaceBlock()
          Close replace block
 void handlePI(java.lang.String target, java.util.HashMap props)
          Handle a processing instruction.
 void initGraphXML(ApplicationData applData, Extensions ext, ParserError parserError)
          Init GraphXML.
 void newEdge(java.lang.String name, java.lang.String source, java.lang.String target)
          New edge with no additional information.
 void newEdge(java.lang.String name, java.lang.String source, java.lang.String target, Reference sourceReference, Reference targetReference)
          New edge with no additional information.
 void newEdge(java.lang.String name, java.lang.String xml_class, java.lang.String source, java.lang.String target, ApplicationData applData, Extensions ext, VisualProperties vis_props, AttributeProperties attrs, Path path)
          New edge in a graph definition.
 void newEdge(java.lang.String name, java.lang.String xml_class, java.lang.String source, java.lang.String target, Reference sourceReference, Reference targetReference, ApplicationData applData, Extensions ext, VisualProperties style, AttributeProperties attrs, Path path)
          New edge in a graph definition.
 void newEditBundle()
          New edit bundle starts.
 void newGraph(java.lang.String id, AttributeProperties attrs, ApplicationData applData, Extensions ext, Style style, Picture icon, Size size)
          New graph.
 void newNode(java.lang.String name)
          New node with no additional information.
 void newNode(java.lang.String name, java.lang.String xml_class, boolean metanode, Reference reference, ApplicationData applData, Extensions ext, VisualProperties vis_props, AttributeProperties attrs, Style subgraphStyle, Position position, Size size, Transform transform)
          New node in a graph definition.
 void newRemoveBlock(java.lang.String id, Reference reference, AttributeProperties attrs)
          New remove block starts
 void newReplaceBlock(java.lang.String id, Reference reference, AttributeProperties attrs)
          New replace block starts
 void removeEdge(java.lang.String name, java.lang.String source, java.lang.String target)
          Remove an edge
 void removeEdgeComponent(java.lang.String name, java.lang.String source, java.lang.String target, ApplicationData applData, Extensions ext, VisualProperties vis_props, AttributeProperties attrs, Path path)
          Remove edge components
 void removeNode(java.lang.String name)
          Remove a Node
 void removeNodeComponent(java.lang.String name, ApplicationData applData, Extensions ext, VisualProperties vis_props, AttributeProperties attrs, Style subgraphStyle, Position position, Size size, Transform transform)
          Remove components of a node.
 void replaceEdge(java.lang.String name, java.lang.String xml_class, java.lang.String source, java.lang.String target)
          Replace an edge
 void replaceEdgeComponent(java.lang.String name, java.lang.String xml_class, java.lang.String source, java.lang.String target, ApplicationData applData, Extensions ext, VisualProperties vis_props, AttributeProperties attrs, Path path)
          Replace edge components
 void replaceNode(java.lang.String name, java.lang.String xml_class, boolean metanode, Reference reference)
          Replace a Node
 void replaceNodeComponent(java.lang.String name, java.lang.String xml_class, boolean metanode, Reference reference, ApplicationData applData, Extensions ext, VisualProperties vis_props, AttributeProperties attrs, Style subgraphStyle, Position position, Size size, Transform transform)
          Replace components of a node.
 

Method Detail

handlePI

public void handlePI(java.lang.String target,
                     java.util.HashMap props)
Handle a processing instruction.

Parameters:
target - the target of the pi, ie the string appearing after "props - the key-value pairs appearing in the processing instruction

initGraphXML

public void initGraphXML(ApplicationData applData,
                         Extensions ext,
                         ParserError parserError)
Init GraphXML. This routine is called before any other element is interpreted, is used to initialize the full parsing.

Parameters:
applData - the application element data which may be associated with the full GraphXML file
ext - user defined extensions to the GraphXML structure
parserError - the parser in charge; used to generate error messages.

closeGraphXML

public void closeGraphXML()
Close GraphXML. Invoked when all other elements have already been intepreted.


newGraph

public void newGraph(java.lang.String id,
                     AttributeProperties attrs,
                     ApplicationData applData,
                     Extensions ext,
                     Style style,
                     Picture icon,
                     Size size)
New graph.

The visual style appearing in the call is "reconciled" with the file-level style, ie, a input argument value is the (semantic) merge of the file level and graph level style.

Parameters:
id - graph ID
attrs - all the attributes of the graph
applData - application data (label, data, data references)
ext - possible extensions
style - visual style
icon - icon image
size - size information

closeGraph

public void closeGraph()
Close current graph


newNode

public void newNode(java.lang.String name,
                    java.lang.String xml_class,
                    boolean metanode,
                    Reference reference,
                    ApplicationData applData,
                    Extensions ext,
                    VisualProperties vis_props,
                    AttributeProperties attrs,
                    Style subgraphStyle,
                    Position position,
                    Size size,
                    Transform transform)
New node in a graph definition.

Parameters:
name - Name of the node
xml_class - Class of the node
metanode - whether this is a metanode
reference - reference data for a metanode
ext - possible extensions
vis_props - Visual Properties
attrs - additional attributes
position - Position of the node
size - Node size
transform - Tranformation matrix for a metanode

newNode

public void newNode(java.lang.String name)
New node with no additional information. This is a shorthand which may optimize some operations.

Parameters:
name - Name of the node

newEdge

public void newEdge(java.lang.String name,
                    java.lang.String xml_class,
                    java.lang.String source,
                    java.lang.String target,
                    Reference sourceReference,
                    Reference targetReference,
                    ApplicationData applData,
                    Extensions ext,
                    VisualProperties style,
                    AttributeProperties attrs,
                    Path path)
New edge in a graph definition.

Parameters:
name - name of the edge
xml_class - class of the edge
source - source node of the edge
target - target node of the edge
sourceReference - Cross-reference to source of the edge
targetReference - Cross-reference to target of the edge
ext - possible extensions
attrs - additional properties
path - geometric path

newEdge

public void newEdge(java.lang.String name,
                    java.lang.String xml_class,
                    java.lang.String source,
                    java.lang.String target,
                    ApplicationData applData,
                    Extensions ext,
                    VisualProperties vis_props,
                    AttributeProperties attrs,
                    Path path)
New edge in a graph definition.

Parameters:
name - name of the edge
xml_class - class of the edge
source - source node of the edge
target - target node of the edge
ext - possible extensions
vis_props - Visual Properties
attrs - additional properties
path - geometric path

newEdge

public void newEdge(java.lang.String name,
                    java.lang.String source,
                    java.lang.String target,
                    Reference sourceReference,
                    Reference targetReference)
New edge with no additional information. This is a shorthand which may optimize some operations.

Parameters:
name - Name of the node
source - Source of the edge
target - Target of the edge
sourceReference - Cross-reference to source of the edge
targetReference - Cross-reference to target of the edge

newEdge

public void newEdge(java.lang.String name,
                    java.lang.String source,
                    java.lang.String target)
New edge with no additional information. This is a shorthand which may optimize some operations.

Parameters:
name - Name of the node
source - Source of the edge
target - Target of the edge

newRemoveBlock

public void newRemoveBlock(java.lang.String id,
                           Reference reference,
                           AttributeProperties attrs)
New remove block starts

Parameters:
id - Id of the edit block
reference - reference data for the graph to be edited
attrs - additional properties

newReplaceBlock

public void newReplaceBlock(java.lang.String id,
                            Reference reference,
                            AttributeProperties attrs)
New replace block starts

Parameters:
id - Id of the edit block
reference - reference data for the graph to be edited
attrs - additional properties

closeRemoveBlock

public void closeRemoveBlock()
Close remove block


closeReplaceBlock

public void closeReplaceBlock()
Close replace block


newEditBundle

public void newEditBundle()
New edit bundle starts.


closeEditBundle

public void closeEditBundle()
Close edit bundle.


removeNode

public void removeNode(java.lang.String name)
Remove a Node

Parameters:
name - Node name

replaceNode

public void replaceNode(java.lang.String name,
                        java.lang.String xml_class,
                        boolean metanode,
                        Reference reference)
Replace a Node

Parameters:
name - name of the node
xml_class - class of the node
metanode - whether this is a metanode
reference - reference data for a metanode

removeNodeComponent

public void removeNodeComponent(java.lang.String name,
                                ApplicationData applData,
                                Extensions ext,
                                VisualProperties vis_props,
                                AttributeProperties attrs,
                                Style subgraphStyle,
                                Position position,
                                Size size,
                                Transform transform)
Remove components of a node. Only the non-null components should be removed.

Parameters:
name - Name of the node
ext - possible extensions
vis_props - Visual Properties
attrs - additional attributes
position - Position of the node
size - Node size
transform - Tranformation matrix for a metanode

replaceNodeComponent

public void replaceNodeComponent(java.lang.String name,
                                 java.lang.String xml_class,
                                 boolean metanode,
                                 Reference reference,
                                 ApplicationData applData,
                                 Extensions ext,
                                 VisualProperties vis_props,
                                 AttributeProperties attrs,
                                 Style subgraphStyle,
                                 Position position,
                                 Size size,
                                 Transform transform)
Replace components of a node. Only the non-null components should be replaced.

Parameters:
name - Name of the node
xml_class - Class of the node
metanode - whether this is a metanode
reference - reference data for a metanode
ext - possible extensions
vis_props - Visual Properties
attrs - additional properties
position - Position of the node
size - Node size
transform - Tranformation matrix for a metanode

removeEdge

public void removeEdge(java.lang.String name,
                       java.lang.String source,
                       java.lang.String target)
Remove an edge

Parameters:
name - Name of the edge
source - source node of the edge
target - target node of the edge

replaceEdge

public void replaceEdge(java.lang.String name,
                        java.lang.String xml_class,
                        java.lang.String source,
                        java.lang.String target)
Replace an edge

Parameters:
name - name of the edge
source - source node of the edge
target - target node of the edge

removeEdgeComponent

public void removeEdgeComponent(java.lang.String name,
                                java.lang.String source,
                                java.lang.String target,
                                ApplicationData applData,
                                Extensions ext,
                                VisualProperties vis_props,
                                AttributeProperties attrs,
                                Path path)
Remove edge components

Parameters:
name - Name of the edge
source - source node of the edge
target - target node of the edge
ext - possible extensions
vis_props - Visual Properties
attrs - additional attributes
path - geometric path

replaceEdgeComponent

public void replaceEdgeComponent(java.lang.String name,
                                 java.lang.String xml_class,
                                 java.lang.String source,
                                 java.lang.String target,
                                 ApplicationData applData,
                                 Extensions ext,
                                 VisualProperties vis_props,
                                 AttributeProperties attrs,
                                 Path path)
Replace edge components

Parameters:
name - name of the edge
xml_class - class of the edge
source - source node of the edge
target - target node of the edge
ext - possible extensions
vis_props - Visual Properties
attrs - additional attributes
path - geometric path