|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
DrawingView renders a Drawing and listens to its changes. It receives user input and delegates it to the current tool.
Observer
DrawingView observes drawing for changes via the DrawingListener interface.
State
DrawingView plays the role of the StateContext in
the State pattern. Tool is the State.
Strategy
DrawingView is the StrategyContext in the Strategy pattern
with regard to the UpdateStrategy.
DrawingView is the StrategyContext for the PointConstrainer.
Drawing
,
Painter
,
Tool
Field Summary |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary | |
Figure |
add(Figure figure)
Adds a figure to the drawing. |
void |
addAll(java.util.Collection figures)
Adds a collections of figures to the drawing. |
void |
addFigureSelectionListener(FigureSelectionListener fsl)
Add a listener for selection changes in this DrawingView. |
void |
addToSelection(Figure figure)
Adds a figure to the current selection. |
void |
addToSelectionAll(java.util.Collection figures)
Adds a collections of figures to the current selection. |
void |
addToSelectionAll(FigureEnumeration fe)
Adds a FigureEnumeration to the current selection. |
void |
checkDamage()
Checks whether the drawing has some accumulated damage |
void |
clearSelection()
Clears the current selection. |
java.awt.Image |
createImage(int width,
int height)
Creates an image with the given dimensions |
void |
draw(java.awt.Graphics g,
FigureEnumeration fe)
Draws the given figures. |
void |
drawAll(java.awt.Graphics g)
Draws the contents of the drawing view. |
void |
drawBackground(java.awt.Graphics g)
Draws the background. |
void |
drawDrawing(java.awt.Graphics g)
Draws the drawing. |
void |
drawHandles(java.awt.Graphics g)
Draws the currently active handles. |
Drawing |
drawing()
Gets the drawing. |
DrawingEditor |
editor()
Gets the editor. |
Handle |
findHandle(int x,
int y)
Finds a handle at the given coordinates. |
void |
freezeView()
Freezes the view by acquiring the drawing lock. |
java.awt.Color |
getBackground()
Gets the background color of the DrawingView |
FigureEnumeration |
getConnectionFigures(Figure inFigure)
Returns a FigureEnumeration of connection figures |
PointConstrainer |
getConstrainer()
Gets the current grid setting. |
Painter |
getDisplayUpdate()
Gets the current display update strategy. |
FigureSelection |
getFigureSelection()
Gets the current selection as a FigureSelection. |
java.awt.Graphics |
getGraphics()
Gets a graphic to draw into |
java.awt.Dimension |
getMinimumSize()
Gets the minimum dimension of the drawing. |
java.awt.Dimension |
getPreferredSize()
Gets the preferred dimension of the drawing.. |
java.awt.Dimension |
getSize()
Gets the size of the drawing. |
FigureEnumeration |
insertFigures(FigureEnumeration inFigures,
int dx,
int dy,
boolean bCheck)
Inserts figures in a drawing at given offset. |
boolean |
isFigureSelected(Figure checkFigure)
Test whether a given figure is selected. |
boolean |
isInteractive()
Check whether the DrawingView is interactive, i.e. whether it accepts user input and whether it can display a drawing. |
java.awt.Point |
lastClick()
Gets the position of the last click inside the view. |
void |
paint(java.awt.Graphics g)
Paints the drawing view. |
Figure |
remove(Figure figure)
Removes a figure from the drawing. |
void |
removeFigureSelectionListener(FigureSelectionListener fsl)
Remove a listener for selection changes in this DrawingView. |
void |
removeFromSelection(Figure figure)
Removes a figure from the selection. |
void |
repairDamage()
Repair the damaged area |
FigureEnumeration |
selection()
Gets an enumeration over the currently selected figures. |
int |
selectionCount()
Gets the number of selected figures. |
FigureEnumeration |
selectionZOrdered()
Gets the currently seleced figures in Z order. |
void |
setBackground(java.awt.Color c)
Sets the background color of the DrawingView |
void |
setConstrainer(PointConstrainer p)
Sets the current point constrainer. |
void |
setCursor(Cursor c)
Sets the cursor of the DrawingView |
void |
setDisplayUpdate(Painter updateStrategy)
Sets the current display update strategy. |
void |
setDrawing(Drawing d)
Sets and installs another drawing in the view. |
void |
setEditor(DrawingEditor editor)
Sets the view's editor. |
void |
toggleSelection(Figure figure)
If a figure isn't selected it is added to the selection. |
Tool |
tool()
Gets the current tool. |
void |
unfreezeView()
Unfreezes the view by releasing the drawing lock. |
Methods inherited from interface java.awt.image.ImageObserver |
imageUpdate |
Methods inherited from interface org.jhotdraw.framework.DrawingChangeListener |
drawingInvalidated, drawingRequestUpdate, drawingTitleChanged |
Method Detail |
public void setEditor(DrawingEditor editor)
public Tool tool()
public Drawing drawing()
public void setDrawing(Drawing d)
public DrawingEditor editor()
public Figure add(Figure figure)
public Figure remove(Figure figure)
public void addAll(java.util.Collection figures)
public java.awt.Dimension getSize()
public java.awt.Dimension getMinimumSize()
public java.awt.Dimension getPreferredSize()
public void setDisplayUpdate(Painter updateStrategy)
Painter
public Painter getDisplayUpdate()
Painter
public FigureEnumeration selection()
public FigureEnumeration selectionZOrdered()
selection()
public int selectionCount()
public boolean isFigureSelected(Figure checkFigure)
public void addToSelection(Figure figure)
public void addToSelectionAll(java.util.Collection figures)
public void addToSelectionAll(FigureEnumeration fe)
public void removeFromSelection(Figure figure)
public void toggleSelection(Figure figure)
public void clearSelection()
public FigureSelection getFigureSelection()
public Handle findHandle(int x, int y)
public java.awt.Point lastClick()
public void setConstrainer(PointConstrainer p)
public PointConstrainer getConstrainer()
public void checkDamage()
public void repairDamage()
public void paint(java.awt.Graphics g)
Painter
public java.awt.Image createImage(int width, int height)
public java.awt.Graphics getGraphics()
public java.awt.Color getBackground()
public void setBackground(java.awt.Color c)
public void drawAll(java.awt.Graphics g)
public void draw(java.awt.Graphics g, FigureEnumeration fe)
public void drawHandles(java.awt.Graphics g)
public void drawDrawing(java.awt.Graphics g)
public void drawBackground(java.awt.Graphics g)
public void setCursor(Cursor c)
public void freezeView()
Drawing.lock()
public void unfreezeView()
Drawing.unlock()
public void addFigureSelectionListener(FigureSelectionListener fsl)
fsl
- jhotdraw.framework.FigureSelectionListenerpublic void removeFigureSelectionListener(FigureSelectionListener fsl)
fsl
- jhotdraw.framework.FigureSelectionListenerpublic FigureEnumeration getConnectionFigures(Figure inFigure)
public FigureEnumeration insertFigures(FigureEnumeration inFigures, int dx, int dy, boolean bCheck)
public boolean isInteractive()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |