de.enough.polish.ui
Class FakeCustomItem

java.lang.Object
  extended by javax.microedition.lcdui.Item
      extended by javax.microedition.lcdui.CustomItem
          extended by de.enough.polish.ui.FakeCustomItem
Direct Known Subclasses:
ChartItem, FakeContainerCustomItem, FakeStringCustomItem, PictureBrowserItem

public abstract class FakeCustomItem
extends javax.microedition.lcdui.CustomItem

A superclass for components that can be added to a Form.

Items support following CSS attributes:

A superclass for components that can be added to a 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.

Item Layout

An Item's layout within its container is influenced through layout directives:

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.

Item Sizes

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.

Commands

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.

Appearance Modes

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.

Default State

Unless otherwise specified by a subclass, the default state of newly created Items is as follows:

Since:
MIDP 1.0

Field Summary
 Field _bbField
          a blackberry specific internal field
 boolean _bbFieldAdded
          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.
 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  Border border
           
protected  int borderWidth
           
static int BUTTON
          An appearance mode value indicating that the Item is to appear as a button.
protected  int colSpan
           
protected  ArrayList commands
           
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
protected  int contentY
          the vertical position of this item's content relative to it's top edge
protected  java.lang.String cssSelector
          The appropriate CSS selector of this item.
protected  javax.microedition.lcdui.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 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
 boolean isFocused
           
protected  boolean isInitialized
           
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  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  int maximumHeight
           
protected  int maximumWidth
           
protected  int minimumHeight
           
protected  int minimumWidth
           
static int NO_POSITION_SET
           
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  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  Style style
           
static int TRANSPARENT
          A J2ME Polish constant defining a transparent/invisible color.
static int VERTICAL
          A J2ME Polish constant defining a vertical orientation.
protected  ItemView view
           
 
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()
           
protected FakeCustomItem(java.lang.String label, int layout)
           
protected FakeCustomItem(java.lang.String label, int layout, int appearanceMode, Style style)
          Creates a new Item.
protected FakeCustomItem(Style style)
           
 
Method Summary
 void addCommand(javax.microedition.lcdui.Command cmd)
          Adds a context sensitive Command to the item.
 void addCommand(javax.microedition.lcdui.Command cmd, Style commandStyle)
          Adds a context sensitive Command to the item.
protected  void addCommands(ArrayList commandsList)
          Shows the commands on the screen.
 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.
 boolean animate()
          Animates this item.
 void animate(long currentTime, ClippingRegion repaintRegion)
          Animates this item.
 boolean containsCommand(javax.microedition.lcdui.Command command)
          Determines whether this item contains the given command.
protected abstract  java.lang.String createCssSelector()
          Retrieves the CSS selector for this item.
protected  void defocus(Style originalStyle)
          Removes the focus from this item.
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 horizontal position
 int getAppearanceMode()
          Returns the appearance mode of this Item.
 java.lang.Object getAttribute(java.lang.Object key)
          Gets an previously added attribute of this item.
 HashMap getAttributes()
          Returns a HashMap object with all registered attributes.
 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.
 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.
 javax.microedition.lcdui.Command getDefaultCommand()
           
 Style getFocusedStyle()
          Retrieves the approriate style for focusing this item.
 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.
 int getItemHeight(int firstLineWidth, int lineWidth)
          Retrieves the complete height of this item.
 ItemStateListener getItemStateListener()
          Gets an ItemStateListener specifically for this item.
 int getItemWidth(int firstLineWidth, int lineWidth)
          Retrieves the complete width of this item.
 java.lang.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.
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 getMinimumWidth()
          Gets the minimum width 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.
 Screen getScreen()
          Retrieves the screen to which this item belongs to.
 Style getStyle()
          Retrieves the style of this item.
protected  boolean handleCommand(javax.microedition.lcdui.Command cmd)
          Tries to handle the specified command.
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 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.
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 lineWidth)
          Initialises this item.
protected abstract  void initContent(int firstLineWidth, int lineWidth)
          Initialises this item.
