|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjpicedt.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 Viewpublic void setElement(Element e)
setElement in interface Viewpublic View getParentView()
getParentView in interface ViewView).public PECanvas getContainer()
getContainer in interface Viewpublic ViewFactory getViewFactory()
ViewFactory implementation that is feeding the
view hierarchy.
getViewFactory in interface Viewpublic Graphics getGraphics()
getGraphics in interface Viewpublic Drawing getDrawing()
getDrawing in interface Viewpublic void repaint(Rectangle2D clip)
repaint in interface Viewclip - the clip rectangle in model-coordinate; if null, simply
call repaint() on the hosting container.public Rectangle2D getBounds()
getBounds in interface Viewbounds.public Highlighter getHighlighter()
Highlighter responsible for rendering the highlighted part of this view.
getHighlighter in interface Viewnull if this view cannot be highlightedpublic void setHighlighter(Highlighter h)
Highlighter responsible for rendering the highlighted part of this view.
setHighlighter in interface Viewh - the delegate ; null if this View mustn't support highlighting.
public void paintHighlighter(Graphics2D g,
Rectangle2D allocation,
double scale)
paintHighlighter in interface Viewallocation - 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 ViewisHighlightVisible - 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 ViewisHighlightVisible - 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 | |||||||||