|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.jhotdraw.standard.StandardDrawingView
The standard implementation of DrawingView.
DrawingView
,
Painter
,
Tool
,
Serialized FormNested Class Summary | |
class |
StandardDrawingView.DrawingViewKeyListener
|
class |
StandardDrawingView.DrawingViewMouseListener
|
class |
StandardDrawingView.DrawingViewMouseMotionListener
|
Nested classes inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes 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. |
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. |
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. whether it accepts user input and whether it can display a drawing. |
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 |
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, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
public static final int MINIMUM_WIDTH
public static final int MINIMUM_HEIGHT
public static final int SCROLL_INCR
public static final int SCROLL_OFFSET
Constructor Detail |
public StandardDrawingView(DrawingEditor editor)
public StandardDrawingView(DrawingEditor editor, int width, int height)
Method Detail |
protected java.awt.event.MouseListener createMouseListener()
protected java.awt.event.MouseMotionListener createMouseMotionListener()
protected java.awt.event.KeyListener createKeyListener()
protected Painter createDisplayUpdate()
public void setEditor(DrawingEditor editor)
setEditor
in interface DrawingView
public Tool tool()
tool
in interface DrawingView
public Drawing drawing()
drawing
in interface DrawingView
public void setDrawing(Drawing d)
setDrawing
in interface DrawingView
public DrawingEditor editor()
editor
in interface DrawingView
public Figure add(Figure figure)
add
in interface DrawingView
public Figure remove(Figure figure)
remove
in interface DrawingView
public void addAll(java.util.Collection figures)
addAll
in interface DrawingView
public boolean figureExists(Figure inf, FigureEnumeration fe)
public FigureEnumeration insertFigures(FigureEnumeration fe, int dx, int dy, boolean bCheck)
insertFigures
in interface DrawingView
public FigureEnumeration getConnectionFigures(Figure inFigure)
getConnectionFigures
in interface DrawingView
public void setDisplayUpdate(Painter updateStrategy)
setDisplayUpdate
in interface DrawingView
Painter
public Painter getDisplayUpdate()
getDisplayUpdate
in interface DrawingView
Painter
public FigureEnumeration selection()
selection
in interface DrawingView
public FigureEnumeration selectionZOrdered()
selectionZOrdered
in interface DrawingView
selection()
public int selectionCount()
selectionCount
in interface DrawingView
public boolean isFigureSelected(Figure checkFigure)
isFigureSelected
in interface DrawingView
public void addToSelection(Figure figure)
addToSelection
in interface DrawingView
protected boolean addToSelectionImpl(Figure figure)
public void addToSelectionAll(java.util.Collection figures)
addToSelectionAll
in interface DrawingView
public void addToSelectionAll(FigureEnumeration fe)
addToSelectionAll
in interface DrawingView
public void removeFromSelection(Figure figure)
removeFromSelection
in interface DrawingView
public void toggleSelection(Figure figure)
toggleSelection
in interface DrawingView
public void clearSelection()
clearSelection
in interface DrawingView
protected HandleEnumeration selectionHandles()
public FigureSelection getFigureSelection()
getFigureSelection
in interface DrawingView
public Handle findHandle(int x, int y)
findHandle
in interface DrawingView
protected void fireSelectionChanged()
protected java.awt.Rectangle getDamage()
protected void setDamage(java.awt.Rectangle r)
public java.awt.Point lastClick()
lastClick
in interface DrawingView
protected void setLastClick(java.awt.Point newLastClick)
public void setConstrainer(PointConstrainer c)
setConstrainer
in interface DrawingView
public PointConstrainer getConstrainer()
getConstrainer
in interface DrawingView
protected java.awt.Point constrainPoint(java.awt.Point p)
public void checkDamage()
checkDamage
in interface DrawingView
public void repairDamage()
DrawingView
repairDamage
in interface DrawingView
public void drawingInvalidated(DrawingChangeEvent e)
DrawingChangeListener
drawingInvalidated
in interface DrawingChangeListener
public void drawingRequestUpdate(DrawingChangeEvent e)
DrawingChangeListener
drawingRequestUpdate
in interface DrawingChangeListener
public void drawingTitleChanged(DrawingChangeEvent e)
DrawingChangeListener
drawingTitleChanged
in interface DrawingChangeListener
protected void paintComponent(java.awt.Graphics g)
Painter
public void drawAll(java.awt.Graphics g)
drawAll
in interface DrawingView
public void draw(java.awt.Graphics g, FigureEnumeration fe)
draw
in interface DrawingView
public void drawHandles(java.awt.Graphics g)
drawHandles
in interface DrawingView
public void drawDrawing(java.awt.Graphics g)
drawDrawing
in interface DrawingView
public void drawBackground(java.awt.Graphics g)
drawBackground
in interface DrawingView
protected void drawPainters(java.awt.Graphics g, java.util.List v)
public void addBackground(Painter painter)
public void removeBackground(Painter painter)
protected java.util.List getBackgrounds()
public void removeForeground(Painter painter)
public void addForeground(Painter painter)
protected java.util.List getForegrounds()
public void freezeView()
freezeView
in interface DrawingView
Drawing.lock()
public void unfreezeView()
unfreezeView
in interface DrawingView
Drawing.unlock()
protected void checkMinimumSize()
protected java.awt.Dimension getDrawingSize()
public boolean isFocusTraversable()
Component.isFocusTraversable()
public boolean isInteractive()
DrawingView
isInteractive
in interface DrawingView
public void keyTyped(java.awt.event.KeyEvent e)
public void keyReleased(java.awt.event.KeyEvent e)
public void addFigureSelectionListener(FigureSelectionListener fsl)
addFigureSelectionListener
in interface DrawingView
fsl
- jhotdraw.framework.FigureSelectionListenerpublic void removeFigureSelectionListener(FigureSelectionListener fsl)
removeFigureSelectionListener
in interface DrawingView
fsl
- jhotdraw.framework.FigureSelectionListenerpublic int getDefaultDNDActions()
public void autoscroll(java.awt.Point p)
autoscroll
in interface java.awt.dnd.Autoscroll
public java.awt.Insets getAutoscrollInsets()
getAutoscrollInsets
in interface java.awt.dnd.Autoscroll
public java.lang.String toString()
protected void handleMouseEventException(java.lang.Throwable t)
protected DNDHelper createDNDHelper()
protected DNDHelper getDNDHelper()
public java.awt.dnd.DragSourceListener getDragSourceListener()
DNDInterface
getDragSourceListener
in interface DNDInterface
public void DNDInitialize(java.awt.dnd.DragGestureListener dgl)
DNDInitialize
in interface DNDInterface
public void DNDDeinitialize()
DNDDeinitialize
in interface DNDInterface
public boolean isReadOnly()
public void setReadOnly(boolean newIsReadOnly)
public void setCursor(Cursor cursor)
DrawingView
setCursor
in interface DrawingView
DrawingView.setCursor(Cursor)
,
Component.setCursor(java.awt.Cursor)
public java.awt.Dimension getMinimumSize()
getMinimumSize
in interface DrawingView
getMinimumSize()
,
Component.getMinimumSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |