|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.util.StringProvider
public final class StringProvider
Provides a String that can be changed. The most common use case would be for
locale changes. The StringProvider is immutable to external
changes - i.e. there are no public mutator methods. For applications needing
mutator methods, use StringProviderMutator
.
Use:
protected void layout(int width, int height) { _cachedValue = _myLabel.toString(); Font font = getFont(); width = font.getAdvance(_cachedValue); setExtent(width, font.getHeight()); } protected void paint(Graphics graphics) { if( ! _myLabel.toString().equals( _cachedValue ) ) { updateLayout(); } graphics.drawText(_myLabel.getString(), 0, 0); }
StringProviderMutator
Constructor Summary | ||
---|---|---|
StringProvider(String string)
Constructs a new StringProvider instance with initial text from a specified string. |
||
StringProvider(String family,
int id)
Constructs a new StringProvider instance with initial text from a resource bundle. |
||
StringProvider(StringProvider provider)
Constructs a new StringProvider instance with initial text from an existing StringProvider. |
Method Summary | ||
---|---|---|
boolean |
equals(Object o)
Checks to see if another object is equal to this StringProvider. |
|
int |
getResourceBundleId()
Retrieves the resource bundle ID set in this provider. |
|
String |
getResourceBundleName()
Retrieves the resource bundle name set in this provider. |
|
String |
toString()
Returns the string of this provider. |
|
StringProvider |
toStringProviderWithoutHotkey()
Creates a new StringProvider where the StringProvider.toString() method
will return strings without the hot keys. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StringProvider(String family, int id)
family
- Name of resource bundle containing inital text.id
- ID in resource bundle containing initial text.public StringProvider(String string)
string
- String containing inital text.public StringProvider(StringProvider provider)
provider
- StringProvider to copy.Method Detail |
---|
public boolean equals(Object o)
This provider is equal to another StringProvider 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 StringProviders which have identical resource information but different strings due to absence or presence of hotkeys are considered unequal.
equals
in class Object
o
- Object to compare to
True
if object is the same as this, false
otherwise.Boolean.hashCode()
,
Hashtable
public int getResourceBundleId()
public String getResourceBundleName()
null
if not set.public String toString()
toString
in class Object
null
if text not set or if resource bundle does not exist.public StringProvider toStringProviderWithoutHotkey()
StringProvider.toString()
method
will return strings without the hot keys.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal