public abstract class AbstractElement extends java.lang.Object implements Element
This implementation provides some useful behaviour where the integration of Element's in a tree-model is concerned.
Modifier and Type | Field and Description |
---|---|
protected PicAttributeSet |
attributeSet
the attribute set
|
protected Element |
parent
the parent of this element
|
protected View |
view
the view that render this element
|
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
Constructor and Description |
---|
AbstractElement()
construct an AbstractElement with no parent and a default PicAttributeSet
|
AbstractElement(AbstractElement obj)
cloning constructor ; attribute set is deeply copied.
|
AbstractElement(PicAttributeSet attributeSet)
construct an AbstractElement with no parent and the given PicAttributeSet.
|
Modifier and Type | Method and Description |
---|---|
PointIndexIterator |
anchorPointsIterator()
Create an Iterator over points that can serve as anchor points for grid alignment.
|
abstract java.lang.Object |
clone()
Returns a clone of this Element
|
protected void |
fireChangedUpdate(DrawingEvent.EventType eventType)
Must be called each time this AbstractElement changes.
|
java.lang.Object |
getAttribute(PicAttributeName name)
Returns the value for the given attribute name
|
PicAttributeSet |
getAttributeSet()
Returns the AttributeSet bound to this AbstractElement.
|
Drawing |
getDrawing()
Retrieves the underlying drawing
|
Element |
getParent()
Gets the parent of the element.
|
View |
getView()
Returns the View that's responsible for rendering this AbstractElement
|
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 |
scale(PicPoint ptOrg,
double sx,
double sy)
Scale this object by (sx,sy) using ptOrg as origin
sx and sy can be negative.
|
void |
setAttribute(PicAttributeName name,
java.lang.Object value)
Set the given attribute name to the given value for this AbstractElement
|
void |
setAttributeSet(PicAttributeSet attributeSet)
Bind the given attributes set to this Element.
|
void |
setParent(Element p)
Sets the parent of this element to be the given element.
|
void |
setViewFromFactory(ViewFactory f)
set the view for this AbstractElement from the given view factory
or remove the view if f is null.
|
java.lang.String |
toString()
Returns a String representation of the attribute set for this AbstractElement
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forwardChangedUpdate, getAllowsChildren, getBoundingBox, getFirstPointIndex, getLastPointIndex, getName, getPoint, getPointX, getPointY, rotate, scale, setPoint, setPoint, shear, translate
protected Element parent
protected PicAttributeSet attributeSet
protected View view
public AbstractElement()
public AbstractElement(PicAttributeSet attributeSet)
public AbstractElement(AbstractElement obj)
public abstract java.lang.Object clone()
public Drawing getDrawing()
getDrawing
in interface Element
public Element getParent()
public void setParent(Element p)
protected void fireChangedUpdate(DrawingEvent.EventType eventType)
forwardChangedUpdate(this)
on the Element's parent, if any.
super.fireChangeUpdate
.type
- the event typepublic PointIndexIterator anchorPointsIterator()
anchorPointsIterator
in interface Element
public void scale(PicPoint ptOrg, double sx, double sy)
scale(double,double,double,double)
.public View getView()
public void setViewFromFactory(ViewFactory f)
setViewFromFactory
in interface Element
public void removeView()
removeView
in interface Element
public PicAttributeSet getAttributeSet()
Be careful that modifying attributes using this method does not fire any DrawingEvent's, hence does not keep the view synchronized with the state of the model.
getAttributeSet
in interface Element
public void setAttributeSet(PicAttributeSet attributeSet)
setAttributeSet
in interface Element
attributeSet
- a new AttributeSet for this Element ; this actually make a deep copy of the
given attribute set beforehands.public void setAttribute(PicAttributeName name, java.lang.Object value)
setAttribute
in interface Element
public java.lang.Object getAttribute(PicAttributeName name)
getAttribute
in interface Element
public java.lang.String toString()
toString
in class java.lang.Object
Submit a bug : syd@jpicedt.org