public abstract class AbstractView extends java.lang.Object implements View, ViewConstants
Modifier and Type | Field and Description |
---|---|
protected java.awt.geom.Rectangle2D |
bounds
the bounds rectangle used for clipping (as returned by getBounds) ; this should be updated
by changedUpdate.
|
protected Element |
element
the graphic element that this View renders
|
protected Highlighter |
highlighter
the highlighter delegate for this view
|
BARBELL_SIZE, CLICK_DISTANCE
Constructor and Description |
---|
AbstractView(Element element)
construct a new View for the given Element
|
AbstractView(Element element,
Highlighter h)
construct a new View for the given Element, delegating highlighting
to the given Highlighter.
|
Modifier and Type | Method and Description |
---|---|
java.awt.geom.Rectangle2D |
getBounds() |
PECanvas |
getContainer()
Fetches the container hosting the view.
|
Drawing |
getDrawing()
Fetches the model associated with the view.
|
Element |
getElement() |
java.awt.Graphics |
getGraphics()
Fetch a Graphics for rendering from the hosting container (if not null).
|
Highlighter |
getHighlighter()
Returns the Highlighter responsible for rendering the highlighted part of this view.
|
View |
getParentView()
Returns the parent of the view, as given by the tree-structure the associated graphic element belongs to.
|
ViewFactory |
getViewFactory()
Fetches the ViewFactory implementation that is feeding the view hierarchy.
|
protected abstract HitInfo |
hitTest(PEMouseEvent e)
Returns a HitInfo corresponding to the given mouse-event.
|
HitInfo |
hitTest(PEMouseEvent e,
boolean isHighlightVisible)
Depending on the value of isHighlighVisible, current implementation first delegates
to the hosted Highlighter's hitTest() method, then calls
hitTest(PEMouseEvent) . |
void |
paintHighlighter(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D allocation,
double scale)
Render the Highlighter to the given graphic context.
|
void |
repaint(java.awt.geom.Rectangle2D clip)
ask the hosting container (if it's non-null) to repaint itself
|
void |
setElement(Element e)
set the element the View is responsible for rendering
|
void |
setHighlighter(Highlighter h)
Sets the Highlighter responsible for rendering the highlighted part of this view.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
changedUpdate, paint
protected Element element
protected java.awt.geom.Rectangle2D bounds
protected Highlighter highlighter
public AbstractView(Element element)
public AbstractView(Element element, Highlighter h)
public Element getElement()
getElement
in interface View
public void setElement(Element e)
setElement
in interface View
public View getParentView()
getParentView
in interface View
public PECanvas getContainer()
getContainer
in interface View
public ViewFactory getViewFactory()
getViewFactory
in interface View
public java.awt.Graphics getGraphics()
getGraphics
in interface View
public Drawing getDrawing()
getDrawing
in interface View
public void repaint(java.awt.geom.Rectangle2D clip)
public java.awt.geom.Rectangle2D getBounds()
public Highlighter getHighlighter()
getHighlighter
in interface View
public void setHighlighter(Highlighter h)
setHighlighter
in interface View
h
- the delegate ; null if this View mustn't support highlightingpublic void paintHighlighter(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)
paintHighlighter
in interface View
allocation
- current clippingscale
- The current scale factor from model to screen for the Graphics2D context ;
this may be used to scale down line thickess, etc... so that lines/rectangle/... appear with the
same lenght on the screen whatever the scale factor that's set to the graphic context.protected abstract HitInfo hitTest(PEMouseEvent e)
public HitInfo hitTest(PEMouseEvent e, boolean isHighlightVisible)
hitTest(PEMouseEvent)
.Submit a bug : syd@jpicedt.org