edu.mit.sketch.system
Class BasicSurface

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 edu.mit.sketch.ui.SketchPanel
                      extended by edu.mit.sketch.system.SurfaceView
                          extended by edu.mit.sketch.system.BasicSurface
All Implemented Interfaces:
BBDisplay, StrokeDataListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class BasicSurface
extends SurfaceView
implements BBDisplay, StrokeDataListener

Since this is a SketchPanel other classes can register to listen for new stroke events that it will fire when it detects new inputs.

Created: Mon Nov 5 13:00:16 2001
Copyright: Copyright (C) 2001 by MIT. All rights reserved.

Version:
$Id: BasicSurface.html,v 1.3 2007-11-25 20:52:39 bpaulson Exp $
Author:
Michael Oltmans
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, 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
BasicSurface()
           
 
Method Summary
 void displayBB(Blackboard bb, boolean isRecognizing)
          This method should only be called by the Scheduler when it has determined that the BB is in a consistant state.
 void doneMoving(java.lang.Object item, java.awt.Point startPos, java.awt.Point endPos)
          The move has been completed.
 java.lang.Object findObjectAt(java.awt.Point point)
          Find the object that is located under the given point.
 void handleStroke(StrokeData data)
          This method is called by classes that collect StrokeData objects.
 void moving(java.lang.Object item, int dx, int dy)
          Update whatever needs to be updated while we are in the process of moving the given item.
 void paintStrokes(java.awt.Graphics g)
           
 void paintSurface(java.awt.Graphics g)
          Paint the game thus far.
 
Methods inherited from class edu.mit.sketch.system.SurfaceView
getGraphics, getStrokeColor, getStrokeThickness, paintComponent, setStrokeColor, setStrokeThickness
 
Methods inherited from class edu.mit.sketch.ui.SketchPanel
addStrokeDataListener, getStrokeDataListeners, isPaintingAsWeGo, isRecognizing, removeStrokeDataListener, setIsPaintingAsWeGo, setIsRecognizing
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, isFocusTraversable, 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, 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, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicSurface

public BasicSurface()
Method Detail

displayBB

public void displayBB(Blackboard bb,
                      boolean isRecognizing)
This method should only be called by the Scheduler when it has determined that the BB is in a consistant state. This avoids rendering a partially interpreted sketch.

Specified by:
displayBB in interface BBDisplay
Specified by:
displayBB in class SurfaceView

paintSurface

public void paintSurface(java.awt.Graphics g)
Paint the game thus far.

Specified by:
paintSurface in class SurfaceView

paintStrokes

public void paintStrokes(java.awt.Graphics g)

moving

public void moving(java.lang.Object item,
                   int dx,
                   int dy)
Description copied from class: SurfaceView
Update whatever needs to be updated while we are in the process of moving the given item. This will be the item returned by the findObjectAt method when the move is initiated.

This should usually only update the display of the element and should not trigger any actions by the recognition system.

Specified by:
moving in class SurfaceView

doneMoving

public void doneMoving(java.lang.Object item,
                       java.awt.Point startPos,
                       java.awt.Point endPos)
Description copied from class: SurfaceView
The move has been completed. The recognition system should be updated so that it can interprete the new state of affairs. XXX: this means reevaluating constraints that the moved item is part of.

Specified by:
doneMoving in class SurfaceView

findObjectAt

public java.lang.Object findObjectAt(java.awt.Point point)
Description copied from class: SurfaceView
Find the object that is located under the given point. This will be used to determine which object should be moved.

Specified by:
findObjectAt in class SurfaceView

handleStroke

public void handleStroke(StrokeData data)
Description copied from interface: StrokeDataListener
This method is called by classes that collect StrokeData objects.

Specified by:
handleStroke in interface StrokeDataListener