JGraph
v5.1


org.jgraph.graph
Class AttributeMap

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by org.jgraph.graph.AttributeMap
All Implemented Interfaces:
Serializable, Cloneable, Map

public class AttributeMap
extends Hashtable

See Also:
Serialized Form

Nested Class Summary
static class AttributeMap.SerializablePoint2D
           
static class AttributeMap.SerializableRectangle2D
           
 
Constructor Summary
AttributeMap()
           
AttributeMap(Map map)
           
 
Method Summary
 AttributeMap applyMap(Map change)
          Apply the change to the target.
 Object applyValue(Object key, Object value)
          Apply the key to value and return the old value.
 Object clone()
          Returns a clone of map, from keys to values.
 List clonePoints(List points)
          Returns a list where all instances of PortView are replaced by their correspnding Point instance.
 List clonePoints(List points, boolean convertPortViews)
          Returns a list where all instances of PortView are replaced by their correspnding Point instance.
 Point2D createPoint()
           
 Point2D createPoint(double x, double y)
           
 Point2D createPoint(Point2D p)
           
 Rectangle2D createRect()
           
 Rectangle2D createRect(double x, double y, double w, double h)
           
 Rectangle2D createRect(double x, double y, double w, double h, double grow1, double grow2)
           
 Rectangle2D createRect(Point2D pt)
           
 Rectangle2D createRect(Point2D pt, double size)
           
 Rectangle2D createRect(Rectangle2D rect)
           
 Rectangle2D createRect(Rectangle2D rect, double grow1, double grow2)
           
 Map diff(Map newState)
          Returns a new map that contains all (key, value)-pairs of newState where either key is not used or value is different for key in oldState.
 void scale(double sx, double sy, Point2D origin)
          Scales map by the given amount.
static void translate(Collection c, double dx, double dy)
          Translates the maps in c using translate(Map, int, int).
 void translate(double dx, double dy)
          Translates map by the given amount.
 Object valueChanged(Object newValue)
          A hook for subclassers to handle in-place edit.
 
Methods inherited from class java.util.Hashtable
clear, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttributeMap

public AttributeMap()

AttributeMap

public AttributeMap(Map map)
Method Detail

createPoint

public Point2D createPoint()
Returns:

createPoint

public Point2D createPoint(Point2D p)
Returns:

createPoint

public Point2D createPoint(double x,
                           double y)
Returns:

createRect

public Rectangle2D createRect()
Returns:

createRect

public Rectangle2D createRect(double x,
                              double y,
                              double w,
                              double h)
Returns:

createRect

public Rectangle2D createRect(Point2D pt)
Returns:

createRect

public Rectangle2D createRect(Point2D pt,
                              double size)
Returns:

createRect

public Rectangle2D createRect(Rectangle2D rect)
Returns:

createRect

public Rectangle2D createRect(double x,
                              double y,
                              double w,
                              double h,
                              double grow1,
                              double grow2)
Returns:

createRect

public Rectangle2D createRect(Rectangle2D rect,
                              double grow1,
                              double grow2)
Returns:

applyMap

public AttributeMap applyMap(Map change)
Apply the change to the target. change must be a Map previously obtained from this object. Returns a map that may be used to undo the change to target.


applyValue

public Object applyValue(Object key,
                         Object value)
Apply the key to value and return the old value.


valueChanged

public Object valueChanged(Object newValue)
A hook for subclassers to handle in-place edit. This method is called from applyValue if the key equals VALUE. If you want undo to work you should return a clone of the new user object (ie. if it is not an immutable string).


clonePoints

public List clonePoints(List points)
Returns a list where all instances of PortView are replaced by their correspnding Point instance.


clonePoints

public List clonePoints(List points,
                        boolean convertPortViews)
Returns a list where all instances of PortView are replaced by their correspnding Point instance.


translate

public static void translate(Collection c,
                             double dx,
                             double dy)
Translates the maps in c using translate(Map, int, int).


translate

public void translate(double dx,
                      double dy)
Translates map by the given amount.


scale

public void scale(double sx,
                  double sy,
                  Point2D origin)
Scales map by the given amount.


diff

public Map diff(Map newState)
Returns a new map that contains all (key, value)-pairs of newState where either key is not used or value is different for key in oldState. In other words, this method removes the common entries from oldState and newState, and returns the "difference" between the two. This method never returns null.


clone

public Object clone()
Returns a clone of map, from keys to values. If the map contains bounds or points, these are cloned as well. References to PortViews are replaces by points.
Note: Extend this method to clone custom user objects.

Overrides:
clone in class Hashtable

JGraph
v5.1


Copyright (C) 2001-2004 Gaudenz Alder. All rights reserved.