protected abstract class DefaultViewFactory.LeafElementView extends AbstractView
changedUpdate method,
and update the shape
variable accordingly.
Modifier and Type | Field and Description |
---|---|
protected java.awt.Paint |
interiorPaint
paint for interior (cached)
|
protected double |
lineWidth
line width to be used to compute the view bounds (cached)
|
protected java.awt.Paint |
outlinePaint
paint for outline (cached)
|
protected java.awt.Stroke |
outlineStroke
stroke for outline (cached)
|
protected double |
overStrikeWidth
overstrike width
|
protected java.awt.geom.Rectangle2D.Double |
shadowBounds
buffer
|
protected java.awt.Shape |
shape
shape to be drawn ; subclass must update it properly
|
bounds, element, highlighter
BARBELL_SIZE, CLICK_DISTANCE
Constructor and Description |
---|
LeafElementView(Element e)
construct a new View for the given Element
|
Modifier and Type | Method and Description |
---|---|
void |
changedUpdate(DrawingEvent.EventType eventType)
Give notification from the model that a change occured for an element this view is responsible
for rendering.
|
ViewFactory |
getViewFactory()
Fetches the ViewFactory implementation that is feeding the view hierarchy.
|
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 ). |
void |
paint(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D a)
Render the View to the given graphic context.
|
protected void |
syncAttributes()
Synchronizes cached attributes values with the model ;
lineWidth, from the LINE_WIDTH attribute
outlineStroke, from the ViewFactory, using
createStroke
outinePaint, from the ViewFactory, using createPaintForOutline
interiorPaint, from the ViewFactory, using createPaintForInterior
overStrikeWidth, from the OVER_STRIKE and OVER_STRIKE_WIDTH attributes
|
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 the shadow area.
|
protected void |
syncShape()
Synchronize the "shape" variable with the model ; obviously, this implementation does nothing !
|
getBounds, getContainer, getDrawing, getElement, getGraphics, getHighlighter, getParentView, hitTest, paintHighlighter, repaint, setElement, setHighlighter
protected java.awt.Shape shape
protected double lineWidth
protected double overStrikeWidth
protected java.awt.Stroke outlineStroke
protected java.awt.Paint interiorPaint
protected java.awt.Paint outlinePaint
protected java.awt.geom.Rectangle2D.Double shadowBounds
public LeafElementView(Element e)
public ViewFactory getViewFactory()
getViewFactory
in interface View
getViewFactory
in class AbstractView
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 type 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
createPaintForOutline
createPaintForInterior
protected void syncBounds()
protected void syncShape()
public void paint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D a)
a
- the current graphic clippublic HitInfo hitTest(PEMouseEvent e)
shape
).hitTest
in class AbstractView
Submit a bug : syd@jpicedt.org