|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.graphic.view.AbstractView jpicedt.graphic.view.LeafElementView
public class LeafElementView
A View for rendering leaf-elements; implements attributes caching, and shape rendering.
Subclasses might just override the changedUpdate
method,
and update the shape
variable accordingly.
Field Summary | |
---|---|
protected AttributesViewFactory |
attrFactory
|
protected Paint |
interiorPaint
paint for interior (cached) |
protected ArrowView |
leftArrow
arrows to be painted if non-null |
protected Paint |
outlinePaint
paint for outline (cached) |
protected BasicStroke |
outlineStroke
stroke for outline and arrows (cached) |
protected BasicStroke |
overstrikeStroke
stroke for overstrike (cached) |
protected ArrowView |
rightArrow
arrows to be painted if non-null |
protected Shape |
shadow
shadow to be painted if non-null ; updated using shape |
protected Paint |
shadowPaint
paint for shadow (cached) |
protected Shape |
shape
shape to be painted ; subclass must update it properly |
Fields inherited from class jpicedt.graphic.view.AbstractView |
---|
bounds, element, highlighter |
Constructor Summary | |
---|---|
LeafElementView(Element e,
AttributesViewFactory f)
construct a new View for the given Element |
Method Summary | |
---|---|
void |
changedUpdate(DrawingEvent.EventType eventType)
Give notification from the model that a change occured for an element this view is responsible for rendering. |
HitInfo |
hitTest(PEMouseEvent e)
This implementation returns a HitInfo.Interior if the view is filled and a click occured on the interior, or a HitInfo.Stroke if a click occured on the stroke path (this use a FlatteningPathIterator built from the current shape ). |
protected boolean |
intersect(Rectangle2D r,
ArrayList<Element> list)
If this view intersects the given rectangle, adds the associated Element to the given list (if non-null) and returns true. |
void |
paint(Graphics2D g,
Rectangle2D a)
Render the View to the given graphic context. |
protected void |
syncArrowsAttributes()
Synchronizes arrows' specific attributes with the model. |
protected void |
syncArrowsGeometry()
Sync the geometry of the current "left/rightArrowShape" variables with the model if applicable, that is, if these vars are non-null (means: not Arrow.NONE). |
protected void |
syncAttributes()
Synchronizes cached attributes values with the model ; outlineStroke, from the ViewFactory, using createStroke
overstrikeStroke, from the ViewFactory, using createStrokeForOverstrike
outlinePaint, from the ViewFactory, using createPaintForOutline
interiorPaint, from the ViewFactory, using createPaintForInterior
shadowPaint, from the ViewFactory, using createPaintForShadow
then calls syncArrowAttributes()
|
protected void |
syncBounds()
Synchronizes the bounding box with the model ; "bounds" is first computed from the current shape's bound, if any, then its size gets increased by BARBELL_SIZE, line-thickness, overstrike width, and possibly shadow and arrows areas. |
protected void |
syncShadow()
sync' the shadow with the current shape (which must therefore be valid) AND the current PicAttributeSet; hence must be called either when the geometry's changed, or when attributes have changed. |
protected void |
syncShape()
Synchronize the "shape" variable with the model |
Methods inherited from class jpicedt.graphic.view.AbstractView |
---|
getBounds, getContainer, getDrawing, getElement, getGraphics, getHighlighter, getParentView, getViewFactory, hitTest, intersect, paintHighlighter, repaint, setElement, setHighlighter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected AttributesViewFactory attrFactory
protected Shape shape
protected Shape shadow
protected BasicStroke outlineStroke
protected BasicStroke overstrikeStroke
protected Paint interiorPaint
protected Paint outlinePaint
protected Paint shadowPaint
protected ArrowView leftArrow
protected ArrowView rightArrow
Constructor Detail |
---|
public LeafElementView(Element e, AttributesViewFactory f)
Method Detail |
---|
public void changedUpdate(DrawingEvent.EventType eventType)
To reduce the burden for subclasses, this implemention dispatches to the following methods, in that order, depending on the value of "eventType" :
syncAttributes()
if it's an ATTRIBUTE_CHANGE event or during initialization
syncShape()
in any case
syncBounds()
in any case.
changedUpdate
on the highlighter delegate, if any.
shape
before calling super.changedUpdate()
,
or override syncAttributes()
and syncBounds()
if they must implement
more specific behaviour.
protected void syncAttributes()
createStroke
createStrokeForOverstrike
createPaintForOutline
createPaintForInterior
createPaintForShadow
syncArrowAttributes()
protected void syncArrowsAttributes()
protected void syncBounds()
protected void syncShape()
protected void syncArrowsGeometry()
protected void syncShadow()
public void paint(Graphics2D g, Rectangle2D a)
a
- the current graphic clippublic HitInfo hitTest(PEMouseEvent e)
shape
).
hitTest
in class AbstractView
protected boolean intersect(Rectangle2D r, ArrayList<Element> list)
intersect
in class AbstractView
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |