|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Item
javax.microedition.lcdui.CustomItem
de.enough.polish.ui.FakeCustomItem
public abstract class FakeCustomItem
A superclass for components that can be added to a Form.
Items support following CSS attributes:
Form. All Item objects have a label field,
which is a string that is
attached to the item. The label is typically displayed near the component
when it is displayed within a screen. The label should be positioned on
the same horizontal row as the item or
directly above the item. The implementation should attempt to distinguish
label strings from other textual content, possibly by displaying the label
in a different font, aligning it to a different margin, or appending a
colon to it if it is placed on the same line as other string content.
If the screen is scrolling, the implementation should try
to keep the label visible at the same time as the Item.
In some cases,
when the user attempts to interact with an Item,
the system will switch to
a system-generated screen where the actual interaction takes place. If
this occurs, the label will generally be carried along and displayed within
this new screen in order to provide the user with some context for the
operation. For this reason it is recommended that applications supply a
label to all interactive Item objects. However, this is not required, and
a null value for a label is legal and specifies
the absence of a label.
An Item's layout within its container is
influenced through layout directives:
LAYOUT_DEFAULT LAYOUT_LEFT LAYOUT_RIGHT LAYOUT_CENTER LAYOUT_TOP LAYOUT_BOTTOM LAYOUT_VCENTER LAYOUT_NEWLINE_BEFORE LAYOUT_NEWLINE_AFTER LAYOUT_SHRINK LAYOUT_VSHRINK LAYOUT_EXPAND LAYOUT_VEXPAND LAYOUT_2 The LAYOUT_DEFAULT directive indicates
that the container's default
layout policy is to be used for this item.
LAYOUT_DEFAULT has the value
zero and has no effect when combined with other layout directives. It is
useful within programs in order to document the programmer's intent.
The LAYOUT_LEFT, LAYOUT_RIGHT, and
LAYOUT_CENTER directives indicate
horizontal alignment and are mutually exclusive. Similarly, the
LAYOUT_TOP, LAYOUT_BOTTOM, and
LAYOUT_VCENTER directives indicate vertical
alignment and are mutually exclusive.
A horizontal alignment directive, a vertical alignment directive, and
any combination of other layout directives may be combined using the
bit-wise OR operator (|) to compose a
layout directive value. Such a value
is used as the parameter to the setLayout(int) method and is the return
value from the getLayout() method.
Some directives have no defined behavior in some contexts. A layout
directive is ignored if its behavior is not defined for the particular
context within which the Item resides.
A complete specification of the layout of Items
within a Form is given
here.
Items have two explicit size concepts: the minimum
size and the
preferred size. Both the minimum and the preferred sizes refer to
the total area of the Item, which includes space for the
Item's contents,
the Item's label, as well as other space that is
significant to the layout
policy. These sizes do not include space that is not significant for
layout purposes. For example, if the addition of a label to an
Item would
cause other Items to move in order to make room,
then the space occupied by
this label is significant to layout and is counted as part of
the Item's
minimum and preferred sizes. However, if an implementation were to place
the label in a margin area reserved exclusively for labels, this would not
affect the layout of neighboring Items.
In this case, the space occupied
by the label would not be considered part of the minimum and preferred
sizes.
The minimum size is the smallest size at which the
Item can function and
display its contents, though perhaps not optimally. The minimum size
may be recomputed whenever the Item's contents changes.
The preferred size is generally a size based on the
Item's contents and
is the smallest size at which no information is clipped and text wrapping
(if any) is kept to a tolerable minimum. The preferred size may be
recomputed whenever the Item's contents changes.
The application can
lock the preferred width or preferred height (or both) by
supplying specific values for parameters to the setPreferredSize method. The manner in which an
Item fits its contents
within an application-specified preferred size is implementation-specific.
However, it is recommended that textual content be word-wrapped to fit the
preferred size set by the application. The application can unlock
either or both dimensions by supplying the value -1
for parameters to the setPreferredSize method.
When an Item is created, both the preferred width
and height are
unlocked. In this state, the implementation computes the preferred width
and height based on the Item's contents, possibly
including other relevant
factors such as the Item's graphic design and the
screen dimensions.
After having locked either the preferred width or height, the application
can restore the initial, unlocked state by calling
setPreferredSize(-1, -1).
The application can lock one dimension of the preferred size and leave
the other unlocked. This causes the system to compute an appropriate value
for the unlocked dimension based on arranging the contents to fit the
locked dimension. If the contents changes, the size on the unlocked
dimension is recomputed to reflect the new contents, but the size on the
locked dimension remains unchanged. For example, if the application called
setPreferredSize(50, -1), the preferred width would be
locked at 50 pixels and the preferred height would
be computed based on the
Item's contents. Similarly, if the application called
setPreferredSize(-1, 60), the preferred height would be
locked at 60 pixels and the preferred width would be
computed based on the
Item's contents. This feature is particularly useful
for Items with
textual content that can be line wrapped.
The application can also lock both the preferred width and height to
specific values. The Item's contents are truncated or padded
as necessary to honor this request. For Items containing
text, the text should be wrapped to the specified width, and any truncation
should occur at the end of the text.
Items also have an implicit maximum size provided by the
implementation. The maximum width is typically based on the width of the
screen space available to a Form. Since Forms
can scroll vertically, the maximum height should typically not be based on
the height of the available screen space.
If the application attempts to lock a preferred size dimension to a
value smaller than the minimum or larger than the maximum, the
implementation may disregard the requested value and instead use either the
minimum or maximum as appropriate. If this occurs, the actual values used
must be visible to the application via the values returned from the
getPreferredWidth and
getPreferredHeight methods.
A Command is said to be present on an Item
if the Command has been
added to this Item with a prior call to addCommand(javax.microedition.lcdui.Command)
or setDefaultCommand(javax.microedition.lcdui.Command) and if
the Command has not been removed with a subsequent call to
removeCommand(javax.microedition.lcdui.Command). Commands present on an
item should have a command
type of ITEM. However, it is not an error for a
command whose type is
other than ITEM to be added to an item.
For purposes of presentation and
placement within its user interface, the implementation is allowed to
treat a command's items as if they were of type ITEM.
Items may have a default Command.
This state is
controlled by the setDefaultCommand(javax.microedition.lcdui.Command) method. The default
Command is eligible to be bound to a special
platform-dependent user
gesture. The implementation chooses which gesture is the most
appropriate to initiate the default command on that particular
Item.
For example, on a device that has a dedicated selection key, pressing
this key might invoke the item's default command. Or, on a
stylus-based device, tapping on the Item might
invoke its default
command. Even if it can be invoked through a special gesture, the
default command should also be invokable in the same fashion as
other item commands.
It is possible that on some devices there is no special gesture suitable for invoking the default command on an item. In this case the default command must be accessible to the user in the same fashion as other item commands. The implementation may use the state of a command being the default in deciding where to place the command in its user interface.
It is possible for an Item not to have a default command.
In this
case, the implementation may bind its special user gesture (if any)
for another purpose, such as for displaying a menu of commands. The
default state of an Item is not to have a default command.
An Item
may be set to have no default Command by removing it from
the Item or
by passing null to the setDefaultCommand()
method.
The same command may occur on more than one
Item and also on more than
one Displayable. If this situation occurs, the user
must be provided with
distinct gestures to invoke that command on each Item or
Displayable on
which it occurs, while those Items or Displayables
are visible on the
display. When the user invokes the command, the listener
(CommandListener
or ItemCommandListener as appropriate) of just the
object on which the
command was invoked will be called.
Adding commands to an Item may affect its appearance, the
way it is laid out, and the traversal behavior. For example, the presence
of commands on an Item may cause row breaks to occur, or it
may cause additional graphical elements (such as a menu icon) to appear.
In particular, if a StringItem whose appearance mode is
PLAIN (see below) is given one or more Commands,
the implementation is allowed to treat it as if it had a different
appearance mode.
J2ME Polish notifies the command-listener of the current screen, when an item-command has been selected and no item-command-listener has been registered.
The StringItem and ImageItem classes have an
appearance mode attribute that can be set in their constructors.
This attribute can have one of the values PLAIN,
HYPERLINK, or BUTTON.
An appearance mode of PLAIN is typically used
for non-interactive
display of textual or graphical material. The appearance
mode values do not have any side effects on the interactivity of the item.
In order to be interactive, the item must have one or more
Commands
(preferably with a default command assigned), and it must have a
CommandListener that receives notification of
Command invocations. The
appearance mode values also do not have any effect on the semantics of
Command invocation on the item. For example,
setting the appearance mode
of a StringItem to be HYPERLINK
requests that the implementation display
the string contents as if they were a hyperlink in a browser. It is the
application's responsibility to attach a Command
and a listener to the
StringItem that provide behaviors that the user
would expect from invoking
an operation on a hyperlink, such as loading the referent of the link or
adding the link to the user's set of bookmarks.
Setting the appearance mode of an Item to be other than
PLAIN may affect its minimum, preferred, and maximum sizes, as
well as the way it is laid out. For example, a StringItem
with an appearance mode of BUTTON should not be wrapped across
rows. (However, a StringItem with an appearance mode of
HYPERLINK should be wrapped the same way as if its appearance
mode is PLAIN.)
A StringItem or ImageItem
in BUTTON mode can be used to create a
button-based user interface. This can easily lead to applications that are
inconvenient to use. For example, in a traversal-based system, users must
navigate to a button before they can invoke any commands on it. If buttons
are spread across a long Form, users may be required
to perform a
considerable amount of navigation in order to discover all the available
commands. Furthermore, invoking a command from a button at the
other end of the Form can be quite cumbersome.
Traversal-based systems
often provide a means of invoking commands from anywhere (such as from a
menu), without the need to traverse to a particular item. Instead of
adding a command to a button and placing that button into a
Form, it would
often be more appropriate and convenient for users if that command were
added directly to the Form. Buttons should be used
only in cases where
direct user interaction with the item's string or image contents is
essential to the user's understanding of the commands that can be invoked
from that item.
Unless otherwise specified by a subclass, the default state of newly
created Items is as follows:
Item is not contained within
("owned by") any container;Commands present;Command is null;ItemCommandListener is null;LAYOUT_DEFAULT; and
| Field Summary | |
|---|---|
net.rim.device.api.ui.Field |
_bbField
a blackberry specific internal field |
int |
appearanceMode
The appearance mode of this item, either PLAIN or one of the interactive modes BUTTON, HYPERLINK or INTERACTIVE. |
protected int |
availableHeight
|
protected int |
availableWidth
|
protected int |
availContentHeight
|
protected int |
availContentWidth
|
Background |
background
the background of this item |
protected int |
backgroundHeight
|
protected int |
backgroundWidth
|
protected int |
backgroundYOffset
The vertical offset for the background, can be used for smoother scrolling, for example |
protected int |
beforeWidth
|
protected Border |
bgBorder
the background border of an item - this border is painted before the background. |
protected Border |
border
|
static int |
BUTTON
An appearance mode value indicating that the Item
is to appear as a button. |
boolean |
cacheItemImage
|
protected int |
colSpan
|
protected ArrayList |
commands
|
protected Background |
completeBackground
|
protected Dimension |
completeBackgroundPadding
|
protected Border |
completeBorder
|
protected int |
contentHeight
The height of this item's content |
protected int |
contentWidth
The width of this item's content |
protected int |
contentX
the horizontal position of this item's content relative to it's left edge (so for a left aligned item its marginLeft + border.widthLeft + paddingLeft |
protected Dimension |
contentXAdjustment
|
protected int |
contentY
the vertical position of this item's content relative to it's top edge |
protected Dimension |
contentYAdjustment
|
protected Dimension |
cssHeight
|
protected String |
cssSelector
The appropriate CSS selector of this item. |
protected Dimension |
cssWidth
|
protected Command |
defaultCommand
|
protected Style |
focusedStyle
|
static int |
HORIZONTAL
A J2ME Polish constant defining a horizontal orientation. |
static int |
HYPERLINK
An appearance mode value indicating that the Item
is to appear as a hyperlink. |
protected boolean |
ignoreRepaintRequests
|
protected boolean |
includeLabel
|
static int |
INTERACTIVE
A J2ME Polish appearance mode value indicating that the Item
accepts input from the user. |
protected int |
internalHeight
The internal height of this item's content. |
protected int |
internalWidth
The internal width of this item's content. |
protected int |
internalX
The internal horizontal position of this item's content relative to it's left edge. |
protected int |
internalY
the vertical position of this item's internal content relative to it's top edge |
protected boolean |
isContentVisible
|
boolean |
isFocused
flag indicating whether this item is focused |
protected boolean |
isInlineLabel
|
protected boolean |
isInvisible
|
protected boolean |
isLayoutCenter
|
protected boolean |
isLayoutExpand
|
protected boolean |
isLayoutRight
|
protected boolean |
isPressed
|
protected boolean |
isShown
|
protected boolean |
isStyleInitialised
Determines whether the style has be dynamically assigned already. |
protected ItemCommandListener |
itemCommandListener
|
int |
itemHeight
the height of this item - only for read access |
int |
itemWidth
the width of this item - only for read access |
protected StringItem |
label
|
protected Style |
labelStyle
|
protected Style |
landscapeStyle
|
protected int |
layout
|
static int |
LAYOUT_2
A layout directive indicating that new MIDP 2.0 layout rules are in effect for this Item. |
static int |
LAYOUT_BOTTOM
A layout directive indicating that this Item should have a
bottom-aligned layout. |
static int |
LAYOUT_CENTER
A layout directive indicating that this Item should have a
horizontally centered layout. |
static int |
LAYOUT_DEFAULT
A layout directive indicating that this Item
should follow the default layout policy of its container. |
static int |
LAYOUT_EXPAND
A layout directive indicating that this Item's
width may be increased to fill available space. |
static int |
LAYOUT_LEFT
A layout directive indicating that this Item should have a
left-aligned layout. |
static int |
LAYOUT_NEWLINE_AFTER
A layout directive indicating that this Item
should the last on its line or row, and that the next
Item (if any) in the container
should be placed on a new line or row. |
static int |
LAYOUT_NEWLINE_BEFORE
A layout directive indicating that this Item
should be placed at the beginning of a new line or row. |
static int |
LAYOUT_RIGHT
A layout directive indicating that this Item should have a
right-aligned layout. |
static int |
LAYOUT_SHRINK
A layout directive indicating that this Item's
width may be reduced to its minimum width. |
static int |
LAYOUT_TOP
A layout directive indicating that this Item should have a
top-aligned layout. |
static int |
LAYOUT_VCENTER
A layout directive indicating that this Item should have a
vertically centered layout. |
static int |
LAYOUT_VEXPAND
A layout directive indicating that this Item's
height may be increased to fill available space. |
static int |
LAYOUT_VSHRINK
A layout directive indicating that this Item's
height may be reduced to its minimum height. |
protected int |
marginBottom
|
protected int |
marginLeft
|
protected int |
marginRight
|
protected int |
marginTop
|
protected Dimension |
maximumHeight
|
protected Dimension |
maximumItemHeight
|
protected Dimension |
maximumItemWidth
|
protected Dimension |
maximumWidth
|
protected Dimension |
minimumHeight
|
protected Dimension |
minimumItemHeight
|
protected Dimension |
minimumItemWidth
|
protected Dimension |
minimumWidth
|
protected NativeItem |
nativeItem
|
static int |
NO_POSITION_SET
no internal position has been set for this item, value is -9999. |
protected int |
opacity
|
protected boolean |
opacityPaintNormally
|
protected int[] |
opacityRgbData
|
protected int |
paddingBottom
|
protected int |
paddingHorizontal
|
protected int |
paddingLeft
|
protected int |
paddingRight
|
protected int |
paddingTop
|
protected int |
paddingVertical
|
protected Item |
parent
The parent of this item. |
static int |
PLAIN
An appearance mode value indicating that the Item is to have
a normal appearance. |
protected Style |
portraitStyle
|
protected int |
preferredHeight
|
protected int |
preferredWidth
|
protected boolean |
preserveViewType
|
int |
relativeX
the horizontal start position relative to it's parent's item left content edge |
int |
relativeY
the vertical start position of this item relative to it's parent item top content edge |
protected int |
rowSpan
|
protected Screen |
screen
The screen to which this item belongs to. |
protected boolean |
setView
|
protected Style |
style
|
static int |
TRANSPARENT
A J2ME Polish constant defining a transparent/invisible color. |
protected boolean |
useSingleRow
indicates that label and content are positioned on the same row if true |
static int |
VERTICAL
A J2ME Polish constant defining a vertical orientation. |
protected ItemView |
view
|
protected Dimension |
xAdjustment
|
protected Dimension |
yAdjustment
|
| Fields inherited from class javax.microedition.lcdui.CustomItem |
|---|
KEY_PRESS, KEY_RELEASE, KEY_REPEAT, NONE, POINTER_DRAG, POINTER_PRESS, POINTER_RELEASE, TRAVERSE_HORIZONTAL, TRAVERSE_VERTICAL |
| Constructor Summary | |
|---|---|
protected |
FakeCustomItem()
Convenience constructor. |
protected |
FakeCustomItem(String label,
int layout)
Convenience constructor. |
protected |
FakeCustomItem(String label,
int layout,
int appearanceMode,
Style style)
Creates a new Item. |
protected |
FakeCustomItem(Style style)
Convenience constructor. |
| Method Summary | |
|---|---|
void |
addCommand(Command cmd)
Adds a command to this item |
void |
addCommand(Command cmd)
Adds a context sensitive Command to the item. |
void |
addCommand(Command cmd,
Style commandStyle)
Adds a context sensitive Command to the item. |
protected void |
addCommands(ArrayList commandsList)
Adds all commands to the specified list. |
void |
addRelativeToBackgroundRegion(Background animatedBackground,
Border animatedBorder,
ClippingRegion repaintRegion,
int x,
int y,
int width,
int height)
Adds a region relative to this item's background x/y start position. |
void |
addRelativeToBackgroundRegion(ClippingRegion repaintRegion,
int x,
int y,
int width,
int height)
Adds a region relative to this item's background x/y start position. |
void |
addRelativeToContentRegion(ClippingRegion repaintRegion,
int x,
int y,
int width,
int height)
Adds a region relative to this item's content x/y start position. |
void |
addRepaintArea(ClippingRegion repaintRegion)
Adds a repaint request for this item's space. |
boolean |
animate()
Animates this item. |
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this item. |
boolean |
containsCommand(Command command)
Determines whether this item contains the given command. |
protected abstract String |
createCssSelector()
Retrieves the CSS selector for this item. |
protected void |
defocus(Style originalStyle)
Removes the focus from this item. |
void |
destroy()
Destroy the item by removing all references to parent, screen, listeners etc. |
void |
fireEvent(String eventName,
Object eventData)
Fires an event for this item as well as its subitems like its label. |
protected Style |
focus(Style newStyle,
int direction)
Focuses this item. |
int |
getAbsoluteX()
Retrieves this item's current absolute horizontal position |
int |
getAbsoluteY()
Retrieves this item's current absolute vertical position |
int |
getAppearanceMode()
Returns the appearance mode of this Item. |
Object |
getAttribute(Object key)
Gets an previously added attribute of this item. |
HashMap |
getAttributes()
Returns a HashMap object with all registered attributes. |
int |
getAvailableContentHeight()
Retrieves the height of the content. |
int |
getAvailableContentWidth()
Retrieves the width of the content. |
int |
getAvailableHeight()
Retrieves the available height for this item. |
int |
getAvailableWidth()
Retrieves the available width for this item. |
int |
getBackgroundHeight()
Retrieves the height of this item's background. |
int |
getBackgroundWidth()
Retrieves the width of this item's background. |
int |
getBackgroundX()
Retrieves the start of the background relative to this item's origin. |
int |
getBackgroundY()
Retrieves the start of the background relative to this item's origin. |
protected int |
getBorderWidthBottom()
Retrieves the border width. |
protected int |
getBorderWidthLeft()
Retrieves the border width. |
protected int |
getBorderWidthRight()
Retrieves the border width. |
protected int |
getBorderWidthTop()
Retrieves the border width. |
int |
getContentHeight()
Retrieves the height of the content. |
int |
getContentWidth()
Retrieves the width of the content. |
int |
getContentX()
Retrieves the start of the content relative to this item's absolute x position. |
int |
getContentY()
Retrieves the start of the content relative to this item's absolute y position. |
Command |
getDefaultCommand()
|
Style |
getFocusedStyle()
Retrieves the approriate style for focusing this item. |
int |
getInternalHeight()
Retrieves the internal area's vertical height |
int |
getInternalWidth()
Retrieves the internal area's vertical width |
int |
getInternalX()
Retrieves the internal area's horizontal start relative to this item's content area |
int |
getInternalY()
Retrieves the internal area's vertical start relative to this item's content area |
int |
getItemAreaHeight()
Retrieves the height of the area that this item covers. |
Item |
getItemAt(int relX,
int relY)
Determines if this item or one of it's children is within the specified point. |
ItemCommandListener |
getItemCommandListener()
Gets the listener for Commands to this Item. |
ArrayList |
getItemCommands()
|
int |
getItemHeight(int firstLineWidth,
int availWidth)
Retrieves the complete height of this item. |
int |
getItemHeight(int firstLineWidth,
int availWidth,
int availHeight)
Retrieves the complete height of this item. |
ItemStateListener |
getItemStateListener()
Gets an ItemStateListener specifically for this item. |
int |
getItemWidth(int firstLineWidth,
int availWidth)
Retrieves the complete width of this item. |
int |
getItemWidth(int firstLineWidth,
int availWidth,
int availHeight)
Retrieves the complete width of this item. |
String |
getLabel()
Gets the label of this Item object. |
Item |
getLabelItem()
Retrieves the label item that is used by this item.\ |
int |
getLayout()
Gets the layout directives used for placing the item. |
int |
getMaximumHeight()
Gets the maximum height for this Item. |
int |
getMaximumHeight(int availHeight)
Gets the maximum height for this Item. |
int |
getMaximumWidth()
Gets the maximum width for this Item. |
int |
getMaximumWidth(int availWidth)
Gets the maximum width for this Item. |
protected int |
getMinContentHeight()
Default implementation of javax.microedition.lcdui.CustomItem method. |
protected int |
getMinContentWidth()
Default implementation of javax.microedition.lcdui.CustomItem method. |
int |
getMinimumHeight()
Gets the minimum height for this Item. |
int |
getMinimumHeight(int availHeight)
Gets the minimum height for this Item. |
int |
getMinimumWidth()
Gets the minimum width for this Item. |
int |
getMinimumWidth(int availWidth)
Gets the minimum width for this Item. |
NativeItem |
getNativeItem()
Species a native implementation for this item. |
Item |
getParent()
Retrieves the parent of this item. |
protected int |
getPrefContentHeight(int width)
Default implementation of javax.microedition.lcdui.CustomItem method. |
protected int |
getPrefContentWidth(int height)
Default implementation of javax.microedition.lcdui.CustomItem method. |
int |
getpreferredHeight()
Gets the preferred height of this Item. |
int |
getpreferredWidth()
Gets the preferred width of this Item. |
int[] |
getRgbData()
Retrieves the RGB data of this item. |
int[] |
getRgbData(boolean supportTranslucency,
int rgbOpacity)
Retrieves the RGB data of this item. |
Screen |
getScreen()
Retrieves the screen to which this item belongs to. |
Style |
getStyle()
Retrieves the style of this item. |
UiEventListener |
getUiEventListener()
Retrieves the UiEventListener for this item or for one of its parents. |
ItemView |
getView()
Retrieves the view type for this item. |
protected ItemView |
getView(ItemView viewType,
Style viewStyle)
Retrieves the view type for this item or instantiates a new one. |
protected boolean |
handleCommand(Command cmd)
Tries to handle the specified command. |
protected boolean |
handleCommand(Command cmd)
Tries to handle the specified command. |
protected boolean |
handleGesture(int gesture,
int x,
int y)
Handles a touch gestures. |
protected boolean |
handleGestureHold(int x,
int y)
Handles the hold touch gestures. |
protected boolean |
handleGestureSwipeLeft(int x,
int y)
Handles the swipe left gesture. |
protected boolean |
handleGestureSwipeRight(int x,
int y)
Handles the swipe right gesture. |
protected boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the key-pressed event. |
protected boolean |
handleKeyReleased(int keyCode,
int gameAction)
Handles the key-released event. |
protected boolean |
handleKeyRepeated(int keyCode,
int gameAction)
Handles the key-repeated event. |
protected boolean |
handlePointerDragged(int relX,
int relY)
Handles the dragging/movement of a pointer. |
protected boolean |
handlePointerDragged(int relX,
int relY,
ClippingRegion repaintRegion)
Handles the dragging/movement of a pointer. |
protected boolean |
handlePointerPressed(int relX,
int relY)
Handles the event when a pointer has been pressed at the specified position. |
protected boolean |
handlePointerReleased(int relX,
int relY)
Handles the event when a pointer has been released at the specified position. |
boolean |
handlePointerTouchDown(int x,
int y)
Handles a touch down/press event. |
boolean |
handlePointerTouchUp(int x,
int y)
Handles a touch up/release event. |
protected void |
hideNotify()
Called by the system to notify the item that it is now completely invisible, when it previously had been at least partially visible. |
protected void |
init(int firstLineWidth,
int availWidth,
int availHeight)
Initialises this item. |
protected abstract void |
initContent(int firstLineWidth,
int availWidth,
int availHeight)
Initialises this item. |
protected void |
initLayout(Style style,
int availWidth)
|
protected void |
initMargin(Style style,
int availWidth)
Initializes the margin of this item Subclasses can override this (e.g. |
protected void |
initPadding(Style style,
int availWidth)
Initializes the padding of this item Subclasses can override this (e.g. |
protected void |
initStyle()
Initialises the appropriate style for this item. |
boolean |
isFocused()
Determines whether this item is currently focused. |
boolean |
isInContentArea(int relX,
int relY)
Determines whether the given relative x/y position is inside of this item's (visible) content area. |
boolean |
isInContentWithPaddingArea(int relX,
int relY)
Determines whether the given relative x/y position is inside of this item's content area. |
boolean |
isInItemArea(int relX,
int relY)
Determines whether the given relative x/y position is inside of this item's area including paddings, margins and label. |
boolean |
isInItemArea(int relX,
int relY,
Item child)
Determines whether the given relative x/y position is inside of the specified child item's area including paddings, margins and label. |
boolean |
isInitialized()
Determines the initialization state of this item |
boolean |
isInteractive()
Determines whether this item is interactive and thus can be selected. |
boolean |
isLayoutBottom()
Determines the layout of this item. |
boolean |
isLayoutCenter()
Determines the layout of this item. |
boolean |
isLayoutExpand()
Determines the layout of this item. |
boolean |
isLayoutLeft()
Determines the layout of this item. |
boolean |
isLayoutNewlineAfter()
Determines the layout of this item. |
boolean |
isLayoutNewlineBefore()
Determines the layout of this item. |
boolean |
isLayoutRight()
Determines the layout of this item. |
boolean |
isLayoutShrink()
Determines the layout of this item. |
boolean |
isLayoutTop()
Determines the layout of this item. |
boolean |
isLayoutVerticalCenter()
Determines the layout of this item. |
boolean |
isLayoutVerticalExpand()
Determines the layout of this item. |
boolean |
isLayoutVerticalShrink()
Determines the layout of this item. |
boolean |
isPressed()
Determines whether this item is currently pressed. |
boolean |
isVisible()
Gets the visible status of this item. |
void |
notifyItemPressedEnd()
Is called when an item is pressed |
boolean |
notifyItemPressedStart()
Is called when an item is pressed using the FIRE game action |
void |
notifyStateChanged()
Causes this Item's containing Form to notify
the Item's ItemStateListener. |
void |
notifyUnvisited()
Is called when the visited state of this item should be reset. |
protected void |
notifyValueChanged(Object newValue)
Notifies this item about a change event, e.g. |
void |
notifyVisited()
Is called when this item has been visited. |
void |
onScreenSizeChanged(int screenWidth,
int screenHeight)
Notifies this item about a new screen size. |
protected void |
paint(Graphics g,
int w,
int h)
Default implementation of javax.microedition.lcdui.CustomItem method. |
void |
paint(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Paints this item on the screen. |
protected void |
paintBackground(int x,
int y,
int width,
int height,
Graphics g)
Paints the background and - if defined - the bgborder of this item. |
protected void |
paintBackgroundAndBorder(int x,
int y,
int width,
int height,
Graphics g)
Paints the background and border of this item. |
protected void |
paintBorder(int x,
int y,
int width,
int height,
Graphics g)
Paints the border of this item. |
protected void |
paintCommands(int x,
int y,
Graphics g)
Paints the commands for this item after the user has pressed/clicked on an item for a long time. |
protected abstract void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Paints the content of this item. |
protected RgbImage |
paintFilter(int x,
int y,
RgbFilter[] partFilters,
RgbImage rgbImage,
int lo,
Graphics g)
Paints the given filters and retrieves the last processed RGB image. |
void |
releaseResources()
Releases all (memory intensive) resources such as images or RGB arrays of this item. |
Object |
removeAttribute(Object key)
Removes an previously added attribute of this item. |
void |
removeCommand(Command cmd)
Removes the context sensitive command from item. |
protected void |
repaintFully()
Repaints the complete screen to which this item belongs to. |
void |
requestInit()
Requests that this item and all its parents are to be re-initialised, if the size of this item has been changed. |
void |
setAbsoluteY(int absY)
Sets the absolute vertical position of this item. |
void |
setAppearanceMode(int appearanceMode)
Sets the appearance mode of this item. |
void |
setAttribute(Object key,
Object value)
Sets an arbitrary attribute for this item. |
void |
setBackground(Background background)
Sets a new background for this item. |
void |
setBorder(Border border)
Sets a new border for this item |
protected void |
setContentHeight(int height)
Sets the content height of this item. |
protected void |
setContentWidth(int width)
Sets the content width of this item. |
void |
setDefaultCommand(Command cmd)
Sets default Command for this Item. |
void |
setDefaultCommand(Command cmd)
Sets default Command for this Item. |
void |
setInitialized(boolean initialized)
Sets the initialized state of this item. |
void |
setItemCommandListener(ItemCommandListener l)
Sets a listener for Commands to this Item,
replacing any previous
ItemCommandListener. |
void |
setItemCommandListener(ItemCommandListener l)
Sets a listener for Commands to this Item,
replacing any previous
ItemCommandListener. |
void |
setItemHeight(int height)
Sets the item's complete height |
void |
setItemStateListener(ItemStateListener listener)
Sets an ItemStateListener specifically for this item. |
void |
setItemTransition(ItemTransition transition)
|
void |
setLabel(String label)
Sets the label of the Item. |
void |
setLayout(int layout)
Sets the layout directives for this item. |
void |
setNativeItem(NativeItem nativeItem)
Species a native implementation for this item. |
void |
setParent(Item parent)
Sets a parent for this item. |
void |
setParent(Item parent)
Sets a parent for this item. |
void |
setpreferredSize(int width,
int height)
Sets the preferred width and height for this Item. |
void |
setStyle()
Sets the style for an item with the use of style preprocessing e.g.: //#style myStyle setStyle(); |
void |
setStyle(Style style)
Sets the style of this item. |
void |
setStyle(Style style,
boolean resetStyle)
Sets the style of this item for animatable CSS attributes. |
void |
setUiEventListener(UiEventListener listener)
Sets an UiEventListener for the this item and its children. |
void |
setView(ItemView view)
Sets the view type for this item. |
void |
setVisible(boolean visible)
Sets the visible status of this item. |
void |
show(Display display)
Shows the screen to which item belongs to and focusses this item. |
void |
showCommands()
Shows the commands on the screen. |
protected void |
showNotify()
Called by the system to notify the item that it is now at least partially visible, when it previously had been completely invisible. |
Image |
toImage()
|
RgbImage |
toRgbImage()
|
String |
toString()
Generates a String representation of this item. |
void |
updateInternalArea()
Updates the internal area on BB and similar platforms that contain native fields. |
| Methods inherited from class javax.microedition.lcdui.CustomItem |
|---|
getGameAction, getInteractionModes, invalidate, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, sizeChanged, traverse, traverseOut |
| Methods inherited from class javax.microedition.lcdui.Item |
|---|
getPreferredHeight, getPreferredWidth, removeCommand, setPreferredSize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int TRANSPARENT
public static final int VERTICAL
public static final int HORIZONTAL
public static final int LAYOUT_DEFAULT
Item
should follow the default layout policy of its container.
Value 0 is assigned to LAYOUT_DEFAULT.
public static final int LAYOUT_LEFT
Item should have a
left-aligned layout.
Value 1 is assigned to LAYOUT_LEFT.
public static final int LAYOUT_RIGHT
Item should have a
right-aligned layout.
Value 2 is assigned to LAYOUT_RIGHT.
public static final int LAYOUT_CENTER
Item should have a
horizontally centered layout.
Value 3 is assigned to LAYOUT_CENTER.
public static final int LAYOUT_TOP
Item should have a
top-aligned layout.
Value 0x10 is assigned to LAYOUT_TOP.
public static final int LAYOUT_BOTTOM
Item should have a
bottom-aligned layout.
Value 0x20 is assigned to LAYOUT_BOTTOM.
public static final int LAYOUT_VCENTER
Item should have a
vertically centered layout.
Value 0x30 is assigned to
LAYOUT_VCENTER.
public static final int LAYOUT_NEWLINE_BEFORE
Item
should be placed at the beginning of a new line or row.
Value 0x100 is assigned to
LAYOUT_NEWLINE_BEFORE.
public static final int LAYOUT_NEWLINE_AFTER
Item
should the last on its line or row, and that the next
Item (if any) in the container
should be placed on a new line or row.
Value 0x200 is assigned to
LAYOUT_NEWLINE_AFTER.
public static final int LAYOUT_SHRINK
Item's
width may be reduced to its minimum width.
Value 0x400 is assigned to LAYOUT_SHRINK
public static final int LAYOUT_EXPAND
Item's
width may be increased to fill available space.
Value 0x800 is assigned to LAYOUT_EXPAND.
public static final int LAYOUT_VSHRINK
Item's
height may be reduced to its minimum height.
Value 0x1000 is assigned to
LAYOUT_VSHRINK.
public static final int LAYOUT_VEXPAND
Item's
height may be increased to fill available space.
Value 0x2000 is assigned to
LAYOUT_VEXPAND.
public static final int LAYOUT_2
Item. If this
bit is clear, indicates that MIDP 1.0 layout behavior
applies to this Item.
Value 0x4000 is assigned to
LAYOUT_2.
public static final int PLAIN
Item is to have
a normal appearance.
Value 0 is assigned to PLAIN.
public static final int HYPERLINK
Item
is to appear as a hyperlink.
Value 1 is assigned to HYPERLINK.
public static final int BUTTON
Item
is to appear as a button.
Value 2 is assigned to BUTTON.
public static final int INTERACTIVE
Item
accepts input from the user.
Value 3 is assigned to INTERACTIVE.
protected int layout
protected ItemCommandListener itemCommandListener
protected Command defaultCommand
protected int preferredWidth
protected int preferredHeight
protected Dimension cssWidth
protected Dimension cssHeight
protected Dimension minimumWidth
protected Dimension minimumHeight
protected Dimension maximumWidth
protected Dimension maximumHeight
protected Dimension minimumItemWidth
protected Dimension minimumItemHeight
protected Dimension maximumItemWidth
protected Dimension maximumItemHeight
public Background background
protected Border border
protected Border bgBorder
protected Style style
public int itemWidth
public int itemHeight
protected int paddingLeft
protected int paddingTop
protected int paddingRight
protected int paddingBottom
protected int paddingVertical
protected int paddingHorizontal
protected int marginLeft
protected int marginTop
protected int marginRight
protected int marginBottom
protected int contentWidth
protected int contentHeight
protected int availContentWidth
protected int availContentHeight
protected int backgroundWidth
protected int backgroundHeight
public int appearanceMode
protected Screen screen
protected String cssSelector
protected boolean isStyleInitialised
protected Item parent
protected ArrayList commands
protected boolean isLayoutCenter
protected boolean isLayoutExpand
protected boolean isLayoutRight
public int relativeX
public int relativeY
protected int contentX
protected int contentY
public static final int NO_POSITION_SET
protected int internalX
protected int internalY
protected int internalWidth
protected int internalHeight
public boolean isFocused
protected int beforeWidth
protected Style labelStyle
protected StringItem label
protected boolean useSingleRow
public net.rim.device.api.ui.Field _bbField
protected Style focusedStyle
protected boolean isPressed
protected int colSpan
protected int rowSpan
protected boolean includeLabel
protected Background completeBackground
protected Border completeBorder
protected Dimension completeBackgroundPadding
protected int backgroundYOffset
protected ItemView view
protected boolean preserveViewType
protected boolean setView
protected boolean isInvisible
protected boolean isShown
protected int opacity
protected int[] opacityRgbData
protected boolean opacityPaintNormally
protected Dimension xAdjustment
protected Dimension yAdjustment
protected Dimension contentXAdjustment
protected Dimension contentYAdjustment
protected boolean isContentVisible
public boolean cacheItemImage
protected boolean isInlineLabel
protected int availableWidth
protected int availableHeight
protected boolean ignoreRepaintRequests
protected Style landscapeStyle
protected Style portraitStyle
protected NativeItem nativeItem
| Constructor Detail |
|---|
protected FakeCustomItem()
protected FakeCustomItem(Style style)
style - the style for this item
protected FakeCustomItem(String label,
int layout)
label - the label of this itemlayout - the layout of this item
protected FakeCustomItem(String label,
int layout,
int appearanceMode,
Style style)
label - the label of this itemlayout - the layout of this itemappearanceMode - the mode of this item, either Item.PLAIN or Item.INTERACTIVE (Item.BUTTON, Item.HYPERLINK, Item.INTERACTIVE)style - the style of this item - contains the background, border etc.| Method Detail |
|---|
protected final int getMinContentWidth()
getMinContentWidth in class CustomItemprotected final int getMinContentHeight()
getMinContentHeight in class CustomItemprotected final int getPrefContentWidth(int height)
getPrefContentWidth in class CustomItemheight - the tentative content height in pixels, or -1 if a tentative height has not been computed.
J2ME Polish will always specify -1 as the height.
protected final int getPrefContentHeight(int width)
getPrefContentHeight in class CustomItemwidth - the tentative content width in pixels, or -1 if a tentative width has not been computed
protected final void paint(Graphics g,
int w,
int h)
paint in class CustomItemg - the Graphics object to be used for rendering the itemw - current width of the item in pixelsh - current height of the item in pixelspublic void setLabel(String label)
Item. If label
is null, specifies that this item has no label.
It is illegal to call this method if this Item
is contained within an Alert.
setLabel in class Itemlabel - - the label string
IllegalStateException - - if this Item is contained within an AlertgetLabel()public String getLabel()
Item object.
getLabel in class ItemsetLabel(java.lang.String)public Item getLabelItem()
public int getLayout()
getLayout in class ItemsetLayout(int)public void setLayout(int layout)
It is illegal to call this method if this Item
is contained within an Alert.
setLayout in class Itemlayout - - a combination of layout directive values for this item
IllegalArgumentException - - if the value of layout is not a bit-wise OR combination of layout directives
IllegalStateException - - if this Item is contained within an AlertgetLayout()public int getAppearanceMode()
Item.
See Appearance Modes.
public void setAppearanceMode(int appearanceMode)
appearanceMode - the mode value, one of Item.PLAIN, Item.HYPERLINK, or Item.BUTTONpublic void setView(ItemView view)
view - the new view, use null to remove the current viewpublic ItemView getView()
public Style getStyle()
public void setBackground(Background background)
background - the new background, use null for not showing a backgroundpublic void setBorder(Border border)
border - the new border, use null for not showing a borderpublic void setStyle()
public void setStyle(Style style)
style - the new style for this item.
NullPointerException - when style is null
protected ItemView getView(ItemView viewType,
Style viewStyle)
viewType - the view registered in the styleviewStyle - the style
public void setStyle(Style style,
boolean resetStyle)
style - the new style for this element.resetStyle - true when style settings should be resetted. This is not the case
when styles are animated, for example.
NullPointerException - when style is null
public int getItemWidth(int firstLineWidth,
int availWidth)
firstLineWidth - the maximum width of the first lineavailWidth - the maximum visible width of any following lines
public int getItemWidth(int firstLineWidth,
int availWidth,
int availHeight)
firstLineWidth - the maximum width of the first lineavailWidth - the maximum visible width of any following linesavailHeight - the maximum visible height, -1 if unknown
public int getItemHeight(int firstLineWidth,
int availWidth)
firstLineWidth - the maximum width of the first lineavailWidth - the maximum visible width of any following lines
public int getItemHeight(int firstLineWidth,
int availWidth,
int availHeight)
firstLineWidth - the maximum width of the first lineavailWidth - the maximum visible width of any following linesavailHeight - the maximum visible height, -1 if unknown
public void addCommand(Command cmd)
addCommand in class Itemcmd - the commandpublic void addCommand(Command cmd)
Command to the item.
The semantic type of
Command should be ITEM. The implementation
will present the command
only when the item is active, for example, highlighted.
If the added command is already in the item (tested by comparing the object references), the method has no effect. If the item is actually visible on the display, and this call affects the set of visible commands, the implementation should update the display as soon as it is feasible to do so.
It is illegal to call this method if this Item
is contained within an Alert.
cmd - the command to be added
IllegalStateException - if this Item is contained within an Alert
NullPointerException - if cmd is null
public void addCommand(Command cmd,
Style commandStyle)
Command to the item.
The semantic type of
Command should be ITEM. The implementation
will present the command
only when the item is active, for example, highlighted.
If the added command is already in the item (tested by comparing the object references), the method has no effect. If the item is actually visible on the display, and this call affects the set of visible commands, the implementation should update the display as soon as it is feasible to do so.
It is illegal to call this method if this Item
is contained within an Alert.
cmd - the command to be addedcommandStyle - the style of the command, for the moment this is ignored
IllegalStateException - if this Item is contained within an Alert
NullPointerException - if cmd is nullpublic void removeCommand(Command cmd)
Item (tested by comparing the object references),
the method has
no effect. If the Item is actually visible on the display,
and this call
affects the set of visible commands, the implementation should update
the display as soon as it is feasible to do so.
If the command to be removed happens to be the default command,
the command is removed and the default command on this Item is
set to null.
The following code:
// Command c is the default command on Item item
item.removeCommand(c);
is equivalent to the following code:
// Command c is the default command on Item item
item.setDefaultCommand(null);
item.removeCommand(c);
cmd - - the command to be removedprotected void repaintFully()
CustomItem.repaint(),
CustomItem.repaint(int, int, int, int)protected int getBorderWidthLeft()
protected int getBorderWidthRight()
protected int getBorderWidthTop()
protected int getBorderWidthBottom()
public void requestInit()
public Screen getScreen()
public void setItemCommandListener(ItemCommandListener l)
Commands to this Item,
replacing any previous
ItemCommandListener. A null reference
is allowed and has the effect of removing any existing listener.
When no listener is registered, J2ME Polish notifies the
command-listener of the current screen, when an item command
has been selected.
It is illegal to call this method if this Item
is contained within an Alert.
l - the new listener, or null.
IllegalStateException - if this Item is contained within an Alertpublic void setItemCommandListener(ItemCommandListener l)
Commands to this Item,
replacing any previous
ItemCommandListener. A null reference
is allowed and has the effect of removing any existing listener.
When no listener is registered, J2ME Polish notifies the
command-listener of the current screen, when an item command
has been selected.
It is illegal to call this method if this Item
is contained within an Alert.
setItemCommandListener in class Iteml - the new listener, or null.
IllegalStateException - if this Item is contained within an Alertpublic ItemCommandListener getItemCommandListener()
Commands to this Item.
When no listener is registered, null is returned
It is illegal to call this method if this Item
is contained within an Alert.
public void setItemStateListener(ItemStateListener listener)
listener - the listener which is set specifically for this item.public ItemStateListener getItemStateListener()
public int getpreferredWidth()
Item.
If the application has locked
the width to a specific value, this method returns that value.
Otherwise, the return value is computed based on the
Item's contents,
possibly with respect to the Item's preferred height
if it is locked.
See Item Sizes for a complete discussion.
getpreferredHeight(),
setpreferredSize(int, int)public int getpreferredHeight()
Item.
If the application has locked
the height to a specific value, this method returns that value.
Otherwise, the return value is computed based on the
Item's contents,
possibly with respect to the Item's preferred
width if it is locked.
See Item Sizes for a complete discussion.
getpreferredWidth(),
setpreferredSize(int, int)
public void setpreferredSize(int width,
int height)
Item.
Values for width and height less than -1 are illegal.
If the width is between zero and the minimum width, inclusive,
the minimum width is used instead.
If the height is between zero and the minimum height, inclusive,
the minimum height is used instead.
Supplying a width or height value greater than the minimum width or
height locks that dimension to the supplied
value. The implementation may silently enforce a maximum dimension for
an Item based on factors such as the screen size.
Supplying a value of
-1 for the width or height unlocks that dimension.
See Item Sizes for a complete discussion.
It is illegal to call this method if this Item
is contained within an Alert.
width - - the value to which the width should be locked, or -1 to unlockheight - - the value to which the height should be locked, or -1 to unlock
IllegalArgumentException - - if width or height is less than -1
IllegalStateException - - if this Item is contained within an AlertgetpreferredHeight(),
getpreferredWidth()public int getMinimumWidth()
Item. This is a width
at which the item can function and display its contents,
though perhaps not optimally.
See Item Sizes for a complete discussion.
getMinimumWidth in class Itempublic int getMinimumWidth(int availWidth)
Item.
availWidth - the available width for percentage calculations
public int getMinimumHeight()
Item. This is a height
at which the item can function and display its contents,
though perhaps not optimally.
See Item Sizes for a complete discussion.
getMinimumHeight in class Itempublic int getMinimumHeight(int availHeight)
Item.
availHeight - the available height for percentage calculations
public int getMaximumWidth()
Item. This is a height
at which the item can function and display its contents,
though perhaps not optimally.
See Item Sizes for a complete discussion.
public int getMaximumWidth(int availWidth)
Item.
availWidth - the available height for percentage calculations
public int getMaximumHeight()
Item. This is a height
at which the item can function and display its contents,
though perhaps not optimally.
See Item Sizes for a complete discussion.
public int getMaximumHeight(int availHeight)
Item.
availHeight - the available height for percentage calculations
public void setDefaultCommand(Command cmd)
Command for this Item.
If the Item previously had a
default Command, that Command
is no longer the default, but it
remains present on the Item.
If not null, the Command object
passed becomes the default Command
for this Item. If the Command object
passed is not currently present
on this Item, it is added as if addCommand(javax.microedition.lcdui.Command)
had been called
before it is made the default Command, unless the "polish.Item.suppressDefaultCommand" preprocessing variable is set to "true".
If null is passed, the Item is set to
have no default Command.
The previous default Command, if any, remains present
on the Item.
It is illegal to call this method if this Item
is contained within an Alert.
cmd - the command to be used as this Item's default Command, or null if there is to be no default command
IllegalStateException - - if this Item is contained within an Alertpublic void setDefaultCommand(Command cmd)
Command for this Item.
setDefaultCommand in class Itemcmd - the command to be used as this Item's default Command, or null if there is to be no default commandpublic void notifyStateChanged()
Item's containing Form to notify
the Item's ItemStateListener.
The application calls this method to inform the
listener on the Item that the Item's
state has been changed in
response to an action. Even though this method simply causes a call
to another part of the application, this mechanism is useful for
decoupling the implementation of an Item (in particular, the
implementation of a CustomItem, though this also applies to
subclasses of other items) from the consumer of the item.
If an edit was performed by invoking a separate screen, and the
editor now wishes to "return" to the form which contained the
selected Item, the preferred method is
Display.setCurrent(Item)
instead of Display.setCurrent(Displayable),
because it allows the
Form to restore focus to the Item
that initially invoked the editor.
In order to make sure that the documented behavior of
ItemStateListener is maintained, it is up to the caller
(application) to guarantee that this function is
not called unless:
Item's value has actually been changed, andItem's APIs The call to ItemStateListener.itemStateChanged
may be delayed in order to be serialized with the event stream.
The notifyStateChanged method does not block awaiting
the completion of the itemStateChanged method.
notifyStateChanged in class ItemIllegalStateException - if the Item is not owned by a Formprotected void notifyValueChanged(Object newValue)
polish.handleEvents is set to true.
newValue - the changed value of this objectnotifyStateChanged()
public void paint(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
x - the left start position of this item.y - the top start position of this item.leftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this position,
rightBorder > x >= leftBorderg - the Graphics on which this item should be painted.
protected void paintCommands(int x,
int y,
Graphics g)
x - horizontal left start positiony - vertical top start positiong - the graphics context
protected void paintBackgroundAndBorder(int x,
int y,
int width,
int height,
Graphics g)
x - the horizontal start positiony - the vertical start positionwidth - the widthheight - the heightg - graphics contextpaintBackground(int, int, int, int, Graphics),
paintBorder(int, int, int, int, Graphics)
protected void paintBorder(int x,
int y,
int width,
int height,
Graphics g)
x - the horizontal start positiony - the vertical start positionwidth - the widthheight - the heightg - graphics context
protected void paintBackground(int x,
int y,
int width,
int height,
Graphics g)
x - the horizontal start positiony - the vertical start positionwidth - the widthheight - the heightg - graphics context
protected RgbImage paintFilter(int x,
int y,
RgbFilter[] partFilters,
RgbImage rgbImage,
int lo,
Graphics g)
x - horizontal paint positiony - vertical paint positionpartFilters - the filtersrgbImage - the initial RGB imagelo - the layout for the processed RGB imageg - the graphics context
protected void init(int firstLineWidth,
int availWidth,
int availHeight)
firstLineWidth - the maximum width of the first lineavailWidth - the maximum width of any following linesavailHeight - the maximum height that can be used without scrollinginitContent(int, int, int),
ItemView.initContent(Item, int, int, int)
protected void initLayout(Style style,
int availWidth)
protected void initMargin(Style style,
int availWidth)
style - the styleavailWidth - the available width
protected void initPadding(Style style,
int availWidth)
style - the styleavailWidth - the available widthprotected void setContentWidth(int width)
width - the new content width in pixelprotected void setContentHeight(int height)
height - the new content height in pixelprotected void initStyle()
protected abstract void initContent(int firstLineWidth,
int availWidth,
int availHeight)
firstLineWidth - the maximum width of the first lineavailWidth - the available maximum width of this item in pixelsavailHeight - the available maximum height of this item in pixelscontentWidth,
contentHeight,
preferredWidth,
preferredHeight
protected abstract void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
x - the left start positiony - the upper start positionleftBorder - the left border, nothing must be painted left of this positionrightBorder - the right border, nothing must be painted right of this positiong - the Graphics on which this item should be painted.protected abstract String createCssSelector()
protected boolean handleKeyPressed(int keyCode,
int gameAction)
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handleKeyRepeated(int keyCode,
int gameAction)
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
handleKeyPressed(int, int)
protected boolean handleKeyReleased(int keyCode,
int gameAction)
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
handleKeyPressed(int, int)public void notifyVisited()
public void notifyUnvisited()
public boolean notifyItemPressedStart()
public boolean isPressed()
public boolean isFocused()
public void notifyItemPressedEnd()
public boolean isInContentArea(int relX,
int relY)
relX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
initContent(int, int, int)
public boolean isInContentWithPaddingArea(int relX,
int relY)
relX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
initContent(int, int, int)
public boolean isInItemArea(int relX,
int relY)
relX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
initContent(int, int, int)
public boolean isInItemArea(int relX,
int relY,
Item child)
relX - the x position relative to this item's left content positionrelY - the y position relative to this item's top content positionchild - the child
protected boolean handlePointerPressed(int relX,
int relY)
relX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
handleKeyPressed(int, int),
for calculating the horizontal position relative to the content (relX - contentX),
for calculating the vertical position relative to the content (relY - contentY)
protected boolean handlePointerReleased(int relX,
int relY)
relX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
this method is used for determining whether the event belongs to this item,
for a helper method for determining whether the event took place into the actual content area,
handleKeyPressed(int, int),
for calculating the horizontal position relative to the content (relX - contentX),
for calculating the vertical position relative to the content (relY - contentY)
protected boolean handlePointerDragged(int relX,
int relY)
relX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
protected boolean handlePointerDragged(int relX,
int relY,
ClippingRegion repaintRegion)
relX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
public boolean handlePointerTouchDown(int x,
int y)
x - the horizontal pixel position of the touch event relative to this item's left positiony - the vertical pixel position of the touch event relative to this item's top position
public boolean handlePointerTouchUp(int x,
int y)
x - the horizontal pixel position of the touch event relative to this item's left positiony - the vertical pixel position of the touch event relative to this item's top position
protected boolean handleGesture(int gesture,
int x,
int y)
gesture - the gesture identifier, e.g. GESTURE_HOLD
handleGestureHold(int, int)
protected boolean handleGestureHold(int x,
int y)
protected boolean handleGestureSwipeLeft(int x,
int y)
protected boolean handleGestureSwipeRight(int x,
int y)
public void addRepaintArea(ClippingRegion repaintRegion)
repaintRegion - the clipping rectangle to which the repaint area should be added
public void addRelativeToContentRegion(ClippingRegion repaintRegion,
int x,
int y,
int width,
int height)
repaintRegion - the clipping regionx - horizontal start relative to this item's content positiony - vertical start relative to this item's content positionwidth - widthheight - heightgetContentWidth(),
getContentHeight()
public void addRelativeToBackgroundRegion(ClippingRegion repaintRegion,
int x,
int y,
int width,
int height)
repaintRegion - the clipping regionx - horizontal start relative to this item's background positiony - vertical start relative to this item's background positionwidth - widthheight - heightgetBackgroundWidth(),
getBackgroundHeight()
public void addRelativeToBackgroundRegion(Background animatedBackground,
Border animatedBorder,
ClippingRegion repaintRegion,
int x,
int y,
int width,
int height)
animatedBackground - the background that requests the repaint (could be a complete-background), can be nullanimatedBorder - the border that requests the repaint (could be a complete-border), can be nullrepaintRegion - the clipping regionx - horizontal start relative to this item's background positiony - vertical start relative to this item's background positionwidth - widthheight - heightgetBackgroundWidth(),
getBackgroundHeight()
public void animate(long currentTime,
ClippingRegion repaintRegion)
currentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedaddRelativeToContentRegion(ClippingRegion, int, int, int, int)public boolean animate()
animate(long, ClippingRegion)public Style getFocusedStyle()
protected Style focus(Style newStyle,
int direction)
newStyle - the style which is used to indicate the focused statedirection - the direction from which this item is focused,
either Canvas.UP, Canvas.DOWN, Canvas.LEFT, Canvas.RIGHT or 0.
When 0 is given, the direction is unknown.
public void showCommands()
protected void addCommands(ArrayList commandsList)
commandsList - an ArrayList into which the commands from this item should be added.protected boolean handleCommand(Command cmd)
cmd - the command
protected boolean handleCommand(Command cmd)
cmd - the command
protected void defocus(Style originalStyle)
originalStyle - the original style which will be restored.protected void showNotify()
paint() calls after
showNotify() has been called.
The default implementation of this method sets the isShown field to true and calls showNotify on style elements.
showNotify in class CustomItemprotected void hideNotify()
paint() calls will be made on this item
until after a showNotify() has been called again.
The default implementation of this method sets the isShown field to false and calls hideNotify on style elements.
hideNotify in class CustomItempublic void show(Display display)
display - the display of the MIDlet.public void releaseResources()
public void destroy()
public void setAttribute(Object key,
Object value)
key - the key for the attributevalue - the attribute valuepublic Object getAttribute(Object key)
key - the key of the attribute
public Object removeAttribute(Object key)
key - the key of the attribute
public HashMap getAttributes()
public Item getItemAt(int relX,
int relY)
relX - the x position of the point relative to this item's left positionrelY - the y position of the point relative to this item's top position
public int getAbsoluteX()
public int getAbsoluteY()
public void setAbsoluteY(int absY)
absY - the absolute y position of this item in pixel.public int getContentX()
getAbsoluteX()public int getContentY()
getAbsoluteY()public int getContentWidth()
public int getContentHeight()
public int getAvailableContentWidth()
public int getAvailableContentHeight()
public int getItemAreaHeight()
public int getBackgroundX()
public int getBackgroundY()
public int getBackgroundWidth()
public int getBackgroundHeight()
public Item getParent()
public void setParent(Item parent)
parent - the parent of this itempublic void setParent(Item parent)
parent - the parent of this itempublic void setVisible(boolean visible)
visible - true when this item should become visible.public boolean isVisible()
public String toString()
toString in class Objectpublic boolean containsCommand(Command command)
command - the command
public Command getDefaultCommand()
public ArrayList getItemCommands()
public void setInitialized(boolean initialized)
initialized - true when this item is deemed to be initialized, otherwise false. When setting to 'false' the item will run its init() and initContent() methods at the next option.public boolean isInitialized()
public void setItemHeight(int height)
height - the height in pixelpublic int getInternalX()
public int getInternalY()
public int getInternalWidth()
public int getInternalHeight()
public void fireEvent(String eventName,
Object eventData)
eventName - the name of the eventeventData - the event dataEventManager.fireEvent(String, Object, Object)public void updateInternalArea()
public boolean isLayoutRight()
setLayout(int),
init(int,int,int)public boolean isLayoutLeft()
setLayout(int),
init(int,int,int)public boolean isLayoutCenter()
setLayout(int),
init(int,int,int)public boolean isLayoutTop()
setLayout(int),
init(int,int,int)public boolean isLayoutBottom()
setLayout(int),
init(int,int,int)public boolean isLayoutVerticalCenter()
setLayout(int),
init(int,int,int)public boolean isLayoutVerticalShrink()
setLayout(int),
init(int,int,int)public boolean isLayoutVerticalExpand()
setLayout(int),
init(int,int,int)public boolean isLayoutExpand()
setLayout(int),
init(int,int,int)public boolean isLayoutShrink()
setLayout(int),
init(int,int,int)public boolean isLayoutNewlineAfter()
setLayout(int),
init(int,int,int)public boolean isLayoutNewlineBefore()
setLayout(int),
init(int,int,int)public void setItemTransition(ItemTransition transition)
public Image toImage()
public RgbImage toRgbImage()
public boolean isInteractive()
public void onScreenSizeChanged(int screenWidth,
int screenHeight)
screenWidth - the screen widthscreenHeight - the screen heightpublic int getAvailableWidth()
public int getAvailableHeight()
public void setUiEventListener(UiEventListener listener)
listener - the listener, use null to remove a listenerpublic UiEventListener getUiEventListener()
public int[] getRgbData()
public int[] getRgbData(boolean supportTranslucency,
int rgbOpacity)
supportTranslucency - true when not only transparent but also translucent parts of the item should be rendered correctlyrgbOpacity - The opacity of the item between 0 (fully transparent) and 255 (fully opaque)
public void setNativeItem(NativeItem nativeItem)
nativeItem - the native implementationpublic NativeItem getNativeItem()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||