|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.microedition.lcdui.Item
javax.microedition.lcdui.CustomItem
de.enough.polish.ui.FakeCustomItem
de.enough.polish.ui.FakeContainerCustomItem
de.enough.polish.ui.TableItem
public class TableItem
Allows to manage items in a dynamic tabular layout
Copyright Enough Software 2008
| Field Summary | |
|---|---|
protected int[] |
columnWidths
|
protected int |
completeWidth
|
protected javax.microedition.lcdui.Font |
font
|
protected int |
fontColor
|
static int |
LINE_STYLE_DOTTED
dotted style for lines between cells |
static int |
LINE_STYLE_INVISIBLE
no lines between cells |
static int |
LINE_STYLE_SOLID
default style for lines between cells |
protected int |
lineColor
|
protected int |
lineStroke
|
protected int[] |
rowHeights
|
protected Background |
selectedBackground
|
protected Background |
selectedColumnBackground
|
protected Background |
selectedRowBackground
|
static int |
SELECTION_MODE_CELL
Selection mode for a table in which any cell can be selected, even empty ones. |
static int |
SELECTION_MODE_COLUMN
Selection mode for a table in which columns can be selected. |
static int |
SELECTION_MODE_INTERACTIVE
Selection mode for a table in which cells/columns/rows with interactive items (like TextField) can be selected. |
static int |
SELECTION_MODE_NONE
Selection mode for a table in which no cells can be selected. |
static int |
SELECTION_MODE_NONEMPTY
Selection mode for a table in which cells/colummns/rows with content can be selected. |
static int |
SELECTION_MODE_ROW
Selection mode for a table in which rows can be selected. |
protected int |
selectionMode
|
protected TableData |
tableData
|
protected int |
targetXOffset
|
protected int |
xOffset
|
| Fields inherited from class de.enough.polish.ui.FakeContainerCustomItem |
|---|
allowCycling, autoFocusEnabled, autoFocusIndex, availableHeight, containerView, enableScrolling, focusedIndex, focusedItem, focusedStyleFirst, focusedStyleLast, isExpandItems, itemsList, itemStyle, lastPointerPressY, plainStyle, SCROLL_DEFAULT, SCROLL_SMOOTH, scrollSmooth, targetYOffset, yOffset |
| Fields inherited from class javax.microedition.lcdui.CustomItem |
|---|
KEY_PRESS, KEY_RELEASE, KEY_REPEAT, NONE, POINTER_DRAG, POINTER_PRESS, POINTER_RELEASE, TRAVERSE_HORIZONTAL, TRAVERSE_VERTICAL |
| Constructor Summary | |
|---|---|
TableItem()
Creates a new TableItem with an empty table data. |
|
TableItem(int columns,
int rows)
Creates a new TableItem with the specified dimensions |
|
TableItem(int columns,
int rows,
Style style)
Creates a new TableItem with the specified dimensions |
|
TableItem(Style style)
Creates a new TableItem with an empty table data. |
|
TableItem(TableData tableData)
Creates a new TableItem with an empty table data. |
|
TableItem(TableData tableData,
Style style)
Creates a new TableItem with an empty table data. |
|
| Method Summary | |
|---|---|
void |
add(int col,
int row,
Item item)
Adds the given item to the specified table element. |
void |
add(Item item)
Container methods |
int |
addColumn()
Adds a new column to this table. |
int |
addRow()
Adds a new row to this table. |
void |
animate(long currentTime,
ClippingRegion repaintRegion)
Animates this item. |
protected java.lang.String |
createCssSelector()
Retrieves the CSS selector for this item. |
void |
defocus(Style originalStyle)
Removes the focus from this item. |
protected Style |
focus(Style newStyle,
int direction)
Focuses this item. |
Item |
get(int index)
Returns the item at the specified position of this container. |
java.lang.Object |
get(int column,
int row)
Sets the value of the given table position. |
int |
getNumberOfColumns()
Retrieves the number of columns |
int |
getNumberOfRows()
Retrieves the number of rows |
Background |
getSelectedBackground()
|
java.lang.Object |
getSelectedCell()
Retrieves the data within the currently selected cell. |
int |
getSelectedColumn()
Retrieves the index of the currently selected column |
Background |
getSelectedColumnBackground()
|
int |
getSelectedRow()
Retrieves the index of the currently selected row |
Background |
getSelectedRowBackground()
|
int |
getSelectionMode()
Retrieves the selection mode |
protected boolean |
handleKeyPressed(int keyCode,
int gameAction)
Handles the key-pressed event. |
int |
indexOf(Item item)
Retrieves the index of the specified item. |
protected void |
initContent(int firstLineWidth,
int lineWidth)
Initialises this item. |
void |
insertColumn(int index)
Inserts a column before the specified index. |
void |
insertRow(int index)
Inserts a row before the specified index. |
void |
moveToNextColumn()
Moves the internal column index to the next column. |
void |
moveToNextRow()
Moves the internal row index to the next row. |
protected void |
paintBackground(int x,
int y,
int width,
int height,
javax.microedition.lcdui.Graphics g)
Paints the background of this item. |
protected void |
paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
Paints the content of this item. |
Item |
remove(int index)
Removes the item at the specified position of this container. |
void |
removeColumn(int index)
Removes the specified column |
void |
removeRow(int index)
Removes the specified row |
void |
set(int column,
int row,
java.lang.Object value)
Sets the value of the given table position. |
void |
set(int column,
int row,
java.lang.Object value,
Style itemStyle)
Sets the value of the given table position. |
Item |
set(int index,
Item item,
Style itemStyle)
Replaces the item at the specified position in this list with the given item. |
void |
setCellContainerStyle(Style containerStyle)
Sets the style for cases when several items are added to a cell. |
void |
setDimension(int columns,
int rows)
Specifies a new dimension for this table |
void |
setLineStyle(int lineStroke,
int lineColor)
Sets the stroke style and color of the lines between cells. |
void |
setSelectedBackground(Background selectedBackground)
|
void |
setSelectedCell(int col,
int row)
|
void |
setSelectedCell(int col,
int row,
int direction)
|
void |
setSelectedColumnBackground(Background selectedBackgroundVertical)
|
void |
setSelectedRowBackground(Background selectedBackgroundHorizontal)
|
void |
setSelectionMode(int selectionMode)
Sets the selection mode. |
void |
setStyle(Style style)
Sets the style of this item. |
void |
setTableData(TableData tableData)
Sets the table data for this item |
int |
size()
Retrieves the number of items stored in this container. |
| Methods inherited from class javax.microedition.lcdui.CustomItem |
|---|
getGameAction, getInteractionModes, invalidate, keyPressed, keyReleased, keyRepeated, pointerDragged, pointerPressed, pointerReleased, repaint, repaint, sizeChanged, traverse, traverseOut |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int SELECTION_MODE_NONE
public static final int SELECTION_MODE_CELL
public static final int SELECTION_MODE_NONEMPTY
public static final int SELECTION_MODE_INTERACTIVE
public static final int SELECTION_MODE_ROW
public static final int SELECTION_MODE_COLUMN
public static int LINE_STYLE_SOLID
public static int LINE_STYLE_DOTTED
public static int LINE_STYLE_INVISIBLE
protected TableData tableData
protected javax.microedition.lcdui.Font font
protected int fontColor
protected int[] rowHeights
protected int[] columnWidths
protected int lineStroke
protected int lineColor
protected int completeWidth
protected int xOffset
protected int targetXOffset
protected int selectionMode
protected Background selectedBackground
protected Background selectedRowBackground
protected Background selectedColumnBackground
| Constructor Detail |
|---|
public TableItem()
public TableItem(Style style)
style - style of this item
public TableItem(int columns,
int rows)
columns - the number of columnsrows - the number of rows
public TableItem(int columns,
int rows,
Style style)
columns - the number of columnsrows - the number of rowsstyle - the style of this itempublic TableItem(TableData tableData)
tableData - the data to be displayed in this table
public TableItem(TableData tableData,
Style style)
tableData - the data to be displayed in this tablestyle - style of this item| Method Detail |
|---|
public void setTableData(TableData tableData)
tableData - the new table datapublic void setStyle(Style style)
FakeCustomItem
setStyle in class FakeContainerCustomItemstyle - the new style for this item.
public void setLineStyle(int lineStroke,
int lineColor)
lineStroke - the line stroke stylelineColor - the color for linesLINE_STYLE_SOLID,
LINE_STYLE_DOTTED,
LINE_STYLE_INVISIBLE
protected void initContent(int firstLineWidth,
int lineWidth)
FakeCustomItem
initContent in class FakeContainerCustomItemfirstLineWidth - the maximum width of the first linelineWidth - the maximum width of any following linesFakeCustomItem.contentWidth,
FakeCustomItem.contentHeight,
FakeCustomItem.preferredWidth,
FakeCustomItem.preferredHeight
protected void paintContent(int x,
int y,
int leftBorder,
int rightBorder,
javax.microedition.lcdui.Graphics g)
FakeCustomItem
paintContent in class FakeContainerCustomItemx - 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 paintBackground(int x,
int y,
int width,
int height,
javax.microedition.lcdui.Graphics g)
FakeCustomItem
paintBackground in class FakeCustomItemx - the horizontal start positiony - the vertical start positionwidth - the widthheight - the heightg - graphics context
public void animate(long currentTime,
ClippingRegion repaintRegion)
FakeCustomItem
animate in class FakeContainerCustomItemcurrentTime - the current time in millisecondsrepaintRegion - the repaint area that needs to be updated when this item is animated#addRelativeRegion(ClippingRegion, int, int, int, int)
protected boolean handleKeyPressed(int keyCode,
int gameAction)
FakeCustomItem
handleKeyPressed in class FakeContainerCustomItemkeyCode - the code of the pressed key, e.g. Canvas.KEY_NUM2gameAction - the corresponding game-action, e.g. Canvas.UP
public void setSelectedCell(int col,
int row)
col - the columnrow - the row
public void setSelectedCell(int col,
int row,
int direction)
col - the columnrow - the rowdirection - the direction
public void setDimension(int columns,
int rows)
columns - the number of columnsrows - the number of rowspublic int getNumberOfColumns()
public int getNumberOfRows()
public int addColumn()
public void moveToNextColumn()
add(Item)public void moveToNextRow()
add(Item)public void insertColumn(int index)
index - the index, use 0 for adding a column in the front, use getNumberOfColumns() for appending the column at the end
java.lang.ArrayIndexOutOfBoundsException - when the index is invalidpublic void removeColumn(int index)
index - the index. 0 is the first column
java.lang.ArrayIndexOutOfBoundsException - when the index is invalidpublic int addRow()
public void insertRow(int index)
index - the index, use 0 for adding a row in the top, use getNumberOfRows() for appending the column at the bottom
java.lang.ArrayIndexOutOfBoundsException - when the index is invalidpublic void removeRow(int index)
index - the index. 0 is the first row
java.lang.ArrayIndexOutOfBoundsException - when the index is invalid
public void set(int column,
int row,
java.lang.Object value)
column - the horizontal positionrow - the vertical positionvalue - the value, use null to delete a previous set value
java.lang.ArrayIndexOutOfBoundsException - when the column or row is invalidget(int, int)
public void set(int column,
int row,
java.lang.Object value,
Style itemStyle)
column - the horizontal positionrow - the vertical positionvalue - the value, use null to delete a previous set valueitemStyle - the style of the added value item, if the value is not an Item it will be converted to a StringItem
java.lang.ArrayIndexOutOfBoundsException - when the column or row is invalidget(int, int)
public java.lang.Object get(int column,
int row)
column - the horizontal positionrow - the vertical position
java.lang.ArrayIndexOutOfBoundsException - when the column or row is invalidset(int, int, Object)public java.lang.Object getSelectedCell()
setSelectionMode(int)public int getSelectedRow()
public int getSelectedColumn()
protected java.lang.String createCssSelector()
FakeCustomItem
createCssSelector in class FakeContainerCustomItempublic int getSelectionMode()
SELECTION_MODE_NONE,
SELECTION_MODE_CELL,
SELECTION_MODE_NONEMPTY,
SELECTION_MODE_INTERACTIVE,
SELECTION_MODE_ROW,
SELECTION_MODE_COLUMNpublic void setSelectionMode(int selectionMode)
selectionMode - the desired selection modeSELECTION_MODE_NONE,
SELECTION_MODE_CELL,
SELECTION_MODE_NONEMPTY,
SELECTION_MODE_INTERACTIVE,
SELECTION_MODE_ROW,
SELECTION_MODE_COLUMNpublic Background getSelectedBackground()
public void setSelectedBackground(Background selectedBackground)
selectedBackground - the selectedBackground to setpublic Background getSelectedRowBackground()
public void setSelectedRowBackground(Background selectedBackgroundHorizontal)
selectedBackgroundHorizontal - the selectedBackgroundHorizontal to setpublic Background getSelectedColumnBackground()
public void setSelectedColumnBackground(Background selectedBackgroundVertical)
selectedBackgroundVertical - the selectedBackgroundVertical to setpublic void defocus(Style originalStyle)
FakeCustomItem
defocus in class FakeContainerCustomItemoriginalStyle - the original style which will be restored.
protected Style focus(Style newStyle,
int direction)
FakeCustomItem
focus in class FakeContainerCustomItemnewStyle - 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 setCellContainerStyle(Style containerStyle)
containerStyle - the style for containers that are automatically generated when several items are added into a cell
public void add(int col,
int row,
Item item)
col - the column indexrow - the row indexitem - the itempublic void add(Item item)
add in class FakeContainerCustomItemitem - the item which should be added.public int size()
FakeContainerCustomItem
size in class FakeContainerCustomItempublic Item get(int index)
FakeContainerCustomItem
get in class FakeContainerCustomItemindex - the position of the desired item.
public int indexOf(Item item)
FakeContainerCustomItem
indexOf in class FakeContainerCustomItemitem - the item
public Item remove(int index)
FakeContainerCustomItem
remove in class FakeContainerCustomItemindex - the position of the desired item.
public Item set(int index,
Item item,
Style itemStyle)
FakeContainerCustomItem
set in class FakeContainerCustomItemindex - 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||