|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjpicedt.graphic.view.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 |
| Fields inherited from interface jpicedt.graphic.view.ViewConstants |
BARBELL_SIZE, CLICK_DISTANCE |
| 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 model associated with the view. |
Element |
getElement()
|
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(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
protected Highlighter highlighter
| Constructor Detail |
public AbstractView(Element element)
public AbstractView(Element element,
Highlighter h)
| Method Detail |
public Element getElement()
getElement in interface Viewpublic void setElement(Element e)
setElement in interface Viewpublic View getParentView()
getParentView in interface Viewpublic PECanvas getContainer()
getContainer in interface Viewpublic ViewFactory getViewFactory()
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()
getHighlighter in interface Viewpublic void setHighlighter(Highlighter h)
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)
public HitInfo hitTest(PEMouseEvent e,
boolean isHighlightVisible)
hitTest(PEMouseEvent).
hitTest in interface ViewisHighlightVisible - whether the receiver should include the highlighter shapes (e.g. end-points)
in the click-sensitive area.
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||