de.enough.polish.ui.containerviews
Class MIDP2LayoutView

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

public class MIDP2LayoutView
extends ContainerView

The MIDP2LayoutView layouts all items in a row instead of placing each item on a new row.

Apply this layout by specifying the view-type in the screen's CSS style:

 .myForm {
   view-type: midp2;
 }
 

Author:
Kin Wong, Robert Virkus

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
MIDP2LayoutView()
          Constructs an instance of MIDP2LayoutView.
 
Method Summary
protected  Item getNextItem(int keyCode, int gameAction)
          Interpretes the given user-input and retrieves the nexte item which should be focused.
protected  void initContent(Item parent, int firstLineWidth, int lineWidth)
          Initialises this item.
protected  void paintContent(Item parent, int x, int y, int leftBorder, int rightBorder, javax.microedition.lcdui.Graphics g)
          Paints the content of this container view.
 
Methods inherited from class de.enough.polish.ui.ContainerView
focusItem, focusItem, focusItem, getItemRelativeY, getNextFocusableItem, getParentRelativeY, getScreen, handleKeyPressed, isInBottomRow, isLayoutExpand, isValid, 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

MIDP2LayoutView

public MIDP2LayoutView()
Constructs an instance of MIDP2LayoutView.

Method Detail

initContent

protected void initContent(Item parent,
                           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:
parent - 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

paintContent

protected void paintContent(Item parent,
                            int x,
                            int y,
                            int leftBorder,
                            int rightBorder,
                            javax.microedition.lcdui.Graphics g)
Description copied from class: ContainerView
Paints the content of this container view. This method adjusts the x and y offsets and forwards the call to paintContent(Container, Item[], int, int, int, int, int, int, int, int, Graphics)

Overrides:
paintContent in class ContainerView
Parameters:
parent - the parent item
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.
See Also:
ContainerView.paintContent(Container, Item[], int, int, int, int, int, int, int, int, Graphics)

getNextItem

protected Item getNextItem(int keyCode,
                           int gameAction)
Description copied from class: ContainerView
Interpretes the given user-input and retrieves the nexte item which should be focused. Please not that the focusItem()-method is not called as well. The view is responsible for updating its internal configuration here as well.

Overrides:
getNextItem in class ContainerView
Parameters:
keyCode - the code of the keyPressed-events
gameAction - the associated game-action to the given keyCode
Returns:
the next item which will be focused, null when there is no such element.