| java.lang.Object javax.microedition.lcdui.ItemLFImpl
All known Subclasses: javax.microedition.lcdui.GaugeLFImpl, javax.microedition.lcdui.StringItemLFImpl, javax.microedition.lcdui.DateFieldLFImpl, javax.microedition.lcdui.TextFieldLFImpl, javax.microedition.lcdui.ChoiceGroupLFImpl, javax.microedition.lcdui.CustomItemLFImpl, javax.microedition.lcdui.ImageItemLFImpl, javax.microedition.lcdui.SpacerLFImpl,
ItemLFImpl | abstract class ItemLFImpl implements ItemLF(Code) | | Look and feel implementation for Item based on
platform widgets.
SYNC NOTE: Only functions with prefix 'uCall' handle locking internally.
Its the caller's responsibility to hold LCDUILock around calls to the
rest of functions.
|
Field Summary | |
final static int | DEFAULT_LABEL_HEIGHT The default label height for an item. | final static int | HEIGHT Bounds[] array index to height. | final static int | INVALID_SIZE A constant used to indicate that Item sizes have to be recalculated. | final static int | WIDTH Bounds[] array index to width. | final static int | X Bounds[] array index to x coordinate. | final static int | Y Bounds[] array index to y coordinate. | boolean[] | actualBoundsInvalid Flags that are set to true when calling invalidate() on this item. | int[] | bounds This is the size granted to this item by the form layout.
An array of 4 elements, describing the x, y, width, height
of this Item 's bounds in the viewport coordinate space. | int | cachedWidth Width used for last calculations. | boolean | hasFocus A flag indicating this Item has the input focus. | boolean | isNewLine This flag marks if the last layout performed placed
this Item at the beginning of a line. | Item | item The owner of this view. | int | nativeId The native MidpItem* of this view. | int | rowHeight Marks the height of the row this Item is placed on. | boolean | sizeChanged A flag indicating the size of this Item has changed in a
subsequent layout operation. | boolean | supportsNativeScrolling If set to true rely on native scrolling mechanism of this item
and give this item all width and height available. | boolean | visibleInViewport A flag indicating the native resource of this
Item is currently (at least
partially) visible on the Form it is on. |
Constructor Summary | |
| ItemLFImpl(Item item) Creates look and feel for the passed in Item . |
Method Summary | |
abstract void | createNativeResource(int ownerId) Create native resource of this Item . | protected void | createTempNativeResource() Create a temporary native resource of this Item whose
id must be deleted before caller function returns. | void | deleteNativeResource() Delete native resource of this Item . | boolean | equateNLA() Determine if this Item should have a newline after it. | boolean | equateNLB() Determine if this Item should have a newline before it. | Display | getCurrentDisplay() Return the current Display instance that this
Item is displayed in. | int | getLayout() Get the effective layout type of this Item . | native int | getMinimumHeight0(int nativeId) Gets minimum height from the native resource corresponding to
this Item . | native int | getMinimumWidth0(int nativeId) Gets minimum width from the native resource corresponding to
this Item . | native int | getPreferredHeight0(int nativeId, int w) Gets preferred height from the native resource corresponding to
this Item . | native int | getPreferredWidth0(int nativeId, int h) Gets preferred width from the native resource corresponding to
this Item . | void | initNativeResource() Initialize native resource - size and location. | final public boolean | isRequestedSizesValid() Return whether the cached requested sizes are valid. | public void | lAddCommand(Command cmd, int i) Notifies L&F of a command addition in the corresponding
Item . | void | lCallHideNotify() Sets the visibleInViewport flag to be false. | void | lCallPaint(Graphics g, int w, int h) Paint the content of this Item . | void | lCallShowNotify() Sets the visibleInViewport flag of this Item to be true. | void | lCallTraverseOut() Called by the system to indicate traversal has left this
Item . | public void | lCommitPendingInteraction() Called to commit any pending user interaction for the item. | int | lGetAdornedMinimumHeight() | int | lGetAdornedMinimumWidth() | int | lGetAdornedPreferredHeight(int width) | int | lGetAdornedPreferredWidth(int height) | protected int | lGetLockedHeight() | int | lGetLockedWidth() | public int | lGetMinimumHeight() Get the minimum height of this Item . | public int | lGetMinimumWidth() Get the minimum width of this Item . | public int | lGetPreferredHeight(int w) Get the preferred height of this Item .
Parameters: w - tentative locked width.Ignored here and preferred width is used always. | public int | lGetPreferredWidth(int h) Get the preferred width of this Item .
Parameters: h - tentative locked height.Ignored here and item.lockedHeight is used always. | void | lGetRequestedSizes() Calculate minimum and preferred width and height of this item and
store the result in instance variables:
minimumWidth, minimumHeight, preferredWidth and preferredHeight.
This function will query native resources for the sizes. | void | lHideNativeResource() Called by the system to hide this Item 's
native resource. | void | lMove(int deltaX, int deltaY) Moves item's location by delta. | public void | lRemoveCommand(Command cmd, int i) Notifies L&F of a command removal in the corresponding
Item . | void | lRequestInvalidate(boolean width, boolean height) Request the event scheduler to schedule an invalidate event, that
eventually will call uCallInvalidate(this item) of this item's
DisplayableLFImpl . | void | lRequestPaint() Called by subclasses to repaint this entire Item 's bounds. | void | lRequestPaint(int x, int y, int w, int h) Called by subclasses to repaint a portion of this Item 's
bounds. | public void | lSetDefaultCommand(Command cmd, int i) Notifies L&F of the default command change in the corresponding
Item . | public void | lSetLabel(String label) Notifies L&F of a label change in the corresponding
Item . | public void | lSetLayout(int layout) Notifies L&F of a layout change in the corresponding
Item . | void | lSetLocation(int x, int y) Sets item's location. | public void | lSetOwner(Screen oldOwner) Notify this itemLF that its owner screen has changed.
Clear internal state if its new owner is null .
Parameters: oldOwner - old owner screen before this change. | public void | lSetPreferredSize(int width, int height) Notifies L&F of a preferred size change in the corresponding
Item . | final void | lSetRequestedSizes(int mw, int mh, int pw, int ph) Set minimum and preferred width and height of this item.
This function should only be called on a CustomItemLFImpl
or SpacerLFImpl . | void | lSetSize(int w, int h) Sets item's size. | void | lShowNativeResource() Called by the system to show this Item 's
native resource. | native void | setLabel0(int nativeId, String label) Notifies native width that new label was set on this Item . | boolean | shouldHExpand() Determine if this Item should horizontally expand. | boolean | shouldHShrink() Determine if this Item should horizontally shrink. | boolean | shouldVExpand() Determine if this Item should vertically expand. | boolean | shouldVShrink() Determine if this Item should vertically shrink. | void | uCallHideNotify() Sets the visibleInViewport flag to be false. | void | uCallKeyPressed(int keyCode) Called by the system to signal a key press. | void | uCallKeyReleased(int keyCode) Called by the system to signal a key release. | void | uCallKeyRepeated(int keyCode) Called by the system to signal a key repeat. | void | uCallPaint(Graphics g, int w, int h) Paint the content of this Item . | abstract boolean | uCallPeerStateChanged(int hint) Called by event delivery to notify an ItemLF in current
FormLF of a change in its peer state. | void | uCallPointerDragged(int x, int y) Called by the system to signal a pointer drag. | void | uCallPointerPressed(int x, int y) Called by the system to signal a pointer press. | void | uCallPointerReleased(int x, int y) Called by the system to signal a pointer release. | void | uCallShowNotify() Sets the visibleInViewport flag of this Item to be true. | void | uCallSizeChanged(int w, int h) Called by the system to indicate the size available to this
Item has changed. | boolean | uCallTraverse(int dir, int viewportWidth, int viewportHeight, int[] visRect_inout) Called by the system to notify internal traverse into the item. | void | uCallTraverseOut() Called by the system to indicate traversal has left this
Item . |
DEFAULT_LABEL_HEIGHT | final static int DEFAULT_LABEL_HEIGHT(Code) | | The default label height for an item.
|
HEIGHT | final static int HEIGHT(Code) | | Bounds[] array index to height.
|
INVALID_SIZE | final static int INVALID_SIZE(Code) | | A constant used to indicate that Item sizes have to be recalculated.
|
WIDTH | final static int WIDTH(Code) | | Bounds[] array index to width.
|
X | final static int X(Code) | | Bounds[] array index to x coordinate.
|
Y | final static int Y(Code) | | Bounds[] array index to y coordinate.
|
actualBoundsInvalid | boolean[] actualBoundsInvalid(Code) | | Flags that are set to true when calling invalidate() on this item.
If it is known that one of the dimensions remains the same, then
the responding invalid flag will stay false .
It will turn to false after it gets laid out.
This is set by Item class and read by
FormLFImpl during layout.
|
bounds | int[] bounds(Code) | | This is the size granted to this item by the form layout.
An array of 4 elements, describing the x, y, width, height
of this Item 's bounds in the viewport coordinate space. If
it is null , it means the Item is currently
not in the viewport.
This array is set by this.lSetLocation() and this.lSetSize(),
and read by FormLFImpl during layout.
|
cachedWidth | int cachedWidth(Code) | | Width used for last calculations. If that indicates if the preferredHeight, preferredWidth,
minimumHeight, minimumWidth are valid, or need a new query.
|
hasFocus | boolean hasFocus(Code) | | A flag indicating this Item has the input focus. This is
maintained by the Item superclass for easy use by subclass
code.
|
isNewLine | boolean isNewLine(Code) | | This flag marks if the last layout performed placed
this Item at the beginning of a line.
This variable is set and read by FormLFImpl during
layout.
|
item | Item item(Code) | | The owner of this view. Set in the constructor.
|
nativeId | int nativeId(Code) | | The native MidpItem* of this view.
Set by owner screen based on the return value of
createNativeResource().
|
rowHeight | int rowHeight(Code) | | Marks the height of the row this Item is placed on.
Note that the Item may be shorter than the height of
the row.
This variable is set and read by FormLFImpl during layout.
|
sizeChanged | boolean sizeChanged(Code) | | A flag indicating the size of this Item has changed in a
subsequent layout operation.
This variable is set and read by FormLFImpl during layout.
|
supportsNativeScrolling | boolean supportsNativeScrolling(Code) | | If set to true rely on native scrolling mechanism of this item
and give this item all width and height available.
(Used for TextBox and List implementation).
|
visibleInViewport | boolean visibleInViewport(Code) | | A flag indicating the native resource of this
Item is currently (at least
partially) visible on the Form it is on.
This is maintained by the Item superclass for easy
use by subclass code.
|
ItemLFImpl | ItemLFImpl(Item item)(Code) | | Creates look and feel for the passed in Item .
Parameters: item - the Item for which the look & feel should be created |
createNativeResource | abstract void createNativeResource(int ownerId)(Code) | | Create native resource of this Item .
After this call, Item.nativeId should have had the
created native resource id.
Parameters: ownerId - native MidpDisplayable* of the owner screen |
createTempNativeResource | protected void createTempNativeResource()(Code) | | Create a temporary native resource of this Item whose
id must be deleted before caller function returns.
|
deleteNativeResource | void deleteNativeResource()(Code) | | Delete native resource of this Item .
After this call, Item.nativeId should have been reset to
DisplayableLFImpl.INVALID_NATIVE_ID .
|
equateNLA | boolean equateNLA()(Code) | | Determine if this Item should have a newline after it.
true if it should have a newline after |
equateNLB | boolean equateNLB()(Code) | | Determine if this Item should have a newline before it.
true if it should have a newline before |
getCurrentDisplay | Display getCurrentDisplay()(Code) | | Return the current Display instance that this
Item is displayed in.
the Display instance this Item is displayed in |
getLayout | int getLayout()(Code) | | Get the effective layout type of this Item .
layout The translated layout type. |
getMinimumHeight0 | native int getMinimumHeight0(int nativeId)(Code) | | Gets minimum height from the native resource corresponding to
this Item .
Parameters: nativeId - pointer to the native resource minimum height |
getMinimumWidth0 | native int getMinimumWidth0(int nativeId)(Code) | | Gets minimum width from the native resource corresponding to
this Item .
Parameters: nativeId - pointer to the native resource minimum width |
getPreferredHeight0 | native int getPreferredHeight0(int nativeId, int w)(Code) | | Gets preferred height from the native resource corresponding to
this Item .
Parameters: nativeId - pointer to the native resource Parameters: w - the tentative content width in pixels, or -1 if a tentative width has not been computed preferred height that corresponds to the passed in width |
getPreferredWidth0 | native int getPreferredWidth0(int nativeId, int h)(Code) | | Gets preferred width from the native resource corresponding to
this Item .
Parameters: nativeId - pointer to the native resource Parameters: h - the tentative content height in pixels, or -1 if a tentative height has not been computed preferred width that corresponds to the passed in height |
initNativeResource | void initNativeResource()(Code) | | Initialize native resource - size and location.
|
isRequestedSizesValid | final public boolean isRequestedSizesValid()(Code) | | Return whether the cached requested sizes are valid.
true if the cached requested sizes are up to date.false if they have been invalidated. |
lAddCommand | public void lAddCommand(Command cmd, int i)(Code) | | Notifies L&F of a command addition in the corresponding
Item .
Parameters: cmd - the newly added command Parameters: i - the index of the added command in the Item 'scommands[] array |
lCallHideNotify | void lCallHideNotify()(Code) | | Sets the visibleInViewport flag to be false.
Note the native resource is not hidden, nor deleted.
|
lCallPaint | void lCallPaint(Graphics g, int w, int h)(Code) | | Paint the content of this Item .
The default implementation does nothing.
Parameters: g - the Graphics object to be used for renderingthe item Parameters: w - current width of the item in pixels Parameters: h - current height of the item in pixels |
lCallShowNotify | void lCallShowNotify()(Code) | | Sets the visibleInViewport flag of this Item to be true.
Note that this method has no effect on the native resource.
|
lCommitPendingInteraction | public void lCommitPendingInteraction()(Code) | | Called to commit any pending user interaction for the item.
|
lGetAdornedMinimumHeight | int lGetAdornedMinimumHeight()(Code) | | PLACE HOLDER
Used by the Form Layout to set the size of this Item
the minimum height that includes cell spacing |
lGetAdornedMinimumWidth | int lGetAdornedMinimumWidth()(Code) | | PLACE HOLDER
Used by the Form Layout to set the size of this Item
the minimum width that includes cell spacing |
lGetAdornedPreferredHeight | int lGetAdornedPreferredHeight(int width)(Code) | | PLACE HOLDER
Used by the Form Layout to set the size of this Item
Parameters: width - the tentative content width in pixels the preferred height |
lGetAdornedPreferredWidth | int lGetAdornedPreferredWidth(int height)(Code) | | PLACE HOLDER
Used by the Form Layout to set the size of this Item
Parameters: height - the tentative content height in pixels the preferred width |
lGetLockedHeight | protected int lGetLockedHeight()(Code) | | Returns the locked height of the Item, or -1 if it's not locked
locked height plus adornment height, or -1 if it's not locked |
lGetLockedWidth | int lGetLockedWidth()(Code) | | Returns the locked width of the Item, or -1 if it's not locked
locked width plus adornment width, or -1 if it's not locked |
lGetMinimumHeight | public int lGetMinimumHeight()(Code) | | Get the minimum height of this Item .
the minimum height |
lGetMinimumWidth | public int lGetMinimumWidth()(Code) | | Get the minimum width of this Item .
the minimum width |
lGetPreferredHeight | public int lGetPreferredHeight(int w)(Code) | | Get the preferred height of this Item .
Parameters: w - tentative locked width.Ignored here and preferred width is used always. the preferred height |
lGetPreferredWidth | public int lGetPreferredWidth(int h)(Code) | | Get the preferred width of this Item .
Parameters: h - tentative locked height.Ignored here and item.lockedHeight is used always. the preferred width |
lGetRequestedSizes | void lGetRequestedSizes()(Code) | | Calculate minimum and preferred width and height of this item and
store the result in instance variables:
minimumWidth, minimumHeight, preferredWidth and preferredHeight.
This function will query native resources for the sizes. For
Item s like CustomItem and
Spacer , whose sizes are only calculated in Java, this
function should be overriden to perform their own calculation.
|
lHideNativeResource | void lHideNativeResource()(Code) | | Called by the system to hide this Item 's
native resource.
The default implementation of this method
hides native resources corresponding to this Item
|
lMove | void lMove(int deltaX, int deltaY)(Code) | | Moves item's location by delta. Both deltaX and deltaY can be
positive and negative.
Parameters: deltaX - the amount of pixels by which x item's locationhas to be moved Parameters: deltaY - the amount of pixels by which y item's locationhas to be moved |
lRemoveCommand | public void lRemoveCommand(Command cmd, int i)(Code) | | Notifies L&F of a command removal in the corresponding
Item .
Parameters: cmd - the newly removed command Parameters: i - the index of the removed command in the Item 'scommands[] array |
lRequestInvalidate | void lRequestInvalidate(boolean width, boolean height)(Code) | | Request the event scheduler to schedule an invalidate event, that
eventually will call uCallInvalidate(this item) of this item's
DisplayableLFImpl .
If caller also needs to call lSetRequestedSizes, then it must be
called AFTER this function, to have effect.
Parameters: width - true if it was changed Parameters: height - true if it was changed |
lRequestPaint | void lRequestPaint()(Code) | | Called by subclasses to repaint this entire Item 's bounds.
|
lRequestPaint | void lRequestPaint(int x, int y, int w, int h)(Code) | | Called by subclasses to repaint a portion of this Item 's
bounds.
Parameters: x - the x coordinate of the origin of the dirty region Parameters: y - the y coordinate of the origin of the dirty region Parameters: w - the width of the dirty region Parameters: h - the height of the dirty region |
lSetDefaultCommand | public void lSetDefaultCommand(Command cmd, int i)(Code) | | Notifies L&F of the default command change in the corresponding
Item .
Parameters: cmd - the newly set default command Parameters: i - index of this new command in the ChoiceGroup 'scommands array |
lSetLabel | public void lSetLabel(String label)(Code) | | Notifies L&F of a label change in the corresponding
Item .
Parameters: label - the new label string |
lSetLayout | public void lSetLayout(int layout)(Code) | | Notifies L&F of a layout change in the corresponding
Item .
Parameters: layout - the new layout descriptor |
lSetLocation | void lSetLocation(int x, int y)(Code) | | Sets item's location.
Parameters: x - the new x location in form's content coordinate system Parameters: y - the new y location in form's content coordinate system |
lSetOwner | public void lSetOwner(Screen oldOwner)(Code) | | Notify this itemLF that its owner screen has changed.
Clear internal state if its new owner is null .
Parameters: oldOwner - old owner screen before this change. New ownercan be found in Item model. |
lSetPreferredSize | public void lSetPreferredSize(int width, int height)(Code) | | Notifies L&F of a preferred size change in the corresponding
Item .
Parameters: width - the value to which the width is locked, or-1 if it is unlocked Parameters: height - the value to which the height is locked, or-1 if it is unlocked |
lSetRequestedSizes | final void lSetRequestedSizes(int mw, int mh, int pw, int ph)(Code) | | Set minimum and preferred width and height of this item.
This function should only be called on a CustomItemLFImpl
or SpacerLFImpl .
They will collect its own sizing, then call this function to cache them.
Parameters: mw - minimum width Parameters: mh - minimum height Parameters: pw - preferred width Parameters: ph - preferred height |
lSetSize | void lSetSize(int w, int h)(Code) | | Sets item's size.
Parameters: w - the new width of the item Parameters: h - the new height of the item |
lShowNativeResource | void lShowNativeResource()(Code) | | Called by the system to show this Item 's
native resource.
The default implementation of this method shows
the native resource corresponding to this Item
SYNC NOTE:
|
setLabel0 | native void setLabel0(int nativeId, String label)(Code) | | Notifies native width that new label was set on this Item .
Parameters: nativeId - native resource id of this Item Parameters: label - the new label set on this Item |
shouldHExpand | boolean shouldHExpand()(Code) | | Determine if this Item should horizontally expand.
true if it should horizontally expand |
shouldHShrink | boolean shouldHShrink()(Code) | | Determine if this Item should horizontally shrink.
true if it should horizontally shrink |
shouldVExpand | boolean shouldVExpand()(Code) | | Determine if this Item should vertically expand.
true if it should vertically expand |
shouldVShrink | boolean shouldVShrink()(Code) | | Determine if this Item should vertically shrink.
true if it should vertically shrink |
uCallHideNotify | void uCallHideNotify()(Code) | | Sets the visibleInViewport flag to be false.
Note the native resource is not hidden, nor deleted.
This function simply calls lCallShowNotify() after obtaining LCDUILock.
|
uCallKeyPressed | void uCallKeyPressed(int keyCode)(Code) | | Called by the system to signal a key press.
Parameters: keyCode - the key code of the key that has been pressed See Also: ItemLFImpl.getInteractionModes |
uCallKeyReleased | void uCallKeyReleased(int keyCode)(Code) | | Called by the system to signal a key release.
Parameters: keyCode - the key code of the key that has been released See Also: ItemLFImpl.getInteractionModes |
uCallKeyRepeated | void uCallKeyRepeated(int keyCode)(Code) | | Called by the system to signal a key repeat.
Parameters: keyCode - the key code of the key that has been repeated See Also: ItemLFImpl.getInteractionModes |
uCallPaint | void uCallPaint(Graphics g, int w, int h)(Code) | | Paint the content of this Item .
This function simply calls lCallPaint() after obtaining LCDUILock.
Parameters: g - the Graphics object to be used for renderingthe item Parameters: w - current width of the item in pixels Parameters: h - current height of the item in pixels |
uCallPeerStateChanged | abstract boolean uCallPeerStateChanged(int hint)(Code) | | Called by event delivery to notify an ItemLF in current
FormLF of a change in its peer state.
Subclass should implement this function to sync its state with
the peer and choose to return proper value to let Form know
whether the itemStateListener should be notified.
Parameters: hint - some value that is interpreted only between the peers true if internal state has changed and ItemStateListener should be notified after this function returns. |
uCallPointerDragged | void uCallPointerDragged(int x, int y)(Code) | | Called by the system to signal a pointer drag.
Parameters: x - the x coordinate of the pointer drag Parameters: y - the x coordinate of the pointer drag See Also: ItemLFImpl.getInteractionModes |
uCallPointerPressed | void uCallPointerPressed(int x, int y)(Code) | | Called by the system to signal a pointer press.
Parameters: x - the x coordinate of the pointer down Parameters: y - the y coordinate of the pointer down See Also: ItemLFImpl.getInteractionModes |
uCallPointerReleased | void uCallPointerReleased(int x, int y)(Code) | | Called by the system to signal a pointer release.
Parameters: x - the x coordinate of the pointer up Parameters: y - the x coordinate of the pointer up See Also: ItemLFImpl.getInteractionModes |
uCallShowNotify | void uCallShowNotify()(Code) | | Sets the visibleInViewport flag of this Item to be true.
Note that this method has no effect on the native resource.
This function simply calls lCallShowNotify() after obtaining LCDUILock.
|
uCallSizeChanged | void uCallSizeChanged(int w, int h)(Code) | | Called by the system to indicate the size available to this
Item has changed.
Parameters: w - the new width of the item's content area Parameters: h - the new height of the item's content area |
uCallTraverse | boolean uCallTraverse(int dir, int viewportWidth, int viewportHeight, int[] visRect_inout)(Code) | | Called by the system to notify internal traverse into the item.
By default, it always returns false and should be overriden for
items with enabled internal traversal
Parameters: dir - the direction of traversal Parameters: viewportWidth - the width of the container's viewport Parameters: viewportHeight - the height of the container's viewport Parameters: visRect_inout - passes the visible rectangle into the method, andreturns the updated traversal rectangle from themethod true if focus ius accepted by the itemfalse if traversal should proceed out See Also: ItemLFImpl.getInteractionModes See Also: ItemLFImpl.traverseOut See Also: ItemLFImpl.TRAVERSE_HORIZONTAL See Also: ItemLFImpl.TRAVERSE_VERTICAL |
|
|