Methods Summary |
---|
void | createNativeResource(int ownerId)Create native resource for current StringItem .
Override function in ItemLFImpl .
nativeId = createNativeResource0(ownerId,
strItem.label, strItem.layout,
strItem.str,
appearanceMode, strItem.font);
|
private native int | createNativeResource0(int ownerId, java.lang.String label, int layout, java.lang.String text, int appearanceMode, Font font)KNI function that create native resource for current
StringItem .
|
boolean | equateNLA()Determine if this Item should have a newline after it.
String label = item.label;
String str = strItem.str;
// If content ends with a \n, there is a newline after
// this StringItem
if (str != null && str.length() > 0) {
if (str.charAt(str.length() - 1) == '\n") {
return true;
}
} else if (label != null && label.length() > 0) {
// If there is no content and our label ends with a \n,
// there is a newline after this StringItem
if (label.charAt(label.length() - 1) == '\n") {
return true;
}
} else {
// empty StringItem
return false;
}
if ((strItem.layout & Item.LAYOUT_2) == Item.LAYOUT_2) {
return ((item.layout & Item.LAYOUT_NEWLINE_AFTER)
== Item.LAYOUT_NEWLINE_AFTER);
}
return false;
|
boolean | equateNLB()Determine if this Item should have a newline before it.
String label = strItem.label;
String str = strItem.str;
// If label starts with a \n, put this StringItem on a newline
if (label != null && label.length() > 0) {
if (label.charAt(0) == '\n") {
return true;
}
} else if (str != null && str.length() > 0) {
// If there is no label and our content starts with a \n,
// this StringItem starts on a newline
if (str.charAt(0) == '\n") {
return true;
}
} else {
// empty StringItem
return false;
}
if ((strItem.layout & Item.LAYOUT_2) == Item.LAYOUT_2) {
return ((strItem.layout & Item.LAYOUT_NEWLINE_BEFORE)
== Item.LAYOUT_NEWLINE_BEFORE);
}
// LAYOUT_2 was not set, hence we need to provide backward
// compatibility with MIDP1.0 where any StringItem with a
// non-null label would go on a new line.
return label != null && label.length() > 0;
|
public Font | getDefaultFont()Gets default font to render text in StringItem if it was not
set by the application.
return Theme.curContentFont;
|
public void | lAddCommand(Command cmd, int i)Notifies L&F of a command addition in the corresponding
StringItem .
super.lAddCommand(cmd, i);
if ((strItem.numCommands >= 1) && (appearanceMode == Item.PLAIN)) {
appearanceMode = strItem.appearanceMode == Item.BUTTON ?
Item.BUTTON : Item.HYPERLINK;
if (nativeId != DisplayableLFImpl.INVALID_NATIVE_ID) {
setContent0(nativeId, strItem.str, appearanceMode);
}
lRequestInvalidate(true, true);
}
|
public void | lRemoveCommand(Command cmd, int i)Notifies L&F of a command removal in the corresponding
StringItem .
super.lRemoveCommand(cmd, i);
// restore the value of the original appearanceMode
if (strItem.numCommands < 1) {
appearanceMode = Item.PLAIN;
if (nativeId != DisplayableLFImpl.INVALID_NATIVE_ID) {
setContent0(nativeId, strItem.str, appearanceMode);
}
lRequestInvalidate(true, true);
}
|
public void | lSetFont(Font font)Notifies L&F of a font change in the corresponding
StringItem .
// Only update native resource if it exists.
if (nativeId != DisplayableLFImpl.INVALID_NATIVE_ID) {
setFont0(nativeId,
font.getFace(), font.getStyle(), font.getSize());
}
lRequestInvalidate(true, true);
|
public void | lSetText(java.lang.String str)Notifies L&F of a string change in the corresponding
StringItem .
// Only update native resource if it exists.
if (nativeId != DisplayableLFImpl.INVALID_NATIVE_ID) {
setContent0(nativeId, str, appearanceMode);
}
lRequestInvalidate(true, true);
|
private native void | setContent0(int nativeId, java.lang.String text, int appearanceMode)KNI function that sets text on the native resource corresponding
to the current StringItem .
|
private native void | setFont0(int nativeId, int face, int style, int size)KNI function that sets font on the native resource corresponding
to the current StringItem .
|
boolean | uCallPeerStateChanged(int hint)Called by event delivery to notify an ItemLF in current
FormLF of a change in its peer state.
Handle special gesture of default command.
// activate default command if hint is -1
if (hint == -1) {
Command defaultCommand;
ItemCommandListener commandListener;
synchronized (Display.LCDUILock) {
defaultCommand = strItem.defaultCommand;
commandListener = strItem.commandListener;
}
if (defaultCommand != null && commandListener != null) {
// Protect from any unexpected application exceptions
try {
synchronized (Display.calloutLock) {
commandListener.commandAction(defaultCommand, strItem);
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
}
}
// Indicate to Form to not notify ItemStateListener
return false;
|