hades.gui
Class JObjectCanvas

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjfig.canvas.FigSwingCanvas
                  extended byhades.gui.JObjectCanvas
All Implemented Interfaces:
java.util.EventListener, FigCanvas, FullRedraw, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, ObjectCanvas, ObjectPainter, java.io.Serializable, SyncPainter

public class JObjectCanvas
extends FigSwingCanvas
implements ObjectCanvas

JObjectCanvas provides a canvas to display and edit HADES schematics. As a subclass of jfig.canvas.FigSwingCanvas, this class can display arbitrary jfig FIG objects and subclasses like hades.symbols.Symbol. Additionally, JObjectCanvas provides animation support via synchronous repaints and a popup-menu created dynamically from text descriptions.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class jfig.canvas.FigSwingCanvas
FigSwingCanvas.Options2D
 
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 MAX_REPAINT_INDEX
          specify the size of the tables used to manage animation.
protected  int n_repaintOverflows
           
protected  int n_repaintTableEntries
           
protected  int n_repaintTables
           
(package private) static java.lang.String versionString
           
 
Fields inherited from class jfig.canvas.FigSwingCanvas
backgroundColor, BASE_ANCHOR_X, BASE_ANCHOR_Y, canvasListener, cur_height, cur_width, cur_x, cur_y, debug, defaultColor, defaultCursor, enableRulerDragging, enableTimingInfo, gridColor, gridMode, gridVisible, hasRulers, helper, Jdebug, mode, objectEnumerator, objectGR, offscreenGR, offscreenImage, old_x, old_y, PAINT_ALL, PAINT_CURSOR, PAINT_NO_CHANGES, PAINT_OBJECTS, PAINT_RIGHT_RULER, PAINT_RUBBERBAND, PAINT_TMP_TEXT, PAINT_TOP_RULER, printer, ptmp, rubberband, RULER_XL_OFFSET, RULER_XR_OFFSET, RULER_YB_OFFSET, RULER_YT_OFFSET, rulerFont, theObserver, tmp_sc, tmp_wc, trafo, tripleBuffer, tripleBufferGR, two_decimals, useTripleBuffering, waitCursor, XXX, zoomFitBorderWidth, zoomListenerVector
 
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.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface jfig.canvas.FigCanvas
FullRedraw, MouseMotionRedraw, NoChanges, ObjectRedraw, panDOWN, panHOME, panLEFT, panRIGHT, panUP, SyncRedraw, SystemRedraw, TmpObjectRedraw, TmpTextRedraw
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JObjectCanvas(Editor _editor)
          create an empty JObjectCanvas for the specified editor.
 
Method Summary
 void clearRepaintArray()
           
 int countExecutedSyncRepaints()
           
 int countPendingRepaints()
           
 int countRepaintTableEntries()
           
 int countSyncRepaintOverflows()
           
 void createCustomNullCursor()
           
 void createMenuShortcuts()
           
 javax.swing.JToolTip createToolTip()
          create a JMultiLineToolTip with context sensitive information text
 void doPanning(int direction, boolean shift)
          automatic panning of the visible viewport on the world-coordinate system.
 void doSyncRedraw()
          perform a synchronous redrawing of all 'dirty' objects contained in our 'repaintArray' object buffer.
 void doZoomFit()
          doZoomFit(): calculate the bounding box of all objects from our FigDrawableEnumerator, then set the zoom and panning so that all objects are visible.
 void doZoomIn14()
          zoom in by a factor of two.
 void doZoomLandscapeA4(FigBbox bbox)
          fit all objects to "Landscape A4 paper".
 void doZoomOut07()
           
 void doZoomRegion(FigBbox bbox)
          fit objects to this JObjectCanvas.
 void doZoomRegionBroken(FigBbox bbox)
           
 void drawRulers(java.awt.Graphics g)
          drawRulers: draw the scale rulers on top and the right side of the canvas.
 boolean getEnablePopup()
           
 java.awt.Point getPopupPosition()
          return the screen-coordinate position of the last popup-menus invocation
 java.awt.Point getPopupPositionWC()
          return the world-coordinate position corresponding to the last popup-menus invocation
 java.awt.Point getPopupPositionWCsnapped()
           
 SyncRedrawTimer getSyncRedrawTimer()
           
 java.lang.String getToken(java.util.StringTokenizer st)
           
 java.awt.Point getToolTipLocation(java.awt.event.MouseEvent evt)
          calculate a good location for our context sensitive tool tips
 java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
          create a context sensitive tool tip help text, depending on the current mouse position.
 boolean isPopupShowing()
           
 boolean isRightYRuler()
          returns false: we want our Y ruler on the left side of the canvas.
 boolean isToolTipsEnabled()
           
static void main(java.lang.String[] argv)
          main(): simple self test of FigSwingCanvas inside a Frame.
 void mouseDragged(java.awt.event.MouseEvent mme)
          Handle MouseDrag events: Currently, mouseDrag events are used for canvas panning.
 void mouseMoved(java.awt.event.MouseEvent mme)
          Handle mouseMove events: update sliders/cross hatch, provide rubberbanding Note that we don't need to synchronize in the Swing world: everything is executed in the event dispatcher thread Also note that we have to correct the clip rectangle for the cursor extension (currently three pixels...)
 void mousePressed(java.awt.event.MouseEvent e)
          mousePressed(): intercept mouse clicks and show the context-Popup Menu, if triggered.
 void mouseReleased(java.awt.event.MouseEvent e)
          mouseReleased(): intercept mouse release events.
 void paint(FigDrawable obj)
          add a paint-request from an animated object the the repaintStack.
 void paint(FigDrawable obj, int millis)
          repaint an (animated) object within millis milliseconds.
 void paintNoChanges(java.awt.Graphics g)
          repaint the canvas under the assumption that the visible FIG objects have not changed.
 java.lang.String printRepaintStatus()
           
 void setContextToolTipProvider(ContextToolTip provider)
           
 void setCursor(java.awt.Cursor c)
           
 void setEnablePopup(boolean b)
           
 void setEnablePopupOnNextMouseRelease()
          re-enable the popup-menu on the next mouseReleased() event.
 void setPopupPosition(java.awt.Point sp, java.awt.Point wp)
          NOTE: do not call this method.
 void setRulerOffsets()
          update our parent's ruler offset variables, assuming either no rulers, or rulers on the top and left border of the canvas.
 void setToolTipsEnabled(boolean b)
           
 
Methods inherited from class jfig.canvas.FigSwingCanvas
addCanvasListener, addZoomListener, blitOffscreenBuffer, blitOffscreenBufferClipped, blitTripleBuffer, canvasSizeChanged, changeRubberbandMode, changeRubberbandMode, changeRubberbandMode, clearBuffer, clippedDrawTmpObject, doFullRedraw, doFullRedraw, doMotionRedraw, doObjectRedraw, doSimpleRedraw, doSystemRedraw, doTextRedraw, doToggleRubberbandDebug, doZoom11, doZoomFull, doZoomIn, doZoomOut, doZoomRegion, drawAllObjects, drawGrid, drawGridByHand, drawObject, drawSliders, drawSlidersAndCursor, drawSlidersOnce, drawTmpObjects, drawTriangles, eraseObject, flush, getBackground, getComponent, getCurrentCanvasSize, getDebug, getGridColor, getMousePosition, getObjectEnumerator, getOffscreenGraphics, getOptions2D, getSwingRepaintMode, getTrafo, getViewportWCmax, getVisibleRegionBoundingBox, getZoomFitBorderWidth, gotFocus, handleRedraw, initializeOffscreenBuffers, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, mouseClicked, mouseEntered, mouseExited, msg, notifyZoomListeners, paint, paintAllObjects, paintBorder, paintComponent, paintCursor, paintImmediately, paintRubberband, paintTmpText, printTimingStats, processKeyEvent, removeZoomListener, repaint, requestAntiAliasing, requestRenderQuality, setBackground, setConsole, setDebug, setDefaultCursor, setEnableRulerDragging, setGrid, setGridColor, setObjectEnumerator, setRubberbandAspect, setRubberbandBasePoint, setRubberbandBasePoint, setRubberbandBasePoint2, setRubberbandBasePoint2, setRubberbandShowLineLengths, setStatusMessage, setTrafo, setTripleBuffering, setZoomFitBorderWidth, showRulers, statusMessage, synchronousRepaint, update
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintChildren, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateUI
 
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, 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, isFocusTraversable, 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, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jfig.canvas.FigCanvas
addCanvasListener, addZoomListener, blitOffscreenBuffer, blitOffscreenBufferClipped, changeRubberbandMode, changeRubberbandMode, changeRubberbandMode, clippedDrawTmpObject, doFullRedraw, doFullRedraw, doMotionRedraw, doObjectRedraw, doSimpleRedraw, doSystemRedraw, doTextRedraw, doToggleRubberbandDebug, doZoom11, doZoomFull, doZoomIn, doZoomOut, doZoomRegion, drawAllObjects, drawObject, drawSlidersAndCursor, drawTmpObjects, eraseObject, flush, getBackground, getComponent, getCursor, getDebug, getGridColor, getMousePosition, getObjectEnumerator, getOffscreenGraphics, getSize, getTrafo, getViewportWCmax, getVisibleRegionBoundingBox, gotFocus, handleRedraw, mouseClicked, mouseEntered, mouseExited, msg, notifyZoomListeners, paint, printTimingStats, removeZoomListener, repaint, requestAntiAliasing, requestRenderQuality, setBackground, setConsole, setDebug, setDefaultCursor, setEnableRulerDragging, setGrid, setGridColor, setObjectEnumerator, setRubberbandAspect, setRubberbandBasePoint, setRubberbandBasePoint, setRubberbandBasePoint2, setRubberbandBasePoint2, setRubberbandShowLineLengths, setStatusMessage, setTrafo, showRulers, statusMessage, synchronousRepaint, update
 

Field Detail

versionString

static final java.lang.String versionString
See Also:
Constant Field Values

MAX_REPAINT_INDEX

public static final int MAX_REPAINT_INDEX
specify the size of the tables used to manage animation. If more than MAX_REPAINT_INDEX objects have requested a redraw, we use a full redraw instead of single object redraw.

See Also:
Constant Field Values

n_repaintTables

protected int n_repaintTables

n_repaintTableEntries

protected int n_repaintTableEntries

n_repaintOverflows

protected int n_repaintOverflows
Constructor Detail

JObjectCanvas

public JObjectCanvas(Editor _editor)
create an empty JObjectCanvas for the specified editor. In order to actually display FIG objects on this JObjectCanvas, you have to set the object 'enumerator' via setObjectEnumerator(). The popup menu is created dynamically from an external text file, whose location is taken from the SetupManager property "Hades.Editor.PopupMenuResource". The default location is "/hades/gui/PopupMenu.txt" for the editor, and "/hades/gui/ViewModePopupMenu.txt" in viewmode.

Method Detail

createCustomNullCursor

public void createCustomNullCursor()

setCursor

public void setCursor(java.awt.Cursor c)
Specified by:
setCursor in interface FigCanvas

getSyncRedrawTimer

public SyncRedrawTimer getSyncRedrawTimer()
Specified by:
getSyncRedrawTimer in interface ObjectCanvas

createToolTip

public javax.swing.JToolTip createToolTip()
create a JMultiLineToolTip with context sensitive information text


getToolTipLocation

public java.awt.Point getToolTipLocation(java.awt.event.MouseEvent evt)
calculate a good location for our context sensitive tool tips


getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent evt)
create a context sensitive tool tip help text, depending on the current mouse position.


setContextToolTipProvider

public void setContextToolTipProvider(ContextToolTip provider)

isToolTipsEnabled

public boolean isToolTipsEnabled()
Specified by:
isToolTipsEnabled in interface ObjectCanvas

setToolTipsEnabled

public void setToolTipsEnabled(boolean b)
Specified by:
setToolTipsEnabled in interface ObjectCanvas

setRulerOffsets

public void setRulerOffsets()
update our parent's ruler offset variables, assuming either no rulers, or rulers on the top and left border of the canvas.

Specified by:
setRulerOffsets in interface FigCanvas
Overrides:
setRulerOffsets in class FigSwingCanvas

isRightYRuler

public boolean isRightYRuler()
returns false: we want our Y ruler on the left side of the canvas.

Overrides:
isRightYRuler in class FigSwingCanvas

drawRulers

public void drawRulers(java.awt.Graphics g)
drawRulers: draw the scale rulers on top and the right side of the canvas. Both rules are labelled every 2cm (approx), and 10 ticks are drawn between two labels. The labels drawn are either in mm or in inches spacing, depending on the value of FigTrafo2D.units.

Overrides:
drawRulers in class FigSwingCanvas

paintNoChanges

public void paintNoChanges(java.awt.Graphics g)
Description copied from class: FigSwingCanvas
repaint the canvas under the assumption that the visible FIG objects have not changed. The paintNoChanges() method is called from the WindowManager (this is, Swing) as a result of mouseMoved() or mouseDragged() events, or when the window needs to be repainted due to Window or Menu changes. This means that the visible objects have not changed and that our offscreen buffer is up-to-date. On the other hand, XOR-mode painting useful for rubberbanding does not work with JDK 1.3.x. This in turn implies we use the following repaint algorithm: 1. blit the offscreen buffer to the screen 2. draw the temporary objects, if any. 3. update the rulers (if visible) 4. update the rubberband and cursor

