|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.NodeRealizer y.view.ImageNodeRealizer
public class ImageNodeRealizer
A node realizer that displays a node as an image.
The visual representation of a ImageNodeRealizer
is essentially
determined by its associated image content.
As a consequence, the implementation of
paintNode(java.awt.Graphics2D)
ignores the following properties:
fillColor
fillColor2
lineColor
andlineType
Attention: Using the ygf writing capabilities of this class is not thread-safe!
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 | |
---|---|
ImageNodeRealizer()
Creates a new ImageNodeRealizer with no image associated with it. |
|
ImageNodeRealizer(NodeRealizer argNodeRealizer)
Creates a new ImageNodeRealizer whose attributes are copied from the given realizer. |
Method Summary | |
---|---|
static java.awt.Image |
addImage(java.net.URL imageURL)
Adds an image Object to ImageNodeRealizer's image cache. |
static void |
addImages(java.lang.String userHomeRes,
java.lang.String classPathRes)
Adds images that are specified in a property file. |
static void |
addImages(java.net.URL url)
Adds images that are specified in a property file that can be parsed by class java.util.PropertyResourceBundle An example of such a file follows: basepath=imagenodes image1=flower.gif image2=trousers.gif image3=pike.gif The optional key "basepath" signifies a path that is prepended to all given image values. if "basepath' signifies an absolute path then the given url is not prepended to basepath. |
static java.util.Vector |
availableImageURLs()
Returns a vector of all URL objects, that have are used as keys to ImageNodeRealizer's image cache. |
boolean |
contains(double x,
double y)
Determines whether the specified point lies inside this realizer |
NodeRealizer |
createCopy(NodeRealizer nr)
Creates and returns a new ImageNodeRealizer whose attributes are copied from the given realizer. |
java.awt.Image |
getImage()
Returns the image that is displayed by this realizer. |
static java.awt.Image |
getImage(java.net.URL url)
Returns the image that is stored under the given URL in ImageNodeRealizer's image cache, or null
if there is no image registered with that URL. |
static java.util.Hashtable |
getImageTable()
Returns ImageNodeRealizer's image cache. the keys to the cached Image objects are their URLs. |
java.net.URL |
getImageURL()
Returns the URL of the displayed image, or null if
no URL is associated with this realizer. |
boolean |
isAlphaImageUsed()
Returns whether the contains(double, double) method uses the alpha transparency of the
image to determine whether this realizer "contains" points. |
void |
paintNode(java.awt.Graphics2D g)
This method must be implemented by subclasses. |
void |
read(java.io.ObjectInputStream in)
Deprecated. Use the GraphML format instead. |
void |
setAlphaImageUsed(boolean use)
Determines whether the contains(double, double) method should use the alpha transparency of the
image to determine whether this realizer "contains" points. |
void |
setImage(java.awt.Image image)
Sets the image that will be displayed by this realizer. |
void |
setImageURL(java.net.URL imageURL)
Sets the URL of the image that will be displayed by this realizer. |
void |
setToImageSize()
Sets the size of this realizer to the original size of the image being displayed. |
void |
write(java.io.ObjectOutputStream out)
Deprecated. Use the GraphML format instead. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImageNodeRealizer()
public ImageNodeRealizer(NodeRealizer argNodeRealizer)
Method Detail |
---|
public boolean contains(double x, double y)
contains
in class NodeRealizer
x
- the x-coordinate of the point to check.y
- the y-coordinate of the point to check.
true
if the bounding box of this realizer
contains the specified point; false
otherwise.setAlphaImageUsed(boolean)
public void setAlphaImageUsed(boolean use)
contains(double, double)
method should use the alpha transparency of the
image to determine whether this realizer "contains" points. This influences hit testing and
edge intersection calculation
use
- whether to use the Alpha Transparency of the imagepublic boolean isAlphaImageUsed()
contains(double, double)
method uses the alpha transparency of the
image to determine whether this realizer "contains" points. This influences hit testing and
edge intersection calculation
public NodeRealizer createCopy(NodeRealizer nr)
createCopy
in class NodeRealizer
nr
- the prototype realizer whose attributes will be copied.public static void addImages(java.lang.String userHomeRes, java.lang.String classPathRes)
userHomeRes
- A user home relative path to the property
file. If this file is not found then ...classPathRes
- ... a classpath relative path to the property
file will be tried instead.addImages(URL)
public static void addImages(java.net.URL url)
basepath=imagenodes image1=flower.gif image2=trousers.gif image3=pike.gifThe optional key "basepath" signifies a path that is prepended to all given image values. if "basepath' signifies an absolute path then the given url is not prepended to basepath.
url
- the url of the properties file.public static java.awt.Image addImage(java.net.URL imageURL)
public static java.util.Vector availableImageURLs()
public static java.util.Hashtable getImageTable()
public static java.awt.Image getImage(java.net.URL url)
null
if there is no image registered with that URL.
public void setImageURL(java.net.URL imageURL)
public void setImage(java.awt.Image image)
null
.
public java.awt.Image getImage()
public java.net.URL getImageURL()
null
if
no URL is associated with this realizer.
public void setToImageSize()
null
this method returns silently.
public void paintNode(java.awt.Graphics2D g)
NodeRealizer
paintNode
in class NodeRealizer
public void write(java.io.ObjectOutputStream out) throws java.io.IOException
GraphML format
instead.
write
in class NodeRealizer
java.io.IOException
public void read(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
GraphML format
instead.
write(ObjectOutputStream)
method.
read
in class NodeRealizer
java.io.IOException
java.lang.ClassNotFoundException
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |