|
|||||||||
Home >> All >> jpicedt >> graphic >> [ view overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
jpicedt.graphic.view
Interface View

- All Known Implementing Classes:
- AbstractView
- public interface View
a View is a graphic representation of a Element. It can be rendered using its paint method.
It provides the following capabilities :
- Rendering to a Graphics2D context ;
- Highlighting ;
- Mouse-hit testing (this is here because a View knows better than anyone how a graphic element
looks on the screen, and thus where a user should click to select/whatever/... the element). As
an example, consider a rectangle element that has a "fill-color" attribute set to "green", and
is indeed paint in green in some View implementation, but is transparent in some other implementation :
then when the user clicks inside the rectangle, the first implementation should return a "hit-ok" while
the second should return "hit-fail", even thought the element has the same "fill-color" in both cases.
View implementation that don't implement editing capabilities may have their hitTest method simply return null to signal that every mouse-click just fails, and their paintHighlighter do nothing.
[pending] Another approach would be to define aka EditableView interface inheriting from View and adding the afore-mentioned methods ?
Field Summary | |
static double |
BARBELL_SIZE
a constant that can be used as the size of selection-barbells (in pixels !!!) |
static double |
CLICK_DISTANCE
a constant that can be used as the max. |
Method Summary | |
void |
changedUpdate(jpicedt.graphic.event.DrawingEvent.EventType eventType)
Give notification from the model that a change occured for an element this view is responsible for rendering. |
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. |
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 allocation)
Render the View of the underlying Element to the given graphic context. |
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 to repaint itself |
void |
setElement(jpicedt.graphic.model.Element e)
set the element the View is responsible for rendering |
Field Detail |
CLICK_DISTANCE
public static final double CLICK_DISTANCE
- a constant that can be used as the max. distance b/w a point and a mouse click that triggers
a selection (in mm !!!)
- See Also:
- Constant Field Values
BARBELL_SIZE
public static final double BARBELL_SIZE
- a constant that can be used as the size of selection-barbells (in pixels !!!)
- See Also:
- Constant Field Values
Method Detail |
getElement
public jpicedt.graphic.model.Element getElement()
setElement
public void setElement(jpicedt.graphic.model.Element e)
- set the element the View is responsible for rendering
getParentView
public View getParentView()
- Returns the parent of the view, as given by the tree-structure the associated graphic element belongs to.
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.
getViewFactory
public ViewFactory getViewFactory()
- Fetches the ViewFactory implementation that is feeding the view hierarchy.
getGraphics
public java.awt.Graphics getGraphics()
- Fetch a Graphics for rendering. This can be used to determine
font characteristics, and will be different for a print view
than a component view.
- Since:
- 1.3
getDrawing
public jpicedt.graphic.model.Drawing getDrawing()
- Fetches the model associated with the view.
changedUpdate
public void changedUpdate(jpicedt.graphic.event.DrawingEvent.EventType eventType)
- Give notification from the model that a change occured for an element this view is responsible
for rendering.
repaint
public void repaint(java.awt.geom.Rectangle2D clip)
- ask the hosting container to repaint itself
paint
public void paint(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation)
- Render the View of the underlying Element to the given graphic context.
- Since:
- jPicEdt 1.3.2
paintHighlighter
public void paintHighlighter(java.awt.Graphics2D g, java.awt.geom.Rectangle2D allocation, double scale)
- Render the Highlighter to the given graphic context.
- Since:
- jPicEdt 1.3.2
getBounds
public java.awt.geom.Rectangle2D getBounds()
- 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.
- Since:
- jPicEdt 1.3.2
|
|||||||||
Home >> All >> jpicedt >> graphic >> [ view overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |