de.enough.polish.ui
Class Container

java.lang.Object
  extended by de.enough.polish.ui.Item
      extended by de.enough.polish.ui.Container
All Implemented Interfaces:
Animatable, UiElement
Direct Known Subclasses:
ChoiceGroup, Keyboard, VideoContainer

public class Container
extends Item

Contains a number of items.

Main purpose is to manage all items of a Form or similar canvases.

Containers support following additional CSS attributes:

Copyright Enough Software 2004 - 2011

Author:
Robert Virkus, robert@enough.de

Field Summary
 boolean allowCycling
          specifies whether this container is allowed to cycle to the beginning when the last item has been reached
protected  boolean autoFocusEnabled
          defines whether a child item should be automatically focused.
protected  int autoFocusIndex
           
protected  ContainerView containerView
           
protected  boolean enableScrolling
           
protected  Style focusAllStyle
           
 int focusedIndex
          the index of the currently focused item - please use only for reading, not for setting, unless you know what you are doing
protected  Item focusedItem
           
protected  Style focusedStyleFirst
           
protected  Style focusedStyleLast
           
protected  boolean isExpandItems
           
protected  ArrayList itemsList
           
protected  Style itemStyle
           
protected  long lastPointerPressTime
          time in ms when this container was pressed the last time
protected  int lastPointerPressY
          vertical pointer position when it was pressed the last time
protected  int lastPointerPressYOffset
          scrolloffset when this container was pressed the last time
protected  Style plainStyle
           
static int SCROLL_DEFAULT
          constant for normal scrolling (0)
static int SCROLL_SMOOTH
          constant for smooth scrolling (1)
protected  int scrollHeight
          The height available for scrolling, ignore when set to -1
protected  boolean scrollSmooth
           
protected  int targetYOffset
           
protected  int yOffset
           
 
Fields inherited from class de.enough.polish.ui.Item
_androidView, _bbField, appearanceMode, availableHeight, availableWidth, availContentHeight, availContentWidth, background, backgroundHeight, backgroundWidth, backgroundYOffset, bgBorder, border, BUTTON, cacheItemImage, colSpan, commands, completeBackground, completeBackgroundPadding, completeBorder, contentHeight, contentWidth, contentX, contentXAdjustment, contentY, contentYAdjustment, cssHeight, cssSelector, cssWidth, defaultCommand, focusedStyle, HORIZONTAL, HYPERLINK, ignoreRepaintRequests, includeLabel, INTERACTIVE, internalHeight, internalWidth, internalX, internalY, isContentVisible, isFocused, isInlineLabel, isInvisible, isJustFocused, isLayoutCenter, isLayoutExpand, isLayoutRight, isPressed, isShown, isStyleInitialized, itemCommandListener, itemHeight, itemWidth, label, labelStyle, landscapeStyle, layout, LAYOUT_2, LAYOUT_BOTTOM, LAYOUT_CENTER, LAYOUT_DEFAULT, LAYOUT_EXPAND, LAYOUT_LEFT, LAYOUT_NEWLINE_AFTER, LAYOUT_NEWLINE_BEFORE, LAYOUT_RIGHT, LAYOUT_SHRINK, LAYOUT_TOP, LAYOUT_VCENTER, LAYOUT_VEXPAND, LAYOUT_VSHRINK, marginBottom, marginLeft, marginRight, marginTop, maximumHeight, maximumItemHeight, maximumItemWidth, maximumWidth, minimumHeight, minimumItemHeight, minimumItemWidth, minimumWidth, nativeItem, NO_POSITION_SET, opacity, opacityPaintNormally, opacityRgbData, paddingBottom, paddingHorizontal, paddingLeft, paddingRight, paddingTop, paddingVertical, parent, PLAIN, portraitStyle, preferredHeight, preferredWidth, preserveViewType, relativeX, relativeY, rowSpan, screen, setView, style, TRANSPARENT, useSingleRow, VERTICAL, view, xAdjustment, yAdjustment
 
Constructor Summary
Container()
          Creates a new empty container.
Container(boolean focusFirstElement)
          Creates a new empty container.
Container(boolean focusFirstElement, Style style)
          Creates a new empty container.
Container(String label, boolean focusFirstElement, Style style, int height)
          Creates a new empty container.
Container(Style style)
          Creates a new empty container with the specified style.
 
Method Summary
 void add(int index, Item item)
          Inserts the given item at the defined position.
 void add(int index, Item item)
          Inserts an item
 void add(Item item)
          Adds an item to this container.
 void add(Item item)
          Adds an item
 void add(Item item, Style itemAddStyle)
          Adds an item to this container.
 void add(String text)
          Adds an StringItem with the given text to this container.
 void add(String text, Style textAddStyle)
          Adds an StringItem with the given text to this container.
 void addRepaintArea(ClippingRegion repaintRegion)
          Adds a repaint request for this item's space.
 void animate(long currentTime, ClippingRegion repaintRegion)
          Animates this item.
 void changeChildStyles(String oldChildStyleName, String newChildStyleName)
          Changes the style of all children that are currently using the specified oldChildStyle with the given newChildStyle.
 void changeChildStyles(Style oldChildStyle, Style newChildStyle)
          Changes the style of all children that are currently using the specified oldChildStyle with the given newChildStyle.
 void clear()
          Removes all items from this container.
 boolean contains(Item item)
          Checks if this container includes the specified item
protected  String createCssSelector()
          Retrieves the CSS selector for this item.
 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 focusStyle, int direction)
          Focuses this item.
 boolean focusChild(int index)
          Focuses the specified item.
 void focusChild(int index, Item item, int direction, boolean force)
          Sets the focus to the given item.
 boolean focusClosestItem(int index)
          Focuses the next focussable item starting at the specified index +/- 1.
 boolean focusClosestItemAbove(int index)
          Focuses the next focussable item starting at the specified index + 1.
 Item get(int index)
          Returns the item at the specified position of this container.
 Item getChildAt(int relX, int relY)
          Retrieves the child of this container at the corresponding position.
