All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.standard.StandardDrawingView
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Panel
|
+----CH.ifa.draw.standard.StandardDrawingView
- public class StandardDrawingView
- extends Panel
- implements DrawingView, MouseListener, MouseMotionListener, KeyListener
The standard implementation of DrawingView.
- See Also:
- DrawingView, Painter, Tool
-
StandardDrawingView(DrawingEditor, int, int)
- Constructs the view.
-
add(Figure)
- Adds a figure to the drawing.
-
addAll(Vector)
- Adds a vector of figures to the drawing.
-
addBackground(Painter)
- Adds a background.
-
addForeground(Painter)
- Adds a foreground.
-
addToSelection(Figure)
- Adds a figure to the current selection.
-
addToSelectionAll(Vector)
- Adds a vector of figures to the current selection.
-
checkDamage()
- Refreshes the drawing if there is some accumulated damage
-
clearSelection()
- Clears the current selection.
-
constrainPoint(Point)
- Constrains a point to the current grid.
-
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.
-
drawingInvalidated(DrawingChangeEvent)
-
-
drawingRequestUpdate(DrawingChangeEvent)
-
-
editor()
- Gets the editor.
-
findHandle(int, int)
- Finds a handle at the given coordinates.
-
freezeView()
- Freezes the view by acquiring the drawing lock.
-
getConstrainer()
- Gets the current constrainer.
-
getFigureSelection()
- Gets the current selection as a FigureSelection.
-
getMinimumSize()
- Gets the minimum dimension of the drawing.
-
getPreferredSize()
- Gets the preferred dimension of the drawing..
-
handleCursorKey(int)
- Handles cursor keys by moving all the selected figures
one grid point in the cursor direction.
-
isFocusTraversable()
-
-
keyPressed(KeyEvent)
- Handles key down events.
-
keyReleased(KeyEvent)
-
-
keyTyped(KeyEvent)
-
-
lastClick()
- Gets the position of the last click inside the view.
-
mouseClicked(MouseEvent)
-
-
mouseDragged(MouseEvent)
- Handles mouse drag events.
-
mouseEntered(MouseEvent)
-
-
mouseExited(MouseEvent)
-
-
mouseMoved(MouseEvent)
- Handles mouse move events.
-
mousePressed(MouseEvent)
- Handles mouse down events.
-
mouseReleased(MouseEvent)
- Handles mouse up events.
-
paint(Graphics)
- Paints the drawing view.
-
remove(Figure)
- Removes a figure from the drawing.
-
removeBackground(Painter)
- Removes a background.
-
removeForeground(Painter)
- Removes a foreground.
-
removeFromSelection(Figure)
- Removes a figure from the selection.
-
repairDamage()
-
-
selection()
- Gets the currently selected figures.
-
selectionChanged()
- Informs that the current selection changed.
-
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.
-
setConstrainer(PointConstrainer)
- Sets the grid spacing that is used to constrain points.
-
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.
-
update(Graphics)
- Updates the drawing view.
StandardDrawingView
public StandardDrawingView(DrawingEditor editor,
int width,
int height)
- Constructs the view.
setEditor
public void setEditor(DrawingEditor editor)
- Sets the view's editor.
tool
public Tool tool()
- Gets the current tool.
drawing
public Drawing drawing()
- Gets the drawing.
setDrawing
public void setDrawing(Drawing d)
- Sets and installs another drawing in the view.
editor
public DrawingEditor editor()
- Gets the editor.
add
public Figure add(Figure figure)
- Adds a figure to the drawing.
- Returns:
- the added figure.
remove
public Figure remove(Figure figure)
- Removes a figure from the drawing.
- Returns:
- the removed figure
addAll
public void addAll(Vector figures)
- Adds a vector of figures to the drawing.
getMinimumSize
public Dimension getMinimumSize()
- Gets the minimum dimension of the drawing.
- Overrides:
- getMinimumSize in class Container
getPreferredSize
public Dimension getPreferredSize()
- Gets the preferred dimension of the drawing..
- Overrides:
- getPreferredSize in class Container
setDisplayUpdate
public void setDisplayUpdate(Painter updateStrategy)
- Sets the current display update strategy.
- See Also:
- UpdateStrategy
selection
public 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 FigureEnumeration selectionElements()
- Gets an enumeration over the currently selected figures.
selectionZOrdered
public 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 int selectionCount()
- Gets the number of selected figures.
addToSelection
public void addToSelection(Figure figure)
- Adds a figure to the current selection.
addToSelectionAll
public void addToSelectionAll(Vector figures)
- Adds a vector of figures to the current selection.
removeFromSelection
public void removeFromSelection(Figure figure)
- Removes a figure from the selection.
toggleSelection
public 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 void clearSelection()
- Clears the current selection.
getFigureSelection
public FigureSelection getFigureSelection()
- Gets the current selection as a FigureSelection. A FigureSelection
can be cut, copied, pasted.
findHandle
public Handle findHandle(int x,
int y)
- Finds a handle at the given coordinates.
- Returns:
- the hit handle, null if no handle is found.
selectionChanged
protected void selectionChanged()
- Informs that the current selection changed.
By default this event is forwarded to the
drawing editor.
lastClick
public Point lastClick()
- Gets the position of the last click inside the view.
setConstrainer
public void setConstrainer(PointConstrainer c)
- Sets the grid spacing that is used to constrain points.
getConstrainer
public PointConstrainer getConstrainer()
- Gets the current constrainer.
constrainPoint
protected Point constrainPoint(Point p)
- Constrains a point to the current grid.
mousePressed
public void mousePressed(MouseEvent e)
- Handles mouse down events. The event is delegated to the
currently active tool.
- Returns:
- whether the event was handled.
mouseDragged
public void mouseDragged(MouseEvent e)
- Handles mouse drag events. The event is delegated to the
currently active tool.
- Returns:
- whether the event was handled.
mouseMoved
public void mouseMoved(MouseEvent e)
- Handles mouse move events. The event is delegated to the
currently active tool.
- Returns:
- whether the event was handled.
mouseReleased
public void mouseReleased(MouseEvent e)
- Handles mouse up events. The event is delegated to the
currently active tool.
- Returns:
- whether the event was handled.
keyPressed
public void keyPressed(KeyEvent e)
- Handles key down events. Cursor keys are handled
by the view the other key events are delegated to the
currently active tool.
- Returns:
- whether the event was handled.
handleCursorKey
protected void handleCursorKey(int key)
- Handles cursor keys by moving all the selected figures
one grid point in the cursor direction.
checkDamage
public synchronized void checkDamage()
- Refreshes the drawing if there is some accumulated damage
repairDamage
public void repairDamage()
drawingInvalidated
public void drawingInvalidated(DrawingChangeEvent e)
drawingRequestUpdate
public void drawingRequestUpdate(DrawingChangeEvent e)
update
public void update(Graphics g)
- Updates the drawing view.
- Overrides:
- update in class Component
paint
public void paint(Graphics g)
- Paints the drawing view. The actual drawing is delegated to
the current update strategy.
- Overrides:
- paint in class Container
- See Also:
- Painter
drawAll
public 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 void drawHandles(Graphics g)
- Draws the currently active handles.
drawDrawing
public void drawDrawing(Graphics g)
- Draws the drawing.
drawBackground
public 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.
addBackground
public void addBackground(Painter painter)
- Adds a background.
removeBackground
public void removeBackground(Painter painter)
- Removes a background.
removeForeground
public void removeForeground(Painter painter)
- Removes a foreground.
addForeground
public void addForeground(Painter painter)
- Adds a foreground.
freezeView
public void freezeView()
- Freezes the view by acquiring the drawing lock.
- See Also:
- lock
unfreezeView
public void unfreezeView()
- Unfreezes the view by releasing the drawing lock.
- See Also:
- unlock
isFocusTraversable
public boolean isFocusTraversable()
- Overrides:
- isFocusTraversable in class Component
mouseEntered
public void mouseEntered(MouseEvent e)
mouseExited
public void mouseExited(MouseEvent e)
mouseClicked
public void mouseClicked(MouseEvent e)
keyTyped
public void keyTyped(KeyEvent e)
keyReleased
public void keyReleased(KeyEvent e)
All Packages Class Hierarchy This Package Previous Next Index