|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.view.DefaultGraph2DRenderer
yext.svg.io.SVGGraph2DRenderer
yext.svg.io.SVGDOMEnhancer
public class SVGDOMEnhancer
A SVGGraph2DRenderer that allows to enhance the svg document
while it gets generated by SVGIOHandler.
This renderer adds named group elements <g> around the SVG definition of each node and edge in the graph.
Additionally this renderer provides callback methods that will be invoked whenever a node label, a node, an edge, an edge label or a graph has been added to the document. Subclasses can override these methods to add to or modify the generated DOM structure.
As an example, one can hyperlink all graph nodes in the SVG document by overwriting
method nodeAddedToDOM(y.base.Node yNode, org.w3c.dom.Element element) in
the following way:
protected void nodeAddedToDOM(y.base.Node yNode, org.w3c.dom.Element element) {
org.w3c.dom.Element a = createElement("a");
a.setAttribute("xlink:href", "http://www.yworks.com");
insertNodeBelow(a, element);
}
| Field Summary | |
|---|---|
static byte |
LABEL_DETECTION_BY_SEPARATE_RENDERING
Label detection strategy specifier. |
static byte |
LABEL_DETECTION_BY_TEXT_SEARCH
Label detection strategy specifier. |
static byte |
LABEL_DETECTION_BY_WRAPPING
Label detection strategy specifier. |
| Constructor Summary | |
|---|---|
SVGDOMEnhancer()
Creates a new instance of SVGDOMEnhancer |
|
| Method Summary | |
|---|---|
protected String |
createGroupID(Edge edge)
Returns the group identifier assigned to the group element encapsulating the given edge in the SVG document. |
protected String |
createGroupID(Node node)
Returns the group identifier assigned to the group element encapsulating the given node in the SVG document. |
protected void |
edgeAddedToDOM(Edge yEdge,
Element element)
Callback method that will be invoked whenever the given edge has been added to the SVG document. |
protected void |
edgeLabelAddedToDOM(EdgeLabel yEdgeLabel,
Element element)
Callback method that will be invoked whenever the given edge label has been added to the SVG document. |
byte |
getLabelDetectionStrategy()
Returns the detection strategy used for DOM elements that enclose node and edge label graphics. |
protected void |
initializeDOM()
Callback method that will be invoked just before the graph will be added to the SVG document. |
protected void |
nodeAddedToDOM(Node yNode,
Element element)
Callback method that will be invoked whenever the given node has been added to the SVG document. |
protected void |
nodeLabelAddedToDOM(NodeLabel yNodeLabel,
Element element)
Callback method that will be invoked whenever the given node label has been added to the SVG document. |
void |
paint(Graphics2D gfx,
EdgeRealizer r)
|
protected void |
paint(Graphics2D gfx,
EdgeRealizer r,
boolean sloppyMode)
Renders the given edge realizer on the given graphics context. |
void |
paint(Graphics2D gfx,
Graph2D graph)
Renders the graph on the given graphics context. |
void |
paint(Graphics2D gfx,
NodeRealizer r)
|
protected void |
paint(Graphics2D gfx,
NodeRealizer r,
boolean sloppyMode)
Renders the given node realizer on the given graphics context. |
void |
paintSloppy(Graphics2D gfx,
EdgeRealizer r)
|
void |
paintSloppy(Graphics2D gfx,
Graph2D graph)
Renders the graph sloppily on the given graphics context. |
void |
paintSloppy(Graphics2D gfx,
NodeRealizer r)
|
void |
setLabelDetectionStrategy(byte labelDetectionStrategy)
Sets the detection strategy used for DOM elements that enclose node label and edge label graphics. |
| Methods inherited from class yext.svg.io.SVGGraph2DRenderer |
|---|
addToSVGDefinition, createCDATASection, createElement, getSVGDocument, getSVGIOHandler, getTopLevelGroup, insertNodeAbove, insertNodeBelow, setSVGIOHandler, setTopLevelGroup, writeDocument |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte LABEL_DETECTION_BY_TEXT_SEARCH
public static final byte LABEL_DETECTION_BY_SEPARATE_RENDERING
public static final byte LABEL_DETECTION_BY_WRAPPING
YLabel.paint(java.awt.Graphics2D).
| Constructor Detail |
|---|
public SVGDOMEnhancer()
| Method Detail |
|---|
public void paint(Graphics2D gfx,
Graph2D graph)
initializeDOM() will be
invoked.
paint in interface Graph2DRendererpaint in class DefaultGraph2DRenderer
public void paintSloppy(Graphics2D gfx,
Graph2D graph)
initializeDOM() will be
invoked.
paintSloppy in interface Graph2DRendererpaintSloppy in class DefaultGraph2DRenderer
public void paint(Graphics2D gfx,
NodeRealizer r)
paint in class SVGGraph2DRenderer
public void paintSloppy(Graphics2D gfx,
NodeRealizer r)
paintSloppy in class SVGGraph2DRenderer
public void paint(Graphics2D gfx,
EdgeRealizer r)
paint in class SVGGraph2DRenderer
public void paintSloppy(Graphics2D gfx,
EdgeRealizer r)
paintSloppy in class SVGGraph2DRenderer
protected void paint(Graphics2D gfx,
NodeRealizer r,
boolean sloppyMode)
nodeAddedToDOM(y.base.Node, org.w3c.dom.Element) will be
invoked. Also, the method nodeLabelAddedToDOM(NodeLabel, org.w3c.dom.Element)
will be invoked for each node label that has been added to the SVG document.
protected void paint(Graphics2D gfx,
EdgeRealizer r,
boolean sloppyMode)
edgeAddedToDOM(Edge, org.w3c.dom.Element) will be
invoked. Also, the method edgeLabelAddedToDOM(EdgeLabel, org.w3c.dom.Element)
will be invoked for each edge label that has been added to the SVG document.
protected void nodeAddedToDOM(Node yNode,
Element element)
protected void nodeLabelAddedToDOM(NodeLabel yNodeLabel,
Element element)
protected void edgeAddedToDOM(Edge yEdge,
Element element)
protected void edgeLabelAddedToDOM(EdgeLabel yEdgeLabel,
Element element)
protected void initializeDOM()
protected String createGroupID(Node node)
By default the identifier "y.node." + node.index() will be returned.
protected String createGroupID(Edge edge)
By default the identifier "y.edge." + edge.index() will be returned.
public byte getLabelDetectionStrategy()
public void setLabelDetectionStrategy(byte labelDetectionStrategy)
LABEL_DETECTION_BY_WRAPPING is set.
labelDetectionStrategy - one of
LABEL_DETECTION_BY_WRAPPING,
LABEL_DETECTION_BY_TEXT_SEARCH, or
LABEL_DETECTION_BY_SEPARATE_RENDERING.
|
© Copyright 2000-2007, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||