Overrides:
paintNoChanges in class FigSwingCanvas

getToken

public java.lang.String getToken(java.util.StringTokenizer st)
                          throws java.lang.Exception
Throws:
java.lang.Exception

createMenuShortcuts

public void createMenuShortcuts()

isPopupShowing

public boolean isPopupShowing()
Specified by:
isPopupShowing in interface ObjectCanvas

getPopupPosition

public java.awt.Point getPopupPosition()
return the screen-coordinate position of the last popup-menus invocation

Specified by:
getPopupPosition in interface ObjectCanvas

getPopupPositionWC

public java.awt.Point getPopupPositionWC()
return the world-coordinate position corresponding to the last popup-menus invocation

Specified by:
getPopupPositionWC in interface ObjectCanvas

getPopupPositionWCsnapped

public java.awt.Point getPopupPositionWCsnapped()
Specified by:
getPopupPositionWCsnapped in interface ObjectCanvas

setPopupPosition

public void setPopupPosition(java.awt.Point sp,
                             java.awt.Point wp)
NOTE: do not call this method. It is only provided as a hook to allow LogPlaybackManager to modify the 'virtual'popup menu position during a log playback. It has no effect whatsoever on the 'real' popup menu coordinates, which are always overridden by the actual mouseclicks.

Specified by:
setPopupPosition in interface ObjectCanvas

setEnablePopup

public void setEnablePopup(boolean b)
Specified by:
setEnablePopup in interface ObjectCanvas

getEnablePopup

public boolean getEnablePopup()
Specified by:
getEnablePopup in interface ObjectCanvas

setEnablePopupOnNextMouseRelease

public void setEnablePopupOnNextMouseRelease()
re-enable the popup-menu on the next mouseReleased() event.

This method is a quick fix and workaround for the different popup-menu trigger semantics on X11/Unix and Windows platforms. In a few Hades editor commands (like create object or move object), a right mouse button is used to cancel the command - on the mousePressed event. After canceling the command, we have to re-enable the popup menu. However, doing this right away from the mousePressed callback would instantly display the popup menu on the next mouseReleased event, which is annoying on Windows.

The workaround is to call this method instead of setEnablePopup(true) from the mousePressed callback. We just set our internal enablePopupOnNextMouseRelease flag and check for it in our own mouseRelease handler.

Specified by:
setEnablePopupOnNextMouseRelease in interface ObjectCanvas

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent mme)
Description copied from class: FigSwingCanvas
Handle mouseMove events: update sliders/cross hatch, provide rubberbanding Note that we don't need to synchronize in the Swing world: everything is executed in the event dispatcher thread Also note that we have to correct the clip rectangle for the cursor extension (currently three pixels...)

Specified by:
mouseMoved in interface FigCanvas
Overrides:
mouseMoved in class FigSwingCanvas

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent mme)
Description copied from class: FigSwingCanvas
Handle MouseDrag events: Currently, mouseDrag events are used for canvas panning. The (global) variables mouse_drag_(x,y) are set at each mouseDown() and mouseUp() event.

However, mouseDrag() at the moment is not used: The actual panning calculations are done in mouseUp(). We should probably provide visual feedback about the drag amout by redrawing the rulers in this function.

Specified by:
mouseDragged in interface FigCanvas
Overrides:
mouseDragged in class FigSwingCanvas

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
mousePressed(): intercept mouse clicks and show the context-Popup Menu, if triggered. Forward other mouseEvents to our parent class.

Specified by:
mousePressed in interface FigCanvas
Overrides:
mousePressed in class FigSwingCanvas

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased(): intercept mouse release events. While the HADES editor does not use mouse release events, this method is required as the popup menu trigger on Windows.

If the enablePopupOnNextMouseRelease flag is set, we just set the enablePopup flag and return right away. This extra complication is necessary to handle the "editor command canceled by right mouse button click" situation on Windows. If the enablePopupOnNextMouseRelease flag is not set, we just check the value of the enablePopup flag and check whether the current MouseEvent is a popup trigger event.

If it is not, we do nothing here. Note that dispatching to FigSwingCanvas.mouseRelease() would mean to implement the mouse dragging behaviour that we don't want for the Hades editor.

Specified by:
mouseReleased in interface FigCanvas
Overrides:
mouseReleased in class FigSwingCanvas

doPanning

public void doPanning(int direction,
                      boolean shift)
automatic panning of the visible viewport on the world-coordinate system. Possible directions are left, right, up, down, and home. The amount of panning is 1/20th of the current viewport, or 1/2 with shift=true.

Specified by:
doPanning in interface FigCanvas
Overrides:
doPanning in class FigSwingCanvas

doZoomFit

public void doZoomFit()
Description copied from interface: FigCanvas
doZoomFit(): calculate the bounding box of all objects from our FigDrawableEnumerator, then set the zoom and panning so that all objects are visible. This method currently assumes a 10 pixel border.

Specified by:
doZoomFit in interface FigCanvas
Overrides:
doZoomFit in class FigSwingCanvas

doZoomIn14

public void doZoomIn14()
zoom in by a factor of two. Fixed point is the viewport center.

Overrides:
doZoomIn14 in class FigSwingCanvas

doZoomOut07

public void doZoomOut07()
Overrides:
doZoomOut07 in class FigSwingCanvas

doZoomRegionBroken

public void doZoomRegionBroken(FigBbox bbox)

doZoomRegion

public void doZoomRegion(FigBbox bbox)
fit objects to this JObjectCanvas. We calculate our Trafo2D parameters for zoom and offset (anchor) so that all objects within the specified bounding box 'bbox' are visible. This method uses a fixed border of 10 pixels on all sides.


doZoomLandscapeA4

public void doZoomLandscapeA4(FigBbox bbox)
fit all objects to "Landscape A4 paper". This function is useful for Java 1.1 printing, which basically translates AWT drawing commands to printing commands for a 72 dpi printer. To improve object layout on the final page, this function takes the given bounding box and calculates the resulting zoom factor and offset so as to fit all objects into the (840x594) pixel rectangle useful for an A4 paper in landscape orientation. We also use a fixed border of 50 pixels (which should be OK for most printers).

Specified by:
doZoomLandscapeA4 in interface ObjectCanvas

paint

public void paint(FigDrawable obj)
add a paint-request from an animated object the the repaintStack. The repaint is not handled right-away but only later after synchronousRepaint() has been called.

Specified by:
paint in interface FigCanvas
Overrides:
paint in class FigSwingCanvas

paint

public void paint(FigDrawable obj,
                  int millis)
repaint an (animated) object within millis milliseconds. JObjectCanvas ignores this direct request, but puts the object into the repaintStack for later redraw after synchronousRepaint() has been called.

Specified by:
paint in interface FigCanvas
Overrides:
paint in class FigSwingCanvas

clearRepaintArray

public void clearRepaintArray()
Specified by:
clearRepaintArray in interface ObjectCanvas

printRepaintStatus

public java.lang.String printRepaintStatus()

countPendingRepaints

public int countPendingRepaints()
Specified by:
countPendingRepaints in interface ObjectCanvas

countRepaintTableEntries

public int countRepaintTableEntries()

countSyncRepaintOverflows

public int countSyncRepaintOverflows()
Specified by:
countSyncRepaintOverflows in interface ObjectCanvas

countExecutedSyncRepaints

public int countExecutedSyncRepaints()
Specified by:
countExecutedSyncRepaints in interface ObjectCanvas

doSyncRedraw

public void doSyncRedraw()
perform a synchronous redrawing of all 'dirty' objects contained in our 'repaintArray' object buffer. This method is used to perform a redrawing of all objects that have been changed by the simulation or animation thread and registered via a call to paint( FigObject object ). Depending on the number of objects to redraw, two different algorithms are used. When the number of objects to paint is large (larger than MAX_REPAINT_INDEX), we perform a standard full redraw of all objects. Otherwise, we paint the individual objects to the offscreen buffer. Note that this assumes the objects are not overlapping, because the repaint buffer is *NOT* layer-sorted.

for debugging purposes, if (debug) is on this method will print a dot '.' when the redraw uses the painting of a few objects, and an asterisk '*' when performing a full redraw due to a repaint buffer overflow.

Specified by:
doSyncRedraw in interface FigCanvas
Overrides:
doSyncRedraw in class FigSwingCanvas

main

public static void main(java.lang.String[] argv)
Description copied from class: FigSwingCanvas
main(): simple self test of FigSwingCanvas inside a Frame.