TPTP 4.4.0 Testing Tools Project
Internal API Specification

org.eclipse.tptp.test.auto.gui.internal.commands
Class AbstractStructuredCommand

java.lang.Object
  extended byorg.eclipse.tptp.test.auto.gui.internal.macro.AbstractMacroInstruction
      extended byorg.eclipse.tptp.test.auto.gui.internal.commands.AbstractMacroCommand
          extended byorg.eclipse.tptp.test.auto.gui.internal.commands.AbstractStructuredCommand
All Implemented Interfaces:
IMacroCommand, IMacroInstruction, IPlayable, IWritable
Direct Known Subclasses:
StructuredSelectionCommand, ToggleStructuredCommand

public abstract class AbstractStructuredCommand
extends AbstractMacroCommand

An abstract structured command that other commands can optionally extend.


Field Summary
protected  java.util.ArrayList items
          The items that are associated with the structured selection.
 
Fields inherited from class org.eclipse.tptp.test.auto.gui.internal.commands.AbstractMacroCommand
DESCRIPTIVE_FIELD_BOUND
 
Constructor Summary
AbstractStructuredCommand(MacroCommandShell parent, WidgetIdentifier wid)
          The constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  java.lang.Object[] findMatches(org.eclipse.swt.widgets.Widget widget)
           
protected  IWidgetId findObjectId(int inx)
          Returns the object id of the inx-th item associated with this structured command.
 IUIObject getCorrespondingObject()
          Returns the corresponding IUIObject of this macro instruction.
protected  java.util.Map getItemAttributes(org.eclipse.swt.widgets.Widget item)
          Returns the item attributes that will be used to find and resolve the item that is associated with this structured command.
protected  java.util.ArrayList getItems()
          Returns the items that this command must match
protected  java.lang.Object[] getItemsForEvent(org.eclipse.swt.widgets.Event event)
          Returns the items that are embedded in the event passed in
 void load(org.w3c.dom.Node node, java.util.Hashtable lineTable)
          Invoked to load the macro instruction based on its corresponding XML node.
 boolean mergeEvent(org.eclipse.swt.widgets.Event e)
          If this command occurs consecutively, then this method gives this command a chance to merge mutliple commands together to reduce the overhead.
 boolean playback(org.eclipse.swt.widgets.Display display, org.eclipse.swt.widgets.Composite parent, org.eclipse.core.runtime.IProgressMonitor monitor)
           
protected abstract  void playStructuredCommand(org.eclipse.swt.widgets.Widget widget, java.lang.Object[] matches)
          Used to play the structured command collectively for all the discovered matches.
protected abstract  void playStructuredCommandForFoundMatch(org.eclipse.swt.widgets.Widget widget, java.lang.Object match)
          Some events require to be played as matches are discovered.
 void processEvent(org.eclipse.swt.widgets.Event event)
          Allows this command to process the corresponding event.
 void write(int indent, java.lang.StringBuffer sb)
          Equivalent to write(indent, writer, false, false)
protected  void writeAdditionalAttributes(java.lang.StringBuffer sb)
          Sub-classes can optionally overwrite this method to write additional attributes to command.
 
Methods inherited from class org.eclipse.tptp.test.auto.gui.internal.commands.AbstractMacroCommand
findDescriptiveField, findDescriptiveField, getDescriptiveField, getObjectClassName, getParent, getText, getTimeDifference, isRepeatRedundant, setDescriptiveField, setParent, setTimeDifference, toString, write, writeFinish, writeStart
 
Methods inherited from class org.eclipse.tptp.test.auto.gui.internal.macro.AbstractMacroInstruction
bindSourceLocation, getStartLine, getStopLine, getWidgetId, setCorrespondingObject, setWidgetId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.tptp.test.auto.gui.internal.commands.IMacroCommand
getType
 
Methods inherited from interface org.eclipse.tptp.test.auto.gui.internal.core.IMacroInstruction
getStartLine, getStopLine, getWidgetId, setCorrespondingObject, setWidgetId
 

Field Detail

items

protected java.util.ArrayList items
The items that are associated with the structured selection. The list contains Hashtable entries with the following content: KEY = XML attribute of the item VALUE = The value of the attribute

Constructor Detail

AbstractStructuredCommand

public AbstractStructuredCommand(MacroCommandShell parent,
                                 WidgetIdentifier wid)
The constructor

Parameters:
parent - The parent macro command shell owning this command
wid - The widget identifier
Method Detail

mergeEvent

public boolean mergeEvent(org.eclipse.swt.widgets.Event e)
Description copied from interface: IMacroCommand
If this command occurs consecutively, then this method gives this command a chance to merge mutliple commands together to reduce the overhead.

Specified by:
mergeEvent in interface IMacroCommand
Overrides:
mergeEvent in class AbstractMacroCommand
See Also:
AbstractMacroCommand.mergeEvent(org.eclipse.swt.widgets.Event)

getItemsForEvent

protected java.lang.Object[] getItemsForEvent(org.eclipse.swt.widgets.Event event)
Returns the items that are embedded in the event passed in

Parameters:
event - The event
Returns:
The items of the event

processEvent

public void processEvent(org.eclipse.swt.widgets.Event event)
Description copied from interface: IMacroCommand
Allows this command to process the corresponding event.

Parameters:
event - The event that awaits processing
See Also:
IMacroCommand.processEvent(org.eclipse.swt.widgets.Event)

getItemAttributes

protected java.util.Map getItemAttributes(org.eclipse.swt.widgets.Widget item)
Returns the item attributes that will be used to find and resolve the item that is associated with this structured command.

Parameters:
item - The item
Returns:
A map indicating the item attributes and values; null if the item can't be resolved.

getCorrespondingObject

public IUIObject getCorrespondingObject()
Description copied from interface: IMacroInstruction
Returns the corresponding IUIObject of this macro instruction. If an object is not supported then null will be returned.

Specified by:
getCorrespondingObject in interface IMacroInstruction
Overrides:
getCorrespondingObject in class AbstractMacroInstruction
See Also:
AbstractMacroInstruction.getCorrespondingObject()

load

public void load(org.w3c.dom.Node node,
                 java.util.Hashtable lineTable)
          throws org.eclipse.core.runtime.CoreException
Description copied from interface: IMacroInstruction
Invoked to load the macro instruction based on its corresponding XML node.

Specified by:
load in interface IMacroInstruction
Overrides:
load in class AbstractMacroCommand
Throws:
org.eclipse.core.runtime.CoreException
See Also:
AbstractMacroCommand.load(org.w3c.dom.Node, java.util.Hashtable)

writeAdditionalAttributes

protected void writeAdditionalAttributes(java.lang.StringBuffer sb)
Sub-classes can optionally overwrite this method to write additional attributes to command.

Parameters:
sb - The string buffer that the attributes should be written to.

write

public void write(int indent,
                  java.lang.StringBuffer sb)
Description copied from class: AbstractMacroCommand
Equivalent to write(indent, writer, false, false)

Specified by:
write in interface IWritable
Overrides:
write in class AbstractMacroCommand
See Also:
AbstractMacroCommand.write(int, java.lang.StringBuffer)

playStructuredCommand

protected abstract void playStructuredCommand(org.eclipse.swt.widgets.Widget widget,
                                              java.lang.Object[] matches)
Used to play the structured command collectively for all the discovered matches.

Parameters:
widget - The widget
matches - The matches discovered

playStructuredCommandForFoundMatch

protected abstract void playStructuredCommandForFoundMatch(org.eclipse.swt.widgets.Widget widget,
                                                           java.lang.Object match)
Some events require to be played as matches are discovered. (e.g. an expansion command requires to be played for each discovered item in order for successive children to be found) It's recommended that either playStructuredCommandForFoundMatch or playStructuredCommand be implemented by clients, eventhough both methods will be invoked.

Parameters:
widget - The widget

playback

public final boolean playback(org.eclipse.swt.widgets.Display display,
                              org.eclipse.swt.widgets.Composite parent,
                              org.eclipse.core.runtime.IProgressMonitor monitor)
                       throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

findMatches

protected java.lang.Object[] findMatches(org.eclipse.swt.widgets.Widget widget)
                                  throws org.eclipse.core.runtime.CoreException
Throws:
org.eclipse.core.runtime.CoreException

findObjectId

protected IWidgetId findObjectId(int inx)
                          throws org.eclipse.core.runtime.CoreException
Returns the object id of the inx-th item associated with this structured command.

Parameters:
inx - The index of the item
Returns:
The object id
Throws:
org.eclipse.core.runtime.CoreException - If an error occurrs while attempting to find the object

getItems

protected java.util.ArrayList getItems()
Returns the items that this command must match

Returns:
Matched items

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AbstractMacroCommand

TPTP 4.4.0 Testing Tools Project
Internal API Specification