JHotDraw 7.2

org.jhotdraw.draw
Class RelativeLocator

java.lang.Object
  extended by org.jhotdraw.draw.AbstractLocator
      extended by org.jhotdraw.draw.RelativeLocator
All Implemented Interfaces:
java.io.Serializable, Locator, DOMStorable
Direct Known Subclasses:
RelativeDecoratorLocator

public class RelativeLocator
extends AbstractLocator

A locator that specfies a point that is relative to the bounds of a figure.

Version:
3.0 2007-04-12 Added support for TRANSFORM AttributeKey.
2.3 2006-07-08 Added DOMStorable support.
2.2 2006-07-05 Added support for DECORATOR_INSETS.
2.1 2006-02-14 Fixed computed coordinate values.
2.0 2006-01-14 Changed to support double precision coordinates.
1.0 2003-12-01 Derived from JHotDraw 5.4b1.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
protected  boolean isTransform
          If this is set to true, if the locator is transforming with the figure.
protected  double relativeX
          Relative x-coordinate on the bounds of the figure.
protected  double relativeY
          Relative y-coordinate on the bounds of the figure.
 
Constructor Summary
RelativeLocator()
          Creates a new instance.
RelativeLocator(double relativeX, double relativeY)
          Creates a new instance.
RelativeLocator(double relativeX, double relativeY, boolean isTransform)
           
 
Method Summary
static Locator center()
          Non-transforming Center.
static Locator center(boolean isTransform)
          Center.
static Locator east()
          Non-transforming East.
static Locator east(boolean isTransform)
          East.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 java.awt.geom.Point2D.Double locate(Figure owner)
          Locates a position on the provided figure.
static Locator north()
          Non-transforming North.
static Locator north(boolean isTransform)
          North.
static Locator northEast()
          Non-transforming North east.
static Locator northEast(boolean isTransform)
          Norht East.
static Locator northWest()
          Non-transforming North west.
static Locator northWest(boolean isTransform)
          North West.
 void read(DOMInput in)
           
static Locator south()
          Non-transforming South.
static Locator south(boolean isTransform)
          South.
static Locator southEast()
          Non-transforming South east.
static Locator southEast(boolean isTransform)
          South East.
static Locator southWest()
          Non-transforming South west.
static Locator southWest(boolean isTransform)
          South West.
static Locator west()
          Non-transforming West.
static Locator west(boolean isTransform)
          West.
 void write(DOMOutput out)
           
 
Methods inherited from class org.jhotdraw.draw.AbstractLocator
locate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

relativeX

protected double relativeX
Relative x-coordinate on the bounds of the figure. The value 0 is on the left boundary of the figure, the value 1 on the right boundary.


relativeY

protected double relativeY
Relative y-coordinate on the bounds of the figure. The value 0 is on the top boundary of the figure, the value 1 on the bottom boundary.


isTransform

protected boolean isTransform
If this is set to true, if the locator is transforming with the figure.

Constructor Detail

RelativeLocator

public RelativeLocator()
Creates a new instance.


RelativeLocator

public RelativeLocator(double relativeX,
                       double relativeY)
Creates a new instance.


RelativeLocator

public RelativeLocator(double relativeX,
                       double relativeY,
                       boolean isTransform)
Parameters:
relativeX - x-position relative to bounds expressed as a value between 0 and 1.
relativeY - y-position relative to bounds expressed as a value between 0 and 1.
isTransform - Set this to true, if the locator shall honor the TRANSFORM attribute of the Figure.
Method Detail

locate

public java.awt.geom.Point2D.Double locate(Figure owner)
Description copied from interface: Locator
Locates a position on the provided figure.

Returns:
a point on the figure.

east

public static Locator east()
Non-transforming East.


east

public static Locator east(boolean isTransform)
East.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

north

public static Locator north()
Non-transforming North.


north

public static Locator north(boolean isTransform)
North.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

west

public static Locator west()
Non-transforming West.


west

public static Locator west(boolean isTransform)
West.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

northEast

public static Locator northEast()
Non-transforming North east.


northEast

public static Locator northEast(boolean isTransform)
Norht East.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

northWest

public static Locator northWest()
Non-transforming North west.


northWest

public static Locator northWest(boolean isTransform)
North West.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

south

public static Locator south()
Non-transforming South.


south

public static Locator south(boolean isTransform)
South.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

southEast

public static Locator southEast()
Non-transforming South east.


southEast

public static Locator southEast(boolean isTransform)
South East.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

southWest

public static Locator southWest()
Non-transforming South west.


southWest

public static Locator southWest(boolean isTransform)
South West.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

center

public static Locator center()
Non-transforming Center.


center

public static Locator center(boolean isTransform)
Center.

Parameters:
isTransform - Set this to true, if RelativeLocator shall honour the AttributesKey.TRANSFORM attribute of the Figure.

write

public void write(DOMOutput out)

read

public void read(DOMInput in)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Copyright 1996-2009 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.