|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.shapes.AbstractShape
public abstract class AbstractShape
This base class is used for shapes with a specific bounds computation based on anchor definition. The derived classes can be serialized.
Nested Class Summary | |
---|---|
static class |
AbstractShape.AbstractShapePropertiesNames
A delegate class that provides the list of properties names related to its mother class |
Field Summary | |
---|---|
protected int |
_h
|
protected int |
_ox
anchor location on x |
protected int |
_oy
anchor location on y |
protected java.lang.String[] |
_propertyNames
The list of properties managed by this panel |
protected int |
_w
|
protected int |
_x
|
protected int |
_y
|
static boolean |
ANTI_ALIASING
Use anti aliasing |
static AbstractShapePropertiesDialogBox |
currentDialogBox
Only one shape properties dialog box can be displayed at once When user opens a dialog box properties while another one is still displayed: this last dislaog box is closed |
static java.lang.String[] |
FONT_NAMES
Available font list |
protected ListenerManager |
listeners
|
static int |
REFRESH_PERIOD
Refresh at no more than 100 ms |
Constructor Summary | |
---|---|
AbstractShape()
Initializes this abstract shape, anchored at 0,0 |
|
AbstractShape(int ox,
int oy)
Initializes this abstract shape |
Method Summary | |
---|---|
void |
addListener(ShapeListener sl)
|
protected AbstractShape |
cloneShape()
Performs a copy of the shape This method has to be overriden to deal with concrete shapes |
boolean |
contains(double x,
double y)
|
boolean |
contains(double x,
double y,
double w,
double h)
|
boolean |
contains(java.awt.geom.Point2D p)
|
boolean |
contains(java.awt.geom.Rectangle2D r)
|
abstract void |
draw(java.awt.Graphics2D g)
Draws the shape |
java.awt.Point |
getAnchor()
Gets shape anchor |
java.awt.Rectangle |
getBounds()
|
java.awt.geom.Rectangle2D |
getBounds2D()
|
java.util.Collection |
getInnerProperties()
Get the properties of inner objects or null if none |
void |
getMax(java.awt.Point p)
Compare shape right/down coordinates with a point If the shape coordiantes are lowered then replace the point coordinates with the maximum value of the coordinates |
void |
getMaxTranslated(java.awt.Point p,
int dx,
int dy)
Compares shape right/down coordinates with a transalted point If the shape coordiantes are lowered then replace the point coordinates with the maximum value of the coordinates |
void |
getMin(java.awt.Point p)
Compares shape left/top origin with a point If the shape origin is lowered then replace the point coordinates with the minimum corrdinates |
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at)
|
java.awt.geom.PathIterator |
getPathIterator(java.awt.geom.AffineTransform at,
double flatness)
|
java.lang.String[] |
getPropertyNames()
Get the list of property names |
java.lang.Object |
getPropertyValue(java.lang.String name)
Get the value of the property named name |
boolean |
intersects(double x,
double y,
double w,
double h)
|
boolean |
intersects(java.awt.geom.Rectangle2D r)
|
protected void |
notifyChange()
Notify listeners that this shape has changed. |
protected void |
notifyChange(java.awt.Rectangle changedArea)
|
void |
refresh()
Reload all shape properties. |
void |
removeListener(ShapeListener sl)
|
void |
setAnchor(int ox,
int oy)
|
void |
setAnchor(java.awt.Point p)
Sets shape anchor |
boolean |
setProperties(NamedProperties properties,
javax.swing.undo.CompoundEdit ce)
|
void |
setPropertyValue(java.lang.String name,
java.lang.Object value)
Assigns value to the property named name |
void |
translate(int dx,
int dy)
Translates the shape |
void |
wipeOff()
Wipe-off all all buffered resources in order to refresh shape. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int _x
protected int _y
protected int _w
protected int _h
protected int _ox
protected int _oy
protected transient java.lang.String[] _propertyNames
protected transient ListenerManager listeners
public static int REFRESH_PERIOD
public static boolean ANTI_ALIASING
public static java.lang.String[] FONT_NAMES
public static transient AbstractShapePropertiesDialogBox currentDialogBox
Constructor Detail |
---|
public AbstractShape()
public AbstractShape(int ox, int oy)
ox
- the anchor x positionoy
- the anchor y positionMethod Detail |
---|
protected AbstractShape cloneShape()
public void getMin(java.awt.Point p)
p
- the pointpa
- the anchor originpublic java.awt.Point getAnchor()
public void setAnchor(java.awt.Point p)
p
- the originpublic void setAnchor(int ox, int oy)
public void getMax(java.awt.Point p)
p
- the pointpublic void getMaxTranslated(java.awt.Point p, int dx, int dy)
p
- the pointpa
- the anchor origindx
- translation along X axisdy
- translation along Y axispublic void translate(int dx, int dy)
public abstract void draw(java.awt.Graphics2D g)
g
- the graphics contextpublic boolean contains(double x, double y)
contains
in interface java.awt.Shape
public boolean contains(double x, double y, double w, double h)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Point2D p)
contains
in interface java.awt.Shape
public boolean contains(java.awt.geom.Rectangle2D r)
contains
in interface java.awt.Shape
public boolean intersects(double x, double y, double w, double h)
intersects
in interface java.awt.Shape
public boolean intersects(java.awt.geom.Rectangle2D r)
intersects
in interface java.awt.Shape
public java.awt.Rectangle getBounds()
getBounds
in interface java.awt.Shape
public java.awt.geom.Rectangle2D getBounds2D()
getBounds2D
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at)
getPathIterator
in interface java.awt.Shape
public java.awt.geom.PathIterator getPathIterator(java.awt.geom.AffineTransform at, double flatness)
getPathIterator
in interface java.awt.Shape
public void addListener(ShapeListener sl)
public void removeListener(ShapeListener sl)
protected void notifyChange()
protected void notifyChange(java.awt.Rectangle changedArea)
public void setPropertyValue(java.lang.String name, java.lang.Object value)
value
to the property named name
setPropertyValue
in interface NamedProperties
name
- value
- setPropertyValue(String, Object)
public java.lang.Object getPropertyValue(java.lang.String name)
name
getPropertyValue
in interface NamedProperties
name
-
getPropertyValue(String)
public java.util.Collection getInnerProperties()
NamedProperties
getInnerProperties
in interface NamedProperties
public java.lang.String[] getPropertyNames()
NamedProperties
getPropertyNames
in interface NamedProperties
public boolean setProperties(NamedProperties properties, javax.swing.undo.CompoundEdit ce)
public void wipeOff()
public void refresh()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |