talx x1.0.5

keyboard.constraint
Class ShowAllMovement

java.lang.Object
  extended byconstraint.ConstraintAdapter
      extended bykeyboard.constraint.ShowAllMovement
All Implemented Interfaces:
Constraint, ConstraintConstants, KeyboardConstants, SettingsConstants, StateConstants

public class ShowAllMovement
extends ConstraintAdapter
implements KeyboardConstants

Moves the cursor using the cursor control keys. This constraint works with the keyboard trainin panel. The value for this constraint can contain the following tokens:


When reported errors, this constraint uses the following format:
  1. The value of this constraint enclosed in curly braces
  2. The offending keystroke
NOTE: This constraint only monitors actual typing and not other changes made to the user text. TO DO: Implement page up and page down.


Field Summary
static java.lang.String BAD_MOVEMENT_ERROR
           
static java.lang.String NO_SHIFT
          Token used in constraint values.
 
Fields inherited from interface keyboard.KeyboardConstants
BACK, BOTTOM, BUTTON_COLOR, BUTTON_COMMAND, BUTTON_TEXT, BUTTON_TEXT_ATTRIBUTES, BUTTON_TEXT_COLOR, BUTTON_TEXT_FONT_FACE, BUTTON_TEXT_SIZE, DELAY, DOWN, END, END_OF_LINE, ERROR_DETECTED, FINGER, FIRST, FRONT, HOME, INSTRUCTION_POSITION_TO_COORDS, KEYMAP, KEYMAP_COORDS_TO_PANEL_COORDS, LAST, LEFT, NO_BEEP, NO_DELETE, NO_ERROR, NO_WRAP, PAGE_DOWN, PAGE_UP, POSITION, PRESS, RIGHT, SPEED, START_OF_LINE, STRICT, TARGET_BACKGROUND_COLOR, TARGET_HIGHLIGHT, TARGET_HIGHLIGHT_CIRCLE_COLOR, TARGET_HIGHLIGHT_COLOR, TARGET_HIGHLIGHT_TEXT_COLOR, TARGET_POSITION_TO_COORDS, TARGET_TEXT, TARGET_TEXT_ATTRIBUTES, TARGET_TEXT_COLOR, TARGET_TEXT_FONT_FACE, TARGET_TEXT_SIZE, TOP, UP, USER_BACKGROUND_COLOR, USER_CARET, USER_CARET_BLINK_RATE, USER_CARET_COLOR, USER_CARET_HIGHLIGHT_COLOR, USER_CARET_WIDTH, USER_HIGHLIGHT, USER_HIGHLIGHT_CIRCLE_COLOR, USER_HIGHLIGHT_COLOR, USER_HIGHLIGHT_TEXT_COLOR, USER_POSITION_ABOVE, USER_POSITION_BELOW, USER_POSITION_TO_COORDS, USER_TEXT, USER_TEXT_ATTRIBUTES, USER_TEXT_COLOR, USER_TEXT_FONT_FACE, USER_TEXT_SIZE
 
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 controller.StateConstants
ACTION, ACTION_TYPE_CONTINUE, ACTION_TYPE_GOTO, ACTION_TYPE_IGNORE, ACTION_TYPE_PANIC, ACTION_TYPE_QUIT, ACTION_TYPE_RESTART, ACTION_TYPE_REVIEW, ACTION_TYPE_SKIP_DRILL, ACTION_TYPE_SKIP_SKILL, ACTION_TYPE_SKIP_TASK, ACTION_TYPE_TASK_STARTED, ACTION_TYPE_TRAIN, CALLBACK_COMMAND, FIRST_CALLBACK, FOURTH_CALLBACK, SECOND_CALLBACK, THIRD_CALLBACK
 
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
 
Constructor Summary
ShowAllMovement()
           
 
Method Summary
static int[] moveDown(TaskProperties tp, int[] caret, boolean select)
          Returns the mark and dot value to place the caret on the following line.
static int[] moveEnd(TaskProperties tp, int[] caret, boolean select)
          Moves the caret to the lastcharacter in the current line.
static int[] moveHome(TaskProperties tp, int[] caret, boolean select)
          Moves the caret to the first character in the current line.
static int[] moveLeft(TaskProperties tp, int[] caret, boolean select, boolean wrap)
          Returns the mark and dot value to place the caret on the previous character.
static int[] moveRight(TaskProperties tp, int[] caret, boolean select, boolean wrap)
          Returns the mark and dot value to place the caret on the next character.
static int[] moveUp(TaskProperties tp, int[] caret, boolean select)
          Returns the mark and dot value to place the caret on the previous line.
 void processKeyEvent(java.awt.event.KeyEvent ev, TaskProperties tp)
          Moves the cursor in response to cursor control keys.
 
Methods inherited from class constraint.ConstraintAdapter
fireAutoAction, getIntValue, getType, getValue, process, processActionEvent, processInit, processMouseEvent, setValue, splitPairs, startAutoAction, stopAutoAction, stringToRGB, toString, valueContains
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_SHIFT

public static final java.lang.String NO_SHIFT
Token used in constraint values.

See Also:
Constant Field Values

BAD_MOVEMENT_ERROR

public static final java.lang.String BAD_MOVEMENT_ERROR
See Also:
Constant Field Values
Constructor Detail

ShowAllMovement

public ShowAllMovement()
Method Detail

moveUp

public static int[] moveUp(TaskProperties tp,
                           int[] caret,
                           boolean select)
                    throws javax.swing.text.BadLocationException
Returns the mark and dot value to place the caret on the previous line.

Parameters:
tp - the task properties of the keyboard training panel.
select - if true, the return value will contain a selection from the current mark to the new cursor position. If false, the method returns with mark = dot.
Returns:
{mark, dot} where mark is the beginning of the selection and dot is the cursor location
Throws:
throws - BadLocationException if the cursor cannot move up.
javax.swing.text.BadLocationException

moveDown

public static int[] moveDown(TaskProperties tp,
                             int[] caret,
                             boolean select)
                      throws javax.swing.text.BadLocationException
Returns the mark and dot value to place the caret on the following line.

Parameters:
tp - the task properties of the keyboard training panel.
select - if true, the return value will contain a selection from the current mark to the new cursor position. If false, the method returns with mark = dot.
Returns:
{mark, dot} where mark is the beginning of the selection and dot is the cursor location
Throws:
throws - BadLocationException if the cursor cannot move down.
javax.swing.text.BadLocationException

moveLeft

public static int[] moveLeft(TaskProperties tp,
                             int[] caret,
                             boolean select,
                             boolean wrap)
                      throws javax.swing.text.BadLocationException
Returns the mark and dot value to place the caret on the previous character.

Parameters:
tp - the task properties of the keyboard training panel.
select - if true, the return value will contain a selection from the current mark to the new cursor position.
wrap - if true and the cursor is at the beginning of a line, the return value will be the end of the previous line. If false, the method returns with mark = dot.
Returns:
{mark, dot} where mark is the beginning of the selection and dot is the cursor location
Throws:
throws - BadLocationException if the cursor cannot move left.
javax.swing.text.BadLocationException

moveRight

public static int[] moveRight(TaskProperties tp,
                              int[] caret,
                              boolean select,
                              boolean wrap)
                       throws javax.swing.text.BadLocationException
Returns the mark and dot value to place the caret on the next character.

Parameters:
tp - the task properties of the keyboard training panel.
select - if true, the return value will contain a selection from the current mark to the new cursor position.
wrap - if true and the cursor is at the beginning of a line, the return value will be the end of the previous line. If false, the method returns with mark = dot.
Returns:
{mark, dot} where mark is the beginning of the selection and dot is the cursor location
Throws:
throws - BadLocationException if the cursor cannot move right.
javax.swing.text.BadLocationException

moveHome

public static int[] moveHome(TaskProperties tp,
                             int[] caret,
                             boolean select)
Moves the caret to the first character in the current line.


moveEnd

public static int[] moveEnd(TaskProperties tp,
                            int[] caret,
                            boolean select)
Moves the caret to the lastcharacter in the current line.


processKeyEvent

public void processKeyEvent(java.awt.event.KeyEvent ev,
                            TaskProperties tp)
Moves the cursor in response to cursor control keys. This class just tests for each key and then calls the appropriate move method. subclasses should override this method to only respond to the appropriate keys.

Overrides:
processKeyEvent in class ConstraintAdapter

talx x1.0.5

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