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

 o Observer
DrawingView observes drawing for changes via the DrawingListener interface.
 o State
DrawingView plays the role of the StateContext in the State pattern. Tool is the State.
 o 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

Method Index

 o add(Figure)
Adds a figure to the drawing.
 o addAll(Vector)
Adds a vector of figures to the drawing.
 o addToSelection(Figure)
Adds a figure to the current selection.
 o addToSelectionAll(Vector)
Adds a vector of figures to the current selection.
 o checkDamage()
Checks whether the drawing has some accumulated damage
 o clearSelection()
Clears the current selection.
 o createImage(int, int)
Creates an image with the given dimensions
 o drawAll(Graphics)
Draws the contents of the drawing view.
 o drawBackground(Graphics)
Draws the background.
 o drawDrawing(Graphics)
Draws the drawing.
 o drawHandles(Graphics)
Draws the currently active handles.
 o drawing()
Gets the drawing.
 o editor()
Gets the editor.
 o findHandle(int, int)
Finds a handle at the given coordinates.
 o freezeView()
Freezes the view by acquiring the drawing lock.
 o getBackground()
Gets the background color of the DrawingView
 o getConstrainer()
Gets the current grid setting.
 o getFigureSelection()
Gets the current selection as a FigureSelection.
 o getGraphics()
Gets a graphic to draw into
 o getMinimumSize()
Gets the minimum dimension of the drawing.
 o getPreferredSize()
Gets the preferred dimension of the drawing..
 o getSize()
Gets the size of the drawing.
 o lastClick()
Gets the position of the last click inside the view.
 o paint(Graphics)
Paints the drawing view.
 o remove(Figure)
Removes a figure from the drawing.
 o removeFromSelection(Figure)
Removes a figure from the selection.
 o repairDamage()
Repair the damaged area
 o selection()
Gets the currently selected figures.
 o selectionCount()
Gets the number of selected figures.
 o selectionElements()
Gets an enumeration over the currently selected figures.
 o selectionZOrdered()
Gets the currently selected figures in Z order.
 o setBackground(Color)
Gets the background color of the DrawingView
 o setConstrainer(PointConstrainer)
Sets the current point constrainer.
 o setCursor(Cursor)
Sets the cursor of the DrawingView
 o setDisplayUpdate(Painter)
Sets the current display update strategy.
 o setDrawing(Drawing)
Sets and installs another drawing in the view.
 o setEditor(DrawingEditor)
Sets the view's editor.
 o toggleSelection(Figure)
If a figure isn't selected it is added to the selection.
 o tool()
Gets the current tool.
 o unfreezeView()
Unfreezes the view by releasing the drawing lock.

Methods

 o setEditor
 public abstract void setEditor(DrawingEditor editor)
Sets the view's editor.

 o tool
 public abstract Tool tool()
Gets the current tool.

 o drawing
 public abstract Drawing drawing()
Gets the drawing.

 o setDrawing
 public abstract void setDrawing(Drawing d)
Sets and installs another drawing in the view.

 o editor
 public abstract DrawingEditor editor()
Gets the editor.

 o add
 public abstract Figure add(Figure figure)
Adds a figure to the drawing.

Returns:
the added figure.
 o remove
 public abstract Figure remove(Figure figure)
Removes a figure from the drawing.

Returns:
the removed figure
 o addAll
 public abstract void addAll(Vector figures)
Adds a vector of figures to the drawing.

 o getSize
 public abstract Dimension getSize()
Gets the size of the drawing.

 o getMinimumSize
 public abstract Dimension getMinimumSize()
Gets the minimum dimension of the drawing.

 o getPreferredSize
 public abstract Dimension getPreferredSize()
Gets the preferred dimension of the drawing..

 o setDisplayUpdate
 public abstract void setDisplayUpdate(Painter updateStrategy)
Sets the current display update strategy.

See Also:
UpdateStrategy
 o 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.
 o selectionElements
 public abstract FigureEnumeration selectionElements()
Gets an enumeration over the currently selected figures.

 o 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
 o selectionCount
 public abstract int selectionCount()
Gets the number of selected figures.

 o addToSelection
 public abstract void addToSelection(Figure figure)
Adds a figure to the current selection.

 o addToSelectionAll
 public abstract void addToSelectionAll(Vector figures)
Adds a vector of figures to the current selection.

 o removeFromSelection
 public abstract void removeFromSelection(Figure figure)
Removes a figure from the selection.

 o 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.

 o clearSelection
 public abstract void clearSelection()
Clears the current selection.

 o getFigureSelection
 public abstract FigureSelection getFigureSelection()
Gets the current selection as a FigureSelection. A FigureSelection can be cut, copied, pasted.

 o 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.
 o lastClick
 public abstract Point lastClick()
Gets the position of the last click inside the view.

 o setConstrainer
 public abstract void setConstrainer(PointConstrainer p)
Sets the current point constrainer.

 o getConstrainer
 public abstract PointConstrainer getConstrainer()
Gets the current grid setting.

 o checkDamage
 public abstract void checkDamage()
Checks whether the drawing has some accumulated damage

 o repairDamage
 public abstract void repairDamage()
Repair the damaged area

 o paint
 public abstract void paint(Graphics g)
Paints the drawing view. The actual drawing is delegated to the current update strategy.

See Also:
Painter
 o createImage
 public abstract Image createImage(int width,
                                   int height)
Creates an image with the given dimensions

 o getGraphics
 public abstract Graphics getGraphics()
Gets a graphic to draw into

 o getBackground
 public abstract Color getBackground()
Gets the background color of the DrawingView

 o setBackground
 public abstract void setBackground(Color c)
Gets the background color of the DrawingView

 o 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.

 o drawHandles
 public abstract void drawHandles(Graphics g)
Draws the currently active handles.

 o drawDrawing
 public abstract void drawDrawing(Graphics g)
Draws the drawing.

 o 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.

 o setCursor
 public abstract void setCursor(Cursor c)
Sets the cursor of the DrawingView

 o freezeView
 public abstract void freezeView()
Freezes the view by acquiring the drawing lock.

See Also:
lock
 o 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