Methods Summary |
---|
public int | lGetInteractionModes()
int result = customItem.TRAVERSE_HORIZONTAL |
customItem.TRAVERSE_VERTICAL |
customItem.KEY_PRESS |
customItem.KEY_RELEASE;
if (Constants.REPEAT_SUPPORTED) {
result = result | customItem.KEY_REPEAT;
}
if (Constants.POINTER_SUPPORTED) {
result = result | customItem.POINTER_PRESS |
customItem.POINTER_RELEASE;
}
if (Constants.MOTION_SUPPORTED) {
result = result | customItem.POINTER_DRAG;
}
return result;
|
public int | lGetMinimumHeight()Get the minimum height of this time.
return minimumHeight;
|
public int | lGetMinimumWidth()Get the minimum width of this time.
return minimumWidth;
|
public int | lGetPreferredHeight(int w)Get the preferred height of this time.
// argument w is ignored since we are only using the cached value
return preferredHeight;
|
public int | lGetPreferredWidth(int h)Get the preferred width of this time.
// argument h is ignored since we are only using the cached value
return preferredWidth;
|
public void | lInvalidate()Notifies L&F that Custom Item was invalidated.
lRequestInvalidate(true, true);
|
public void | lRepaint()Notifies L&F that repaint of the entire custom item is needed
lRepaint(0, 0, contentBounds[WIDTH], contentBounds[HEIGHT]);
|
public void | lRepaint(int x, int y, int w, int h)Notifies L&F that repaint of the specified region is needed.
try {
if (x > contentBounds[WIDTH] || y > contentBounds[HEIGHT] ||
x + w <= 0 || y + w <= 0 || w <= 0 || h <= 0) {
return;
}
if (x < 0) {
w += x;
x = 0;
}
if (x + w > contentBounds[WIDTH]) {
w = contentBounds[WIDTH] - x;
}
if (y < 0) {
h += y;
y = 0;
}
if (y + h > contentBounds[HEIGHT]) {
h = contentBounds[HEIGHT] - y;
}
lRequestPaint(x + contentBounds[X] + ScreenSkin.PAD_FORM_ITEMS,
y + contentBounds[Y] + ScreenSkin.PAD_FORM_ITEMS,
w, h);
} catch (Exception e) {
Display.handleThrowable(e);
}
|
boolean | labelAndContentOnSameLine(int labelHeight)Returns true if label and content can be placed on the same line.
If this function returns always false then content will be
always put on a new line in relation to label.
return false;
|
boolean | shouldSkipTraverse()Determine if this Item should not be traversed to
return false;
|
void | uCallHideNotify()Called by the system to notify this Item it is being hidden
The default implementation of this method does nothing.
super.uCallHideNotify();
try {
synchronized (Display.calloutLock) {
customItem.hideNotify();
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
void | uCallKeyPressed(int keyCode)Called by the system to signal a key press
ItemCommandListener cl = null;
Command defaultCmd = null;
synchronized (Display.LCDUILock) {
cl = customItem.commandListener;
defaultCmd = customItem.defaultCommand;
} // synchronized
// SYNC NOTE: The call to the listener must occur outside
// of the lock
try {
// SYNC NOTE: We lock on calloutLock around any calls
// into application code
synchronized (Display.calloutLock) {
if ((cl != null)
&& (defaultCmd != null)
&& (keyCode == Constants.KEYCODE_SELECT)) {
cl.commandAction(defaultCmd, customItem);
} else {
customItem.keyPressed(keyCode);
}
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
void | uCallKeyReleased(int keyCode)Called by the system to signal a key release
try {
synchronized (Display.calloutLock) {
customItem.keyReleased(keyCode);
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
void | uCallKeyRepeated(int keyCode)Called by the system to signal a key repeat
try {
synchronized (Display.calloutLock) {
customItem.keyRepeated(keyCode);
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
private int | uCallMinimumHeight()Get the minimum height of this Item, including the minimum
content height and room for the label. This is the callback
for Item's public getMinimumHeight() method.
// SYNC NOTE: call into app code. Must not hold LCDUILock.
int minH = customItem.uGetContentSize(CustomItem.SIZE_MIN_HEIGHT, 0);
int prefW = customItem.uGetContentSize(CustomItem.SIZE_PREF_WIDTH,
minH);
synchronized (Display.LCDUILock) {
if (cachedWidth != INVALID_SIZE ||
contentBounds[WIDTH] != prefW ||
contentBounds[HEIGHT] != minH) {
contentBounds[WIDTH] = prefW;
contentBounds[HEIGHT] = minH;
cachedWidth = INVALID_SIZE;
}
// Note that content size had to be calculated outside of
// the LCDUILock that is why it is set here and
// lGetContentSize is left empty
return super.lGetPreferredHeight(-1);
}
|
private int | uCallMinimumWidth()Get the minimum width of this Item, including the minimum
content width and room for the label. This is the callback
for Item's public getMinimumWidth() method.
// SYNC NOTE: call into app code. Must not hold LCDUILock.
int mw = customItem.uGetContentSize(CustomItem.SIZE_MIN_WIDTH, 0);
int ph = customItem.uGetContentSize(CustomItem.SIZE_PREF_HEIGHT, mw);
synchronized (Display.LCDUILock) {
if (cachedWidth != INVALID_SIZE ||
contentBounds[WIDTH] != mw || contentBounds[HEIGHT] != ph) {
contentBounds[WIDTH] = mw;
contentBounds[HEIGHT] = ph;
cachedWidth = INVALID_SIZE;
}
// Note that content size had to be calculated outside of
// the LCDUILock that is why it is set here and
// lGetContentSize is left empty
return super.lGetPreferredWidth(-1);
}
|
void | uCallPaint(Graphics g, int w, int h)Called to paint this CustomItem
int clipX, clipY, clipH, clipW;
synchronized (Display.LCDUILock) {
// do internal layout, paint label
lDoInternalLayout(labelBounds, contentBounds, w, h);
g.translate(labelBounds[X], labelBounds[Y]);
paintLabel(g, labelBounds[WIDTH]);
g.translate(-labelBounds[X] + contentBounds[X],
-labelBounds[Y] + contentBounds[Y]);
clipX = g.getClipX();
clipY = g.getClipY();
clipH = g.getClipHeight();
clipW = g.getClipWidth();
g.clipRect(0, 0, contentBounds[WIDTH], contentBounds[HEIGHT]);
// IMPL NOTES: We need to remember translation and clipping
// and restore it after this.paint (stroke as well)
// Color does not have to be reset since it is always set
// Font??
g.setColor(0);
g.setFont(Font.getDefaultFont());
w = contentBounds[WIDTH];
h = contentBounds[HEIGHT];
}
if (clipY + clipH >= 0 && clipY < contentBounds[HEIGHT] &&
clipX + clipW >= 0 && clipX < contentBounds[WIDTH]) {
synchronized (Display.calloutLock) {
try {
customItem.paint(g, w, h);
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
}
}
g.translate(-contentBounds[X], -contentBounds[Y]);
|
void | uCallPointerDragged(int x, int y)Called by the system to signal a pointer drag
try {
synchronized (Display.calloutLock) {
customItem.pointerDragged(x - contentBounds[X] -
ScreenSkin.PAD_FORM_ITEMS,
y - contentBounds[Y] -
ScreenSkin.PAD_FORM_ITEMS);
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
void | uCallPointerPressed(int x, int y)Called by the system to signal a pointer press
synchronized (Display.LCDUILock) {
if (hasFocus) {
itemWasPressed = true;
}
} // synchronized
try {
synchronized (Display.calloutLock) {
customItem.pointerPressed(x - contentBounds[X] -
ScreenSkin.PAD_FORM_ITEMS,
y - contentBounds[Y] -
ScreenSkin.PAD_FORM_ITEMS);
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
void | uCallPointerReleased(int x, int y)Called by the system to signal a pointer release
boolean handled = false;
synchronized (Display.LCDUILock) {
ItemCommandListener cl = customItem.commandListener;
Command defaultCmd = customItem.defaultCommand;
if ((cl != null) && (defaultCmd != null) && itemWasPressed) {
cl.commandAction(defaultCmd, customItem);
handled = true;
}
itemWasPressed = false;
} // synchronized
try {
synchronized (Display.calloutLock) {
if (!handled) {
customItem.pointerReleased(x - contentBounds[X] -
ScreenSkin.PAD_FORM_ITEMS,
y - contentBounds[Y] -
ScreenSkin.PAD_FORM_ITEMS);
}
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
private int | uCallPreferredHeight(int w)Get the preferred height of this Item, including the preferred
content height and room for the label. This is the callback
for Item's public getPreferredHeight() method.
// SYNC NOTE: call into app code. Must not hold LCDUILock.
int prefH = customItem.uGetContentSize(CustomItem.SIZE_PREF_HEIGHT, w);
int prefW = customItem.uGetContentSize(CustomItem.SIZE_PREF_WIDTH,
prefH);
if (prefW > w) prefW = w;
synchronized (Display.LCDUILock) {
if (cachedWidth != INVALID_SIZE ||
contentBounds[WIDTH] != prefW ||
contentBounds[HEIGHT] != prefH) {
contentBounds[WIDTH] = prefW;
contentBounds[HEIGHT] = prefH;
cachedWidth = INVALID_SIZE;
}
// Note that content size had to be calculated outside of
// the LCDUILock that is why it is set here and
// lGetContentSize is left empty
return super.lGetPreferredHeight(w);
}
|
private int | uCallPreferredWidth(int h)Get the preferred width of this Item, including the preferred
content width and room for the label. This is the callback
for Item's public getPreferredWidth() method.
// SYNC NOTE: call into app code. Must not hold LCDUILock.
int pw = customItem.uGetContentSize(CustomItem.SIZE_PREF_WIDTH, h);
int ph = h == -1 ?
customItem.uGetContentSize(CustomItem.SIZE_PREF_HEIGHT, pw) : h;
synchronized (Display.LCDUILock) {
if (cachedWidth != INVALID_SIZE ||
contentBounds[WIDTH] != pw || contentBounds[HEIGHT] != ph) {
contentBounds[WIDTH] = pw;
contentBounds[HEIGHT] = ph;
cachedWidth = INVALID_SIZE;
}
// Note that content size had to be calculated outside of
// the LCDUILock that is why it is set here and
// lGetContentSize is left empty
return super.lGetPreferredWidth(h);
}
|
void | uCallShowNotify()Called by the system to notify this Item it is being shown
The default implementation of this method does nothing.
super.uCallShowNotify();
try {
synchronized (Display.calloutLock) {
customItem.showNotify();
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|
void | uCallSizeChanged(int w, int h)Called by the system to indicate the size available to this Item
has changed
super.uCallSizeChanged(w,h);
int prefH = customItem.uGetContentSize(CustomItem.SIZE_PREF_HEIGHT, w);
int prefW = customItem.uGetContentSize(CustomItem.SIZE_PREF_WIDTH, h);
if (prefW > w) {
prefW = w;
}
if (prefH > h) {
prefH = h;
}
synchronized (Display.LCDUILock) {
contentBounds[WIDTH] = prefW;
contentBounds[HEIGHT] = prefH;
lDoInternalLayout(labelBounds, contentBounds, w, h);
}
synchronized (Display.calloutLock) {
try {
customItem.sizeChanged(prefW, prefH);
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
}
|
public void | uCallSizeRefresh()Refresh the cached preferred and minimum sizes of this CustomItem.
if (isRequestedSizesValid()) {
return;
}
int mw = uCallMinimumWidth();
if (mw < 0) mw = 0;
int mh = uCallMinimumHeight();
if (mh < 0) mh = 0;
int pw = item.lockedWidth == -1 ?
uCallPreferredWidth(item.lockedHeight) : item.lockedWidth;
if (pw < mw) pw = mw;
int ph = uCallPreferredHeight(pw);
if (ph < mh) ph = mh;
// Cache the result in ItemLFImpl
synchronized (Display.LCDUILock) {
minimumWidth = mw;
minimumHeight = mh;
preferredWidth = pw;
preferredHeight = ph;
cachedWidth = super.lGetAvailableWidth();
}
|
boolean | uCallTraverse(int dir, int viewportWidth, int viewportHeight, int[] visRect_inout)Traverse this CustomItem
super.uCallTraverse(dir, viewportWidth, viewportHeight, visRect_inout);
try {
synchronized (Display.calloutLock) {
// SYNC NOTE: Make a copy of current label height
int contW = contentBounds[WIDTH];
int contH = contentBounds[HEIGHT];
int contX = contentBounds[X];
int contY = contentBounds[Y];
boolean t = customItem.traverse(dir, viewportWidth,
viewportHeight,
visRect_inout);
// We shift the return value from the item's traverse
// by the label height to give the real location
visRect_inout[X] += contX;
visRect_inout[Y] += contY;
return t;
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
return false;
|
void | uCallTraverseOut()Called by the system to indicate traversal has left this Item
super.uCallTraverseOut();
try {
synchronized (Display.calloutLock) {
customItem.traverseOut();
}
} catch (Throwable thr) {
Display.handleThrowable(thr);
}
|