Class MutableTransformerDecorator
- java.lang.Object
-
- org.jungrapht.visualization.transform.MutableTransformerDecorator
-
- All Implemented Interfaces:
BidirectionalTransformer
,MutableTransformer
,ShapeTransformer
,ChangeEventSupport
- Direct Known Subclasses:
LensTransformer
public abstract class MutableTransformerDecorator extends Object implements MutableTransformer
a complete decorator that wraps a MutableTransformer. Subclasses use this to allow them to only declare methods they need to change.- Author:
- Tom Nelson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MutableTransformerDecorator.Builder<T extends LensTransformer,B extends MutableTransformerDecorator.Builder<T,B>>
-
Field Summary
Fields Modifier and Type Field Description protected MutableTransformer
delegate
-
Constructor Summary
Constructors Constructor Description MutableTransformerDecorator(MutableTransformer delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(ChangeListener l)
void
concatenate(AffineTransform transform)
void
fireStateChanged()
ChangeListener[]
getChangeListeners()
Returns an array of all theChangeListener
s added with addChangeListener().MutableTransformer
getDelegate()
double
getRotation()
double
getScale()
double
getScaleX()
double
getScaleY()
double
getShearX()
double
getShearY()
AffineTransform
getTransform()
double
getTranslateX()
double
getTranslateY()
Point2D
inverseTransform(Point2D p)
convert the supplied screen coordinate to the graph coordinate.Shape
inverseTransform(Shape shape)
void
preConcatenate(AffineTransform transform)
void
removeChangeListener(ChangeListener l)
Removes a ChangeListener.void
rotate(double radians, double x, double y)
void
rotate(double radians, Point2D point)
double
scale()
void
scale(double sx, double sy, Point2D point)
void
setDelegate(MutableTransformer delegate)
void
setScale(double sx, double sy, Point2D point)
void
setToIdentity()
void
setTranslate(double dx, double dy)
void
shear(double shx, double shy, Point2D from)
Point2D
transform(Point2D p)
convert the supplied graph coordinate to the screen coordinateShape
transform(Shape shape)
map a shape from graph coordinate system to the screen coordinate systemvoid
translate(double dx, double dy)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jungrapht.visualization.transform.BidirectionalTransformer
inverseTransform, transform
-
-
-
-
Field Detail
-
delegate
protected MutableTransformer delegate
-
-
Constructor Detail
-
MutableTransformerDecorator
public MutableTransformerDecorator(MutableTransformer delegate)
-
-
Method Detail
-
getDelegate
public MutableTransformer getDelegate()
-
setDelegate
public void setDelegate(MutableTransformer delegate)
-
addChangeListener
public void addChangeListener(ChangeListener l)
- Specified by:
addChangeListener
in interfaceChangeEventSupport
-
concatenate
public void concatenate(AffineTransform transform)
- Specified by:
concatenate
in interfaceMutableTransformer
-
fireStateChanged
public void fireStateChanged()
- Specified by:
fireStateChanged
in interfaceChangeEventSupport
-
getChangeListeners
public ChangeListener[] getChangeListeners()
Description copied from interface:ChangeEventSupport
Returns an array of all theChangeListener
s added with addChangeListener().- Specified by:
getChangeListeners
in interfaceChangeEventSupport
- Returns:
- all of the
ChangeListener
s added or an empty array if no listeners have been added
-
getScale
public double getScale()
- Specified by:
getScale
in interfaceMutableTransformer
-
scale
public double scale()
- Specified by:
scale
in interfaceMutableTransformer
-
getScaleX
public double getScaleX()
- Specified by:
getScaleX
in interfaceMutableTransformer
-
getScaleY
public double getScaleY()
- Specified by:
getScaleY
in interfaceMutableTransformer
-
getShearX
public double getShearX()
- Specified by:
getShearX
in interfaceMutableTransformer
-
getShearY
public double getShearY()
- Specified by:
getShearY
in interfaceMutableTransformer
-
getTransform
public AffineTransform getTransform()
- Specified by:
getTransform
in interfaceMutableTransformer
-
getTranslateX
public double getTranslateX()
- Specified by:
getTranslateX
in interfaceMutableTransformer
-
getTranslateY
public double getTranslateY()
- Specified by:
getTranslateY
in interfaceMutableTransformer
-
inverseTransform
public Point2D inverseTransform(Point2D p)
Description copied from interface:BidirectionalTransformer
convert the supplied screen coordinate to the graph coordinate.- Specified by:
inverseTransform
in interfaceBidirectionalTransformer
- Parameters:
p
- screen point to convert- Returns:
- the graph point
-
inverseTransform
public Shape inverseTransform(Shape shape)
- Specified by:
inverseTransform
in interfaceShapeTransformer
-
preConcatenate
public void preConcatenate(AffineTransform transform)
- Specified by:
preConcatenate
in interfaceMutableTransformer
-
removeChangeListener
public void removeChangeListener(ChangeListener l)
Description copied from interface:ChangeEventSupport
Removes a ChangeListener.- Specified by:
removeChangeListener
in interfaceChangeEventSupport
- Parameters:
l
- the listener to be removed
-
rotate
public void rotate(double radians, Point2D point)
- Specified by:
rotate
in interfaceMutableTransformer
-
scale
public void scale(double sx, double sy, Point2D point)
- Specified by:
scale
in interfaceMutableTransformer
-
setScale
public void setScale(double sx, double sy, Point2D point)
- Specified by:
setScale
in interfaceMutableTransformer
-
setToIdentity
public void setToIdentity()
- Specified by:
setToIdentity
in interfaceMutableTransformer
-
setTranslate
public void setTranslate(double dx, double dy)
- Specified by:
setTranslate
in interfaceMutableTransformer
-
shear
public void shear(double shx, double shy, Point2D from)
- Specified by:
shear
in interfaceMutableTransformer
-
transform
public Point2D transform(Point2D p)
Description copied from interface:BidirectionalTransformer
convert the supplied graph coordinate to the screen coordinate- Specified by:
transform
in interfaceBidirectionalTransformer
- Parameters:
p
- graph point to convert- Returns:
- screen point
-
transform
public Shape transform(Shape shape)
Description copied from interface:ShapeTransformer
map a shape from graph coordinate system to the screen coordinate system- Specified by:
transform
in interfaceShapeTransformer
- Parameters:
shape
- the Shape to transform- Returns:
- a GeneralPath (Shape) representing the screen points of the shape
-
translate
public void translate(double dx, double dy)
- Specified by:
translate
in interfaceMutableTransformer
-
getRotation
public double getRotation()
- Specified by:
getRotation
in interfaceMutableTransformer
-
rotate
public void rotate(double radians, double x, double y)
- Specified by:
rotate
in interfaceMutableTransformer
-
-