Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpicedt.graphic.model
Class AbstractElement

    java.lang.Object
      jpicedt.graphic.model.AbstractElement

All Implemented Interfaces:
  Element, PicObjectConstants

Direct Known Subclasses:
  BranchElement, DefaultLeafElement, PicNodeConnection

public abstract class AbstractElement
extends Object
implements Element

An abstract class that can serve as the basis class for elements of a Drawing.

This implementation provides some useful behaviour where the integration of Element's in a tree-model is concerned.

Since:
  PicEdt 1.0
Author:
  Sylvain Reynal

Field Summary
`protected PicAttributeSet` | `attributeSet` the attribute set
`protected Element` | `parent` the parent of this element
`protected View` | `view` the view that render this element

Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
`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 Summary
`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.

Method Summary
`PointIndexIterator` | `anchorPointsIterator()` Create an Iterator over points that can serve as anchor points for grid alignment.
`abstract Object` | `clone()` Returns a clone of this Element
`protected void` | `fireChangedUpdate(DrawingEvent.EventType eventType)` Must be called each time this AbstractElement changes.
`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, 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.
`String` | `toString()` Returns a String representation of the attribute set for this AbstractElement

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface jpicedt.graphic.model.Element
`forwardChangedUpdate, getAllowsChildren, getBoundingBox, getFirstPointIndex, getLastPointIndex, getName, getPoint, getPointX, getPointY, rotate, scale, setPoint, setPoint, shear, translate`

Field Detail

### parent

    protected Element parent

  the parent of this element

### attributeSet

    protected PicAttributeSet attributeSet

  the attribute set

### view

    protected View view

  the view that render this element

Constructor Detail

### AbstractElement

    public AbstractElement()

  construct an AbstractElement with no parent and a default PicAttributeSet

### AbstractElement

    public AbstractElement(PicAttributeSet attributeSet)

  construct an AbstractElement with no parent and the given PicAttributeSet.

### AbstractElement

    public AbstractElement(AbstractElement obj)

  cloning constructor ; attribute set is deeply copied. The parent and the view are set to null.

Method Detail

### clone

    public abstract Object clone()

  Returns a clone of this Element

  Specified by:
    `clone` in interface `Element`

### getDrawing

    public Drawing getDrawing()

  Retrieves the underlying drawing

  Specified by:
    `getDrawing` in interface `Element`
  Returns:
    the drawing ; null if this AbstractElement doesn't belong to any drawing yet.

### getParent

    public Element getParent()

  Gets the parent of the element.

  Specified by:
    `getParent` in interface `Element`
  Returns:
    the parent

### setParent

    public void setParent(Element p)

  Sets the parent of this element to be the given element.

  Specified by:
    `setParent` in interface `Element`

### fireChangedUpdate

    protected void fireChangedUpdate(DrawingEvent.EventType eventType)

  Must be called each time this AbstractElement changes. This default implementation updates the associated View if any, then propagates upward along the tree by calling `forwardChangedUpdate(this)` on the Element's parent, if any.
  Tree's root-element should override so as to fire the change to the hosting drawing.
  If subclasser are willing to override this method, they should call `super.fireChangeUpdate`.

### anchorPointsIterator

    public PointIndexIterator anchorPointsIterator()

  Create an Iterator over points that can serve as anchor points for grid alignment. This implementation returns a DefaultPointIndexIterator which simply iterates through all user-controlled points in ascending order.

  Specified by:
    `anchorPointsIterator` in interface `Element`

### scale

    public void scale(PicPoint ptOrg,
                      double sx,
                      double sy)

  Scale this object by (sx,sy) using ptOrg as origin sx and sy can be negative. This is a convenience call to `scale(double,double,double,double)`.

  Specified by:
    `scale` in interface `Element`

### getView

    public View getView()

  Returns the View that's responsible for rendering this AbstractElement

  Specified by:
    `getView` in interface `Element`
  Returns:
    the View that's responsible for rendering this Element

### setViewFromFactory

    public void setViewFromFactory(ViewFactory f)

  set the view for this AbstractElement from the given view factory or remove the view if f is null.

  Specified by:
    `setViewFromFactory` in interface `Element`

### removeView

    public 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.

  Specified by:
    `removeView` in interface `Element`

### getAttributeSet

    public PicAttributeSet getAttributeSet()

  Returns the AttributeSet bound to this AbstractElement.

  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.

  Specified by:
    `getAttributeSet` in interface `Element`
  Returns:
    AttributeSet for this Element

### setAttributeSet

    public void setAttributeSet(PicAttributeSet attributeSet)

  Bind the given attributes set to this Element. This implementation actually makes a deep copy of the given set beforehands.

  Specified by:
    `setAttributeSet` in interface `Element`
  Parameters:
    `attributeSet` - a new AttributeSet for this Element ; this actually make a deep copy of the given attribute set beforehands.

### setAttribute

    public void setAttribute(PicAttributeName name,
                             Object value)

  Set the given attribute name to the given value for this AbstractElement

  Specified by:
    `setAttribute` in interface `Element`

### getAttribute

    public Object getAttribute(PicAttributeName name)

  Returns the value for the given attribute name

  Specified by:
    `getAttribute` in interface `Element`
  Returns:
    the value for the given attribute name

### toString

    public String toString()

  Returns a String representation of the attribute set for this AbstractElement

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org