All Packages Class Hierarchy This Package Previous Next Index
Interface CH.ifa.draw.framework.DrawingView
- public interface interface DrawingView
- extends ImageObserver, DrawingChangeListener
DrawingView renders a Drawing and listens to its changes.
It receives user input and delegates it to the current tool.
Design Patterns
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.
- See Also:
- Drawing, Painter, Tool
-
add(Figure)
- Adds a figure to the drawing.
-
addAll(Vector)
- Adds a vector of figures to the drawing.
-
addToSelection(Figure)
- Adds a figure to the current selection.
-
addToSelectionAll(Vector)
- Adds a vector of figures to the current selection.
-
checkDamage()
- Checks whether the drawing has some accumulated damage
-
clearSelection()
- Clears the current selection.
-
createImage(int, int)
- Creates an image with the given dimensions
-
drawAll(Graphics)
- Draws the contents of the drawing view.
-
drawBackground(Graphics)
- Draws the background.
-
drawDrawing(Graphics)
- Draws the drawing.
-
drawHandles(Graphics)
- Draws the currently active handles.
-
drawing()
- Gets the drawing.
-
editor()
- Gets the editor.
-
findHandle(int, int)
- Finds a handle at the given coordinates.
-
freezeView()
- Freezes the view by acquiring the drawing lock.
-
getBackground()
- Gets the background color of the DrawingView
-
getConstrainer()
- Gets the current grid setting.
-
getFigureSelection()
- Gets the current selection as a FigureSelection.
-
getGraphics()
- Gets a graphic to draw into
-
getMinimumSize()
- Gets the minimum dimension of the drawing.
-
getPreferredSize()
- Gets the preferred dimension of the drawing..
-
getSize()
- Gets the size of the drawing.
-
lastClick()
- Gets the position of the last click inside the view.
-
paint(Graphics)
- Paints the drawing view.
-
remove(Figure)
- Removes a figure from the drawing.
-
removeFromSelection(Figure)
- Removes a figure from the selection.
-
repairDamage()
- Repair the damaged area
-
selection()
- Gets the currently selected figures.
-
selectionCount()
- Gets the number of selected figures.
-
selectionElements()
- Gets an enumeration over the currently selected figures.
-
selectionZOrdered()
- Gets the currently selected figures in Z order.
-
setBackground(Color)
- Gets the background color of the DrawingView
-
setConstrainer(PointConstrainer)
- Sets the current point constrainer.
-
setCursor(Cursor)
- Sets the cursor of the DrawingView
-
setDisplayUpdate(Painter)
- Sets the current display update strategy.
-
setDrawing(Drawing)
- Sets and installs another drawing in the view.
-
setEditor(DrawingEditor)
- Sets the view's editor.
-
toggleSelection(Figure)
- If a figure isn't selected it is added to the selection.
-
tool()
- Gets the current tool.
-
unfreezeView()
- Unfreezes the view by releasing the drawing lock.
setEditor
public abstract void setEditor(DrawingEditor editor)
- Sets the view's editor.
tool
public abstract Tool tool()
- Gets the current tool.
drawing
public abstract Drawing drawing()
- Gets the drawing.
setDrawing
public abstract void setDrawing(Drawing d)
- Sets and installs another drawing in the view.
editor
public abstract DrawingEditor editor()
- Gets the editor.
add
public abstract Figure add(Figure figure)
- Adds a figure to the drawing.
- Returns:
- the added figure.
remove
public abstract Figure remove(Figure figure)
- Removes a figure from the drawing.
- Returns:
- the removed figure
addAll
public abstract void addAll(Vector figures)
- Adds a vector of figures to the drawing.
getSize
public abstract Dimension getSize()
- Gets the size of the drawing.
getMinimumSize
public abstract Dimension getMinimumSize()
- Gets the minimum dimension of the drawing.
getPreferredSize
public abstract Dimension getPreferredSize()
- Gets the preferred dimension of the drawing..
setDisplayUpdate
public abstract void setDisplayUpdate(Painter updateStrategy)
- Sets the current display update strategy.
- See Also:
- UpdateStrategy
selection
public abstract Vector selection()
- Gets the currently selected figures.
- Returns:
- a vector with the selected figures. The vector
is a copy of the current selection.
selectionElements
public abstract FigureEnumeration selectionElements()
- Gets an enumeration over the currently selected figures.
selectionZOrdered
public abstract Vector selectionZOrdered()
- Gets the currently selected figures in Z order.
- Returns:
- a vector with the selected figures. The vector
is a copy of the current selection.
- See Also:
- selection
selectionCount
public abstract int selectionCount()
- Gets the number of selected figures.
addToSelection
public abstract void addToSelection(Figure figure)
- Adds a figure to the current selection.
addToSelectionAll
public abstract void addToSelectionAll(Vector figures)
- Adds a vector of figures to the current selection.
removeFromSelection
public abstract void removeFromSelection(Figure figure)
- Removes a figure from the selection.
toggleSelection
public abstract void toggleSelection(Figure figure)
- If a figure isn't selected it is added to the selection.
Otherwise it is removed from the selection.
clearSelection
public abstract void clearSelection()
- Clears the current selection.
getFigureSelection
public abstract FigureSelection getFigureSelection()
- Gets the current selection as a FigureSelection. A FigureSelection
can be cut, copied, pasted.
findHandle
public abstract Handle findHandle(int x,
int y)
- Finds a handle at the given coordinates.
- Returns:
- the hit handle, null if no handle is found.
lastClick
public abstract Point lastClick()
- Gets the position of the last click inside the view.
setConstrainer
public abstract void setConstrainer(PointConstrainer p)
- Sets the current point constrainer.
getConstrainer
public abstract PointConstrainer getConstrainer()
- Gets the current grid setting.
checkDamage
public abstract void checkDamage()
- Checks whether the drawing has some accumulated damage
repairDamage
public abstract void repairDamage()
- Repair the damaged area
paint
public abstract void paint(Graphics g)
- Paints the drawing view. The actual drawing is delegated to
the current update strategy.
- See Also:
- Painter
createImage
public abstract Image createImage(int width,
int height)
- Creates an image with the given dimensions
getGraphics
public abstract Graphics getGraphics()
- Gets a graphic to draw into
getBackground
public abstract Color getBackground()
- Gets the background color of the DrawingView
setBackground
public abstract void setBackground(Color c)
- Gets the background color of the DrawingView
drawAll
public abstract void drawAll(Graphics g)
- Draws the contents of the drawing view.
The view has three layers: background, drawing, handles.
The layers are drawn in back to front order.
drawHandles
public abstract void drawHandles(Graphics g)
- Draws the currently active handles.
drawDrawing
public abstract void drawDrawing(Graphics g)
- Draws the drawing.
drawBackground
public abstract void drawBackground(Graphics g)
- Draws the background. If a background pattern is set it
is used to fill the background. Otherwise the background
is filled in the background color.
setCursor
public abstract void setCursor(Cursor c)
- Sets the cursor of the DrawingView
freezeView
public abstract void freezeView()
- Freezes the view by acquiring the drawing lock.
- See Also:
- lock
unfreezeView
public abstract void unfreezeView()
- Unfreezes the view by releasing the drawing lock.
- See Also:
- unlock
All Packages Class Hierarchy This Package Previous Next Index