protected  void initStyle()
          Initialises the appropriate style for this item.
 boolean isInContentArea(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 isVisible()
          Gets the visible status of this item.
protected  void notifyItemPressedEnd()
          Is called when an item is pressed
protected  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.
protected  void paint(javax.microedition.lcdui.Graphics g, int w, int h)
          Default implementation of javax.microedition.lcdui.CustomItem method.
 void paint(int x, int y, int leftBorder, int rightBorder, javax.microedition.lcdui.Graphics g)
          Paints this item on the screen.
protected  void paintBackground(int x, int y, int width, int height, javax.microedition.lcdui.Graphics g)
          Paints the background of this item.
protected  void paintBackgroundAndBorder(int x, int y, int width, int height, javax.microedition.lcdui.Graphics g)
          Paints the background and border of this item.
protected  void paintBorder(int x, int y, int width, int height, javax.microedition.lcdui.Graphics g)
          Paints the border of this item.
protected abstract  void paintContent(int x, int y, int leftBorder, int rightBorder, javax.microedition.lcdui.Graphics g)
          Paints the content of this item.
 void releaseResources()
          Releases all (memory intensive) resources such as images or RGB arrays of this item.
 void removeCommand(javax.microedition.lcdui.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 at the next repainting.
 void setAppearanceMode(int appearanceMode)
          Sets the appearance mode of this item.
 void setAttribute(java.lang.Object key, java.lang.Object value)
          Sets an arbitrary attribute for this item.
 void setDefaultCommand(javax.microedition.lcdui.Command cmd)
          Sets default Command for this Item.
 void setItemCommandListener(ItemCommandListener l)
          Sets a listener for Commands to this Item, replacing any previous ItemCommandListener.
 void setItemCommandListener(javax.microedition.lcdui.ItemCommandListener l)
          Sets a listener for Commands to this Item, replacing any previous ItemCommandListener.
 void setItemStateListener(ItemStateListener listener)
          Sets an ItemStateListener specifically for this item.
 void setLabel(java.lang.String label)
          Sets the label of the Item.
 void setLayout(int layout)
          Sets the layout directives for this item.
 void setPreferredSize(int width, int height)
          Sets the preferred width and height for this Item.
 void setStyle(Style style)
          Sets the style of this item.
 void setVisible(boolean visible)
          Sets the visible status of this item.
 void show(javax.microedition.lcdui.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.
 java.lang.String toString()
          Generates a String representation of this item.
 
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_POSITION_SET

public static final int NO_POSITION_SET
See Also:
Constant Field Values

TRANSPARENT

public static final int TRANSPARENT
A J2ME Polish constant defining a transparent/invisible color. TRANSPARENT has the value -1.

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
A J2ME Polish constant defining a vertical orientation. VERTICAL has the value 0.

See Also:
Constant Field Values

HORIZONTAL

public static final int HORIZONTAL
A J2ME Polish constant defining a horizontal orientation. HORIZONTAL has the value 1.

See Also:
Constant Field Values

LAYOUT_DEFAULT

public static final int LAYOUT_DEFAULT
A layout directive indicating that this Item should follow the default layout policy of its container.

Value 0 is assigned to LAYOUT_DEFAULT.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_LEFT

public static final int LAYOUT_LEFT
A layout directive indicating that this Item should have a left-aligned layout.

Value 1 is assigned to LAYOUT_LEFT.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_RIGHT

public static final int LAYOUT_RIGHT
A layout directive indicating that this Item should have a right-aligned layout.

Value 2 is assigned to LAYOUT_RIGHT.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_CENTER

public static final int LAYOUT_CENTER
A layout directive indicating that this Item should have a horizontally centered layout.

Value 3 is assigned to LAYOUT_CENTER.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_TOP

public static final int LAYOUT_TOP
A layout directive indicating that this Item should have a top-aligned layout.

Value 0x10 is assigned to LAYOUT_TOP.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_BOTTOM

public static final int LAYOUT_BOTTOM
A layout directive indicating that this Item should have a bottom-aligned layout.

Value 0x20 is assigned to LAYOUT_BOTTOM.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_VCENTER

public static final int LAYOUT_VCENTER
A layout directive indicating that this Item should have a vertically centered layout.

Value 0x30 is assigned to LAYOUT_VCENTER.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_NEWLINE_BEFORE

public static final int LAYOUT_NEWLINE_BEFORE
A layout directive indicating that this Item should be placed at the beginning of a new line or row.

Value 0x100 is assigned to LAYOUT_NEWLINE_BEFORE.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_NEWLINE_AFTER

public static final 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.

Value 0x200 is assigned to LAYOUT_NEWLINE_AFTER.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_SHRINK

public static final int LAYOUT_SHRINK
A layout directive indicating that this Item's width may be reduced to its minimum width.

Value 0x400 is assigned to LAYOUT_SHRINK

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_EXPAND

public static final int LAYOUT_EXPAND
A layout directive indicating that this Item's width may be increased to fill available space.

Value 0x800 is assigned to LAYOUT_EXPAND.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_VSHRINK

public static final int LAYOUT_VSHRINK
A layout directive indicating that this Item's height may be reduced to its minimum height.

Value 0x1000 is assigned to LAYOUT_VSHRINK.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_VEXPAND

public static final int LAYOUT_VEXPAND
A layout directive indicating that this Item's height may be increased to fill available space.

Value 0x2000 is assigned to LAYOUT_VEXPAND.

Since:
MIDP 2.0
See Also:
Constant Field Values

LAYOUT_2

public static final int LAYOUT_2
A layout directive indicating that new MIDP 2.0 layout rules are in effect for this Item. If this bit is clear, indicates that MIDP 1.0 layout behavior applies to this Item.

Value 0x4000 is assigned to LAYOUT_2.

Since:
MIDP 2.0
See Also:
Constant Field Values

PLAIN

public static final int PLAIN
An appearance mode value indicating that the Item is to have a normal appearance.

Value 0 is assigned to PLAIN.

Since:
MIDP 2.0
See Also:
Constant Field Values

HYPERLINK

public static final int HYPERLINK
An appearance mode value indicating that the Item is to appear as a hyperlink.

Value 1 is assigned to HYPERLINK.

Since:
MIDP 2.0
See Also:
Constant Field Values

BUTTON

public static final int BUTTON
An appearance mode value indicating that the Item is to appear as a button.

Value 2 is assigned to BUTTON.

Since:
MIDP 2.0
See Also:
Constant Field Values

INTERACTIVE

public static final int INTERACTIVE
A J2ME Polish appearance mode value indicating that the Item accepts input from the user.

Value 3 is assigned to INTERACTIVE.

See Also:
Constant Field Values

layout

protected int layout

itemCommandListener

protected ItemCommandListener itemCommandListener

defaultCommand

protected javax.microedition.lcdui.Command defaultCommand

preferredWidth

protected int preferredWidth

preferredHeight

protected int preferredHeight

minimumWidth

protected int minimumWidth

minimumHeight

protected int minimumHeight

maximumWidth

protected int maximumWidth

maximumHeight

protected int maximumHeight

isInitialized

protected boolean isInitialized

background

public Background background
the background of this item


border

protected Border border

style

protected Style style

itemWidth

public int itemWidth
the width of this item - only for read access


itemHeight

public int itemHeight
the height of this item - only for read access


paddingLeft

protected int paddingLeft

paddingTop

protected int paddingTop

paddingRight

protected int paddingRight

paddingBottom

protected int paddingBottom

paddingVertical

protected int paddingVertical

paddingHorizontal

protected int paddingHorizontal

marginLeft

protected int marginLeft

marginTop

protected int marginTop

marginRight

protected int marginRight

marginBottom

protected int marginBottom

contentWidth

protected int contentWidth
The width of this item's content


contentHeight

protected int contentHeight
The height of this item's content


borderWidth

protected int borderWidth

backgroundWidth

protected int backgroundWidth

backgroundHeight

protected int backgroundHeight

appearanceMode

public int appearanceMode
The appearance mode of this item, either PLAIN or one of the interactive modes BUTTON, HYPERLINK or INTERACTIVE.


screen

protected Screen screen
The screen to which this item belongs to.


cssSelector

protected java.lang.String cssSelector
The appropriate CSS selector of this item. This is either the style's name or a selector depending on the state of this item. A StringItem can have the selector "p", "a" or "button", for example. This variable can only be used, when the proprocessing variable "polish.useDynamicStyles" is defined.


isStyleInitialised

protected boolean isStyleInitialised
Determines whether the style has be dynamically assigned already.


parent

protected Item parent
The parent of this item.


commands

protected ArrayList commands

isLayoutCenter

protected boolean isLayoutCenter

isLayoutExpand

protected boolean isLayoutExpand

isLayoutRight

protected boolean isLayoutRight

relativeX

public int relativeX
the horizontal start position relative to it's parent's item left content edge


relativeY

public int relativeY
the vertical start position of this item relative to it's parent item top content edge


contentX

protected int contentX
the horizontal position of this item's content relative to it's left edge


contentY

protected int contentY
the vertical position of this item's content relative to it's top edge


internalX

protected int internalX
The internal horizontal position of this item's content relative to it's left edge. When it is equal NO_POSITION_SET this item's internal position is not known. The internal position is useful for items that have a large content which needs to be scrolled, e.g. containers.


internalY

protected int internalY
the vertical position of this item's internal content relative to it's top edge


internalWidth

protected int internalWidth
The internal width of this item's content.


internalHeight

protected int internalHeight
The internal height of this item's content.


isFocused

public boolean isFocused

labelStyle

protected Style labelStyle

label

protected StringItem label

_bbField

public Field _bbField
a blackberry specific internal field


_bbFieldAdded

public boolean _bbFieldAdded
a blackberry specific internal field


focusedStyle

protected Style focusedStyle

colSpan

protected int colSpan

rowSpan

protected int rowSpan

includeLabel

protected boolean includeLabel

backgroundYOffset

protected int backgroundYOffset
The vertical offset for the background, can be used for smoother scrolling, for example


view

protected ItemView view

preserveViewType

protected boolean preserveViewType

isInvisible

protected boolean isInvisible

isShown

protected boolean isShown

isPressed

protected boolean isPressed
Constructor Detail

FakeCustomItem

protected FakeCustomItem()

FakeCustomItem

protected FakeCustomItem(Style style)

FakeCustomItem

protected FakeCustomItem(java.lang.String label,
                         int layout)

FakeCustomItem

protected FakeCustomItem(java.lang.String label,
                         int layout,
                         int appearanceMode,
                         Style style)
Creates a new Item.

Parameters:
label - the label of this item
layout - the layout of this item
appearanceMode - the mode of this item, either Item.PLAIN, Item.BUTTON or Item.HYPERLINK
style - the style of this item - contains the background, border etc.
Method Detail

getMinContentWidth

protected final int getMinContentWidth()
Default implementation of javax.microedition.lcdui.CustomItem method.

Specified by:
getMinContentWidth in class javax.microedition.lcdui.CustomItem
Returns:
the minimum content width in pixels

getMinContentHeight

protected final int getMinContentHeight()
Default implementation of javax.microedition.lcdui.CustomItem method.

Specified by:
getMinContentHeight in class javax.microedition.lcdui.CustomItem
Returns:
the minimum content height in pixels

getPrefContentWidth

protected final int getPrefContentWidth(int height)
Default implementation of javax.microedition.lcdui.CustomItem method.

Specified by:
getPrefContentWidth in class javax.microedition.lcdui.CustomItem
Parameters:
height - 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.
Returns:
the preferred content width in pixels

getPrefContentHeight

protected final int getPrefContentHeight(int width)
Default implementation of javax.microedition.lcdui.CustomItem method.

Specified by:
getPrefContentHeight in class javax.microedition.lcdui.CustomItem
Parameters:
width - the tentative content width in pixels, or -1 if a tentative width has not been computed
Returns:
the preferred content height in pixels

paint

protected final void paint(javax.microedition.lcdui.Graphics g,
                           int w,
                           int h)
Default implementation of javax.microedition.lcdui.CustomItem method.

Specified by:
paint in class javax.microedition.lcdui.CustomItem
Parameters:
g - the Graphics object to be used for rendering the item
w - current width of the item in pixels
h - current height of the item in pixels

setLabel

public void setLabel(java.lang.String label)
Sets the label of the 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.

Overrides:
setLabel in class javax.microedition.lcdui.Item
Parameters:
label - - the label string
Throws:
java.lang.IllegalStateException - - if this Item is contained within an Alert
See Also:
getLabel()

getLabel

public java.lang.String getLabel()
Gets the label of this Item object.

Overrides:
getLabel in class javax.microedition.lcdui.Item
Returns:
the label string
See Also:
setLabel(java.lang.String)

getLabelItem

public Item getLabelItem()
Retrieves the label item that is used by this item.\

Returns:
the item or null when no item is used.

getLayout

public int getLayout()
Gets the layout directives used for placing the item.

Overrides:
getLayout in class javax.microedition.lcdui.Item
Returns:
a combination of layout directive values
Since:
MIDP 2.0
See Also:
setLayout(int)

setLayout

public void setLayout(int layout)
Sets the layout directives for this item.

It is illegal to call this method if this Item is contained within an Alert.

Overrides: