JHotDraw 6.0b1

org.jhotdraw.standard
Class StandardDrawingView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.jhotdraw.standard.StandardDrawingView
All Implemented Interfaces:
java.awt.dnd.Autoscroll, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, DNDInterface, DrawingChangeListener, DrawingView
Direct Known Subclasses:
ZoomDrawingView

public class StandardDrawingView
extends javax.swing.JPanel
implements DrawingView, DNDInterface, java.awt.dnd.Autoscroll

The standard implementation of DrawingView.

See Also:
DrawingView, Painter, Tool, Serialized Form

Nested Class Summary
 class StandardDrawingView.DrawingViewKeyListener
           
 class StandardDrawingView.DrawingViewMouseListener
           
 class StandardDrawingView.DrawingViewMouseMotionListener
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int MINIMUM_HEIGHT
           
static int MINIMUM_WIDTH
          Scrolling increment
static int SCROLL_INCR
           
static int SCROLL_OFFSET
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
StandardDrawingView(DrawingEditor editor)
          Constructs the view.
StandardDrawingView(DrawingEditor editor, int width, int height)
           
 
Method Summary
 Figure add(Figure figure)
          Adds a figure to the drawing.
 void addAll(java.util.Collection figures)
          Adds a Collection of figures to the drawing.
 void addBackground(Painter painter)
          Adds a background.
 void addFigureSelectionListener(FigureSelectionListener fsl)
          Add a listener for selection changes.
 void addForeground(Painter painter)
          Adds a foreground.
 void addToSelection(Figure figure)
          Adds a figure to the current selection.
 void addToSelectionAll(java.util.Collection figures)
          Adds a Collection of figures to the current selection.
 void addToSelectionAll(FigureEnumeration fe)
          Adds a FigureEnumeration to the current selection.
protected  boolean addToSelectionImpl(Figure figure)
           
 void autoscroll(java.awt.Point p)
           
 void checkDamage()
          Refreshes the drawing if there is some accumulated damage
protected  void checkMinimumSize()
           
 void clearSelection()
          Clears the current selection.
 void clearToolTip()
          Call this to ensure that the tool tip is no longer shown.
protected  java.awt.Point constrainPoint(java.awt.Point p)
          Constrains a point to the current grid.
protected  Painter createDisplayUpdate()
          Factory method which can be overriden by subclasses
protected  DNDHelper createDNDHelper()
           
protected  java.awt.event.KeyListener createKeyListener()
           
protected  java.awt.event.MouseListener createMouseListener()
           
protected  java.awt.event.MouseMotionListener createMouseMotionListener()
           
 void DNDDeinitialize()
           
 void DNDInitialize(java.awt.dnd.DragGestureListener dgl)
           
 void draw(java.awt.Graphics g, FigureEnumeration fe)
          Draws the given figures.
 void drawAll(java.awt.Graphics g)
          Draws the contents of the drawing view.
 void drawBackground(java.awt.Graphics g)
          Draws the background.
 void drawDrawing(java.awt.Graphics g)
          Draws the drawing.
 void drawHandles(java.awt.Graphics g)
          Draws the currently active handles.
 Drawing drawing()
          Gets the drawing.
 void drawingInvalidated(DrawingChangeEvent e)
          Sent when an area is invalid
 void drawingRequestUpdate(DrawingChangeEvent e)
          Sent when the drawing wants to be refreshed
 void drawingTitleChanged(DrawingChangeEvent e)
          Sent when the drawing Title has changed
protected  void drawPainters(java.awt.Graphics g, java.util.List v)
           
 DrawingEditor editor()
          Gets the editor.
 boolean figureExists(Figure inf, FigureEnumeration fe)
          Check existance of figure in the drawing
 Handle findHandle(int x, int y)
          Finds a handle at the given coordinates.
protected  void fireSelectionChanged()
          Informs that the current selection changed.
 void freezeView()
          Freezes the view by acquiring the drawing lock.
 java.awt.Insets getAutoscrollInsets()
           
protected  java.util.List getBackgrounds()
           
 FigureEnumeration getConnectionFigures(Figure inFigure)
          Returns a FigureEnumeration of connectionfigures attached to this figure
 PointConstrainer getConstrainer()
          Gets the current constrainer.
protected  java.awt.Rectangle getDamage()
           
 int getDefaultDNDActions()
           
 Painter getDisplayUpdate()
          Sets the current display update strategy.
protected  DNDHelper getDNDHelper()
           
 java.awt.dnd.DragSourceListener getDragSourceListener()
          When the DNDTool starts a drag action, it queries the interface for the dragSourceListener of the source view.
protected  java.awt.Dimension getDrawingSize()
          Return the size of the area occupied by the contained figures inside the drawing.
 FigureSelection getFigureSelection()
          Gets the current selection as a FigureSelection.
protected  java.util.List getForegrounds()
           
 java.awt.Dimension getMinimumSize()
          Gets the minimum dimension of the drawing.
Fixed version (JHotDraw version has a bug).
 java.awt.Point getToolTipLocation(java.awt.event.MouseEvent event)
          Return the location of the tool tip to Swing
protected  void handleMouseEventException(java.lang.Throwable t)
          Default action when any uncaught exception bubbled from the mouse event handlers of the tools.
 FigureEnumeration insertFigures(FigureEnumeration fe, int dx, int dy, boolean bCheck)
          Inserts a FigureEnumeration of figures and translates them by the given offset.
 boolean isFigureSelected(Figure checkFigure)
          Test whether a given figure is selected.
 boolean isFocusTraversable()
          Deprecated. see super class
 boolean isInteractive()
          Check whether the DrawingView is interactive, i.e.
 boolean isReadOnly()
          Asks whether the drawing view is in read-only mode.
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 java.awt.Point lastClick()
          Gets the position of the last click inside the view.
protected  void paintComponent(java.awt.Graphics g)
          Paints the drawing view.
 Figure remove(Figure figure)
          Removes a figure from the drawing.
 void removeBackground(Painter painter)
          Removes a background.
 void removeFigureSelectionListener(FigureSelectionListener fsl)
          Remove a listener for selection changes.
 void removeForeground(Painter painter)
          Removes a foreground.
 void removeFromSelection(Figure figure)
          Removes a figure from the selection.
 void repairDamage()
          Repair the damaged area
 FigureEnumeration selection()
          Gets an enumeration over the currently selected figures.
 int selectionCount()
          Gets the number of selected figures.
protected  HandleEnumeration selectionHandles()
          Gets an enumeration of the currently active handles.
 FigureEnumeration selectionZOrdered()
          Gets the currently selected figures in Z order.
 void setConstrainer(PointConstrainer c)
          Sets the grid spacing that is used to constrain points.
 void setCursor(Cursor cursor)
          Sets the cursor of the DrawingView
protected  void setDamage(java.awt.Rectangle r)
           
 void setDisplayUpdate(Painter updateStrategy)
          Sets the current display update strategy.
 void setDrawing(Drawing d)
          Sets and installs another drawing in the view.
 void setEditor(DrawingEditor editor)
          Sets the view's editor.
protected  void setLastClick(java.awt.Point newLastClick)
           
 void setReadOnly(boolean newIsReadOnly)
          Determines whether the drawing view is in read-only mode.
 void setToolTipFigure(Figure f)
          Calls setToolTipLocation(Point p) with a standard position relative to the given figure.
 void setToolTipLocation(java.awt.Point p)
          Works along with setToolTipText() and when both are called, a tool tip is shown at the Point p until clearToolTip() is called
 void toggleSelection(Figure figure)
          If a figure isn't selected it is added to the selection.
 Tool tool()
          Gets the current tool.
 java.lang.String toString()
           
 void unfreezeView()
          Unfreezes the view by releasing the drawing lock.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.framework.DrawingView
createImage, getBackground, getGraphics, getPreferredSize, getSize, paint, setBackground
 
Methods inherited from interface java.awt.image.ImageObserver
imageUpdate
 

Field Detail

MINIMUM_WIDTH

public static final int MINIMUM_WIDTH
Scrolling increment

See Also:
Constant Field Values

MINIMUM_HEIGHT

public static final int MINIMUM_HEIGHT
See Also:
Constant Field Values

SCROLL_INCR

public static final int SCROLL_INCR
See Also:
Constant Field Values

SCROLL_OFFSET

public static final int SCROLL_OFFSET
See Also:
Constant Field Values
Constructor Detail

StandardDrawingView

public StandardDrawingView(DrawingEditor editor)
Constructs the view.


StandardDrawingView

public StandardDrawingView(DrawingEditor editor,
                           int width,
                           int height)
Method Detail

createMouseListener

protected java.awt.event.MouseListener createMouseListener()

createMouseMotionListener

protected java.awt.event.MouseMotionListener createMouseMotionListener()

createKeyListener

protected java.awt.event.KeyListener createKeyListener()

createDisplayUpdate

protected Painter createDisplayUpdate()
Factory method which can be overriden by subclasses


setEditor

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

Specified by:
setEditor in interface DrawingView

tool

public Tool tool()
Gets the current tool.

Specified by:
tool in interface DrawingView

drawing

public Drawing drawing()
Gets the drawing.

Specified by:
drawing in interface DrawingView

setDrawing

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

Specified by:
setDrawing in interface DrawingView

editor

public DrawingEditor editor()
Gets the editor.

Specified by:
editor in interface DrawingView

add

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

Specified by:
add in interface DrawingView
Returns:
the added figure.

remove

public Figure remove(Figure figure)
Removes a figure from the drawing.

Specified by:
remove in interface DrawingView
Returns:
the removed figure

addAll

public void addAll(java.util.Collection figures)
Adds a Collection of figures to the drawing.

Specified by:
addAll in interface DrawingView

figureExists

public boolean figureExists(Figure inf,
                            FigureEnumeration fe)
Check existance of figure in the drawing


insertFigures

public FigureEnumeration insertFigures(FigureEnumeration fe,
                                       int dx,
                                       int dy,
                                       boolean bCheck)
Inserts a FigureEnumeration of figures and translates them by the given offset. This function is used to insert figures from clipboards (cut/copy)

Specified by:
insertFigures in interface DrawingView
Returns:
enumeration which has been added to the drawing. The figures in the enumeration can have changed during adding them (e.g. they could have been decorated).

getConnectionFigures

public FigureEnumeration getConnectionFigures(Figure inFigure)
Returns a FigureEnumeration of connectionfigures attached to this figure

Specified by:
getConnectionFigures in interface DrawingView

setDisplayUpdate

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

Specified by:
setDisplayUpdate in interface DrawingView
See Also:
Painter

getDisplayUpdate

public Painter getDisplayUpdate()
Sets the current display update strategy.

Specified by:
getDisplayUpdate in interface DrawingView
See Also:
Painter

selection

public FigureEnumeration selection()
Gets an enumeration over the currently selected figures. The selection is a snapshot of the current selection which does not get changed anymore

Specified by:
selection in interface DrawingView
Returns:
an enumeration with the currently selected figures.

selectionZOrdered

public FigureEnumeration selectionZOrdered()
Gets the currently selected figures in Z order.

Specified by:
selectionZOrdered in interface DrawingView
Returns:
a FigureEnumeration with the selected figures. The enumeration represents a snapshot of the current selection.
See Also:
selection()

selectionCount

public int selectionCount()
Gets the number of selected figures.

Specified by:
selectionCount in interface DrawingView

isFigureSelected

public boolean isFigureSelected(Figure checkFigure)
Test whether a given figure is selected.

Specified by:
isFigureSelected in interface DrawingView

addToSelection

public void addToSelection(Figure figure)
Adds a figure to the current selection. The figure is only selected if it is also contained in the Drawing associated with this DrawingView.

Specified by:
addToSelection in interface DrawingView

addToSelectionImpl

protected boolean addToSelectionImpl(Figure figure)

addToSelectionAll

public void addToSelectionAll(java.util.Collection figures)
Adds a Collection of figures to the current selection.

Specified by:
addToSelectionAll in interface DrawingView

addToSelectionAll

public void addToSelectionAll(FigureEnumeration fe)
Adds a FigureEnumeration to the current selection.

Specified by:
addToSelectionAll in interface DrawingView

removeFromSelection

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

Specified by:
removeFromSelection in interface DrawingView

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.

Specified by:
toggleSelection in interface DrawingView

clearSelection

public void clearSelection()
Clears the current selection.

Specified by:
clearSelection in interface DrawingView

selectionHandles

protected HandleEnumeration selectionHandles()
Gets an enumeration of the currently active handles.


getFigureSelection

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

Specified by:
getFigureSelection in interface DrawingView

findHandle

public Handle findHandle(int x,
                         int y)
Finds a handle at the given coordinates.

Specified by:
findHandle in interface DrawingView
Returns:
the hit handle, null if no handle is found.

fireSelectionChanged

protected void fireSelectionChanged()
Informs that the current selection changed. By default this event is forwarded to the drawing editor.


getDamage

protected java.awt.Rectangle getDamage()

setDamage

protected void setDamage(java.awt.Rectangle r)

lastClick

public java.awt.Point lastClick()
Gets the position of the last click inside the view.

Specified by:
lastClick in interface DrawingView

setLastClick

protected void setLastClick(java.awt.Point newLastClick)

setConstrainer

public void setConstrainer(PointConstrainer c)
Sets the grid spacing that is used to constrain points.

Specified by:
setConstrainer in interface DrawingView

getConstrainer

public PointConstrainer getConstrainer()
Gets the current constrainer.

Specified by:
getConstrainer in interface DrawingView

constrainPoint

protected java.awt.Point constrainPoint(java.awt.Point p)
Constrains a point to the current grid.


checkDamage

public void checkDamage()
Refreshes the drawing if there is some accumulated damage

Specified by:
checkDamage in interface DrawingView

repairDamage

public void repairDamage()
Description copied from interface: DrawingView
Repair the damaged area

Specified by:
repairDamage in interface DrawingView

drawingInvalidated

public void drawingInvalidated(DrawingChangeEvent e)
Description copied from interface: DrawingChangeListener
Sent when an area is invalid

Specified by:
drawingInvalidated in interface DrawingChangeListener

drawingRequestUpdate

public void drawingRequestUpdate(DrawingChangeEvent e)
Description copied from interface: DrawingChangeListener
Sent when the drawing wants to be refreshed

Specified by:
drawingRequestUpdate in interface DrawingChangeListener

drawingTitleChanged

public void drawingTitleChanged(DrawingChangeEvent e)
Description copied from interface: DrawingChangeListener
Sent when the drawing Title has changed

Specified by:
drawingTitleChanged in interface DrawingChangeListener

paintComponent

protected void paintComponent(java.awt.Graphics g)
Paints the drawing view. The actual drawing is delegated to the current update strategy.

Overrides:
paintComponent in class javax.swing.JComponent
See Also:
Painter

drawAll

public void drawAll(java.awt.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.

Specified by:
drawAll in interface DrawingView

draw

public void draw(java.awt.Graphics g,
                 FigureEnumeration fe)
Draws the given figures. The view has three layers: background, drawing, handles. The layers are drawn in back to front order. No background is drawn.

Specified by:
draw in interface DrawingView

drawHandles

public void drawHandles(java.awt.Graphics g)
Draws the currently active handles.

Specified by:
drawHandles in interface DrawingView

drawDrawing

public void drawDrawing(java.awt.Graphics g)
Draws the drawing.

Specified by:
drawDrawing in interface DrawingView

drawBackground

public void drawBackground(java.awt.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.

Specified by:
drawBackground in interface DrawingView

drawPainters

protected void drawPainters(java.awt.Graphics g,
                            java.util.List v)

addBackground

public void addBackground(Painter painter)
Adds a background.


removeBackground

public void removeBackground(Painter painter)
Removes a background.


getBackgrounds

protected java.util.List getBackgrounds()

removeForeground

public void removeForeground(Painter painter)
Removes a foreground.


addForeground

public void addForeground(Painter painter)
Adds a foreground.


getForegrounds

protected java.util.List getForegrounds()

freezeView

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

Specified by:
freezeView in interface DrawingView
See Also:
Drawing.lock()

unfreezeView

public void unfreezeView()
Unfreezes the view by releasing the drawing lock.

Specified by:
unfreezeView in interface DrawingView
See Also:
Drawing.unlock()

checkMinimumSize

protected void checkMinimumSize()

getDrawingSize

protected java.awt.Dimension getDrawingSize()
Return the size of the area occupied by the contained figures inside the drawing. This method is called by checkMinimumSize().


isFocusTraversable

public boolean isFocusTraversable()
Deprecated. see super class

Overrides:
isFocusTraversable in class java.awt.Component
See Also:
Component.isFocusTraversable()

isInteractive

public boolean isInteractive()
Description copied from interface: DrawingView
Check whether the DrawingView is interactive, i.e. whether it accepts user input and whether it can display a drawing.

Specified by:
isInteractive in interface DrawingView

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)

addFigureSelectionListener

public void addFigureSelectionListener(FigureSelectionListener fsl)
Add a listener for selection changes.

Specified by:
addFigureSelectionListener in interface DrawingView
Parameters:
fsl - jhotdraw.framework.FigureSelectionListener

removeFigureSelectionListener

public void removeFigureSelectionListener(FigureSelectionListener fsl)
Remove a listener for selection changes.

Specified by:
removeFigureSelectionListener in interface DrawingView
Parameters:
fsl - jhotdraw.framework.FigureSelectionListener

getDefaultDNDActions

public int getDefaultDNDActions()

autoscroll

public void autoscroll(java.awt.Point p)
Specified by:
autoscroll in interface java.awt.dnd.Autoscroll

getAutoscrollInsets

public java.awt.Insets getAutoscrollInsets()
Specified by:
getAutoscrollInsets in interface java.awt.dnd.Autoscroll

toString

public java.lang.String toString()
Overrides:
toString in class java.awt.Component

handleMouseEventException

protected void handleMouseEventException(java.lang.Throwable t)
Default action when any uncaught exception bubbled from the mouse event handlers of the tools. Subclass may override it to provide other action.


createDNDHelper

protected DNDHelper createDNDHelper()

getDNDHelper

protected DNDHelper getDNDHelper()

getDragSourceListener

public java.awt.dnd.DragSourceListener getDragSourceListener()
Description copied from interface: DNDInterface
When the DNDTool starts a drag action, it queries the interface for the dragSourceListener of the source view. It uses this listener to create the dragGestureEvent.

Specified by:
getDragSourceListener in interface DNDInterface

DNDInitialize

public void DNDInitialize(java.awt.dnd.DragGestureListener dgl)
Specified by:
DNDInitialize in interface DNDInterface

DNDDeinitialize

public void DNDDeinitialize()
Specified by:
DNDDeinitialize in interface DNDInterface

isReadOnly

public boolean isReadOnly()
Asks whether the drawing view is in read-only mode. If so, the user can't modify it using mouse or keyboard actions. Yet, it can still be modified from inside the program.


setReadOnly

public void setReadOnly(boolean newIsReadOnly)
Determines whether the drawing view is in read-only mode. If so, the user can't modify it using mouse or keyboard actions. Yet, it can still be modified from inside the program.


setCursor

public void setCursor(Cursor cursor)
Description copied from interface: DrawingView
Sets the cursor of the DrawingView

Specified by:
setCursor in interface DrawingView
See Also:
DrawingView.setCursor(Cursor), Component.setCursor(java.awt.Cursor)

getMinimumSize

public java.awt.Dimension getMinimumSize()
Gets the minimum dimension of the drawing.
Fixed version (JHotDraw version has a bug).

Specified by:
getMinimumSize in interface DrawingView
Overrides:
getMinimumSize in class javax.swing.JComponent
See Also:
getMinimumSize(), Component.getMinimumSize()

getToolTipLocation

public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent event)
Return the location of the tool tip to Swing

Overrides:
getToolTipLocation in class javax.swing.JComponent

setToolTipLocation

public void setToolTipLocation(java.awt.Point p)
Works along with setToolTipText() and when both are called, a tool tip is shown at the Point p until clearToolTip() is called


setToolTipFigure

public void setToolTipFigure(Figure f)
Calls setToolTipLocation(Point p) with a standard position relative to the given figure.


clearToolTip

public void clearToolTip()
Call this to ensure that the tool tip is no longer shown.


JHotDraw 6.0b1