| java.lang.Object abbot.editor.recorder.SemanticRecorder abbot.editor.recorder.ComponentRecorder
All known Subclasses: abbot.editor.recorder.CheckboxRecorder, abbot.editor.recorder.ButtonRecorder, abbot.editor.recorder.ContainerRecorder, abbot.editor.recorder.ChoiceRecorder,
ComponentRecorder | public class ComponentRecorder extends SemanticRecorder (Code) | | Record basic semantic events you might find on any component. This class
handles the following actions:
- window actions
- popup menus
- click
- typed keys
- basic drag and drop
- InputMethod events (extended character input)
Clicks, popup menus, and drag/drop actions may be based on coordinates or
component substructure (cell, row, tab, etc) locations.
Window Actions
While these nominally might be handled in a WindowRecorder, they are so
common that it's easier to handle here instead. Currently supports
tracking show/hide/activate. TODO: move/resize/iconfify/deiconify.
Popup Menus
Currently only the click/select/click sequence is supported. The
press/drag/release version shouldn't be hard to implement, though.
Click
Simple press/release on a component, storing the exact coordinate of the
click. Most things with selectability will want to override this. Culling
accidental intervening drags would be nice but probably not worth the
effort or complexity (better just to be less sloppy with your mouse).
Key Type
Capture only events that result in actual output. No plain modifiers,
shortcuts, or mnemonics.
Drag/Drop
Basic drag from one component and drop on another, storing exact
coordinates of the press/release actions. Should definitely override this
to represent your component's internal objects (e.g. cells in a table).
Note that these are two distinct actions, even though they always appear
together. The source is responsible for identifying the drag, and the
target is responsible for identifying the drop.
InputMethod
Catch extended character input.
|
Constructor Summary | |
public | ComponentRecorder(Resolver resolver) Create a ComponentRecorder for use in capturing the semantics of a GUI
action. |
Method Summary | |
public boolean | accept(AWTEvent event) Returns whether this ComponentRecorder wishes to accept the given
event. | protected boolean | canDrag() Default to recording a drag if it looks like one. | protected boolean | canMultipleClick() Default to waiting for multiple clicks. | protected Step | createAWTMenuSelection(Component parent, MenuItem menuItem, boolean isPopup) | protected Step | createClick(Component target, int x, int y, int mods, int count) Create a click event with the given event information. | protected Step | createDrag(Component comp, int x, int y) | protected Step | createDrop(Component comp, int x, int y) | protected Step | createInputMethod(Component comp, ArrayList codes, String text) | protected Step | createKey(Component comp, char keychar, int mods) | protected Step | createMenuSelection(Component menuItem) | protected Step | createPopupMenuSelection(Component invoker, int x, int y, Component menuItem) | protected Step | createStep() Returns the script step generated from the events recorded so far. | protected Step | createWindowEvent(Window window, boolean isClose) Create a wait for the window show/hide. | protected boolean | dragStarted(Component target, int x, int y, int modifiers, MouseEvent dragEvent) Returns whether the first drag motion event should be consumed. | protected ComponentLocation | getLocation(Component c, int x, int y) Obtain a more precise location than the given coordinate, if
possible. | protected String | getLocationArgument(Component c, int x, int y) Obtain the String representation of the Component-specific location. | protected void | init(int recordingType) | protected boolean | isClick(AWTEvent event) Test whether the given event is a trigger for a mouse button click. | protected boolean | isClose(AWTEvent event) | protected boolean | isDragDrop(AWTEvent event) Test whether the given event precurses a drop. | protected boolean | isKeyTyped(AWTEvent event) | protected boolean | isMenuEvent(AWTEvent event) | protected boolean | isOpen(AWTEvent event) | protected boolean | isToolTip(Object source) Return true if the given event source is a tooltip. | protected boolean | isWindowEvent(AWTEvent event) Test whether the given event is a trigger for a window event. | public boolean | parse(AWTEvent event) Handle an event. | protected boolean | parseClick(AWTEvent event) Provide standard parsing of mouse button events. | protected boolean | parseDrop(AWTEvent event) | protected boolean | parseInputMethod(AWTEvent event) | protected boolean | parseKeyEvent(AWTEvent e) | protected boolean | parseMenuSelection(AWTEvent event) Base implementation handles context (popup) menus. | protected boolean | parseWindowEvent(AWTEvent event) | protected void | setFinished(boolean state) Invoke when end of the semantic event has been seen. |
ComponentRecorder | public ComponentRecorder(Resolver resolver)(Code) | | Create a ComponentRecorder for use in capturing the semantics of a GUI
action.
|
accept | public boolean accept(AWTEvent event)(Code) | | Returns whether this ComponentRecorder wishes to accept the given
event. If the event is accepted, the recorder must invoke init() with
the appropriate semantic event type.
|
canDrag | protected boolean canDrag()(Code) | | Default to recording a drag if it looks like one.
|
canMultipleClick | protected boolean canMultipleClick()(Code) | | Default to waiting for multiple clicks.
|
createClick | protected Step createClick(Component target, int x, int y, int mods, int count)(Code) | | Create a click event with the given event information.
|
createStep | protected Step createStep()(Code) | | Returns the script step generated from the events recorded so far.
|
createWindowEvent | protected Step createWindowEvent(Window window, boolean isClose)(Code) | | Create a wait for the window show/hide. Use an appropriate identifier
string, which might be the name, title, or component reference.
|
dragStarted | protected boolean dragStarted(Component target, int x, int y, int modifiers, MouseEvent dragEvent)(Code) | | Returns whether the first drag motion event should be consumed.
Derived classes may override this to provide custom drag behavior.
Default behavior saves the drag initiation event by itself.
|
getLocationArgument | protected String getLocationArgument(Component c, int x, int y)(Code) | | Obtain the String representation of the Component-specific location.
|
init | protected void init(int recordingType)(Code) | | |
isClick | protected boolean isClick(AWTEvent event)(Code) | | Test whether the given event is a trigger for a mouse button click.
Allow derived classes to change definition of a click.
|
isClose | protected boolean isClose(AWTEvent event)(Code) | | Does the given event indicate a window was closed?
|
isDragDrop | protected boolean isDragDrop(AWTEvent event)(Code) | | Test whether the given event precurses a drop.
|
isOpen | protected boolean isOpen(AWTEvent event)(Code) | | Does the given event indicate a window was shown?
|
isToolTip | protected boolean isToolTip(Object source)(Code) | | Return true if the given event source is a tooltip.
Such events look like window events, but we check for them before other
kinds of window events so as to be able to filter them out.
TODO: emit steps to confirm value of tooltip?
Parameters: source - the object to examine true if this event source is a tooltip |
isWindowEvent | protected boolean isWindowEvent(AWTEvent event)(Code) | | Test whether the given event is a trigger for a window event.
Allow derived classes to change definition of a click.
|
parse | public boolean parse(AWTEvent event)(Code) | | Handle an event. Return whether the event was consumed.
|
parseClick | protected boolean parseClick(AWTEvent event)(Code) | | Provide standard parsing of mouse button events.
|
parseInputMethod | protected boolean parseInputMethod(AWTEvent event)(Code) | | |
parseMenuSelection | protected boolean parseMenuSelection(AWTEvent event)(Code) | | Base implementation handles context (popup) menus.
|
parseWindowEvent | protected boolean parseWindowEvent(AWTEvent event)(Code) | | |
setFinished | protected void setFinished(boolean state)(Code) | | Invoke when end of the semantic event has been seen.
|
|
|