protected  Item getChildAtImpl(int relX, int relY)
          Actual implementation for finding a child, can be used by ContainerViews.
protected  int getChildHeight(Item item)
          Queries the height of an child item of this container.
protected  int getChildWidth(Item item)
          Queries the width of an child item of this container.
 int getCurrentScrollYOffset()
          Retrieves the current vertical scrolling offset of this item, depending on the scroll mode this can change with every paint iteration.
 Item getFocusedChild()
          Recursively returns the focused child item of this Container or of the currently focused child Container.
 int getFocusedIndex()
          Retrieves the index of the item which is currently focused.
 Item getFocusedItem()
          Retrieves the currently focused item.
protected  Style getFocusedStyle(int index, Item item)
          Retrieves the best matching focus style for the given item
 FocusListener getFocusListener()
          Retrieves the focus listener
 Object[] getInternalArray()
          Retrieves the internal array with all managed items embedded in this container, some entries might be null.
 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.
 Item[] getItems()
          Retrieves all items which this container holds.
 int getNumberOfInteractiveItems()
          Calculates the number of interactive items included in this container.
 int getPosition(Item item)
          Retrieves the position of the specified item.
 int getRelativeScrollYOffset()
          Retrieves the vertical scrolling offset of this item relative to the top most container.
 int getScrollHeight()
          Returns the available height for scrolling either from this container or from it's parent container.
 int getScrollYOffset()
          Retrieves the vertical scrolling offset of this item.
 Object getSynchronizationLock()
          Retrieves the synchronization lock for this container.
 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 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 handleNavigate(int keyCode, int gameAction)
          Handles a keyPressed or keyRepeated event for navigating in the container.
 void handleOnFocusSoftKeyboardDisplayBehavior()
          Handles the behavior of the virtual keyboard when the item is focused.
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.
protected  boolean handlePointerScrollReleased(int relX, int relY)
          Allows subclasses to check if a pointer release event is used for scrolling the container.
 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.
 int indexOf(Item item)
          Retrieves the index of the specified item.
protected  void initContent(int firstLineWidth, int availWidth, int availHeight)
          Initialises this item.
protected  void initLayout(Style style, int availWidth)
          Initializes paddings and margins.
protected  void initMargin(Style style, int availWidth)
          Initializes the margin of this item Subclasses can override this (e.g.
 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.
protected  boolean isItemVisible(int verticalMin, int verticalMax, int itemTop, int itemBottom, boolean full)
          Returns true if the given item top and bottom offset is inside the given vertical minimum and maximum offset.
 boolean isScrolling()
          Determines whether this container or one of its parent containers is currently being scrolled
 boolean isVerticalLayout()
          Checks if this container arranges its child items vertically.
 void notifyItemPressedEnd()
          Is called when an item is pressed
 boolean notifyItemPressedStart()
          Is called when an item is pressed using the FIRE game action
 void onScreenSizeChanged(int screenWidth, int screenHeight)
          Notifies this item about a new screen size.
protected  void paintBackgroundAndBorder(int x, int y, int width, int height, Graphics g)
          Paints the background and border of this item.
protected  void paintContent(int x, int y, int leftBorder, int rightBorder, Graphics g)
          Paints the content of this item.
 String parseIndexUrl(String url, Item item)
          Parses the given URL and includes the index of the item, when there is an "%INDEX%" within the given url.
 void releaseResources()
          Releases all (memory intensive) resources such as images or RGB arrays of this background.
 Item remove(int index)
          Removes the item at the specified position of this container.
 boolean remove(Item item)
          Removes the given item.
 void requestDefocus(Item item)
          Moves the focus away from the specified item.
 void requestFullInit()
          Requests the initialization of this container and all of its children items.
 void resetLastPointerPressYOffset()
          Resets the pointer press y offset which is used for starting scrolling processes.
 void resetStyle(boolean recursive)
          Resets the style of this item and all its children (if any).
protected  boolean 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  boolean scroll(int direction, int x, int y, int width, int height, boolean force)
          Adjusts the yOffset or the targetYOffset so that the given relative values are inside of the visible area.
 boolean scroll(int direction, Item item, boolean force)
          Scrolls this container so that the (internal) area of the given item is best seen.
 void scrollToBottom()
          Scrolls this container so that its last item is visible.
 void scrollToTop()
          Scrolls this container so that its first item is visible.
 void set(int index, Item item)
          Replaces an item
 Item set(int index, Item item)
          Replaces the item at the specified position in this list with the given item.
 Item set(int index, Item item, Style itemStyle)
          Replaces the item at the specified position in this list with the given item.
 void setAppearanceMode(int appearanceMode)
          Sets the appearance mode of this item.
protected  void setAutoFocusEnabled(boolean enable)
          Enables or disables the auto focus of this container
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 setFocusListener(FocusListener listener)
          Sets the focus listener.
 void setItemsList(ArrayList itemsList)
          Sets a list of items for this container.
 void setItemWidth(int width)
          Sets the item's complete width
 void setScrollHeight(int height)
          Sets the height available for scrolling of this item.
 void setScrollYOffset(int offset)
          Sets the vertical scrolling offset of this item.
 void setScrollYOffset(int offset, boolean smooth)
          Sets the vertical scrolling offset of this item.
 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 setStyleWithBackground(Style style, boolean ignoreBackground)
          Sets the style of this container.
 void setView(ItemView view)
          Sets the view type for 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.
 int size()
          Retrieves the number of items stored in this container.
 void startScroll(int direction, int speed, int damping)
          Starts to scroll in the specified direction
 String toString()
          Generates a String representation of this item.
protected  void updateInternalPosition(Item item)
          Updates the internal position of this container according to the specified item's one
 
Methods inherited from class de.enough.polish.ui.Item
addCommand, addCommand, addCommand, addCommands, addRelativeToBackgroundRegion, addRelativeToBackgroundRegion, addRelativeToContentRegion, animate, containsCommand, fireContinueCycle, getAbsoluteX, getAbsoluteY, getAfterWidthWithPadding, getAppearanceMode, getAttribute, getAttributes, getAvailableContentHeight, getAvailableContentWidth, getAvailableHeight, getAvailableWidth, getBackgroundHeight, getBackgroundWidth, getBackgroundX, getBackgroundY, getBeforeWidthWithPadding, getBorderWidthBottom, getBorderWidthLeft, getBorderWidthRight, getBorderWidthTop, getContentHeight, getContentWidth, getContentX, getContentY, getCycleListener, getDefaultCommand, getFocusedStyle, getInternalHeight, getInternalWidth, getInternalX, getInternalY, getItemCommandListener, getItemCommands, getItemHeight, getItemHeight, getItemStateListener, getItemWidth, getItemWidth, getLabel, getLabelItem, getLayout, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMaximumHeight, getMaximumHeight, getMaximumWidth, getMaximumWidth, getMinimumHeight, getMinimumHeight, getMinimumWidth, getMinimumWidth, getNativeItem, getPaddingBottom, getPaddingHorizontal, getPaddingLeft, getPaddingRight, getPaddingTop, getPaddingVertical, getParent, getParentRoot, getpreferredHeight, getpreferredWidth, getRgbData, getRgbData, getScreen, getStyle, getUiEventListener, handleCommand, handleGesture, handleGestureHold, handleGestureSwipeLeft, handleGestureSwipeRight, init, initPadding, initStyle, isFocused, isInContentArea, isInContentWithPaddingArea, isInItemArea, isInitialized, isInteractive, isLayoutBottom, isLayoutCenter, isLayoutExpand, isLayoutLeft, isLayoutNewlineAfter, isLayoutNewlineBefore, isLayoutRight, isLayoutShrink, isLayoutTop, isLayoutVerticalCenter, isLayoutVerticalExpand, isLayoutVerticalShrink, isPressed, isSameRowForContentAndLabel, isVisible, notifyStateChanged, notifyUnvisited, notifyValueChanged, notifyVisited, paint, paintBackground, paintBorder, paintCommands, paintFilter, removeAttribute, removeCommand, repaint, repaint, repaintFully, requestInit, setAbsoluteY, setAttribute, setBackground, setBorder, setCycleListener, setDefaultCommand, setDefaultCommand, setInitialized, setItemCommandListener, setItemCommandListener, setItemHeight, setItemStateListener, setItemTransition, setLabel, setLayout, setNativeItem, setParent, setParent, setpreferredSize, setSameRowForContentAndLabel, setStyle, setUiEventListener, setVisible, show, show, toImage, toRgbImage, updateInternalArea
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCROLL_DEFAULT

public static final int SCROLL_DEFAULT
constant for normal scrolling (0)

See Also:
Constant Field Values

SCROLL_SMOOTH

public static final int SCROLL_SMOOTH
constant for smooth scrolling (1)

See Also:
Constant Field Values

itemsList

protected ArrayList itemsList

autoFocusEnabled

protected boolean autoFocusEnabled
defines whether a child item should be automatically focused. Please do no set directly, instead use setAutoFocusEnabled(boolean).

See Also:
setAutoFocusEnabled(boolean)

autoFocusIndex

protected int autoFocusIndex

itemStyle

protected Style itemStyle

focusedItem

protected Item focusedItem

focusedIndex

public int focusedIndex
the index of the currently focused item - please use only for reading, not for setting, unless you know what you are doing


enableScrolling

protected boolean enableScrolling

allowCycling

public boolean allowCycling
specifies whether this container is allowed to cycle to the beginning when the last item has been reached


yOffset

protected int yOffset

targetYOffset

protected int targetYOffset

containerView

protected ContainerView containerView

scrollSmooth

protected boolean scrollSmooth

isExpandItems

protected boolean isExpandItems

lastPointerPressY

protected int lastPointerPressY
vertical pointer position when it was pressed the last time


lastPointerPressYOffset

protected int lastPointerPressYOffset
scrolloffset when this container was pressed the last time


lastPointerPressTime

protected long lastPointerPressTime
time in ms when this container was pressed the last time


focusedStyleFirst

protected Style focusedStyleFirst

focusedStyleLast

protected Style focusedStyleLast

scrollHeight

protected int scrollHeight
The height available for scrolling, ignore when set to -1


plainStyle

protected Style plainStyle

focusAllStyle

protected Style focusAllStyle
Constructor Detail

Container

public Container()
Creates a new empty container.


Container

public Container(Style style)
Creates a new empty container with the specified style.

Parameters:
style - the style for this container

Container

public Container(boolean focusFirstElement)
Creates a new empty container.

Parameters:
focusFirstElement - true when the first focussable element should be focused automatically.

Container

public Container(boolean focusFirstElement,
                 Style style)
Creates a new empty container.

Parameters:
focusFirstElement - true when the first focussable element should be focused automatically.
style - the style for this container

Container

public Container(String label,
                 boolean focusFirstElement,
                 Style style,
                 int height)
Creates a new empty container.

Parameters:
label - the label of this container
focusFirstElement - true when the first focusable element should be focused automatically.
style - the style for this container
height - the vertical space available for this container, set to -1 when scrolling should not be activated
See Also:
setScrollHeight( int )
Method Detail

setScrollHeight

public void setScrollHeight(int height)
Sets the height available for scrolling of this item.

Parameters:
height - available height for this item including label, padding, margin and border, -1 when scrolling should not be done.

getScrollHeight

public int getScrollHeight()
Returns the available height for scrolling either from this container or from it's parent container. Note that the height available for this container might differ from the returned value.

Returns:
the available vertical space or -1 when it is not known.
See Also:
getContentScrollHeight()

add

public void add(String text)
Adds an StringItem with the given text to this container.

Parameters:
text - the text
Throws:
IllegalArgumentException - when the given item is null

add

public void add(String text,
                Style textAddStyle)
Adds an StringItem with the given text to this container.

Parameters:
text - the text
textAddStyle - the style for the text
Throws:
IllegalArgumentException - when the given item is null

add

public void add(Item item)
Adds an item to this container.

Parameters:
item - the item which should be added.
Throws:
IllegalArgumentException - when the given item is null

add

public void add(Item item,
                Style itemAddStyle)
Adds an item to this container.

Parameters:
item - the item which should be added.
itemAddStyle - the style for the item
Throws:
IllegalArgumentException - when the given item is null

add

public void add(int index,
                Item item)
Inserts the given item at the defined position. Any following elements are shifted one position to the back.

Parameters:
index - the position at which the element should be inserted, use 0 when the element should be inserted in the front of this list.
item - the item which should be inserted
Throws:
IllegalArgumentException - when the given item is null
IndexOutOfBoundsException - when the index < 0 || index >= size()

add

public void add(Item item)
Adds an item

Parameters:
item - the item to be added

add

public void add(int index,
                Item item)
Inserts an item

Parameters:
index - the index
item - the item

set

public void set(int index,
                Item item)
Replaces an item

Parameters:
index - the index
item - the item to be added

set

public Item set(int index,
                Item item)
Replaces the item at the specified position in this list with the given item.

Parameters:
index - the position of the element, the first element has the index 0.
item - the item which should be set
Returns:
the replaced item
Throws:
IndexOutOfBoundsException - when the index < 0 || index >= size()

set

public Item set(int index,
                Item item,
                Style itemStyle)
Replaces the item at the specified position in this list with the given item.

Parameters:
index - the position of the element, the first element has the index 0.
item - the item which should be set
itemStyle - the new style for the item
Returns:
the replaced item
Throws:
IndexOutOfBoundsException - when the index < 0 || index >= size()

get

public Item get(int index)
Returns the item at the specified position of this container.

Parameters:
index - the position of the desired item.
Returns:
the item stored at the given position
Throws:
IndexOutOfBoundsException - when the index < 0 || index >= size()

remove

public Item remove(int index)
Removes the item at the specified position of this container.

Parameters:
index - the position of the desired item.
Returns:
the item stored at the given position
Throws:
IndexOutOfBoundsException - when the index < 0 || index >= size()

focusClosestItemAbove

public boolean focusClosestItemAbove(int index)
Focuses the next focussable item starting at the specified index + 1.

Parameters:
index - the index of the item that should be used as a starting point for the search of a new possible focussable item
Returns:
true when the focus could be set, when false is returned autofocus will be enabled instead

focusClosestItem

public boolean focusClosestItem(int index)
Focuses the next focussable item starting at the specified index +/- 1.

Parameters:
index - the index of the item that should be used as a starting point for the search of a new possible focussable item
Returns:
true when the focus could be set, when false is returned autofocus will be enabled instead

remove

public boolean remove(Item item)
Removes the given item.

Parameters:
item - the item which should be removed.
Returns:
true when the item was found in this list.
Throws:
IllegalArgumentException - when the given item is null

clear

public void clear()
Removes all items from this container.


size

public int size()
Retrieves the number of items stored in this container.

Returns:
The number of items stored in this container.

getItems

public Item[] getItems()
Retrieves all items which this container holds. The items might not have been intialised.

Returns:
an array of all items, can be empty but not null.

setFocusListener

public void setFocusListener(FocusListener listener)
Sets the focus listener.

Parameters:
listener - the new listener, use null to remove an existing listener.
See Also:
getFocusListener()

getFocusListener

public FocusListener getFocusListener()
Retrieves the focus listener

Returns:
the listener, may be null
See Also:
setFocusListener(FocusListener)

focusChild

public boolean focusChild(int index)
Focuses the specified item.

Parameters:
index - the index of the item. The first item has the index 0, when -1 is given, the focus will be removed altogether
Returns:
true when the specified item could be focused. It needs to have an appearanceMode which is not Item.PLAIN to be focusable.

focusChild

public void focusChild(int index,
                       Item item,
                       int direction,
                       boolean force)
Sets the focus to the given item.

Parameters:
index - the position
item - the item which should be focused
direction - the direction, either Canvas.DOWN, Canvas.RIGHT, Canvas.UP, Canvas.LEFT or 0.
force - true when the child should be focused again even though is has been focused before

getChildWidth

protected int getChildWidth(Item item)
Queries the width of an child item of this container. This allows subclasses to control the possible re-initialization that is happening here. Also ContainerViews can override the re-initialization in their respective getChildWidth() method.

Parameters:
item - the child item
Returns:
the width of the child item
See Also:
getChildHeight(Item), ContainerView.getChildWidth(Item)

getChildHeight

protected int getChildHeight(Item item)
Queries the height of an child item of this container. This allows subclasses to control the possible re-initialization that is happening here. Also ContainerViews can override the re-initialization in their respective getChildHeight() method.

Parameters:
item - the child item
Returns:
the height of the child item
See Also:
getChildHeight(Item), ContainerView.getChildHeight(Item)

getFocusedStyle

protected Style getFocusedStyle(int index,
                                Item item)
Retrieves the best matching focus style for the given item

Parameters:
index - the index of the item
item - the item
Returns:
the matching focus style

scroll

public boolean scroll(int direction,
                      Item item,
                      boolean force)
Scrolls this container so that the (internal) area of the given item is best seen. This is used when a GUI even has been consumed by the currently focused item. The call is fowarded to scroll( direction, x, y, w, h ).

Parameters:
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.RIGHT
item - the item for which the scrolling should be adjusted
Returns:
true when the container was scrolled

scroll

protected boolean 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. The call is forwarded to a parent container when scrolling is not enabled for this item.

Parameters:
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.RIGHT
x - the horizontal position of the area relative to this content's left edge, is ignored in the current version
y - the vertical position of the area relative to this content's top edge
width - the width of the area
height - the height of the area
Returns:
true when the scroll request changed the internal scroll offsets

scroll

protected boolean scroll(int direction,
                         int x,
                         int y,
                         int width,
                         int height,
                         boolean force)
Adjusts the yOffset or the targetYOffset so that the given relative values are inside of the visible area. The call is forwarded to a parent container when scrolling is not enabled for this item.

Parameters:
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.RIGHT
x - the horizontal position of the area relative to this content's left edge, is ignored in the current version
y - the vertical position of the area relative to this content's top edge
width - the width of the area
height - the height of the area
force - true when the area should be shown regardless where the the current scrolloffset is located
Returns:
true when the scroll request changed the internal scroll offsets

setAppearanceMode

public void setAppearanceMode(int appearanceMode)
Description copied from class: Item
Sets the appearance mode of this item.

Overrides:
setAppearanceMode in class Item
Parameters:
appearanceMode - the mode value, one of Item.PLAIN, Item.HYPERLINK, or Item.BUTTON

initLayout

protected void initLayout(Style style,
                          int availWidth)
Description copied from class: Item
Initializes paddings and margins.

Overrides:
initLayout in class Item
Parameters:
style - the style of this item
availWidth - the available width in case paddings or margins include relative values

getSynchronizationLock

public Object getSynchronizationLock()
Retrieves the synchronization lock for this container. As a lock either the internal ArrayList for items is used or the paint lock of the screen when this container is associated with a screen. The lock can be used manipulate a Container that is currently displayed

Returns:
the synchronization lock
See Also:
Screen.getPaintLock(), add(Item)

initContent

protected void initContent(int firstLineWidth,
                           int availWidth,
                           int availHeight)
Description copied from class: Item
Initialises this item. The implementation needs to calculate and set the contentWidth and contentHeight fields. The implementation should take the fields preferredWidth and preferredHeight into account.

Specified by:
initContent in class Item
Parameters:
firstLineWidth - the maximum width of the first line
availWidth - the available maximum width of this item in pixels
availHeight - the available maximum height of this item in pixels
See Also:
Item.contentWidth, Item.contentHeight, Item.preferredWidth, Item.preferredHeight

setAutoFocusEnabled

protected void setAutoFocusEnabled(boolean enable)
Enables or disables the auto focus of this container

Parameters:
enable - true when autofocus should be enabled

updateInternalPosition

protected void updateInternalPosition(Item item)
Updates the internal position of this container according to the specified item's one

Parameters:
item - the (assumed focused) item

setContentWidth

protected void setContentWidth(int width)
Description copied from class: Item
Sets the content width of this item. Subclasses can override this to react to content width changes

Overrides:
setContentWidth in class Item
Parameters:
width - the new content width in pixel

setContentHeight

protected void setContentHeight(int height)
Description copied from class: Item
Sets the content height of this item. Subclasses can override this to react to content height changes

Overrides:
setContentHeight in class Item
Parameters:
height - the new content height in pixel

setItemWidth

public void setItemWidth(int width)
Description copied from class: Item
Sets the item's complete width

Overrides:
setItemWidth in class Item
Parameters:
width - the width in pixel

paintContent

protected void paintContent(int x,
                            int y,
                            int leftBorder,
                            int rightBorder,
                            Graphics g)
Description copied from class: Item
Paints the content of this item. The background has already been painted and the border will be added after this method returns.

Specified by:
paintContent in class Item
Parameters:
x - the left start position
y - the upper start position
leftBorder - the left border, nothing must be painted left of this position
rightBorder - the right border, nothing must be painted right of this position
g - the Graphics on which this item should be painted.

paintBackgroundAndBorder

protected void paintBackgroundAndBorder(int x,
                                        int y,
                                        int width,
                                        int height,
                                        Graphics g)
Description copied from class: Item
Paints the background and border of this item. The call is forwarded to paintBackground() and paintBorder().

Overrides:
paintBackgroundAndBorder in class Item
Parameters:
x - the horizontal start position
y - the vertical start position
width - the width
height - the height
g - graphics context
See Also:
Item.paintBackground(int, int, int, int, Graphics), Item.paintBorder(int, int, int, int, Graphics)

createCssSelector

protected String createCssSelector()
Description copied from class: Item
Retrieves the CSS selector for this item. The CSS selector is used for the dynamic assignment of styles - that is the styles are assigned by the usage of the item and not by a predefined style-name. With the #style preprocessing command styles are set fix, this method yields in a faster GUI and is recommended. When in a style-sheet dynamic styles are used, e.g. "Form>p", than the selector of the item is needed.
This abstract method needs only be implemented, when dynamic styles are used: #ifdef polish.useDynamicStyles
The returned selector needs to be in lower case.

Specified by:
createCssSelector in class Item
Returns:
the appropriate CSS selector for this item. The selector needs to be in lower case.

handleKeyPressed

protected boolean handleKeyPressed(int keyCode,
                                   int gameAction)
Description copied from class: Item
Handles the key-pressed event. Please note, that implementation should first try to handle the given key-code, before the game-action is processed. The default implementation just handles the FIRE game-action when a default-command and an item-command-listener have been registered.

Overrides:
handleKeyPressed in class Item
Parameters:
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2
gameAction - the corresponding game-action, e.g. Canvas.UP
Returns:
true when the key has been handled / recognized

handleNavigate

protected boolean handleNavigate(int keyCode,
                                 int gameAction)
Handles a keyPressed or keyRepeated event for navigating in the container.

Parameters:
keyCode - the code of the keypress/keyrepeat event
gameAction - the associated game action
Returns:
true when the key was handled

handleKeyReleased

protected boolean handleKeyReleased(int keyCode,
                                    int gameAction)
Description copied from class: Item
Handles the key-released event. Please note, that implementation should first try to handle the given key-code, before the game-action is processed. The default implementation invokes the default command if one is present

Overrides:
handleKeyReleased in class Item
Parameters:
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2
gameAction - the corresponding game-action, e.g. Canvas.UP
Returns:
true when the key has been handled / recognized
See Also:
Item.handleKeyPressed(int, int)

handleKeyRepeated

protected boolean handleKeyRepeated(int keyCode,
                                    int gameAction)
Description copied from class: Item
Handles the key-repeated event. Please note, that implementation should first try to handle the given key-code, before the game-action is processed. The default implementation forwards the event to the handleKeyPressed method.

Overrides:
handleKeyRepeated in class Item
Parameters:
keyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2
gameAction - the corresponding game-action, e.g. Canvas.UP
Returns:
true when the key has been handled / recognized
See Also:
Item.handleKeyPressed(int, int)

isItemVisible

protected boolean isItemVisible(int verticalMin,
                                int verticalMax,
                                int itemTop,
                                int itemBottom,
                                boolean full)
Returns true if the given item top and bottom offset is inside the given vertical minimum and maximum offset.

Parameters:
verticalMin - the vertical minimum offset
verticalMax - the vertical maximum offset
itemTop - the item top offset
itemBottom - the item bottom offset
full - true if the item must fit completly into the given vertical offsets otherwise false
Returns:
true if the item fits into the given vertical offsets otherwise false

getFocusedIndex

public int getFocusedIndex()
Retrieves the index of the item which is currently focused.

Returns:
the index of the focused item, -1 when none is focused.

getFocusedItem

public Item getFocusedItem()
Retrieves the currently focused item.

Returns:
the currently focused item, null when there is no focusable item in this container.

setStyle

public void setStyle(Style style)
Description copied from class: Item
Sets the style of this item.

Specified by:
setStyle in interface UiElement
Overrides:
setStyle in class Item
Parameters:
style - the new style for this item.

setStyleWithBackground

public void setStyleWithBackground(Style style,
                                   boolean ignoreBackground)
Sets the style of this container.

Parameters:
style - the style
ignoreBackground - when true is given, the background and border-settings will be ignored.

setStyle

public void setStyle(Style style,
                     boolean resetStyle)
Description copied from class: Item
Sets the style of this item for animatable CSS attributes.

Specified by:
setStyle in interface UiElement
Overrides:
setStyle in class Item
Parameters:
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.

resetStyle

public void resetStyle(boolean recursive)
Description copied from class: Item
Resets the style of this item and all its children (if any). This is useful when you have applied changes to this Item's style or one of its elements.

Overrides:
resetStyle in class Item
Parameters:
recursive - true when all subelements of this Item should reset their style as well.
See Also:
Screen.resetStyle(boolean), UiAccess.resetStyle(Screen,boolean), UiAccess.resetStyle(Item,boolean)

changeChildStyles

public void changeChildStyles(String oldChildStyleName,
                              String newChildStyleName)
Changes the style of all children that are currently using the specified oldChildStyle with the given newChildStyle.

Parameters:
oldChildStyleName - the name of the style of child items that should be exchanged
newChildStyleName - the name of the new style for child items that were using the specified oldChildStyle before
Throws:
IllegalArgumentException - if no corresponding newChildStyle could be found
See Also:
StyleSheet.getStyle(String)

changeChildStyles

public void changeChildStyles(Style oldChildStyle,
                              Style newChildStyle)
Changes the style of all children that are currently using the specified oldChildStyle with the given newChildStyle.

Parameters:
oldChildStyle - the style of child items that should be exchanged
newChildStyle - the new style for child items that were using the specified oldChildStyle before
Throws:
IllegalArgumentException - if newChildStyle is null

parseIndexUrl

public String parseIndexUrl(String url,
                            Item item)
Parses the given URL and includes the index of the item, when there is an "%INDEX%" within the given url.

Parameters:
url - the resource URL which might include the substring "%INDEX%"
item - the item to which the URL belongs to. The item must be included in this container.
Returns:
the URL in which the %INDEX% is substituted by the index of the item in this container. The url "icon%INDEX%.png" is resolved to "icon1.png" when the item is the second item in this container.
Throws:
NullPointerException - when the given url or item is null

getPosition

public int getPosition(Item item)
Retrieves the position of the specified item.

Parameters:
item - the item
Returns:
the position of the item, or -1 when it is not defined

focus

protected Style focus(Style focusStyle,
                      int direction)
Description copied from class: Item
Focuses this item.

Overrides:
focus in class Item
Parameters:
focusStyle - the style which is used to indicate the focused state
direction - 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.
Returns:
the current style of this item

defocus

public void defocus(Style originalStyle)
Description copied from class: Item
Removes the focus from this item.

Overrides:
defocus in class Item
Parameters:
originalStyle - the original style which will be restored.

showCommands

public void showCommands()
Description copied from class: Item
Shows the commands on the screen.

Overrides:
showCommands in class Item

handleCommand

protected boolean handleCommand(Command cmd)
Description copied from class: Item
Tries to handle the specified command. The item checks if the command belongs to this item and if it has an associated ItemCommandListener. Only then it handles the command.

Overrides:
handleCommand in class Item
Parameters:
cmd - the command
Returns:
true when the command has been handled by this item

animate

public void animate(long currentTime,
                    ClippingRegion repaintRegion)
Description copied from class: Item
Animates this item. Subclasses can override this method to create animations. The default implementation animates the background and the item view if present.

Specified by:
animate in interface Animatable
Overrides:
animate in class Item
Parameters:
currentTime - the current time in milliseconds
repaintRegion - the repaint area that needs to be updated when this item is animated
See Also:
Item.addRelativeToContentRegion(ClippingRegion, int, int, int, int)

addRepaintArea

public void addRepaintArea(ClippingRegion repaintRegion)
Description copied from class: Item
Adds a repaint request for this item's space.

Specified by:
addRepaintArea in interface UiElement
Overrides:
addRepaintArea in class Item
Parameters:
repaintRegion - the clipping rectangle to which the repaint area should be added

showNotify

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. The item may receive paint() calls after showNotify() has been called.

The container implementation calls showNotify() on the embedded items.

Overrides:
showNotify in class Item

hideNotify

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. No further paint() calls will be made on this item until after a showNotify() has been called again.

The container implementation calls hideNotify() on the embedded items.

Overrides:
hideNotify in class Item

handlePointerPressed

protected boolean handlePointerPressed(int relX,
                                       int relY)
Description copied from class: Item
Handles the event when a pointer has been pressed at the specified position. The default method discards this event when relX/relY is outside of the item's area. When the event took place inside of the content area, the pointer-event is translated into an artificial FIRE game-action keyPressed event, which is subsequently handled by the handleKeyPressed(-1, Canvas.FIRE) method. This method needs should be overwritten only when the "polish.hasPointerEvents" preprocessing symbol is defined: "//#ifdef polish.hasPointerEvents".

Overrides:
handlePointerPressed in class Item
Parameters:
relX - the x position of the pointer pressing relative to this item's left position
relY - the y position of the pointer pressing relative to this item's top position
Returns:
true when the pressing of the pointer was actually handled by this item.
See Also:
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)

