|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface specifies the general contract for models of graphic elements that may be added to a Drawing.
A MODEL of graphic element basically comprises :
getFirstPointIndex()
to getLastPointIndex()
inclusive.
These methods may be used e.g. by the UI machinery when processing mouse-events, or by parsers when
building a new Drawing from scratch.
PointIterator
).
java.awt.Shape
, or by any other kind of mechanism the developper thinks is appropriate
to the particular model she wants to implement.
Field Summary |
Method Summary | |
PointIndexIterator |
anchorPointsIterator()
Return an Iterator over user-controlled point indexes that can serve as anchor points for grid alignment. |
Object |
clone()
Return a deep copy of this element. |
void |
forwardChangedUpdate(Element child,
DrawingEvent.EventType eventType)
Called by a child of this element to inform its parent of some change that occured to it or one of its children. |
boolean |
getAllowsChildren()
Returns true if the receiver allows children. |
Object |
getAttribute(PicAttributeName name)
|
PicAttributeSet |
getAttributeSet()
|
Rectangle2D |
getBoundingBox(Rectangle2D r)
|
Drawing |
getDrawing()
Retrieves the underlying drawing |
int |
getFirstPointIndex()
Return the index of the first user-controlled point that can be retrieved by getPoint() |
int |
getLastPointIndex()
Return the index of the last user-controlled point that can be retrieved by getPoint() |
String |
getName()
Return a non-localised string representing this element's name. |
Element |
getParent()
Gets the parent of the element. |
PicPoint |
getPoint(int index,
PicPoint src)
Return the user-controlled point having the given index. |
double |
getPointX(int index)
Same as getPoint() , yet return the x-coordinate only. |
double |
getPointY(int index)
Same as getPoint() , yet return the y-coordinate only. |
View |
getView()
|
void |
removeView()
remove the view that render this element ; this may be used to remove any reference to the view, and render it eligible for garbage collection ; if no View, does nothing. |
void |
rotate(PicPoint ptOrg,
double angle)
Rotate this Element by the given angle along the given point |
void |
scale(double ptOrgX,
double ptOrgY,
double sx,
double sy)
Scale this object by (sx,sy) using (ptOrgX,ptOrgY) as origin sx and sy can be negative. |
void |
scale(PicPoint ptOrg,
double sx,
double sy)
Scale this object by (sx,sy) using ptOrg as origin sx and sy may be negative. |
void |
setAttribute(PicAttributeName name,
Object value)
set the given attribute name to the given value for this Element |
void |
setAttributeSet(PicAttributeSet attributeSet)
|
void |
setParent(Element p)
Sets the parent of the element. |
void |
setPoint(int index,
PicPoint pt)
Deprecated. Use setPoint(int, PicPoint, EditPointConstraint) |
void |
setPoint(int index,
PicPoint pt,
EditPointConstraint constraint)
Set the user-controlled point indexed by "index" to the given value, using the specified geometrical constraint. |
void |
setViewFromFactory(ViewFactory f)
set the view for this Element from the given view factory |
void |
shear(PicPoint ptOrg,
double shx,
double shy)
Shear this Element by the given params wrt to the given origin |
void |
translate(double dx,
double dy)
Translate this object by (dx,dy) |
Method Detail |
public String getName()
public Object clone()
public Drawing getDrawing()
public Element getParent()
public void setParent(Element p)
public boolean getAllowsChildren()
public void forwardChangedUpdate(Element child, DrawingEvent.EventType eventType)
eventType
- the event typechild
- the child that sent the change-event.public PicPoint getPoint(int index, PicPoint src)
setPoint
method.
index
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.
index
;
if src
is null, concrete implementation of this method should
allocate a new PicPoint and return it,
otherwise directly modify src
and return it as well for convenience.public double getPointX(int index)
getPoint()
, yet return the x-coordinate only.
index
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.
index
.public double getPointY(int index)
getPoint()
, yet return the y-coordinate only.
index
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.
index
.public int getFirstPointIndex()
public int getLastPointIndex()
public void setPoint(int index, PicPoint pt)
public void setPoint(int index, PicPoint pt, EditPointConstraint constraint)
constraint
- a geometry constraint, or null if no particular constraint is being imposed (aka default).public PointIndexIterator anchorPointsIterator()
public void translate(double dx, double dy)
dx
- The X coordinate of translation vectordy
- The Y coordinate of translation vectorpublic void scale(PicPoint ptOrg, double sx, double sy)
public void scale(double ptOrgX, double ptOrgY, double sx, double sy)
public void rotate(PicPoint ptOrg, double angle)
angle
- rotation angle in radianspublic void shear(PicPoint ptOrg, double shx, double shy)
public Rectangle2D getBoundingBox(Rectangle2D r)
public View getView()
public void setViewFromFactory(ViewFactory f)
public void removeView()
public PicAttributeSet getAttributeSet()
public void setAttributeSet(PicAttributeSet attributeSet)
attributeSet
- a new AttributeSet for this Element ; this actually make a deep copy of the
given attribute set beforehands.public void setAttribute(PicAttributeName name, Object value)
public Object getAttribute(PicAttributeName name)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |