de.enough.polish.ui.containerviews
Class CenterNavigationContainerView

java.lang.Object
  extended by de.enough.polish.ui.ItemView
      extended by de.enough.polish.ui.ContainerView
          extended by de.enough.polish.ui.containerviews.CenterNavigationContainerView
All Implemented Interfaces:
Serializable

public class CenterNavigationContainerView
extends ContainerView

Shows the available items of a Container in a horizontal list.

Apply this view by specifying "view-type: horizontal;" in your polish.css file.

Copyright Enough Software 2007 - 2008

Author:
Andre Schmidt

Field Summary
 
Fields inherited from class de.enough.polish.ui.ContainerView
allowCycling, allowsAutoTraversal, allowsDirectSelectionByPointerEvent, appearanceMode, columnsSetting, columnsWidths, EQUAL_WIDTH_COLUMNS, focusedIndex, focusedItem, focusFirstElement, isExpandItems, isHorizontal, isSequentialTraversal, isVertical, leftXOffset, NO_COLUMNS, NORMAL_WIDTH_COLUMNS, numberOfColumns, numberOfRows, parentContainer, restartAnimation, rightXOffset, rowsHeights, STATIC_WIDTH_COLUMNS, topYOffset, yOffset
 
Fields inherited from class de.enough.polish.ui.ItemView
contentHeight, contentWidth, isFocused, isLayoutCenter, isLayoutRight, layout, paddingHorizontal, paddingVertical, parentItem
 
Constructor Summary
CenterNavigationContainerView()
          Creates a new view
 
Method Summary
protected  void convertToGrayScale(int[] rgbData)
           
 Style focusItem(int index, Item item, int direction, Style focusedStyle)
          Focuses the given item and retrieves the previous style of that item.
protected  void initContent(Item parentItm, int firstLineWidth, int lineWidth)
          Initialises this item.
protected  boolean isValid(Item parent, Style style)
          Implementation that are valid only for specific item classes can override this method so that they cannot be accidently attached to unsupported classes.
protected  void paintContent(Container container, Item[] myItems, int x, int y, int leftBorder, int rightBorder, int clipX, int clipY, int clipWidth, int clipHeight, javax.microedition.lcdui.Graphics g)
          Paints the content of this container view.
 
Methods inherited from class de.enough.polish.ui.ContainerView
focusItem, focusItem, getItemRelativeY, getNextFocusableItem, getNextItem, getParentRelativeY, getScreen, handleKeyPressed, isInBottomRow, isLayoutExpand, paintContent, paintItem, scroll, setStyle, shiftFocus, showNotify
 
Methods inherited from class de.enough.polish.ui.ItemView
addFullRepaintRegion, animate, animate, defocus, focus, handleKeyReleased, handlePointerPressed, handlePointerReleased, hideNotify, initContentByParent, notifyItemPressedEnd, notifyItemPressedStart, paintBackground, paintBorder, paintContentByParent, releaseResources, removeItemBackground, removeItemBorder, removeParentBackground, removeParentBorder, removeViewFromParent, requestInit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CenterNavigationContainerView

public CenterNavigationContainerView()
Creates a new view

Method Detail

initContent

protected void initContent(Item parentItm,
                           int firstLineWidth,
                           int lineWidth)
Description copied from class: ContainerView
Initialises this item. The implementation needs to calculate and set the contentWidth and contentHeight fields. The style of the focused item has already been set.

Overrides:
initContent in class ContainerView
Parameters:
parentItm - the Container which uses this view, use parent.getItems() for retrieving all items.
firstLineWidth - the maximum width of the first line
lineWidth - the maximum width of any following lines
See Also:
ItemView.contentWidth, ItemView.contentHeight

focusItem

public Style focusItem(int index,
                       Item item,
                       int direction,
                       Style focusedStyle)
Description copied from class: ContainerView
Focuses the given item and retrieves the previous style of that item. The default implementation sets the focusedIndex and focusedItem fields and returns the result of item.focus( focusStyle, direction ). This is a method that is usually called from within the parent Container (in contrast to the other focusItem() methods which forward the call to the parentContainer).

Overrides:
focusItem in class ContainerView
Parameters:
index - the index of the item
item - the item which should be focused
direction - the direction, either Canvas.DOWN, Canvas.RIGHT, Canvas.UP, Canvas.LEFT or 0.
focusedStyle - the new style for the focused item
Returns:
the previous style of the focussed item

convertToGrayScale

protected void convertToGrayScale(int[] rgbData)

paintContent

protected void paintContent(Container container,
                            Item[] myItems,
                            int x,
                            int y,
                            int leftBorder,
                            int rightBorder,
                            int clipX,
                            int clipY,
                            int clipWidth,
                            int clipHeight,
                            javax.microedition.lcdui.Graphics g)
Description copied from class: ContainerView
Paints the content of this container view. This method calls

Overrides:
paintContent in class ContainerView
Parameters:
container - the parent container
myItems - the items that should be painted
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
clipX - absolute horizontal clipping start
clipY - absolute verical clipping start
clipWidth - clipping width
clipHeight - clipping height
g - the Graphics on which this item should be painted.

isValid

protected boolean isValid(Item parent,
                          Style style)
Description copied from class: ItemView
Implementation that are valid only for specific item classes can override this method so that they cannot be accidently attached to unsupported classes. This allows casting without checking the parent item with instanceof in each method, for example. The default implementation just returns true for any case.

Overrides:
isValid in class ContainerView
Parameters:
parent - the parent item
style - the style
Returns:
true when the view can be used for the parent item.