|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.util.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 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 string)
string - String containing inital text.public StringProvider(String family, int id)
family - Name of resource bundle containing inital text.id - ID in resource bundle containing initial 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.
o - Object to compare toTrue if object is the same as this, false
otherwise.public int getResourceBundleId()
public String getResourceBundleName()
null if not set.public String toString()
null
if text not set or if resource bundle does not exist.public StringProvider toStringProviderWithoutHotkey()
toString() method
will return strings without the hot keys.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2009 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.