handlePointerScrollReleased

protected boolean handlePointerScrollReleased(int relX,
                                              int relY)
Allows subclasses to check if a pointer release event is used for scrolling the container. This method can only be called when polish.hasPointerEvents is true.

Parameters:
relX - the x position of the pointer pressing relative to this item's left position
relY - the y position of the pointer pressing relative to this item's top position

handleOnFocusSoftKeyboardDisplayBehavior

public void handleOnFocusSoftKeyboardDisplayBehavior()
Handles the behavior of the virtual keyboard when the item is focused. By defaukt, the virtual keyboard is hidden. Components which need to have the virtual keyboard shown when they are focused can override this method.

Overrides:
handleOnFocusSoftKeyboardDisplayBehavior in class Item

handlePointerReleased

protected boolean handlePointerReleased(int relX,
                                        int relY)
Description copied from class: Item
Handles the event when a pointer has been released at the specified position. The default method discards this event when relX/relY is outside of the item's area. When the event took place inside of the content area, the pointer-event is translated into an artificial FIRE game-action keyReleased event, which is subsequently handled bu the handleKeyPressed(-1, Canvas.FIRE) method. This method needs should be overwritten only when the "polish.hasPointerEvents" preprocessing symbol is defined: "//#ifdef polish.hasPointerEvents".

Overrides:
handlePointerReleased in class Item
Parameters:
relX - the x position of the pointer pressing relative to this item's left position
relY - the y position of the pointer pressing relative to this item's top position
Returns:
true when the pressing of the pointer was actually handled by this item.
See Also:
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)

handlePointerDragged

protected boolean handlePointerDragged(int relX,
                                       int relY)
Description copied from class: Item
Handles the dragging/movement of a pointer. This method should be overwritten only when the polish.hasPointerEvents preprocessing symbol is defined. The default implementation returns false.

Overrides:
handlePointerDragged in class Item
Parameters:
relX - the x position of the pointer pressing relative to this item's left position
relY - the y position of the pointer pressing relative to this item's top position
Returns:
true when the dragging of the pointer was actually handled by this item.

handlePointerDragged

protected boolean handlePointerDragged(int relX,
                                       int relY,
                                       ClippingRegion repaintRegion)
Description copied from class: Item
Handles the dragging/movement of a pointer. This method should be overwritten only when the polish.hasPointerEvents preprocessing symbol is defined. The default implementation returns false.

Overrides:
handlePointerDragged in class Item
Parameters:
relX - the x position of the pointer pressing relative to this item's left position
relY - the y position of the pointer pressing relative to this item's top position
Returns:
true when the dragging of the pointer was actually handled by this item.

handlePointerTouchDown

public boolean handlePointerTouchDown(int x,
                                      int y)
Description copied from class: Item
Handles a touch down/press event. This is similar to a pointerPressed event, however it is only available on devices with screens that differentiate between press and touch events (read: BlackBerry Storm).

Overrides:
handlePointerTouchDown in class Item
Parameters:
x - the horizontal pixel position of the touch event relative to this item's left position
y - the vertical pixel position of the touch event relative to this item's top position
Returns:
true when the event was handled

handlePointerTouchUp

public boolean handlePointerTouchUp(int x,
                                    int y)
Description copied from class: Item
Handles a touch up/release event. This is similar to a pointerReleased event, however it is only available on devices with screens that differentiate between press and touch events (read: BlackBerry Storm).

Overrides:
handlePointerTouchUp in class Item
Parameters:
x - the horizontal pixel position of the touch event relative to this item's left position
y - the vertical pixel position of the touch event relative to this item's top position
Returns:
true when the event was handled

getItemAreaHeight

public int getItemAreaHeight()
Description copied from class: Item
Retrieves the height of the area that this item covers. This can be different from the original itemHeight for items that have popups such as the POPUP ChoiceGroup

Overrides:
getItemAreaHeight in class Item
Returns:
the height of the item's area in pixel

getItemAt

public Item getItemAt(int relX,
                      int relY)
Description copied from class: Item
Determines if this item or one of it's children is within the specified point. The default implementation returns this item or this item's label when the position fits.

Overrides:
getItemAt in class Item
Parameters:
relX - the x position of the point relative to this item's left position
relY - the y position of the point relative to this item's top position
Returns:
this item or one of it's children, when the position fits, otherwise null is returned

getChildAt

public Item getChildAt(int relX,
                       int relY)
Retrieves the child of this container at the corresponding position.

Parameters:
relX - the relative horizontal position
relY - the relatiev vertical position
Returns:
the item at that position, if any

getChildAtImpl

protected Item getChildAtImpl(int relX,
                              int relY)
Actual implementation for finding a child, can be used by ContainerViews.

Parameters:
relX - the relative horizontal position
relY - the relative vertical position
Returns:
the child item at the specified position

requestDefocus

public void requestDefocus(Item item)
Moves the focus away from the specified item.

Parameters:
item - the item that currently has the focus

requestFullInit

public void requestFullInit()
Requests the initialization of this container and all of its children items. This was previously used for dimension changes which is now picked up automatically and not required anymore.


getScrollYOffset

public int getScrollYOffset()
Retrieves the vertical scrolling offset of this item.

Returns:
either the currently used offset or the targeted offset in case the targeted one is different. This is either a negative integer or 0.
See Also:
getCurrentScrollYOffset()

getCurrentScrollYOffset

public int getCurrentScrollYOffset()
Retrieves the current vertical scrolling offset of this item, depending on the scroll mode this can change with every paint iteration.

Returns:
the currently used offset in pixels, either a negative integer or 0.
See Also:
getScrollYOffset()

getRelativeScrollYOffset

public int getRelativeScrollYOffset()
Retrieves the vertical scrolling offset of this item relative to the top most container.

Returns:
either the currently used offset or the targeted offset in case the targeted one is different.

setScrollYOffset

public void setScrollYOffset(int offset)
Sets the vertical scrolling offset of this item.

Parameters:
offset - either the new offset

setScrollYOffset

public void setScrollYOffset(int offset,
                             boolean smooth)
Sets the vertical scrolling offset of this item.

Parameters:
offset - either the new offset
smooth - scroll to this new offset smooth if allowed
See Also:
getScrollYOffset()

isScrolling

public boolean isScrolling()
Determines whether this container or one of its parent containers is currently being scrolled

Returns:
true when this container or one of its parent containers is currently being scrolled

startScroll

public void startScroll(int direction,
                        int speed,
                        int damping)
Starts to scroll in the specified direction

Parameters:
direction - either Canvas.UP or Canvas.DOWN
speed - the speed in pixels per second
damping - the damping in percent; 0 means no damping at all; 100 means the scrolling will be stopped immediately

indexOf

public int indexOf(Item item)
Retrieves the index of the specified item.

Parameters:
item - the item
Returns:
the index of the item; -1 when the item is not part of this container

contains

public boolean contains(Item item)
Checks if this container includes the specified item

Parameters:
item - the item
Returns:
true when this container contains the item

toString

public String toString()
Generates a String representation of this item. This method is only implemented when the logging framework is active or the preprocessing variable "polish.keepToString" is set to true.

Overrides:
toString in class Item
Returns:
a String representation of this item.

setItemsList

public void setItemsList(ArrayList itemsList)
Sets a list of items for this container. Use this direct access only when you know what you are doing.

Parameters:
itemsList - the list of items to set

getNumberOfInteractiveItems

public int getNumberOfInteractiveItems()
Calculates the number of interactive items included in this container.

Returns:
the number between 0 and size()

releaseResources

public void releaseResources()
Releases all (memory intensive) resources such as images or RGB arrays of this background.

Overrides:
releaseResources in class Item

destroy

public void destroy()
Description copied from class: Item
Destroy the item by removing all references to parent, screen, listeners etc. and calling releaseResources()

Overrides:
destroy in class Item

getInternalArray

public Object[] getInternalArray()
Retrieves the internal array with all managed items embedded in this container, some entries might be null. Use this method only if you know what you are doing and only for reading.

Returns:
the internal array of the managed items

isInItemArea

public boolean isInItemArea(int relX,
                            int relY)
Description copied from class: Item
Determines whether the given relative x/y position is inside of this item's area including paddings, margins and label. Subclasses which extend their area over the declared/official content area, which is determined in the initContent() method (like popup items), might want to override this method. It is assumed that the item has been initialized before.

Overrides:
isInItemArea in class Item
Parameters:
relX - the x position relative to this item's left position
relY - the y position relative to this item's top position
Returns:
true when the relX/relY coordinate is within this item's area.
See Also:
Item.initContent(int, int, int)

fireEvent

public void fireEvent(String eventName,
                      Object eventData)
Description copied from class: Item
Fires an event for this item as well as its subitems like its label.

Overrides:
fireEvent in class Item
Parameters:
eventName - the name of the event
eventData - the event data
See Also:
EventManager.fireEvent(String, Object, Object)

setView

public void setView(ItemView view)
Sets the view type for this item. Please note that this is only supported when view-type CSS attributes are used within your application.

Overrides:
setView in class Item
Parameters:
view - the new view, use null to remove the current view

getView

public ItemView getView()
Retrieves the view type for this item. Please note that this is only supported when view-type CSS attributes are used within your application.

Overrides:
getView in class Item
Returns:
the current view, may be null

getView

protected ItemView getView(ItemView viewType,
                           Style viewStyle)
Retrieves the view type for this item or instantiates a new one. Please note that this is only supported when view-type CSS attributes are used within your application.

Overrides:
getView in class Item
Parameters:
viewType - the view registered in the style
viewStyle - the style
Returns:
the view, may be null

initMargin

protected void initMargin(Style style,
                          int availWidth)
Description copied from class: Item
Initializes the margin of this item Subclasses can override this (e.g. the container embedded in a screen)

Overrides:
initMargin in class Item
Parameters:
style - the style
availWidth - the available width

onScreenSizeChanged

public void onScreenSizeChanged(int screenWidth,
                                int screenHeight)
Description copied from class: Item
Notifies this item about a new screen size. The default implementation just checks if the design should switch to portrait or landscape-style (if those CSS attributes are used). The item will be re-initialized with its available dimensions using init(int,int,int) soon.

Overrides:
onScreenSizeChanged in class Item
Parameters:
screenWidth - the screen width
screenHeight - the screen height

getFocusedChild

public Item getFocusedChild()
Recursively returns the focused child item of this Container or of the currently focused child Container.

Returns:
the focused child item or this Container when there is no focused child.

notifyItemPressedStart

public boolean notifyItemPressedStart()
Description copied from class: Item
Is called when an item is pressed using the FIRE game action

Overrides:
notifyItemPressedStart in class Item
Returns:
true when the item requests a repaint after this action

notifyItemPressedEnd

public void notifyItemPressedEnd()
Description copied from class: Item
Is called when an item is pressed

Overrides:
notifyItemPressedEnd in class Item

resetLastPointerPressYOffset

public void resetLastPointerPressYOffset()
Resets the pointer press y offset which is used for starting scrolling processes. This is only applicable for touch enabled handsets.


scrollToTop

public void scrollToTop()
Scrolls this container so that its first item is visible.


scrollToBottom

public void scrollToBottom()
Scrolls this container so that its last item is visible.


isVerticalLayout

public boolean isVerticalLayout()
Checks if this container arranges its child items vertically.

Returns:
true when the layout is vertical, false when it is horizontal or complex