|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.ItemView
public abstract class ItemView
An item view can take over the rendering of an item.
Copyright Enough Software 2006 - 2008
history
Nov 27, 2006 - rob creation
| Field Summary | |
|---|---|
protected int |
contentHeight
|
protected int |
contentWidth
|
protected boolean |
isFocused
|
protected boolean |
isLayoutCenter
|
protected boolean |
isLayoutRight
|
protected int |
layout
|
protected int |
paddingHorizontal
|
protected int |
paddingVertical
|
protected Item |
parentItem
|
| Constructor Summary | |
|---|---|
ItemView()
|
|
| Method Summary | |
|---|---|
protected void |
addFullRepaintRegion(Item item,
ClippingRegion repaintRegion)
Adds the complete item's dimensions to the repaint region. |
boolean |
animate()
Animates this view - please use animate(long, ClippingRegion) instead, if possible |
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this item. |
protected void |
defocus(Style originalStyle)
Notifies this view that the parent container is not focused anymore. |
void |
focus(Style focusstyle,
int direction)
Sets the focus to this container view. |
protected Screen |
getScreen()
Retrieves the screen to which this view belongs to. |
boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the given keyPressed event. |
boolean |
handleKeyReleased(int keyCode,
int gameAction)
Handles the given keyReleased event when the currently focused item was not able to handle it. |
boolean |
handlePointerPressed(int x,
int y)
Handles pointer pressed events. |
protected boolean |
handlePointerReleased(int x,
int y)
Handles the event when a pointer has been released at the specified position. |
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 abstract void |
initContent(Item parent,
int firstLineWidth,
int lineWidth)
Initialises this item view. |
protected void |
initContentByParent(Item parent,
int firstLineWidth,
int lineWidth)
Calls the original initContent method on the parent. |
protected boolean |
isValid(Item parent,
Style style)
Implementation that are valid only for specific item classes can override this method so that they cannot be accidently attached to unsupported classes. |
protected void |
notifyItemPressedEnd()
Is called when pressing an item is finished, usually when the FIRE key is released The default implementation fowards this to the parent item. |
protected boolean |
notifyItemPressedStart()
Is called when an item is pressed using the FIRE game action. |
void |
paintBackground(Background background,
int x,
int y,
int width,
int height,
javax.microedition.lcdui.Graphics g)
|
void |
paintBorder(Border border,
int x,
int y,
int width,
int height,
javax.microedition.lcdui.Graphics g)
|
protected abstract void |
paintContent(Item parent,
int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints this item view. |
protected void |
paintContentByParent(Item parent,
int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints this item view by the parent. |
void |
releaseResources()
Releases all resources that are not required to keep the state of this view. |
protected Background |
removeItemBackground(Item item)
Removes the set background from an item. |
protected Border |
removeItemBorder(Item item)
Removes the set border from an item. |
Background |
removeParentBackground()
Removes the background from the parent container so that the view implementation can paint it itself. |
Border |
removeParentBorder()
Removes the border from the parent container so that the view implementation can paint it itself. |
protected void |
removeViewFromParent()
Removes this view from the parent item. |
void |
requestInit()
Requests the re-initialization of this item view. |
protected void |
setStyle(Style style)
Sets the style for this view. |
void |
showNotify()
Notifies this view that it is about to be shown (again). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int contentWidth
protected int contentHeight
protected int paddingVertical
protected int paddingHorizontal
protected int layout
protected boolean isLayoutCenter
protected boolean isLayoutRight
protected transient Item parentItem
protected boolean isFocused
| Constructor Detail |
|---|
public ItemView()
| Method Detail |
|---|
protected abstract void initContent(Item parent,
int firstLineWidth,
int lineWidth)
parent - the parent itemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linescontentWidth,
contentHeight
protected abstract void paintContent(Item parent,
int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
parent - the parent itemx - 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 void initContentByParent(Item parent,
int firstLineWidth,
int lineWidth)
parent - the parent itemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following lines
protected void paintContentByParent(Item parent,
int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
parent - the parent itemx - 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.
public void focus(Style focusstyle,
int direction)
focusstyle - the appropriate style.direction - the direction from the which the focus is gained,
either Canvas.UP, Canvas.DOWN, Canvas.LEFT, Canvas.RIGHT or 0.
When 0 is given, the direction is unknown.1protected void defocus(Style originalStyle)
originalStyle - the previous used style, may be null.protected void setStyle(Style style)
style - the stylepublic void requestInit()
public Background removeParentBackground()
public Border removeParentBorder()
protected Border removeItemBorder(Item item)
item - the item to remove the border from
protected Background removeItemBackground(Item item)
item - the item to remove the background from
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 animatedItem.getAbsoluteX(),
Item.getAbsoluteY()
protected void addFullRepaintRegion(Item item,
ClippingRegion repaintRegion)
item - the itemrepaintRegion - the region to which the item's positions are addedpublic boolean animate()
animate(long, ClippingRegion)public void showNotify()
public void hideNotify()
paint() calls will be made on this item
until after a showNotify() has been called again.
protected Screen getScreen()
public boolean handleKeyPressed(int keyCode,
int gameAction)
keyCode - the key codegameAction - the game action like Canvas.UP etc
public boolean handleKeyReleased(int keyCode,
int gameAction)
keyCode - the key codegameAction - the game action like Canvas.UP etc
public boolean handlePointerPressed(int x,
int y)
//#if polish.hasPointerEvents
x - the x position of the event relative to the item's horizontal left edgey - the y position of the event relative to the item's vertical top edge
protected boolean handlePointerReleased(int x,
int y)
//#if polish.hasPointerEvents
x - the x position of the event relative to the item's horizontal left edgey - the y position of the event relative to the item's vertical top edge
protected boolean isValid(Item parent,
Style style)
parent - the parent itemstyle - the style
protected void removeViewFromParent()
protected boolean notifyItemPressedStart()
protected void notifyItemPressedEnd()
public void paintBackground(Background background,
int x,
int y,
int width,
int height,
javax.microedition.lcdui.Graphics g)
background - x - y - width - height - g -
public void paintBorder(Border border,
int x,
int y,
int width,
int height,
javax.microedition.lcdui.Graphics g)
border - x - y - width - height - g - public void releaseResources()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||