jdraw.framework
Interface DrawView


public interface DrawView

The class DrawView displays a graphic model. It is responsible for the presentation of the model and the interaction with the user (selecting, moving and dragging new figures). The type of new figures which are generated if a rectangle is drawn is defined by the currently installed factory.

See Also:
DrawModel, DrawTool

Method Summary
 void addToSelection(jdraw.framework.Figure f)
          Adds a figure to the selected figures.
 void clearSelection()
          Clears the selection.
 jdraw.framework.PointConstrainer getConstrainer()
          Gets the current grid setting.
 jdraw.framework.DrawEditor getEditor()
          Returns the draw editor which contains this view.
 jdraw.framework.DrawModel getModel()
          Returns the graphic model of this view.
 java.util.Set getSelection()
          Returns the selected figures.
 java.awt.Dimension getSize()
          Returns the size of the drawing.
 jdraw.framework.DrawTool getTool()
          Returns the currently active tool.
 void paint(java.awt.Graphics g)
          Draws the graphic model.
 void removeFromSelection(jdraw.framework.Figure f)
          Removes a figure from the selected figures.
 void repaint()
          Repaints this view.
 void setConstrainer(jdraw.framework.PointConstrainer p)
          Sets the current point constrainer.
 void setCursor(java.awt.Cursor c)
          Sets the cursor of the DrawingView.
 void setDefaultTool()
          Sets the default tool (selection and moving of figures).
 void setTool(jdraw.framework.DrawTool tool)
          Sets the tool to be used.
 

Method Detail

getModel

public jdraw.framework.DrawModel getModel()
Returns the graphic model of this view.

Returns:
the graphic model presented by this view

getEditor

public jdraw.framework.DrawEditor getEditor()
Returns the draw editor which contains this view. This object gains access to the editor's menu bar and status field.

Returns:
the draw editor

getTool

public jdraw.framework.DrawTool getTool()
Returns the currently active tool.

Returns:
active tool

setTool

public void setTool(jdraw.framework.DrawTool tool)
Sets the tool to be used.

Parameters:
tool - tool to be used by the draw view

setDefaultTool

public void setDefaultTool()
Sets the default tool (selection and moving of figures).


setConstrainer

public void setConstrainer(jdraw.framework.PointConstrainer p)
Sets the current point constrainer.


getConstrainer

public jdraw.framework.PointConstrainer getConstrainer()
Gets the current grid setting.


getSelection

public java.util.Set getSelection()
Returns the selected figures.


clearSelection

public void clearSelection()
Clears the selection.


addToSelection

public void addToSelection(jdraw.framework.Figure f)
Adds a figure to the selected figures.


removeFromSelection

public void removeFromSelection(jdraw.framework.Figure f)
Removes a figure from the selected figures.


paint

public void paint(java.awt.Graphics g)
Draws the graphic model. The paint method iterates over all figures in the graphic model and calls their paint method.


repaint

public void repaint()
Repaints this view.


getSize

public java.awt.Dimension getSize()
Returns the size of the drawing.

Returns:
size of the drawing

setCursor

public void setCursor(java.awt.Cursor c)
Sets the cursor of the DrawingView.