|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.graphic.view.AbstractView
public abstract class AbstractView
Abstract implementation that provide some basic common behaviours for View
's.
Field Summary | |
---|---|
protected 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 . |
Constructor Summary | |
---|---|
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 . |
Method Summary | |
---|---|
Rectangle2D |
getBounds()
|
PECanvas |
getContainer()
Fetches the container hosting the view. |
Drawing |
getDrawing()
Fetches the drawing (aka model) associated with the view. |
Element |
getElement()
Returns the element the View is responsible for rendering |
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) . |
protected abstract boolean |
intersect(Rectangle2D r,
ArrayList<Element> list)
If this view intersects the given rectangle, add the associated Element
or a child Element if it's more appropriate (for
instance for composite views) to the given list (if non-null), and returns true. |
boolean |
intersect(Rectangle2D r,
boolean isHighlightVisible,
ArrayList<Element> list)
Depending on the value of isHighlighVisible , current implementation first delegates to the
hosted Highlighter 's intersect() method, then calls intersect(Rectangle2D, ArrayList<Element>) . |
void |
paintHighlighter(Graphics2D g,
Rectangle2D allocation,
double scale)
Render the Highlighter to the given graphic context. |
void |
repaint(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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jpicedt.graphic.view.View |
---|
changedUpdate, paint |
Field Detail |
---|
protected Element element
protected Rectangle2D bounds
getBounds
); this should be updated
by changedUpdate
.
protected Highlighter highlighter
view
.
Constructor Detail |
---|
public AbstractView(Element element)
Element
.
public AbstractView(Element element, Highlighter h)
View
for the given Element
, delegating highlighting
to the given Highlighter
.
Method Detail |
---|
public Element getElement()
View
getElement
in interface View
public void setElement(Element e)
setElement
in interface View
public View getParentView()
getParentView
in interface View
View
).public PECanvas getContainer()
getContainer
in interface View
public ViewFactory getViewFactory()
ViewFactory
implementation that is feeding the
view hierarchy.
getViewFactory
in interface View
public Graphics getGraphics()
getGraphics
in interface View
public Drawing getDrawing()
getDrawing
in interface View
public void repaint(Rectangle2D clip)
repaint
in interface View
clip
- the clip rectangle in model-coordinate; if null, simply
call repaint()
on the hosting container.public Rectangle2D getBounds()
getBounds
in interface View
bounds
.public Highlighter getHighlighter()
Highlighter
responsible for rendering the highlighted part of this view.
getHighlighter
in interface View
null
if this view cannot be highlightedpublic void setHighlighter(Highlighter h)
Highlighter
responsible for rendering the highlighted part of this view.
setHighlighter
in interface View
h
- the delegate ; null if this View
mustn't support highlighting.public void paintHighlighter(Graphics2D g, 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)
HitInfo
corresponding to the given mouse-event.
Only the view's shape should be included in this test.
public HitInfo hitTest(PEMouseEvent e, boolean isHighlightVisible)
isHighlighVisible
, current implementation first delegates
to the hosted Highlighter
's hitTest()
method, then calls
hitTest(PEMouseEvent)
.
hitTest
in interface View
isHighlightVisible
- whether the receiver should include the
highlighter shapes (e.g. end-points) in the click-sensitive area.e
- the mouse event for which a HitInfo
is returned
public boolean intersect(Rectangle2D r, boolean isHighlightVisible, ArrayList<Element> list)
isHighlighVisible
, current implementation first delegates to the
hosted Highlighter
's intersect()
method, then calls intersect(Rectangle2D, ArrayList<Element>)
.
intersect
in interface View
isHighlightVisible
- whether the receiver should include the
highlighter shapes (e.g. control-points) in the intersection
area.
protected abstract boolean intersect(Rectangle2D r, ArrayList<Element> list)
Element
or a child Element
if it's more appropriate (for
instance for composite views) to the given list (if non-null), and returns true.
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |