yext.svg.view
Class SVGNodeRealizer

java.lang.Object
  extended by y.view.NodeRealizer
      extended by yext.svg.view.SVGNodeRealizer
All Implemented Interfaces:
NodeLayout

public class SVGNodeRealizer
extends NodeRealizer

A node realizer that displays a node as a scalable vector graphics. The scalable vector graphics must be given in SVG format.

This node realizer is based on the SVG implementation provided by the Batik project.


Field Summary
 
Fields inherited from class y.view.NodeRealizer
height, HOTSPOT_E, HOTSPOT_N, HOTSPOT_NE, HOTSPOT_NONE, HOTSPOT_NW, HOTSPOT_S, HOTSPOT_SE, HOTSPOT_SW, HOTSPOT_W, width, x, y
 
Constructor Summary
SVGNodeRealizer()
          Creates a new SVGNodeRealizer with no SVG graphics associated with it.
SVGNodeRealizer(NodeRealizer argNodeRealizer)
          Creates a new SVGNodeRealizer whose attributes are copied from the given realizer.
SVGNodeRealizer(SVGModel model)
          Creates a new SVGIcon that displays the given SVG model.
SVGNodeRealizer(URL svgURL)
          Creates a new SVGNodeRealizer displaying the given SVG graphics.
 
Method Summary
 NodeRealizer createCopy(NodeRealizer nr)
          Creates and returns a new SVGNodeRealizer whose attributes are copied from the given realizer.
 boolean findIntersection(double ix, double iy, double ox, double oy, Point2D result)
           
 SVGModel getModel()
          Returns the underlying SVG model for this SVGNodeRealizer.
 URL getSVGURL()
          Returns the URL of the SVG graphics that will be displayed by this realizer.
 void paintNode(Graphics2D gfx)
          Paints the node as scalable vector graphics on the given graphics context.
 void read(ObjectInputStream in)
          Reads in the serialized form of this realizer.
 void setModel(SVGModel model)
          Sets the underlying SVG model for this SVGNodeRealizer.
 void setSVGURL(URL svgURL)
          Sets the URL of the SVG graphics that will be displayed by this realizer.
 void setToOriginalSize()
          Sets the size of this realizer to the natural size of the svg graphics being displayed.
 void write(ObjectOutputStream out)
          Writes out this realizer in a serialized form.
 
Methods inherited from class y.view.NodeRealizer
addLabel, boundsChanged, calcUnionRect, calcUnionRect, contains, createCopy, createNodeLabel, findBBIntersection, getBoundingBox, getCenterX, getCenterY, getFillColor, getFillColor2, getHeight, getHotSpotColor, getLabel, getLabel, getLabelText, getLayer, getLineColor, getLineType, getNode, getPortCandidates, getSloppySelectionColor, getWidth, getX, getY, hotSpotHit, intersects, isInBox, isSelected, isTransparent, isVisible, labelCount, moveBy, paint, paintHotSpots, paintLayer, paintLayerSloppy, paintSloppy, paintText, removeLabel, repaint, setCenter, setCenterX, setCenterY, setEdgesDirty, setFillColor, setFillColor2, setFrame, setFrame, setHeight, setHotSpotColor, setLabel, setLabelText, setLayer, setLayer, setLineColor, setLineType, setLocation, setSelected, setSize, setSloppySelectionColor, setTransparent, setVisible, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGNodeRealizer

public SVGNodeRealizer()
Creates a new SVGNodeRealizer with no SVG graphics associated with it.


SVGNodeRealizer

public SVGNodeRealizer(SVGModel model)
Creates a new SVGIcon that displays the given SVG model.


SVGNodeRealizer

public SVGNodeRealizer(URL svgURL)
Creates a new SVGNodeRealizer displaying the given SVG graphics. The size of this node will be determined by the bounds of the SVG graphics.


SVGNodeRealizer

public SVGNodeRealizer(NodeRealizer argNodeRealizer)
Creates a new SVGNodeRealizer whose attributes are copied from the given realizer.

Method Detail

createCopy

public NodeRealizer createCopy(NodeRealizer nr)
Creates and returns a new SVGNodeRealizer whose attributes are copied from the given realizer.

Specified by:
createCopy in class NodeRealizer

findIntersection

public boolean findIntersection(double ix,
                                double iy,
                                double ox,
                                double oy,
                                Point2D result)
Overrides:
findIntersection in class NodeRealizer

getSVGURL

public URL getSVGURL()
Returns the URL of the SVG graphics that will be displayed by this realizer.


setSVGURL

public void setSVGURL(URL svgURL)
Sets the URL of the SVG graphics that will be displayed by this realizer. The given URL must point to a resource in SVG format.


getModel

public SVGModel getModel()
Returns the underlying SVG model for this SVGNodeRealizer.


setModel

public void setModel(SVGModel model)
Sets the underlying SVG model for this SVGNodeRealizer.


setToOriginalSize

public void setToOriginalSize()
Sets the size of this realizer to the natural size of the svg graphics being displayed.


paintNode

public void paintNode(Graphics2D gfx)
Paints the node as scalable vector graphics on the given graphics context.

Specified by:
paintNode in class NodeRealizer

write

public void write(ObjectOutputStream out)
           throws IOException
Writes out this realizer in a serialized form. Note that unlike previous versions, SVGNodeRealizer now serializes the complete information contained in the SVG DOM as well as the URL associated to the realizer. As a side effect, serialization/deserialization no longer depends on the location and content of the original SVG file (if that existed at all).

Overrides:
write in class NodeRealizer
Throws:
IOException

read

public void read(ObjectInputStream in)
          throws IOException,
                 ClassNotFoundException
Reads in the serialized form of this realizer. Note that unlike previous versions, SVGNodeRealizer now deserializes the complete information for the SVG DOM as well as the URL associated to the realizer. As a side effect, serialization/deserialization no longer depends on the location and content of the original SVG file (if that existed at all).

Overrides:
read in class NodeRealizer
Throws:
IOException
ClassNotFoundException

© Copyright 2000-2007,
yWorks GmbH.
All rights reserved.