talx x1.0.5

desktop
Class TrainingPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bydesktop.TrainingPanel
All Implemented Interfaces:
javax.accessibility.Accessible, ConstraintConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, SettingsConstants, TrainingComponent
Direct Known Subclasses:
IntroPanel, KeyboardTrainingPanel, MediaPanel, MouseModelClickingPanel, MouseModelMovingPanel, MouseTrainingPanel, SoundPanel, TalPanel, TOCPanel, TOCPanel2, TOCTopPanel, TOCTreePanel

public abstract class TrainingPanel
extends javax.swing.JPanel
implements TrainingComponent, SettingsConstants, ConstraintConstants

See Also:
Serialized Form

Nested Class Summary
static class TrainingPanel.KeyValue
          Holds a key value pair.
protected  class TrainingPanel.StartSoundThread
          Loads the audio, so that the panel class will not hang.
protected  class TrainingPanel.TaskPropertyMap
           
 
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
protected  AudioPlayer sound
          The sound/audio player.
 
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 util.SettingsConstants
ALTERNATIVE_BACKGROUND_COLOR, ALTERNATIVE_BACKGROUND_COLOR_ALIAS, ALTERNATIVE_FONT_ATTRIBUTES, ALTERNATIVE_FONT_ATTRIBUTES_ALIAS, ALTERNATIVE_FONT_COLOR, ALTERNATIVE_FONT_COLOR_ALIAS, CARET_BLINK_RATE, CARET_COLOR, CARET_WIDTH, DECORATED, DEFAULT_UI_STATE_CLASS, FONT_FACE, FONT_FACE_ALIAS, FONT_SIZE, FONT_SIZE_ALIAS, INNER_BACKGROUND_COLOR, INSTRUCTION_BACKGROUND_COLOR, INSTRUCTION_BACKGROUND_COLOR_ALIAS, INSTRUCTION_FONT_ATTRIBUTES, INSTRUCTION_FONT_ATTRIBUTES_ALIAS, INSTRUCTION_FONT_COLOR, INSTRUCTION_FONT_COLOR_ALIAS, LARGE_FONT_SIZE, LARGE_FONT_SIZE_ALIAS, LESSON_UI_STATE_CLASS, LOGGER_CLASS, LOGGER_DIRECTORY, LOGGER_PARAMS, SAVE_FILENAME, SCREEN_PERCENT, SKILL_LATTICE_FILENAME, SMALL_FONT_SIZE, SMALL_FONT_SIZE_ALIAS, STATS_FILENAME, TAL_SETTINGS_FILENAME, TITLE, TITLE_ALIAS, TITLE_ICON, TITLE_ICON_ALIAS, TRAINER_UI_STATE_CLASS, USER_ID
 
Fields inherited from interface constraint.ConstraintConstants
ACTION_COMMAND_KEY, ACTION_TYPE_SOUND_FINISHED, COMPONENT_FINGER_POSITION, COMPONENT_FINGER_PRESS_POSITION, COMPONENT_HORIZONTAL_ARROW_POSITION, COMPONENT_INSTRUCTION_BACKGROUND_COLOR, COMPONENT_INSTRUCTION_TEXT, COMPONENT_INSTRUCTION_TEXT_ATTRIBUTES, COMPONENT_INSTRUCTION_TEXT_COLOR, COMPONENT_INSTRUCTION_TEXT_FONT_FACE, COMPONENT_INSTRUCTION_TEXT_SIZE, COMPONENT_MOUSE_FINGER_POSITION, COMPONENT_SOUND, COMPONENT_SOUND_IS_PLAYING, COMPONENT_SOUND_QUIT, COMPONENT_TIMER, COMPONENT_VERTICAL_ARROW_POSITION, DIALOG, HIDE_BULLSEYE, LESSON_STOP_ACTION, MOUSE_BULLSEYE, MOUSE_FINGER_IMAGE, NO_TOKEN, PREVIOUS_TASK_COMPLETION_REASON, PROGRESS_PANEL_VISIBLITY, SHOW_BULLSEYE, SKIP_TASK_ACTION, TAL_DIALOG, TASK_FAIL_COUNT, TASK_STATUS, TASK_SUCCEED_COUNT, YES_TOKEN
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TrainingPanel(TrainingDesktop dt)
          Creates a new TrainingPanel with the default JPanel layout manager.
TrainingPanel(TrainingDesktop dt, java.awt.LayoutManager lm)
          Creates a new TrainingPanel with the given layout manager.
 
Method Summary
 void addActionListener(java.awt.event.ActionListener l)
           
 TrainingDesktop getDesktop()
           
protected abstract  TrainingPanel.KeyValue[] getMonitoredKeys()
          Returns the array of monitored keys.
protected abstract  java.lang.String[] getQueryKeys()
          Returns the array of query keys.
 TaskProperties getResetProperties()
           
 Settings getSettings()
           
protected  TaskProperties getTaskProperties()
           
static int[] parseCoords(java.lang.String coords)
          Parses a coordinate string.
protected abstract  java.lang.String query(java.lang.String key)
          This allows the constraints to ask for a property of the panel.
 void removeActionListener(java.awt.event.ActionListener l)
           
 TaskProperties reset()
          Clears the interface and returns a new TaskProperties object.
protected abstract  void TaskPropertyChanged(java.lang.String key, java.lang.String value)
          This method is called to indicate that a monitored value has changed.
 
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, getMinimumSize, 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, paintComponent, 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, 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, setCursor, 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
 

Field Detail

sound

protected AudioPlayer sound
The sound/audio player.

Constructor Detail

TrainingPanel

public TrainingPanel(TrainingDesktop dt)
Creates a new TrainingPanel with the default JPanel layout manager.


TrainingPanel

public TrainingPanel(TrainingDesktop dt,
                     java.awt.LayoutManager lm)
Creates a new TrainingPanel with the given layout manager.

Method Detail

parseCoords

public static int[] parseCoords(java.lang.String coords)
Parses a coordinate string.

Parameters:
coords - a string consisting of two space-separated non-negative numbers. The first number is considered to be the x value and the second is the y value.
Returns:
  • parseCoords[0] = the x coordinate of coords or -1 if the first token was not a number.
  • parseCoords[1] = the y coordinate of coords or -1 if the second token was not a number.
Throws:
java.lang.NullPointerException - if coords is null.

getSettings

public Settings getSettings()

addActionListener

public void addActionListener(java.awt.event.ActionListener l)

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)

reset

public TaskProperties reset()
Clears the interface and returns a new TaskProperties object. Changes to any previously generated TaskProperties objects will be ignored. This method generates a new TaskProperties object with only the monitored keys reset to their default values (ie the values returned from getMonitoredKeys(). The default behavior is to call the TaskPropertyChanged method with each key and its default value. To speed processing, implementation classes can override this to change all the visual settings at once. If a class overrides this method, it must return the value of the getResetProperties() method.

Specified by:
reset in interface TrainingComponent

getResetProperties

public TaskProperties getResetProperties()

getDesktop

public TrainingDesktop getDesktop()

getTaskProperties

protected TaskProperties getTaskProperties()

TaskPropertyChanged

protected abstract void TaskPropertyChanged(java.lang.String key,
                                            java.lang.String value)
This method is called to indicate that a monitored value has changed. Presumeably, the value is being monitored so that this TrainingPanel can make some visual change. Implementors must be sure that such changes are done in a thread-safe manner, using the AWT Event Queue.


query

protected abstract java.lang.String query(java.lang.String key)
This allows the constraints to ask for a property of the panel. To the constraint, it appears that these are normal task properties keys, but when the TaskPropertyMap is asked for the value of a query key, it calls this method rather than looking up the saved information. Query keys are actually prefix strings. So, for example, a contraint may call taskProperties.get(CHAR_AT + "0 0") assuming CHAR_AT is a query key to specify the location (0, 0). Since the match is just a prefix match, care must be taken to create a unique string that does not appear as a prefix for some other key.


getMonitoredKeys

protected abstract TrainingPanel.KeyValue[] getMonitoredKeys()
Returns the array of monitored keys. Whenever the TaskPropertyMap detects changes to these keys, it will call the TaskPropertyChanged method with the key and the new value. The TaskProperties object returned from reset() contains these keys and values. The values returned can be based on the settings from getSettings(), or some predetermined defaults; however, this method will be called in this class's constructor before the subclass has been constructed. Therefore, any subclass instance variables will not be available.


getQueryKeys

protected abstract java.lang.String[] getQueryKeys()
Returns the array of query keys. Query keys are used as keys in the TaskPropertyMap, but the value returned from the get method is computed using the query method, rather than looked up in the map itself.


talx x1.0.5

© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.