org.uispec4j
Class AbstractUIComponent

java.lang.Object
  extended by org.uispec4j.AbstractUIComponent
All Implemented Interfaces:
UIComponent
Direct Known Subclasses:
AbstractSwingUIComponent, Desktop, MenuBar, MenuItem, Panel, PasswordField, ProgressBar, Slider, TabGroup

public abstract class AbstractUIComponent
extends java.lang.Object
implements UIComponent

Base class for UIComponent implementations.


Constructor Summary
AbstractUIComponent()
           
 
Method Summary
protected  void addAttributes(java.awt.Component component, XmlWriter.Tag tag)
           
 Assertion backgroundEquals(java.lang.String expectedColor)
          Checks the background color of the component The color can be given in either hexadecimal ("FF45C0") or human-readable ("red") format.
 Assertion backgroundNear(java.lang.String expectedColor)
          Checks that the background color of the component is close to the given value.
 Assertion foregroundEquals(java.lang.String expectedColor)
          Checks the foreground color of the component.
 Assertion foregroundNear(java.lang.String expectedColor)
          Checks that the foreground color of the component is close to the given value.
 Panel getContainer()
           
 Panel getContainer(java.lang.String parentName)
          Returns the first container named parentName or null if not found
 java.lang.String getDescription()
          Returns an XML representation of the component and its subcomponents.
protected  void getDescription(java.awt.Component component, XmlWriter.Tag tag, boolean showVisibleOnly)
           
 java.lang.String getLabel()
          Returns the label displayed on this component, or null if this has no sense for this kind of components.
 java.lang.String getName()
          Returns the internal name with which can be used to identify the component.
protected  void getSubDescription(java.awt.Container container, XmlWriter.Tag tag)
           
 Assertion isEnabled()
           
 Assertion isVisible()
           
 AbstractUIComponent pressKey(Key key)
          Simulates pressing a key while the focus is on the component.
 AbstractUIComponent releaseKey(Key key)
          Simulates releasing a key while the focus is on the component.
 AbstractUIComponent typeKey(Key key)
          Simulates typing a key while the focus is on the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.uispec4j.UIComponent
getAwtComponent, getDescriptionTypeName
 

Constructor Detail

AbstractUIComponent

public AbstractUIComponent()
Method Detail

getDescription

public final java.lang.String getDescription()
Description copied from interface: UIComponent
Returns an XML representation of the component and its subcomponents.

Specified by:
getDescription in interface UIComponent

getSubDescription

protected void getSubDescription(java.awt.Container container,
                                 XmlWriter.Tag tag)

getDescription

protected void getDescription(java.awt.Component component,
                              XmlWriter.Tag tag,
                              boolean showVisibleOnly)

addAttributes

protected void addAttributes(java.awt.Component component,
                             XmlWriter.Tag tag)

getName

public java.lang.String getName()
Description copied from interface: UIComponent
Returns the internal name with which can be used to identify the component. This can be null if no name was set by the developers.

Specified by:
getName in interface UIComponent

getLabel

public java.lang.String getLabel()
Description copied from interface: UIComponent
Returns the label displayed on this component, or null if this has no sense for this kind of components.

Specified by:
getLabel in interface UIComponent

isVisible

public Assertion isVisible()
Specified by:
isVisible in interface UIComponent

isEnabled

public Assertion isEnabled()
Specified by:
isEnabled in interface UIComponent

foregroundEquals

public Assertion foregroundEquals(java.lang.String expectedColor)
Checks the foreground color of the component.

The color can be given in either hexadecimal ("FF45C0") or human-readable ("red") format.

See Also:
Using colors

foregroundNear

public Assertion foregroundNear(java.lang.String expectedColor)
Checks that the foreground color of the component is close to the given value.

The color can be given in either hexadecimal ("FF45C0") or human-readable ("red") format.

See Also:
Using colors

backgroundEquals

public Assertion backgroundEquals(java.lang.String expectedColor)
Checks the background color of the component The color can be given in either hexadecimal ("FF45C0") or human-readable ("red") format.

See Also:
Using colors

backgroundNear

public Assertion backgroundNear(java.lang.String expectedColor)
Checks that the background color of the component is close to the given value.

The color can be given in either hexadecimal ("FF45C0") or human-readable ("red") format.

See Also:
Using colors

getContainer

public Panel getContainer()

getContainer

public Panel getContainer(java.lang.String parentName)
Description copied from interface: UIComponent
Returns the first container named parentName or null if not found

Specified by:
getContainer in interface UIComponent

typeKey

public AbstractUIComponent typeKey(Key key)
Description copied from interface: UIComponent
Simulates typing a key while the focus is on the component.

Specified by:
typeKey in interface UIComponent

pressKey

public AbstractUIComponent pressKey(Key key)
Description copied from interface: UIComponent
Simulates pressing a key while the focus is on the component.

Specified by:
pressKey in interface UIComponent

releaseKey

public AbstractUIComponent releaseKey(Key key)
Description copied from interface: UIComponent
Simulates releasing a key while the focus is on the component.

Specified by:
releaseKey in interface UIComponent


Copyright © 2004-2010. All Rights Reserved.