|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.enough.polish.ui.ItemView
de.enough.polish.ui.ContainerView
public class ContainerView
Is responsible for visual representation and interpretation of user-input.
Copyright Enough Software 2004 - 2007 - 2008
history
Oct 27, 2004 - rob creation
| Field Summary | |
|---|---|
protected boolean |
allowCycling
|
protected boolean |
allowsAutoTraversal
indicates whether the parent Container is allowed to change the currently focused item when the user traverses around a form and enters the container from different sides |
protected boolean |
allowsDirectSelectionByPointerEvent
indicates whether elements in this container view can be selected directly by pointer events |
protected int |
appearanceMode
|
protected int |
columnsSetting
|
protected int[] |
columnsWidths
|
protected static int |
EQUAL_WIDTH_COLUMNS
|
protected int |
focusedIndex
|
protected Item |
focusedItem
|
protected boolean |
focusFirstElement
|
protected boolean |
isExpandItems
|
protected boolean |
isHorizontal
|
protected boolean |
isSequentialTraversal
|
protected boolean |
isVertical
|
protected int |
leftXOffset
|
protected static int |
NO_COLUMNS
|
protected static int |
NORMAL_WIDTH_COLUMNS
|
protected int |
numberOfColumns
|
protected int |
numberOfRows
|
protected Container |
parentContainer
this field is set automatically, so that subclasses can use it for referencing the parent-container |
protected boolean |
restartAnimation
determines whether any animation of this view should be (re) started at the next possibility. |
protected int |
rightXOffset
|
protected int[] |
rowsHeights
|
protected static int |
STATIC_WIDTH_COLUMNS
|
protected int |
topYOffset
|
protected int |
yOffset
|
| Fields inherited from class de.enough.polish.ui.ItemView |
|---|
contentHeight, contentWidth, isFocused, isLayoutCenter, isLayoutRight, layout, paddingHorizontal, paddingVertical, parentItem |
| Constructor Summary | |
|---|---|
protected |
ContainerView()
Creates a new view |
| Method Summary | |
|---|---|
protected void |
focusItem(int index,
Item item)
Focuses the item with the given index. |
protected void |
focusItem(int index,
Item item,
int direction)
Focuses the item with the given index. |
Style |
focusItem(int index,
Item item,
int direction,
Style focusedStyle)
Focuses the given item and retrieves the previous style of that item. |
protected int |
getItemRelativeY(Item item)
|
protected Item |
getNextFocusableItem(Item[] items,
boolean forward,
int steps,
boolean allowCircle)
Retrieves the next focusable item. |
protected Item |
getNextItem(int keyCode,
int gameAction)
Interpretes the given user-input and retrieves the nexte item which should be focused. |
protected int |
getParentRelativeY()
|
protected Screen |
getScreen()
Retrieves the screen to which this view belongs to. |
boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the given keyPressed event when the currently focused item was not able to handle it. |
protected void |
initContent(Item parentContainerItem,
int firstLineWidth,
int lineWidth)
Initialises this item. |
protected boolean |
isInBottomRow(int index)
Detects if the specified item index is within the last row of this view. |
protected boolean |
isLayoutExpand()
Determines whether this view should be expanded horizontally |
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 |
paintContent(Container container,
Item[] myItems,
int x,
int y,
int leftBorder,
int rightBorder,
int clipX,
int clipY,
int clipWidth,
int clipHeight,
javax.microedition.lcdui.Graphics g)
Paints the content of this container view. |
protected void |
paintContent(Item parent,
int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this container view. |
protected void |
paintItem(Item item,
int index,
int x,
int y,
int leftBorder,
int rightBorder,
int clipX,
int clipY,
int clipWidth,
int clipHeight,
javax.microedition.lcdui.Graphics g)
Paints this item at the specified position. |
protected void |
scroll(int direction,
int x,
int y,
int width,
int height)
Adjusts the yOffset or the targetYOffset so that the given relative values are inside of the visible area. |
protected void |
setStyle(Style style)
Sets the style for this view. |
protected Item |
shiftFocus(boolean forwardFocus,
int steps,
Item[] items)
Shifts the focus to the next or the previous item. |
void |
showNotify()
Notifies this view that it is about to be shown (again). |
| Methods inherited from class de.enough.polish.ui.ItemView |
|---|
addFullRepaintRegion, animate, animate, defocus, focus, handleKeyReleased, handlePointerPressed, handlePointerReleased, hideNotify, initContentByParent, notifyItemPressedEnd, notifyItemPressedStart, paintBackground, paintBorder, paintContentByParent, releaseResources, removeItemBackground, removeItemBorder, removeParentBackground, removeParentBorder, removeViewFromParent, requestInit |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int NO_COLUMNS
protected static final int EQUAL_WIDTH_COLUMNS
protected static final int NORMAL_WIDTH_COLUMNS
protected static final int STATIC_WIDTH_COLUMNS
protected int yOffset
protected int focusedIndex
protected transient Container parentContainer
protected boolean restartAnimation
protected boolean focusFirstElement
protected int appearanceMode
protected transient Item focusedItem
protected int columnsSetting
protected int numberOfColumns
protected int[] columnsWidths
protected int[] rowsHeights
protected int numberOfRows
protected boolean allowCycling
protected int leftXOffset
protected int rightXOffset
protected int topYOffset
protected boolean isSequentialTraversal
protected boolean isExpandItems
protected boolean allowsAutoTraversal
protected boolean isHorizontal
protected boolean isVertical
protected boolean allowsDirectSelectionByPointerEvent
| Constructor Detail |
|---|
protected ContainerView()
| Method Detail |
|---|
protected void initContent(Item parentContainerItem,
int firstLineWidth,
int lineWidth)
initContent in class ItemViewparentContainerItem - the Container which uses this view, use parent.getItems() for retrieving all items.firstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesItemView.contentWidth,
ItemView.contentHeightprotected boolean isLayoutExpand()
ItemView.layout,
Item.LAYOUT_EXPAND
protected void paintContent(Item parent,
int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
paintContent in class ItemViewparent - 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.paintContent(Container, Item[], int, int, int, int, int, int, int, int, Graphics)
protected void paintContent(Container container,
Item[] myItems,
int x,
int y,
int leftBorder,
int rightBorder,
int clipX,
int clipY,
int clipWidth,
int clipHeight,
javax.microedition.lcdui.Graphics g)
container - the parent containermyItems - the items that should be paintedx - 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 positionclipX - absolute horizontal clipping startclipY - absolute verical clipping startclipWidth - clipping widthclipHeight - clipping heightg - the Graphics on which this item should be painted.
protected void paintItem(Item item,
int index,
int x,
int y,
int leftBorder,
int rightBorder,
int clipX,
int clipY,
int clipWidth,
int clipHeight,
javax.microedition.lcdui.Graphics g)
item - the item that needs to be paintedindex - the index of the itemx - the horizontal position of the itemy - the vertical position of the itemleftBorder - the left borderrightBorder - the right borderclipX - absolute horizontal clipping startclipY - absolute verical clipping startclipWidth - clipping widthclipHeight - clipping heightg - the graphics context
protected Item getNextItem(int keyCode,
int gameAction)
keyCode - the code of the keyPressed-eventsgameAction - the associated game-action to the given keyCode
protected Item shiftFocus(boolean forwardFocus,
int steps,
Item[] items)
forwardFocus - true when the next item should be focused, false when
the previous item should be focused.steps - how many steps forward or backward the search for the next focusable item should be started,
0 for the current item, negative values go backwards.items - the items of this view
protected boolean isInBottomRow(int index)
index - the item's index
protected void focusItem(int index,
Item item)
index - the index of the itemitem - the item which should be focusedfocusItem(int, Item, int)
protected void focusItem(int index,
Item item,
int direction)
index - the index of the itemitem - the item which should be focuseddirection - the direction, either Canvas.DOWN, Canvas.RIGHT, Canvas.UP, Canvas.LEFT or 0.protected void setStyle(Style style)
setStyle in class ItemViewstyle - the style
protected Item getNextFocusableItem(Item[] items,
boolean forward,
int steps,
boolean allowCircle)
items - the available itemsforward - true when a following item should be looked for,
false if a previous item should be looked for.steps - the number of steps which should be used (e.g. 2 in a table with two columns)allowCircle - true when either the first focusable or the last focusable element
should be returned when there is no focusable item in the given direction.
focusItem(int, Item)public void showNotify()
showNotify in class ItemViewprotected Screen getScreen()
getScreen in class ItemView
public boolean handleKeyPressed(int keyCode,
int gameAction)
handleKeyPressed in class ItemViewkeyCode - the key codegameAction - the game action like Canvas.UP etc
protected void scroll(int direction,
int x,
int y,
int width,
int height)
direction - the direction, is used for adjusting the scrolling when the internal area is to large. Either 0 or Canvas.UP, Canvas.DOWN, Canvas.LEFT or Canvas.RIGHTx - the horizontal position of the area relative to this content's left edge, is ignored in the current versiony - the vertical position of the area relative to this content's top edgewidth - the width of the areaheight - the height of the areaprotected int getParentRelativeY()
protected int getItemRelativeY(Item item)
protected boolean isValid(Item parent,
Style style)
ItemView
isValid in class ItemViewparent - the parent itemstyle - the style
public Style focusItem(int index,
Item item,
int direction,
Style focusedStyle)
index - the index of the itemitem - the item which should be focuseddirection - the direction, either Canvas.DOWN, Canvas.RIGHT, Canvas.UP, Canvas.LEFT or 0.focusedStyle - the new style for the focused item
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||