|
JHotDraw 7.1 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DrawingView
A DrawingView paints a Drawing
on a JComponent.
To support editing, a DrawingView can paint Handle
s and
the current Tool
of the DrawingEditor
on top of the
drawing. It can render a Constrainer
below the drawing.
Tools can register mouse and key listeners on the DrawingView.
A DrawingView can paint the drawing with a scale factor. It supports conversion between scaled view coordinates and drawing coordinates.
Field Summary | |
---|---|
static java.lang.String |
CONSTRAINER_PROPERTY
This constant is used to identify the constrainer property of the DrawingView. |
static java.lang.String |
CONSTRAINER_VISIBLE_PROPERTY
This constant is used to identify the constrainer visible property of the DrawingView. |
static java.lang.String |
CURSOR_PROPERTY
This constant is used to identify the cursor property of the DrawingView. |
static java.lang.String |
DRAWING_PROPERTY
This constant is used to identify the drawing property of the DrawingView. |
static java.lang.String |
ENABLED_PROPERTY
This constant is used to identify the enabled property of the DrawingView. |
static java.lang.String |
HANDLE_DETAIL_LEVEL_PROPERTY
This constant is used to identify the handle detail level property of the DrawingView. |
static java.lang.String |
INVISIBLE_CONSTRAINER_PROPERTY
This constant is used to identify the invisible constrainer property of the DrawingView. |
static java.lang.String |
SCALE_FACTOR_PROPERTY
This constant is used to identify the scale factor property of the DrawingView. |
static java.lang.String |
VISIBLE_CONSTRAINER_PROPERTY
This constant is used to identify the visible constrainer property of the DrawingView. |
Method Summary | |
---|---|
void |
addFigureSelectionListener(FigureSelectionListener fsl)
Add a listener for selection changes in this DrawingView. |
void |
addKeyListener(java.awt.event.KeyListener l)
|
void |
addMouseListener(java.awt.event.MouseListener l)
|
void |
addMouseMotionListener(java.awt.event.MouseMotionListener l)
|
void |
addNotify(DrawingEditor editor)
Informs the view that it has been added to the specified editor. |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
addToSelection(java.util.Collection<Figure> figures)
Adds a collection of figures to the current selection. |
void |
addToSelection(Figure figure)
Adds a figure to the current selection. |
void |
clearSelection()
Clears the current selection. |
java.awt.Point |
drawingToView(java.awt.geom.Point2D.Double p)
Converts drawing coordinates to view coordinates. |
java.awt.Rectangle |
drawingToView(java.awt.geom.Rectangle2D.Double p)
Converts drawing coordinates to view coordinates. |
Figure |
findFigure(java.awt.Point p)
Finds a figure at the given point. |
java.util.Collection<Figure> |
findFigures(java.awt.Rectangle r)
Returns all figures that lie within or intersect the specified bounds. |
java.util.Collection<Figure> |
findFiguresWithin(java.awt.Rectangle r)
Returns all figures that lie within the specified bounds. |
Handle |
findHandle(java.awt.Point p)
Finds a handle at the given coordinates. |
java.util.Collection<Handle> |
getCompatibleHandles(Handle handle)
Gets compatible handles. |
javax.swing.JComponent |
getComponent()
Returns the JComponent of the drawing view. |
Constrainer |
getConstrainer()
Gets the current constrainer of this view. |
Drawing |
getDrawing()
Gets the drawing. |
java.awt.geom.AffineTransform |
getDrawingToViewTransform()
Gets an transform which can be used to convert drawing coordinates to view coordinates. |
int |
getHandleDetailLevel()
Returns the detail level of the handles. |
Constrainer |
getInvisibleConstrainer()
Gets the editor's constrainer for this view, for use, when the visible constrainer is turned off. |
double |
getScaleFactor()
Gets the scale factor of the drawing view. |
java.util.Set<Figure> |
getSelectedFigures()
Gets the selected figures. |
int |
getSelectionCount()
Gets the number of selected figures. |
Constrainer |
getVisibleConstrainer()
Gets the editor's constrainer for this view, for use, when the visible constrainer is turned on. |
boolean |
isConstrainerVisible()
Returns true, if the visible Constrainer is in use, returns false, if the invisible Constrainer is in use. |
boolean |
isEnabled()
Gets the enabled state of the drawing view. |
boolean |
isFigureSelected(Figure checkFigure)
Test whether a given figure is selected. |
void |
removeFigureSelectionListener(FigureSelectionListener fsl)
Remove a listener for selection changes in this DrawingView. |
void |
removeFromSelection(Figure figure)
Removes a figure from the selection. |
void |
removeKeyListener(java.awt.event.KeyListener l)
|
void |
removeMouseListener(java.awt.event.MouseListener l)
|
void |
removeMouseMotionListener(java.awt.event.MouseMotionListener l)
|
void |
removeNotify(DrawingEditor editor)
Informs the view that it has been removed from the specified editor. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
|
void |
requestFocus()
|
void |
selectAll()
Selects all figures. |
void |
setConstrainerVisible(boolean newValue)
Changes between a visible Constrainer and an invisible Constrainer. |
void |
setCursor(java.awt.Cursor c)
Sets the cursor of the DrawingView. |
void |
setDrawing(Drawing d)
Sets and installs another drawing in the view. |
void |
setEnabled(boolean newValue)
Sets the enabled state of the drawing view. |
void |
setHandleDetailLevel(int newValue)
The detail level of the handles. |
void |
setInvisibleConstrainer(Constrainer constrainer)
Sets the editor's constrainer for this view, for use, when the visible constrainer is turned off. |
void |
setScaleFactor(double newValue)
Sets the scale factor of the drawing view. |
void |
setVisibleConstrainer(Constrainer constrainer)
Sets the editor's constrainer for this view, for use, when the visible constrainer is turned on. |
void |
toggleSelection(Figure figure)
If a figure isn't selected it is added to the selection. |
java.awt.geom.Point2D.Double |
viewToDrawing(java.awt.Point p)
Converts view coordinates to drawing coordinates. |
java.awt.geom.Rectangle2D.Double |
viewToDrawing(java.awt.Rectangle p)
Converts view coordinates to drawing coordinates. |
Field Detail |
---|
static final java.lang.String DRAWING_PROPERTY
static final java.lang.String CURSOR_PROPERTY
static final java.lang.String CONSTRAINER_PROPERTY
static final java.lang.String VISIBLE_CONSTRAINER_PROPERTY
static final java.lang.String INVISIBLE_CONSTRAINER_PROPERTY
static final java.lang.String CONSTRAINER_VISIBLE_PROPERTY
static final java.lang.String SCALE_FACTOR_PROPERTY
static final java.lang.String HANDLE_DETAIL_LEVEL_PROPERTY
static final java.lang.String ENABLED_PROPERTY
Method Detail |
---|
Drawing getDrawing()
void setDrawing(Drawing d)
void setCursor(java.awt.Cursor c)
boolean isFigureSelected(Figure checkFigure)
void addToSelection(Figure figure)
void addToSelection(java.util.Collection<Figure> figures)
void removeFromSelection(Figure figure)
void toggleSelection(Figure figure)
void clearSelection()
void selectAll()
java.util.Set<Figure> getSelectedFigures()
int getSelectionCount()
Handle findHandle(java.awt.Point p)
java.util.Collection<Handle> getCompatibleHandles(Handle handle)
Figure findFigure(java.awt.Point p)
java.util.Collection<Figure> findFigures(java.awt.Rectangle r)
java.util.Collection<Figure> findFiguresWithin(java.awt.Rectangle r)
void addNotify(DrawingEditor editor)
void removeNotify(DrawingEditor editor)
void addMouseListener(java.awt.event.MouseListener l)
void removeMouseListener(java.awt.event.MouseListener l)
void addKeyListener(java.awt.event.KeyListener l)
void removeKeyListener(java.awt.event.KeyListener l)
void addMouseMotionListener(java.awt.event.MouseMotionListener l)
void removeMouseMotionListener(java.awt.event.MouseMotionListener l)
void addFigureSelectionListener(FigureSelectionListener fsl)
fsl
- jhotdraw.framework.FigureSelectionListenervoid removeFigureSelectionListener(FigureSelectionListener fsl)
fsl
- jhotdraw.framework.FigureSelectionListenervoid requestFocus()
java.awt.Point drawingToView(java.awt.geom.Point2D.Double p)
java.awt.geom.Point2D.Double viewToDrawing(java.awt.Point p)
java.awt.Rectangle drawingToView(java.awt.geom.Rectangle2D.Double p)
java.awt.geom.Rectangle2D.Double viewToDrawing(java.awt.Rectangle p)
Constrainer getConstrainer()
void setVisibleConstrainer(Constrainer constrainer)
Constrainer getVisibleConstrainer()
void setInvisibleConstrainer(Constrainer constrainer)
Constrainer getInvisibleConstrainer()
void setConstrainerVisible(boolean newValue)
boolean isConstrainerVisible()
javax.swing.JComponent getComponent()
java.awt.geom.AffineTransform getDrawingToViewTransform()
double getScaleFactor()
void setScaleFactor(double newValue)
void setHandleDetailLevel(int newValue)
int getHandleDetailLevel()
void setEnabled(boolean newValue)
boolean isEnabled()
void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
|
Copyright 1996-2007 (c) JHotDraw.org. Some rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |