org.netbeans.jemmy
Class JemmyProperties

java.lang.Object
  extended by org.netbeans.jemmy.JemmyProperties

public class JemmyProperties
extends java.lang.Object

Keeps default Jemmy properties.

Author:
Alexandre Iline (alexandre.iline@sun.com)

Field Summary
static int QUEUE_MODEL_MASK
          The event queue model mask.
static int ROBOT_MODEL_MASK
          The robot using model mask.
static int SHORTCUT_MODEL_MASK
          Event shorcutting model mask.
static int SMOOTH_ROBOT_MODEL_MASK
          The robot using model mask.
 
Constructor Summary
protected JemmyProperties()
           
 
Method Summary
protected  JemmyProperties cloneThis()
          Creates an exact copy on this instance.
 boolean contains(java.lang.String name)
          Checks if "name" propery currently has a value.
 void copyTo(JemmyProperties properties)
          Copy all properties from this instance into another.
static java.lang.String getBuild()
          Returns build (like 20011231 (yyyymmdd)).
 BundleManager getBundleManager()
          Returns bundle manager.
static BundleManager getCurrentBundleManager()
          Just like getProperties().getBundleManager().
static int getCurrentDispatchingModel()
          Returns the current dispatching model.
static int getCurrentDragAndDropStepLength()
          Returns the current drag and drop step length value.
static CharBindingMap getCurrentCharBindingMap()
          Just like getProperties().getCharBindingMap().
static java.lang.String[] getCurrentKeys()
          Returns the current key values.
static TestOut getCurrentOutput()
          Just like getProperties().getOutput().
static java.lang.Object getCurrentProperty(java.lang.String propertyName)
          Just like getProperties().getProperty(propertyName).
static java.lang.String getCurrentResource(java.lang.String key)
          Just like getProperties().getBundleManager().getResource(key).
static java.lang.String getCurrentResource(java.lang.String bundleID, java.lang.String key)
          Just like getProperties().getBundleManager().getResource(bundleID, key).
static long getCurrentTimeout(java.lang.String name)
          Just like getProperties().getTimeouts().getTimeout(name).
static Timeouts getCurrentTimeouts()
          Just like getProperties().getTimeouts().
static int getDefaultDispatchingModel()
          Returns default event dispatching model.
 int getDispatchingModel()
          Returns the dispatching model.
 int getDragAndDropStepLength()
          Returns the drag and drop step length value.
static java.lang.String getFullVersion()
          Returns full version string (like 1.0.1-20011231).
 CharBindingMap getCharBindingMap()
          Returns char binding map.
 java.lang.String[] getKeys()
          Returns the key values.
static java.lang.String getMajorVersion()
          Returns major version (like 1.0).
static java.lang.String getMinorVersion()
          Returns minor version (like 1).
 TestOut getOutput()
          Returns output.
static JemmyProperties getProperties()
          Peeks upper JemmyProperties instance from stack.
 java.lang.Object getProperty(java.lang.String name)
          Returns the property value.
 java.lang.String getResource(java.lang.String key)
          Returns resource value.
 java.lang.String getResource(java.lang.String bundleID, java.lang.String key)
          Returns resource value from the specified bundle.
 long getTimeout(java.lang.String name)
          Returns a timeouts value.
 Timeouts getTimeouts()
          Returns timeouts.
static java.lang.String getVersion()
          Returns version string (like 1.0.1).
 void init()
          Inits properties and dispatching model from system environment variables.
static long initCurrentTimeout(java.lang.String name, long newValue)
          Just like getProperties().getTimeouts().initTimeout(name, newValue).
 void initDispatchingModel()
          Initializes dispatching model.
 void initDispatchingModel(boolean queue, boolean robot)
          Initializes dispatching model.
 void initDispatchingModel(boolean queue, boolean robot, boolean shortcut)
          Initializes dispatching model.
 void initDispatchingModel(boolean queue, boolean robot, boolean shortcut, boolean smooth)
          Initializes dispatching model.
 void initProperties()
          Method to initialize timeouts and resources.
 void initProperties(java.lang.String prop_file)
          Method to initialize timeouts and resources.
 long initTimeout(java.lang.String name, long newValue)
          Inits a timeouts value.
static void main(java.lang.String[] argv)
          Prints full version into satndart output.
static JemmyProperties pop()
          Pops last pushed properties from the properties stack.
static JemmyProperties push()
          Creates a copy of the current JemmyProperties object and pushes it into the properties stack.
protected static JemmyProperties push(JemmyProperties props)
          Pushes properties stack.
static java.lang.Object removeCurrentProperty(java.lang.String propertyName)
          Removes a property from current properties list.
 java.lang.Object removeProperty(java.lang.String name)
          Removes the property.
 BundleManager setBundleManager(BundleManager resources)
          Changes bundle manager.
static BundleManager setCurrentBundleManager(BundleManager resources)
          Just like getProperties().setBundleManager(resources).
static int setCurrentDispatchingModel(int model)
          Defines event dispatching model.
static int setCurrentDragAndDropStepLength(int model)
          Specifies the current drag and drop step length value.
static CharBindingMap setCurrentCharBindingMap(CharBindingMap map)
          Just like getProperties().setCharBindingMap(map).
static TestOut setCurrentOutput(TestOut out)
          Just like getProperties().setOutput(out).
static java.lang.Object setCurrentProperty(java.lang.String propertyName, java.lang.Object propertyValue)
          Just like getProperties().setProperty(propertyName, propertyValue).
static long setCurrentTimeout(java.lang.String name, long newValue)
          Just like getProperties().getTimeouts().setTimeout(name, newValue).
static Timeouts setCurrentTimeouts(Timeouts to)
          Just like getProperties().setTimeouts(to).
 int setDispatchingModel(int model)
          Specifies the dispatching model value.
 int setDragAndDropStepLength(int length)
          Specifies the drag and drop step length value.
 CharBindingMap setCharBindingMap(CharBindingMap map)
          Changes char binding map.
 TestOut setOutput(TestOut out)
          Changes output.
 java.lang.Object setProperty(java.lang.String name, java.lang.Object newValue)
          Saves object as a static link to be used by other objects.
 long setTimeout(java.lang.String name, long newValue)
          Changes a timeouts value.
 Timeouts setTimeouts(Timeouts to)
          Changes timeouts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUEUE_MODEL_MASK

public static int QUEUE_MODEL_MASK
The event queue model mask.

See Also:
getCurrentDispatchingModel(), setCurrentDispatchingModel(int)

ROBOT_MODEL_MASK

public static int ROBOT_MODEL_MASK
The robot using model mask.

See Also:
getCurrentDispatchingModel(), setCurrentDispatchingModel(int)

SHORTCUT_MODEL_MASK

public static int SHORTCUT_MODEL_MASK
Event shorcutting model mask. Should not be used together with robot mask.

See Also:
getCurrentDispatchingModel(), setCurrentDispatchingModel(int)

SMOOTH_ROBOT_MODEL_MASK

public static int SMOOTH_ROBOT_MODEL_MASK
The robot using model mask.

See Also:
getCurrentDispatchingModel(), setCurrentDispatchingModel(int)
Constructor Detail

JemmyProperties

protected JemmyProperties()
Method Detail

getMajorVersion

public static java.lang.String getMajorVersion()
Returns major version (like 1.0).

Returns:
a String representing the major version value.

getMinorVersion

public static java.lang.String getMinorVersion()
Returns minor version (like 1).

Returns:
a String representing the minor version value.

getBuild

public static java.lang.String getBuild()
Returns build (like 20011231 (yyyymmdd)).

Returns:
a String representing the build value.

getFullVersion

public static java.lang.String getFullVersion()
Returns full version string (like 1.0.1-20011231).

Returns:
a String representing the full version value.

getVersion

public static java.lang.String getVersion()
Returns version string (like 1.0.1).

Returns:
a String representing the short version value.

push

public static JemmyProperties push()
Creates a copy of the current JemmyProperties object and pushes it into the properties stack.

Returns:
New current properties.

pop

public static JemmyProperties pop()
Pops last pushed properties from the properties stack. If stack has just one element, does nothing.

Returns:
Poped properties.

getCurrentProperty

public static java.lang.Object getCurrentProperty(java.lang.String propertyName)
Just like getProperties().getProperty(propertyName).

Parameters:
propertyName - a property key
Returns:
a property value
See Also:
setCurrentProperty(java.lang.String, java.lang.Object), setCurrentTimeout(java.lang.String, long)

setCurrentProperty

public static java.lang.Object setCurrentProperty(java.lang.String propertyName,
                                                  java.lang.Object propertyValue)
Just like getProperties().setProperty(propertyName, propertyValue).

Parameters:
propertyName - a property key
propertyValue - a property value
Returns:
previous property value
See Also:
getCurrentProperty(java.lang.String), getCurrentTimeout(java.lang.String)

removeCurrentProperty

public static java.lang.Object removeCurrentProperty(java.lang.String propertyName)
Removes a property from current properties list.

Parameters:
propertyName - a property key.
Returns:
previous property value

getCurrentKeys

public static java.lang.String[] getCurrentKeys()
Returns the current key values.

Returns:
an array of Strings representing the current key values

getCurrentTimeouts

public static Timeouts getCurrentTimeouts()
Just like getProperties().getTimeouts().

Returns:
a Timeouts object representing the current timeouts.
See Also:
setCurrentTimeouts(org.netbeans.jemmy.Timeouts)

setCurrentTimeouts

public static Timeouts setCurrentTimeouts(Timeouts to)
Just like getProperties().setTimeouts(to).

Parameters:
to - New timeouts
Returns:
old timeouts.
See Also:
getCurrentTimeouts()

setCurrentTimeout

public static long setCurrentTimeout(java.lang.String name,
                                     long newValue)
Just like getProperties().getTimeouts().setTimeout(name, newValue).

Parameters:
name - a timeout name
newValue - a timeout value
Returns:
previous timeout value
See Also:
getCurrentTimeout(java.lang.String)

getCurrentTimeout

public static long getCurrentTimeout(java.lang.String name)
Just like getProperties().getTimeouts().getTimeout(name).

Parameters:
name - a timeout name
Returns:
a timeout value
See Also:
setCurrentTimeout(java.lang.String, long)

initCurrentTimeout

public static long initCurrentTimeout(java.lang.String name,
                                      long newValue)
Just like getProperties().getTimeouts().initTimeout(name, newValue).

Parameters:
name - a timeout name
newValue - a timeout value
Returns:
a timeout value
See Also:
setCurrentTimeout(java.lang.String, long)

getCurrentOutput

public static TestOut getCurrentOutput()
Just like getProperties().getOutput().

Returns:
a TestOut object representing the current output.
See Also:
setCurrentOutput(org.netbeans.jemmy.TestOut)

setCurrentOutput

public static TestOut setCurrentOutput(TestOut out)
Just like getProperties().setOutput(out).

Parameters:
out - new output
Returns:
a TestOut object representing the current output.
See Also:
getCurrentOutput()

getCurrentBundleManager

public static BundleManager getCurrentBundleManager()
Just like getProperties().getBundleManager().

Returns:
a BundleManager object representing the current bundle manager.
See Also:
setCurrentBundleManager(org.netbeans.jemmy.BundleManager)

setCurrentBundleManager

public static BundleManager setCurrentBundleManager(BundleManager resources)
Just like getProperties().setBundleManager(resources).

Parameters:
resources - new BundleManager
Returns:
a BundleManager object representing the current bundle manager.
See Also:
getCurrentBundleManager()

getCurrentResource

public static java.lang.String getCurrentResource(java.lang.String key)
Just like getProperties().getBundleManager().getResource(key).

Parameters:
key - a resource key.
Returns:
a resource value

getCurrentResource

public static java.lang.String getCurrentResource(java.lang.String bundleID,
                                                  java.lang.String key)
Just like getProperties().getBundleManager().getResource(bundleID, key).

Parameters:
key - a resource key.
bundleID - a bundle ID
Returns:
a resource value

getCurrentCharBindingMap

public static CharBindingMap getCurrentCharBindingMap()
Just like getProperties().getCharBindingMap().

Returns:
a CharBindingMap object representing the current char binding map.
See Also:
setCurrentCharBindingMap(org.netbeans.jemmy.CharBindingMap)

setCurrentCharBindingMap

public static CharBindingMap setCurrentCharBindingMap(CharBindingMap map)
Just like getProperties().setCharBindingMap(map).

Parameters:
map - new CharBindingMap.
Returns:
old CharBindingMap object.
See Also:
getCurrentCharBindingMap()

getCurrentDispatchingModel

public static int getCurrentDispatchingModel()
Returns the current dispatching model.

Returns:
Event dispatching model.
See Also:
getDispatchingModel(), setCurrentDispatchingModel(int), QUEUE_MODEL_MASK, ROBOT_MODEL_MASK

setCurrentDispatchingModel

public static int setCurrentDispatchingModel(int model)
Defines event dispatching model. If (model & ROBOT_MODEL_MASK) != 0 java.awt.Robot class is used to reproduce user actions, otherwise actions are reproduced by event posting. If (model & QUEUE_MODEL_MASK) != 0 actions are reproduced through event queue.

Parameters:
model - New dispatching model value.
Returns:
Previous dispatching model value.
See Also:
setDispatchingModel(int), getCurrentDispatchingModel(), QUEUE_MODEL_MASK, ROBOT_MODEL_MASK, initDispatchingModel(boolean, boolean), initDispatchingModel()

getDefaultDispatchingModel

public static int getDefaultDispatchingModel()
Returns default event dispatching model.

Returns:
QUEUE_MODEL_MASK
See Also:
setCurrentDispatchingModel(int), QUEUE_MODEL_MASK, ROBOT_MODEL_MASK

getCurrentDragAndDropStepLength

public static int getCurrentDragAndDropStepLength()
Returns the current drag and drop step length value.

Returns:
Pixel count to move mouse during one drag'n'drop step.
See Also:
getDragAndDropStepLength(), setCurrentDragAndDropStepLength(int)

setCurrentDragAndDropStepLength

public static int setCurrentDragAndDropStepLength(int model)
Specifies the current drag and drop step length value.

Parameters:
model - Pixel count to move mouse during one drag'n'drop step.
Returns:
Previous value.
See Also:
setDragAndDropStepLength(int), getCurrentDragAndDropStepLength()

getProperties

public static JemmyProperties getProperties()
Peeks upper JemmyProperties instance from stack.

Returns:
a JemmyProperties object representing the properties value.

main

public static void main(java.lang.String[] argv)
Prints full version into satndart output.

Parameters:
argv - Application args.

push

protected static JemmyProperties push(JemmyProperties props)
Pushes properties stack.

Parameters:
props - a JemmyProperties instance to put into the stack head.
Returns:
a JemmyProperties object.

initProperties

public void initProperties(java.lang.String prop_file)
Method to initialize timeouts and resources.

Parameters:
prop_file - File to get filenames from.
Can contain definition of variables TIMEOUTS_FILE - full path to timeouts file,
RESOURCE_FILE - full path to resource file.
See Also:
initProperties()

initProperties

public void initProperties()
Method to initialize timeouts and resources.
Uses jemmy.properties system property to find file.

See Also:
initProperties(String)

initDispatchingModel

public void initDispatchingModel(boolean queue,
                                 boolean robot,
                                 boolean shortcut)
Initializes dispatching model.

Parameters:
queue - Notifies that event queue dispatching should be used.
robot - Notifies that robot dispatching should be used.
shortcut - Notifies that event shorcutting should be used.

initDispatchingModel

public void initDispatchingModel(boolean queue,
                                 boolean robot,
                                 boolean shortcut,
                                 boolean smooth)
Initializes dispatching model.

Parameters:
queue - Notifies that event queue dispatching should be used.
robot - Notifies that robot dispatching should be used.
shortcut - Notifies that event shorcutting should be used.

initDispatchingModel

public void initDispatchingModel(boolean queue,
                                 boolean robot)
Initializes dispatching model.

Parameters:
queue - Notifies that event queue dispatching should be used.
robot - Notifies that robot dispatching should be used.

initDispatchingModel

public void initDispatchingModel()
Initializes dispatching model. Uses "jemmy.queue_dispatching" and "jemmy.robot_dispatching" system properties to determine what model should be used. Possible values for the both properties:
"off" - switch mode off.
"on" - switch mode on.
"" - use default value.

See Also:
getDefaultDispatchingModel()

init

public void init()
Inits properties and dispatching model from system environment variables.

See Also:
initProperties(), initDispatchingModel()

getTimeouts

public Timeouts getTimeouts()
Returns timeouts.

Returns:
the Timeouts value.
See Also:
setTimeouts(org.netbeans.jemmy.Timeouts)

setTimeouts

public Timeouts setTimeouts(Timeouts to)
Changes timeouts.

Parameters:
to - new timeouts.
Returns:
old timeouts.
See Also:
getTimeouts()

setTimeout

public long setTimeout(java.lang.String name,
                       long newValue)
Changes a timeouts value.

Parameters:
name - Timeout name
newValue - New timeout value
Returns:
previous timeout value
See Also:
getTimeout(java.lang.String)

getTimeout

public long getTimeout(java.lang.String name)
Returns a timeouts value.

Parameters:
name - Timeout name
Returns:
a timeout value
See Also:
setTimeout(java.lang.String, long)

initTimeout

public long initTimeout(java.lang.String name,
                        long newValue)
Inits a timeouts value.

Parameters:
name - Timeout name
newValue - New timeout value
Returns:
a timeout value

getOutput

public TestOut getOutput()
Returns output.

Returns:
a TestOut object representing the output value
See Also:
setOutput(org.netbeans.jemmy.TestOut)

setOutput

public TestOut setOutput(TestOut out)
Changes output.

Parameters:
out - new output.
Returns:
old output.
See Also:
getOutput()

getBundleManager

public BundleManager getBundleManager()
Returns bundle manager.

Returns:
a BundleManager object representing the bundle manager value.
See Also:
setBundleManager(org.netbeans.jemmy.BundleManager)

setBundleManager

public BundleManager setBundleManager(BundleManager resources)
Changes bundle manager.

Parameters:
resources - new bundle manager.
Returns:
old bundle manager
See Also:
getBundleManager()

getResource

public java.lang.String getResource(java.lang.String key)
Returns resource value.

Parameters:
key - Resource key.
Returns:
resource value

getResource

public java.lang.String getResource(java.lang.String bundleID,
                                    java.lang.String key)
Returns resource value from the specified bundle.

Parameters:
bundleID - Id of a bundle to get resource from.
key - Resource key.
Returns:
resource value

getCharBindingMap

public CharBindingMap getCharBindingMap()
Returns char binding map.

Returns:
the char binding map.
See Also:
setCharBindingMap(org.netbeans.jemmy.CharBindingMap)

setCharBindingMap

public CharBindingMap setCharBindingMap(CharBindingMap map)
Changes char binding map.

Parameters:
map - new char binding map.
Returns:
old char binding map.
See Also:
getCharBindingMap()

getDispatchingModel

public int getDispatchingModel()
Returns the dispatching model.

Returns:
Event dispatching model.
See Also:
getCurrentDispatchingModel(), setDispatchingModel(int), QUEUE_MODEL_MASK, ROBOT_MODEL_MASK

setDispatchingModel

public int setDispatchingModel(int model)
Specifies the dispatching model value.

Parameters:
model - New dispatching model value.
Returns:
Previous dispatching model value.
See Also:
setCurrentDispatchingModel(int), getDispatchingModel(), QUEUE_MODEL_MASK, ROBOT_MODEL_MASK

getDragAndDropStepLength

public int getDragAndDropStepLength()
Returns the drag and drop step length value.

Returns:
Pixel count to move mouse during one drag'n'drop step.
See Also:
getCurrentDragAndDropStepLength(), setDragAndDropStepLength(int)

setDragAndDropStepLength

public int setDragAndDropStepLength(int length)
Specifies the drag and drop step length value.

Parameters:
length - Pixel count to move mouse during one drag'n'drop step.
Returns:
Previous value.
See Also:
setCurrentDragAndDropStepLength(int), getDragAndDropStepLength()

contains

public boolean contains(java.lang.String name)
Checks if "name" propery currently has a value.

Parameters:
name - Property name. Should by unique.
Returns:
true if property was defined.
See Also:
setProperty(String, Object), getProperty(String)

setProperty

public java.lang.Object setProperty(java.lang.String name,
                                    java.lang.Object newValue)
Saves object as a static link to be used by other objects.

Parameters:
name - Property name. Should by unique.
newValue - Property value.
Returns:
Previous value of "name" property.
See Also:
setCurrentProperty(String, Object), getProperty(String), contains(String)

getProperty

public java.lang.Object getProperty(java.lang.String name)
Returns the property value.

Parameters:
name - Property name. Should by unique.
Returns:
Property value stored by setProperty(String, Object) method.
See Also:
getCurrentProperty(String), setProperty(String, Object), contains(String)

removeProperty

public java.lang.Object removeProperty(java.lang.String name)
Removes the property.

Parameters:
name - A name of the property to be removed.
Returns:
previous property value

getKeys

public java.lang.String[] getKeys()
Returns the key values.

Returns:
an array of Strings representing the key values.

copyTo

public void copyTo(JemmyProperties properties)
Copy all properties from this instance into another.

Parameters:
properties - a JemmyProperties instance to copy properties into.

cloneThis

protected JemmyProperties cloneThis()
Creates an exact copy on this instance.

Returns:
new JemmyProperties object.