|
||||||||||
| 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.Container
public class Container
Contains a number of items.
Main purpose is to manage all items of a Form or similar canvases.
Containers support following additional CSS attributes:
columns: 2;
columns-width: 15,5;
Copyright Enough Software 2004 - 2011
| 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
|
| 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 java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int SCROLL_DEFAULT
public static final int SCROLL_SMOOTH
protected ArrayList itemsList
protected boolean autoFocusEnabled
setAutoFocusEnabled(boolean)protected int autoFocusIndex
protected Style itemStyle
protected Item focusedItem
public int focusedIndex
protected boolean enableScrolling
public boolean allowCycling
protected int yOffset
protected int targetYOffset
protected ContainerView containerView
protected boolean scrollSmooth
protected boolean isExpandItems
protected int lastPointerPressY
protected int lastPointerPressYOffset
protected long lastPointerPressTime
protected Style focusedStyleFirst
protected Style focusedStyleLast
protected int scrollHeight
protected Style plainStyle
protected Style focusAllStyle
| Constructor Detail |
|---|
public Container()
public Container(Style style)
style - the style for this containerpublic Container(boolean focusFirstElement)
focusFirstElement - true when the first focussable element should be focused automatically.
public Container(boolean focusFirstElement,
Style style)
focusFirstElement - true when the first focussable element should be focused automatically.style - the style for this container
public Container(String label,
boolean focusFirstElement,
Style style,
int height)
label - the label of this containerfocusFirstElement - true when the first focusable element should be focused automatically.style - the style for this containerheight - the vertical space available for this container, set to -1 when scrolling should not be activatedsetScrollHeight( int )| Method Detail |
|---|
public void setScrollHeight(int height)
height - available height for this item including label, padding, margin and border, -1 when scrolling should not be done.public int getScrollHeight()
getContentScrollHeight()public void add(String text)
text - the text
IllegalArgumentException - when the given item is null
public void add(String text,
Style textAddStyle)
text - the texttextAddStyle - the style for the text
IllegalArgumentException - when the given item is nullpublic void add(Item item)
item - the item which should be added.
IllegalArgumentException - when the given item is null
public void add(Item item,
Style itemAddStyle)
item - the item which should be added.itemAddStyle - the style for the item
IllegalArgumentException - when the given item is null
public void add(int index,
Item item)
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
IllegalArgumentException - when the given item is null
IndexOutOfBoundsException - when the index < 0 || index >= size()public void add(Item item)
item - the item to be added
public void add(int index,
Item item)
index - the indexitem - the item
public void set(int index,
Item item)
index - the indexitem - the item to be added
public Item set(int index,
Item item)
index - the position of the element, the first element has the index 0.item - the item which should be set
IndexOutOfBoundsException - when the index < 0 || index >= size()
public Item set(int index,
Item item,
Style itemStyle)
index - the position of the element, the first element has the index 0.item - the item which should be setitemStyle - the new style for the item
IndexOutOfBoundsException - when the index < 0 || index >= size()public Item get(int index)
index - the position of the desired item.
IndexOutOfBoundsException - when the index < 0 || index >= size()public Item remove(int index)
index - the position of the desired item.
IndexOutOfBoundsException - when the index < 0 || index >= size()public boolean focusClosestItemAbove(int index)
index - the index of the item that should be used as a starting point for the search of a new possible focussable item
public boolean focusClosestItem(int index)
index - the index of the item that should be used as a starting point for the search of a new possible focussable item
public boolean remove(Item item)
item - the item which should be removed.
IllegalArgumentException - when the given item is nullpublic void clear()
public int size()
public Item[] getItems()
public void setFocusListener(FocusListener listener)
listener - the new listener, use null to remove an existing listener.getFocusListener()public FocusListener getFocusListener()
setFocusListener(FocusListener)public boolean focusChild(int index)
index - the index of the item. The first item has the index 0,
when -1 is given, the focus will be removed altogether
public void focusChild(int index,
Item item,
int direction,
boolean force)
index - the positionitem - the item which should be focuseddirection - 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 beforeprotected int getChildWidth(Item item)
item - the child item
getChildHeight(Item),
ContainerView.getChildWidth(Item)protected int getChildHeight(Item item)
item - the child item
getChildHeight(Item),
ContainerView.getChildHeight(Item)
protected Style getFocusedStyle(int index,
Item item)
index - the index of the itemitem - the item
public boolean scroll(int direction,
Item item,
boolean force)
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.RIGHTitem - the item for which the scrolling should be adjusted
protected boolean 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 area
protected boolean scroll(int direction,
int x,
int y,
int width,
int height,
boolean force)
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 areaforce - true when the area should be shown regardless where the the current scrolloffset is located
public void setAppearanceMode(int appearanceMode)
Item
setAppearanceMode in class ItemappearanceMode - the mode value, one of Item.PLAIN, Item.HYPERLINK, or Item.BUTTON
protected void initLayout(Style style,
int availWidth)
Item
initLayout in class Itemstyle - the style of this itemavailWidth - the available width in case paddings or margins include relative valuespublic Object getSynchronizationLock()
Screen.getPaintLock(),
add(Item)
protected void initContent(int firstLineWidth,
int availWidth,
int availHeight)
Item
initContent in class ItemfirstLineWidth - the maximum width of the first lineavailWidth - the available maximum width of this item in pixelsavailHeight - the available maximum height of this item in pixelsItem.contentWidth,
Item.contentHeight,
Item.preferredWidth,
Item.preferredHeightprotected void setAutoFocusEnabled(boolean enable)
enable - true when autofocus should be enabledprotected void updateInternalPosition(Item item)
item - the (assumed focused) itemprotected void setContentWidth(int width)
Item
setContentWidth in class Itemwidth - the new content width in pixelprotected void setContentHeight(int height)
Item
setContentHeight in class Itemheight - the new content height in pixelpublic void setItemWidth(int width)
Item
setItemWidth in class Itemwidth - the width in pixel
protected void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
Graphics g)
Item
paintContent in class 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 paintBackgroundAndBorder(int x,
int y,
int width,
int height,
Graphics g)
Item
paintBackgroundAndBorder in class Itemx - the horizontal start positiony - the vertical start positionwidth - the widthheight - the heightg - graphics contextItem.paintBackground(int, int, int, int, Graphics),
Item.paintBorder(int, int, int, int, Graphics)protected String createCssSelector()
Item
createCssSelector in class Item
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 handleNavigate(int keyCode,
int gameAction)
keyCode - the code of the keypress/keyrepeat eventgameAction - the associated game action
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 handleKeyRepeated(int keyCode,
int gameAction)
Item
handleKeyRepeated 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 isItemVisible(int verticalMin,
int verticalMax,
int itemTop,
int itemBottom,
boolean full)
verticalMin - the vertical minimum offsetverticalMax - the vertical maximum offsetitemTop - the item top offsetitemBottom - the item bottom offsetfull - true if the item must fit completly into the given vertical offsets otherwise false
public int getFocusedIndex()
public Item getFocusedItem()
public void setStyle(Style style)
Item
setStyle in interface UiElementsetStyle in class Itemstyle - the new style for this item.
public void setStyleWithBackground(Style style,
boolean ignoreBackground)
style - the styleignoreBackground - when true is given, the background and border-settings
will be ignored.
public void setStyle(Style style,
boolean resetStyle)
Item
setStyle in interface UiElementsetStyle in class Itemstyle - 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.public void resetStyle(boolean recursive)
Item
resetStyle in class Itemrecursive - true when all subelements of this Item should reset their style as well.Screen.resetStyle(boolean),
UiAccess.resetStyle(Screen,boolean),
UiAccess.resetStyle(Item,boolean)
public void changeChildStyles(String oldChildStyleName,
String newChildStyleName)
oldChildStyleName - the name of the style of child items that should be exchangednewChildStyleName - the name of the new style for child items that were using the specified oldChildStyle before
IllegalArgumentException - if no corresponding newChildStyle could be foundStyleSheet.getStyle(String)
public void changeChildStyles(Style oldChildStyle,
Style newChildStyle)
oldChildStyle - the style of child items that should be exchangednewChildStyle - the new style for child items that were using the specified oldChildStyle before
IllegalArgumentException - if newChildStyle is null
public String parseIndexUrl(String url,
Item item)
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.
NullPointerException - when the given url or item is nullpublic int getPosition(Item item)
item - the item
protected Style focus(Style focusStyle,
int direction)
Item
focus in class ItemfocusStyle - the style which is used to indicate the focused statedirection - 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.
public void defocus(Style originalStyle)
Item
defocus in class ItemoriginalStyle - the original style which will be restored.public void showCommands()
Item
showCommands in class Itemprotected boolean handleCommand(Command cmd)
Item
handleCommand in class Itemcmd - the command
public void animate(long currentTime,
ClippingRegion repaintRegion)
Item
animate in interface Animatableanimate in class ItemcurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animatedItem.addRelativeToContentRegion(ClippingRegion, int, int, int, int)public void addRepaintArea(ClippingRegion repaintRegion)
Item
addRepaintArea in interface UiElementaddRepaintArea in class ItemrepaintRegion - the clipping rectangle to which the repaint area should be addedprotected void showNotify()
paint() calls after
showNotify() has been called.
The container implementation calls showNotify() on the embedded items.
showNotify in class Itemprotected void hideNotify()
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.
hideNotify in class Item
protected boolean handlePointerPressed(int relX,
int relY)
Item
handlePointerPressed in class ItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - 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 handlePointerScrollReleased(int relX,
int relY)
relX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top positionpublic void handleOnFocusSoftKeyboardDisplayBehavior()
handleOnFocusSoftKeyboardDisplayBehavior in class Item
protected boolean handlePointerReleased(int relX,
int relY)
Item
handlePointerReleased in class ItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - 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 handlePointerDragged(int relX,
int relY)
Item
handlePointerDragged in class ItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
protected boolean handlePointerDragged(int relX,
int relY,
ClippingRegion repaintRegion)
Item
handlePointerDragged in class ItemrelX - the x position of the pointer pressing relative to this item's left positionrelY - the y position of the pointer pressing relative to this item's top position
public boolean handlePointerTouchDown(int x,
int y)
Item
handlePointerTouchDown in class Itemx - the horizontal pixel position of the touch event relative to this item's left positiony - the vertical pixel position of the touch event relative to this item's top position
public boolean handlePointerTouchUp(int x,
int y)
Item
handlePointerTouchUp in class Itemx - the horizontal pixel position of the touch event relative to this item's left positiony - the vertical pixel position of the touch event relative to this item's top position
public int getItemAreaHeight()
Item
getItemAreaHeight in class Item
public Item getItemAt(int relX,
int relY)
Item
getItemAt in class ItemrelX - the x position of the point relative to this item's left positionrelY - the y position of the point relative to this item's top position
public Item getChildAt(int relX,
int relY)
relX - the relative horizontal positionrelY - the relatiev vertical position
protected Item getChildAtImpl(int relX,
int relY)
relX - the relative horizontal positionrelY - the relative vertical position
public void requestDefocus(Item item)
item - the item that currently has the focuspublic void requestFullInit()
public int getScrollYOffset()
getCurrentScrollYOffset()public int getCurrentScrollYOffset()
getScrollYOffset()public int getRelativeScrollYOffset()
public void setScrollYOffset(int offset)
offset - either the new offset
public void setScrollYOffset(int offset,
boolean smooth)
offset - either the new offsetsmooth - scroll to this new offset smooth if allowedgetScrollYOffset()public boolean isScrolling()
public void startScroll(int direction,
int speed,
int damping)
direction - either Canvas.UP or Canvas.DOWNspeed - the speed in pixels per seconddamping - the damping in percent; 0 means no damping at all; 100 means the scrolling will be stopped immediatelypublic int indexOf(Item item)
item - the item
public boolean contains(Item item)
item - the item
public String toString()
toString in class Itempublic void setItemsList(ArrayList itemsList)
itemsList - the list of items to setpublic int getNumberOfInteractiveItems()
public void releaseResources()
releaseResources in class Itempublic void destroy()
Item
destroy in class Itempublic Object[] getInternalArray()
public boolean isInItemArea(int relX,
int relY)
Item
isInItemArea in class ItemrelX - the x position relative to this item's left positionrelY - the y position relative to this item's top position
Item.initContent(int, int, int)
public void fireEvent(String eventName,
Object eventData)
Item
fireEvent in class ItemeventName - the name of the eventeventData - the event dataEventManager.fireEvent(String, Object, Object)public void setView(ItemView view)
setView in class Itemview - the new view, use null to remove the current viewpublic ItemView getView()
getView in class Item
protected ItemView getView(ItemView viewType,
Style viewStyle)
getView in class ItemviewType - the view registered in the styleviewStyle - the style
protected void initMargin(Style style,
int availWidth)
Item
initMargin in class Itemstyle - the styleavailWidth - the available width
public void onScreenSizeChanged(int screenWidth,
int screenHeight)
Item
onScreenSizeChanged in class ItemscreenWidth - the screen widthscreenHeight - the screen heightpublic Item getFocusedChild()
public boolean notifyItemPressedStart()
Item
notifyItemPressedStart in class Itempublic void notifyItemPressedEnd()
Item
notifyItemPressedEnd in class Itempublic void resetLastPointerPressYOffset()
public void scrollToTop()
public void scrollToBottom()
public boolean isVerticalLayout()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||