Back to index

moin  1.9.0~rc2
Public Member Functions
CH.ifa.draw.framework.DrawingView Interface Reference

DrawingView renders a Drawing and listens to its changes. More...

Inheritance diagram for CH.ifa.draw.framework.DrawingView:
Inheritance graph
[legend]
Collaboration diagram for CH.ifa.draw.framework.DrawingView:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void setEditor (DrawingEditor editor)
 Sets the view's editor.
Tool tool ()
 Gets the current tool.
Drawing drawing ()
 Gets the drawing.
void enableGuides (boolean enable)
boolean guidesEnabled ()
void setDrawing (Drawing d)
 Sets and installs another drawing in the view.
DrawingEditor editor ()
 Gets the editor.
Figure add (Figure figure)
 Adds a figure to the drawing.
Figure remove (Figure figure)
 Removes a figure from the drawing.
void addAll (Vector figures)
 Adds a vector of figures to the drawing.
Dimension getSize ()
 Gets the size of the drawing.
Dimension getMinimumSize ()
 Gets the minimum dimension of the drawing.
Dimension getPreferredSize ()
 Gets the preferred dimension of the drawing.
void setDisplayUpdate (Painter updateStrategy)
 Sets the current display update strategy.
Vector selection ()
 Gets the currently selected figures.
FigureEnumeration selectionElements ()
 Gets an enumeration over the currently selected figures.
Vector selectionZOrdered ()
 Gets the currently selected figures in Z order.
int selectionCount ()
 Gets the number of selected figures.
void addToSelection (Figure figure)
 Adds a figure to the current selection.
void addToSelectionAll (Vector figures)
 Adds a vector of figures to the current selection.
void removeFromSelection (Figure figure)
 Removes a figure from the selection.
void toggleSelection (Figure figure)
 If a figure isn't selected it is added to the selection.
void clearSelection ()
 Clears the current selection.
FigureSelection getFigureSelection ()
 Gets the current selection as a FigureSelection.
void moveSelection (int dx, int dy)
 Move current selection by dx and dy.
Handle findHandle (int x, int y)
 Finds a handle at the given coordinates.
Point lastClick ()
 Gets the position of the last click inside the view.
void setConstrainer (PointConstrainer p)
 Sets the current point constrainer.
PointConstrainer getConstrainer ()
 Gets the current grid setting.
void checkDamage ()
 Checks whether the drawing has some accumulated damage.
void repairDamage ()
 Repair the damaged area.
void paint (Graphics g)
 Paints the drawing view.
Image createImage (int width, int height)
 Creates an image with the given dimensions.
Graphics getGraphics ()
 Gets a graphic to draw into.
Color getBackground ()
 Gets the background color of the DrawingView.
void setBackground (Color c)
 Gets the background color of the DrawingView.
void drawAll (Graphics g)
 Draws the contents of the drawing view.
void drawHandles (Graphics g)
 Draws the currently active handles.
void drawDrawing (Graphics g, boolean showGuides)
 Draws the drawing.
void drawBackground (Graphics g)
 Draws the background.
void setCursor (Cursor c)
 Sets the cursor of the DrawingView.
void freezeView ()
 Freezes the view by acquiring the drawing lock.
void unfreezeView ()
 Unfreezes the view by releasing the drawing lock.
void drawingInvalidated (DrawingChangeEvent e)
 Sent when an area is invalid.
void drawingRequestUpdate (DrawingChangeEvent e)
 Sent when the drawing wants to be refreshed.

Detailed Description

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

Definition at line 38 of file DrawingView.java.


Member Function Documentation

Adds a figure to the drawing.

Returns:
the added figure.

Here is the caller graph for this function:

void CH.ifa.draw.framework.DrawingView.addAll ( Vector  figures)

Adds a vector of figures to the drawing.

Adds a figure to the current selection.

Adds a vector of figures to the current selection.

Checks whether the drawing has some accumulated damage.

Clears the current selection.

Image CH.ifa.draw.framework.DrawingView.createImage ( int  width,
int  height 
)

Creates an image with the given dimensions.

Draws the contents of the drawing view.

The view has three layers: background, drawing, handles. The layers are drawn in back to front order.

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.

void CH.ifa.draw.framework.DrawingView.drawDrawing ( Graphics  g,
boolean  showGuides 
)

Draws the drawing.

Draws the currently active handles.

Gets the drawing.

Sent when an area is invalid.

Sent when the drawing wants to be refreshed.

Gets the editor.

Finds a handle at the given coordinates.

Returns:
the hit handle, null if no handle is found.

Freezes the view by acquiring the drawing lock.

See also:
Drawing::lock

Gets the background color of the DrawingView.

Gets the current grid setting.

Gets the current selection as a FigureSelection.

A FigureSelection can be cut, copied, pasted.

Gets a graphic to draw into.

Gets the minimum dimension of the drawing.

Gets the preferred dimension of the drawing.

Gets the size of the drawing.

Gets the position of the last click inside the view.

void CH.ifa.draw.framework.DrawingView.moveSelection ( int  dx,
int  dy 
)

Move current selection by dx and dy.

Paints the drawing view.

The actual drawing is delegated to the current update strategy.

See also:
Painter

Removes a figure from the drawing.

Returns:
the removed figure

Here is the caller graph for this function:

Removes a figure from the selection.

Repair the damaged area.

Gets the currently selected figures.

Returns:
a vector with the selected figures. The vector is a copy of the current selection.

Gets the number of selected figures.

Gets an enumeration over the currently selected figures.

Gets the currently selected figures in Z order.

See also:
selection
Returns:
a vector with the selected figures. The vector is a copy of the current selection.

Gets the background color of the DrawingView.

Sets the current point constrainer.

Sets the cursor of the DrawingView.

Sets the current display update strategy.

See also:
UpdateStrategy

Sets and installs another drawing in the view.

Sets the view's editor.

If a figure isn't selected it is added to the selection.

Otherwise it is removed from the selection.

Gets the current tool.

Unfreezes the view by releasing the drawing lock.

See also:
Drawing::unlock

The documentation for this interface was generated from the following file: