Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jpicedt.graphic.view
Class AbstractView  view AbstractView download AbstractView.java

java.lang.Object
  extended byjpicedt.graphic.view.AbstractView
All Implemented Interfaces:
View
Direct Known Subclasses:
DefaultViewFactory.CompositeView, DefaultViewFactory.LeafElementView

public abstract class AbstractView
extends java.lang.Object
implements View

Abstract implementation that provide some basic common behaviours for View's.


Field Summary
protected  java.awt.geom.Rectangle2D bounds
          the bounds rectangle used for clipping (as returned by getBounds) ; this should be updated by changedUpdate.
protected  jpicedt.graphic.model.Element element
          the graphic element that this View renders
 
Fields inherited from interface jpicedt.graphic.view.View
BARBELL_SIZE, CLICK_DISTANCE
 
Constructor Summary
AbstractView(jpicedt.graphic.model.Element element)
          construct a new View for the given Element
 
Method Summary
 java.awt.geom.Rectangle2D getBounds()
           
 jpicedt.graphic.PECanvas getContainer()
          Fetches the container hosting the view.
 jpicedt.graphic.model.Drawing getDrawing()
          Fetches the model associated with the view.
 jpicedt.graphic.model.Element getElement()
           
 java.awt.Graphics getGraphics()
          Fetch a Graphics for rendering from the hosting container (if not null).
 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.
 HitInfo hitTest(jpicedt.graphic.event.PEMouseEvent e, boolean isHighlightVisible)
          Current implementation returns a HitInfo.Point if highlighter is visible and a click occured on an end-point ; return null otherwise.
 void paint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D a)
          This implementation does nothing.
 void paintHighlighter(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)
          Render the Highlighter to the given graphic context.
Current implementation paints end-points using the highlighter color if the given allocation intersects the bounds of this view.
 void repaint(java.awt.geom.Rectangle2D clip)
          ask the hosting container (if it's non-null) to repaint itself
 void setElement(jpicedt.graphic.model.Element e)
          set the element the View is responsible for rendering
 
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
 

Field Detail

element

protected jpicedt.graphic.model.Element element
the graphic element that this View renders


bounds

protected java.awt.geom.Rectangle2D bounds
the bounds rectangle used for clipping (as returned by getBounds) ; this should be updated by changedUpdate.

Constructor Detail

AbstractView

public AbstractView(jpicedt.graphic.model.Element element)
construct a new View for the given Element

Method Detail

getElement

public jpicedt.graphic.model.Element getElement()
Specified by:
getElement in interface View

setElement

public void setElement(jpicedt.graphic.model.Element e)
set the element the View is responsible for rendering

Specified by:
setElement in interface View

getParentView

public View getParentView()
Returns the parent of the view, as given by the tree-structure the associated graphic element belongs to.

Specified by:
getParentView in interface View

getContainer

public jpicedt.graphic.PECanvas getContainer()
Fetches the container hosting the view. This is useful for things like scheduling a repaint, finding out the host components font, etc. The default implementation of this is to forward the query to the parent view, if any... (that means that for this method to return non-null, the element attached to this view must have a parent, and this parent, a view, etc...)

Specified by:
getContainer in interface View

getViewFactory

public ViewFactory getViewFactory()
Fetches the ViewFactory implementation that is feeding the view hierarchy.

Specified by:
getViewFactory in interface View

getGraphics

public java.awt.Graphics getGraphics()
Fetch a Graphics for rendering from the hosting container (if not null). This can be used to determine font characteristics, and will be different for a print view than a component view.

Specified by:
getGraphics in interface View
Since:
1.3

getDrawing

public jpicedt.graphic.model.Drawing getDrawing()
Fetches the model associated with the view.

Specified by:
getDrawing in interface View

repaint

public void repaint(java.awt.geom.Rectangle2D clip)
ask the hosting container (if it's non-null) to repaint itself

Specified by:
repaint in interface View

paint

public void paint(java.awt.Graphics2D g,
                  java.awt.geom.Rectangle2D a)
This implementation does nothing.

Specified by:
paint in interface View

paintHighlighter

public void paintHighlighter(java.awt.Graphics2D g,
                             java.awt.geom.Rectangle2D allocation,
                             double scale)
Render the Highlighter to the given graphic context.
Current implementation paints end-points using the highlighter color if the given allocation intersects the bounds of this view.

Specified by:
paintHighlighter in interface View
Since:
jPicEdt 1.3.2

getBounds

public java.awt.geom.Rectangle2D getBounds()
Specified by:
getBounds in interface View
Since:
jPicEdt 1.3.2

hitTest

public HitInfo hitTest(jpicedt.graphic.event.PEMouseEvent e,
                       boolean isHighlightVisible)
Current implementation returns a HitInfo.Point if highlighter is visible and a click occured on an end-point ; return null otherwise.

Specified by:
hitTest in interface View
Since:
jPicEdt 1.3.2