|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.Item
de.enough.polish.ui.StringItem
de.enough.polish.ui.IconItem
de.enough.polish.ui.CommandItem
public class CommandItem
Wraps a javax.microedition.lcdui.Command object and allows to add subcommands, specific styles etc to single commands.
Copyright Enough Software 2006 - 2008
history
Mar 4, 2006 - rob creation
| Field Summary | |
|---|---|
protected javax.microedition.lcdui.Command |
command
|
protected boolean |
hasChildren
|
| Fields inherited from class de.enough.polish.ui.IconItem |
|---|
horizontalAdjustment, image, imageAlign, imageHeight, imageWidth, isTextVisible, relativeIconX, relativeIconY, scaleData, scaleFinished, verticalAdjustment, yAdjustText |
| Fields inherited from class de.enough.polish.ui.StringItem |
|---|
animateTextWrap, bitMapFont, bitMapFontViewer, clipText, font, text, textColor, textEffect, textHorizontalAdjustment, textLines, textVerticalAdjustment, textWrapDirection, textWrapSpeed, useSingleLine, xOffset |
| Constructor Summary | |
|---|---|
CommandItem(javax.microedition.lcdui.Command command,
Item parent)
Creates a new command item. |
|
CommandItem(javax.microedition.lcdui.Command command,
Item parent,
Style style)
Creates a new command item. |
|
| Method Summary | |
|---|---|
void |
addChild(javax.microedition.lcdui.Command childCommand)
Adds a subcommand to this node. |
void |
addChild(CommandItem child)
Adds a subcommand to this node. |
void |
addChild(javax.microedition.lcdui.Command childCommand,
Style childStyle)
Adds a subcommand to this node. |
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this item. |
CommandItem |
getChild(javax.microedition.lcdui.Command parentCommand)
Retrieves the child item for the specified command. |
CommandItem |
getChild(int index)
Retrieves a child item for a given index. |
javax.microedition.lcdui.Command |
getCommand()
Returns the command for this item. |
int |
getLayer()
Retrieves the layer to which this command item belongs. |
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 |
handlePointerPressed(int x,
int y)
Handles the event when a pointer has been pressed at the specified position. |
protected boolean |
handlePointerReleased(int x,
int y)
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 |
initContent(int firstLineWidth,
int lineWidth)
Initialises this item. |
protected boolean |
isOpen()
Tells whether this item is open so that the children commands are visible (or not). |
protected void |
open(boolean open)
Opens or closes this command item so that the children commands are visible (or not). |
void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this item. |
boolean |
removeChild(javax.microedition.lcdui.Command childCommand)
Removes a child from this command item. |
void |
setStyle(Style style)
Sets the style of this item. |
| Methods inherited from class de.enough.polish.ui.IconItem |
|---|
createCssSelector, defocus, getImage, isTextVisible, releaseResources, setImage, setImage, setImage, setImage, setImageAlign, setTextVisible, toString |
| Methods inherited from class de.enough.polish.ui.StringItem |
|---|
getFont, getFontHeight, getText, setFont, setText, setText, setTextColor, showNotify, stringWidth |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final javax.microedition.lcdui.Command command
protected boolean hasChildren
| Constructor Detail |
|---|
public CommandItem(javax.microedition.lcdui.Command command,
Item parent)
command - the commmand represented by this item.parent - the parent item
public CommandItem(javax.microedition.lcdui.Command command,
Item parent,
Style style)
command - the commmand represented by this item.parent - the parent itemstyle - the style for this item| Method Detail |
|---|
public void addChild(javax.microedition.lcdui.Command childCommand)
childCommand - the child command
public void addChild(javax.microedition.lcdui.Command childCommand,
Style childStyle)
childCommand - the child commandchildStyle - the style for the child commandpublic void addChild(CommandItem child)
child - the child command itempublic int getLayer()
public boolean removeChild(javax.microedition.lcdui.Command childCommand)
childCommand - the child that should be removed
protected void initContent(int firstLineWidth,
int lineWidth)
Item
initContent in class IconItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesItem.contentWidth,
Item.contentHeight,
Item.preferredWidth,
Item.preferredHeight
public void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Item
paintContent in class IconItemx - 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 boolean handleKeyPressed(int keyCode,
int gameAction)
Item
handleKeyPressed in class ItemkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
protected boolean handleKeyReleased(int keyCode,
int gameAction)
Item
handleKeyReleased in class ItemkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
Item.handleKeyPressed(int, int)
protected boolean handlePointerPressed(int x,
int y)
Item
handlePointerPressed in class Itemx - the x position of the pointer pressing relative to this item's left positiony - 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,
Item.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 x,
int y)
Item
handlePointerReleased in class Itemx - the x position of the pointer pressing relative to this item's left positiony - 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,
Item.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 void open(boolean open)
open - true when the children should be visible and the focus is moved to them.public CommandItem getChild(javax.microedition.lcdui.Command parentCommand)
parentCommand - the corresponding command
public void setStyle(Style style)
Item
setStyle in class IconItemstyle - the new style for this item.
public void animate(long currentTime,
ClippingRegion repaintRegion)
Item
animate in class IconItemcurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedItem.addRelativeToContentRegion(ClippingRegion, int, int, int, int)protected void hideNotify()
Itempaint() 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 StringItempublic javax.microedition.lcdui.Command getCommand()
protected boolean isOpen()
public CommandItem getChild(int index)
index - the index
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||