net.rim.device.api.util
Class StringProviderMutator

java.lang.Object
  extended by net.rim.device.api.util.StringProviderMutator

public final class StringProviderMutator
extends Object

Provides a String that can change.

A StringProviderMutator is identical to StringProvider, except it provides access to the mutator methods. This is useful when an application wants unrestricted access to a context-sensitive String but wants to provide restricted access to other applications.

Since:
BlackBerry API 6.0.0

Constructor Summary
StringProviderMutator(String string)
          Constructs a new StringProviderMutator instance with initial text from a specified string.
StringProviderMutator(String family, int id)
          Constructs a new StringProviderMutator instance with initial text from a resource bundle.
StringProviderMutator(StringProviderMutator provider)
          Constructs a new StringProviderMutator instance with initial text from an existing StringProviderMutator.
 
Method Summary
 boolean equals(Object o)
          Checks to see if another object is equal to this StringProviderMutator.
 int getResourceBundleId()
          Retrieves the resource bundle ID set in this provider.
 String getResourceBundleName()
          Retrieves the resource bundle name set in this provider.
 StringProvider getStringProvider()
          Retrieves the underlying StringProvider.
 void setRemoveHotkeyFromString(boolean isRemoveHotkey)
          Indicates whether this provider should remove hotkey underscores in the text, e.g. for application titles.
 void setString(String string)
          Sets the string containing the text for this provider.
 void setString(String family, int id)
          Sets the resource bundle containing the text for this provider.
 void setString(StringProviderMutator provider)
          Sets the string containing the text for this provider.
 String toString()
          Returns the string of this provider.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

StringProviderMutator

public StringProviderMutator(String family,
                             int id)
Constructs a new StringProviderMutator instance with initial text from a resource bundle.

Parameters:
family - Name of resource bundle containing inital text.
id - ID in resource bundle containing initial text.
Since:
BlackBerry API 6.0.0

StringProviderMutator

public StringProviderMutator(String string)
Constructs a new StringProviderMutator instance with initial text from a specified string.

Parameters:
string - String containing inital text.
Since:
BlackBerry API 6.0.0

StringProviderMutator

public StringProviderMutator(StringProviderMutator provider)
Constructs a new StringProviderMutator instance with initial text from an existing StringProviderMutator.

Parameters:
provider - StringProviderMutator to copy.
Since:
BlackBerry API 6.0.0


Method Detail

equals

public boolean equals(Object o)
Checks to see if another object is equal to this StringProviderMutator. This provider is equal to another StringProviderMutator if the result of their getResourceBundleID and getResourceBundleName are equivalent. If the bundle ID or name are null,checks to see if the result of toString is equivalent.

Two StringProviderMutators which have identical resource information but different strings due to absence or presence of hotkeys are considered unequal.

Overrides:
equals in class Object
Parameters:
o - Object to compare to
Returns:
True if object is the same as this, false otherwise.
See Also:
Boolean.hashCode(), Hashtable
Since:
BlackBerry API 6.0.0

getResourceBundleId

public int getResourceBundleId()
Retrieves the resource bundle ID set in this provider.

Returns:
Resource bundle ID of text or -1 if not set.
Since:
BlackBerry API 6.0.0

getResourceBundleName

public String getResourceBundleName()
Retrieves the resource bundle name set in this provider.

Returns:
Resource bundle name containing text or null if not set.
Since:
BlackBerry API 6.0.0

getStringProvider

public StringProvider getStringProvider()
Retrieves the underlying StringProvider. A StringProvider does not have any modifier (@link setString} methods and cannot directly modify this object.

The returned StringProvider can still be updated through this StringProviderMutator.

Returns:
A StringProvider.
Since:
BlackBerry API 6.0.0

setRemoveHotkeyFromString

public void setRemoveHotkeyFromString(boolean isRemoveHotkey)
Indicates whether this provider should remove hotkey underscores in the text, e.g. for application titles.

Parameters:
True - to remove hotkey underscores, false otherwise.
Since:
BlackBerry API 6.0.0

setString

public void setString(String family,
                      int id)
Sets the resource bundle containing the text for this provider. Note that this disables the use of any previously set strings.

Parameters:
family - Name of resource bundle containing text.
id - ID in resource bundle containing text.
Since:
BlackBerry API 6.0.0

setString

public void setString(String string)
Sets the string containing the text for this provider. Note that this disables the use of any previously set resource bundles.

Parameters:
string - String containing text.
Since:
BlackBerry API 6.0.0

setString

public void setString(StringProviderMutator provider)
Sets the string containing the text for this provider. Essentially copies the specified StringProviderMutator. All information, including absence or presence of hotkeys is copied.

Parameters:
provider - StringProviderMutator containing text.
Since:
BlackBerry API 6.0.0

toString

public String toString()
Returns the string of this provider.

Overrides:
toString in class Object
Returns:
String representation of the text in this provider. Is null if text not set or if resource bundle does not exist.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.