Package com.iizix.prop.ui.table
Class TCell
java.lang.Object
com.iizix.prop.ui.table.TCell
- All Implemented Interfaces:
Cloneable
The table cell contents that is used with the content provider.
This class is thread-safe and immutable.
- Author:
- Christopher Mindus
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Align horizontal: center (= 5).static final int
Align horizontal: default (=0).static final int
Align horizontal: leading (= 44).static final int
Align horizontal: left (= 4).static final int
Align horizontal: right (= 6).static final int
Align horizontal: trailing (= 66).static final int
Align vertical: bottom (= 2).static final int
Align vertical: default (= 0).static final int
Align vertical: middle (= 5).static final int
Align vertical: top (= 2).static final int
Cell type: Checkbox (= 2).static final int
Cell type: Combobox (= 4).static final int
Cell type: KString (= 1).static final int
Cell type: Radio button (= 3).static final int
Cell type: String (= 0).static final TCell
An empty table cell contents.static final TCell
An empty table cell contents, but cell is selected.Constructor Summary
ConstructorDescriptionTCell
(boolean isSelected) Creates a new instance of the table cell initialized with a radio button and its state default-aligned horizontally and vertically.TCell
(boolean isSelected, int horizontalAlign, int verticalAlign, int style) Creates a new instance of the table cell initialized with a checkbox and its state default-aligned horizontally and vertically.TCell
(int checkState) Creates a new instance of the table cell initialized with a checkbox and its state default-aligned horizontally and vertically.TCell
(int checkState, int horizontalAlign, int verticalAlign, int style) Creates a new instance of the table cell initialized with a checkbox and its state default-aligned horizontally and vertically.Creates a new instance of the table cell initialized with the KString contents default-aligned horizontally and vertically.Creates a new instance of the table cell initialized with the KString contents default-aligned horizontally and vertically.Creates a new instance of the table cell initialized with the KString contents.Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.Creates a new instance of the table cell initialized with the String contents.TCell
(String string, TableCombo combo) Creates a new instance of the table cell initialized with a string and combobox default-aligned horizontally and vertically.TCell
(String string, TableCombo combo, int horizontalAlign, int verticalAlign, int style) Creates a new instance of the table cell initialized with a string and combobox default-aligned horizontally and vertically.Method Summary
Modifier and TypeMethodDescriptionasCellOwner
(TableCell newOwner) Creates a new GCell instance that is cell selected.asCellSelected
(boolean on) Creates a new GCell instance that is cell selected.protected TCell
clone()
Clones the table cell.boolean
Checks for equality.int
Returns if the check state.int
Gets the column index in a row of the cell in the table.getCombo()
Gets the combo instance.int
Gets the horizontal alignment of the cell.Gets the text contents when the cell is text.getRow()
Gets the row for the cell.int
Gets the row index of the cell in the table.int
Gets the selected item for a combobox.Converts the contents to a string, just the textual plain contents or the check state, or selected state.int
getStyle()
Gets the style.getTable()
Gets the table for the cell.int
getType()
Gets the cell type.int
Gets the vertical alignment of the cell.boolean
Returns if the cell selection state is on or off.boolean
Returns if the radio button is selected.toString()
The debug string representation of this object.
Field Details
EMPTY
An empty table cell contents.EMPTY_CELL_SELECTED
An empty table cell contents, but cell is selected.CELL_TYPE_String
public static final int CELL_TYPE_StringCell type: String (= 0).- See Also:
CELL_TYPE_KString
public static final int CELL_TYPE_KStringCell type: KString (= 1).- See Also:
CELL_TYPE_Check
public static final int CELL_TYPE_CheckCell type: Checkbox (= 2).- See Also:
CELL_TYPE_Radio
public static final int CELL_TYPE_RadioCell type: Radio button (= 3).- See Also:
CELL_TYPE_Combo
public static final int CELL_TYPE_ComboCell type: Combobox (= 4).- See Also:
ALIGN_HORIZONTAL_DEFAULT
public static final int ALIGN_HORIZONTAL_DEFAULTAlign horizontal: default (=0).- See Also:
ALIGN_HORIZONTAL_LEFT
public static final int ALIGN_HORIZONTAL_LEFTAlign horizontal: left (= 4).- See Also:
ALIGN_HORIZONTAL_LEADING
public static final int ALIGN_HORIZONTAL_LEADINGAlign horizontal: leading (= 44).- See Also:
ALIGN_HORIZONTAL_CENTER
public static final int ALIGN_HORIZONTAL_CENTERAlign horizontal: center (= 5).- See Also:
ALIGN_HORIZONTAL_RIGHT
public static final int ALIGN_HORIZONTAL_RIGHTAlign horizontal: right (= 6).- See Also:
ALIGN_HORIZONTAL_TRAILING
public static final int ALIGN_HORIZONTAL_TRAILINGAlign horizontal: trailing (= 66).- See Also:
ALIGN_VERTICAL_DEFAULT
public static final int ALIGN_VERTICAL_DEFAULTAlign vertical: default (= 0).- See Also:
ALIGN_VERTICAL_TOP
public static final int ALIGN_VERTICAL_TOPAlign vertical: top (= 2).- See Also:
ALIGN_VERTICAL_MIDDLE
public static final int ALIGN_VERTICAL_MIDDLEAlign vertical: middle (= 5).- See Also:
ALIGN_VERTICAL_BOTTOM
public static final int ALIGN_VERTICAL_BOTTOMAlign vertical: bottom (= 2).- See Also:
Constructor Details
TCell
Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.- Parameters:
string
- The cell String.
TCell
Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.- Parameters:
string
- The cell String.isSelected
- Flag for cell selection.
TCell
Creates a new instance of the table cell initialized with the String contents.- Parameters:
string
- The cell String.horizontalAlign
- The horizontal alignment.verticalAlign
- The vertical alignment.style
- The style registered with the table, zero for none.- Throws:
IllegalArgumentException
- If the alignment or style values are incorrect.NullPointerException
- If the string is null.
TCell
Creates a new instance of the table cell initialized with the KString contents default-aligned horizontally and vertically.- Parameters:
kstring
- The cell String.- Throws:
IllegalArgumentException
- If the alignment values are incorrect.NullPointerException
- If the kstring is null.
TCell
Creates a new instance of the table cell initialized with the KString contents default-aligned horizontally and vertically.- Parameters:
kstring
- The cell String.isSelected
- Flag for cell selection.- Throws:
IllegalArgumentException
- If the alignment values are incorrect.NullPointerException
- If the kstring is null.
TCell
Creates a new instance of the table cell initialized with the KString contents.- Parameters:
kstring
- The cell string.horizontalAlign
- The horizontal alignment.verticalAlign
- The vertical alignment.style
- The style registered with the table, zero for none.- Throws:
IllegalArgumentException
- If the alignment or style values are incorrect.NullPointerException
- If the kstring is null.
TCell
public TCell(int checkState) Creates a new instance of the table cell initialized with a checkbox and its state default-aligned horizontally and vertically.- Parameters:
checkState
- The check state (0=unchecked, 1=checked, 2=third state).- Throws:
IllegalArgumentException
- If the alignment values are incorrect.
TCell
public TCell(int checkState, int horizontalAlign, int verticalAlign, int style) Creates a new instance of the table cell initialized with a checkbox and its state default-aligned horizontally and vertically.- Parameters:
checkState
- The check state (0=unchecked, 1=checked, 2=third state).horizontalAlign
- The horizontal alignment.verticalAlign
- The vertical alignment.style
- The style registered with the table, zero for none.- Throws:
IllegalArgumentException
- If the checkState, alignment or style values are incorrect.
TCell
public TCell(boolean isSelected) Creates a new instance of the table cell initialized with a radio button and its state default-aligned horizontally and vertically.- Parameters:
isSelected
- The radio button selected state.
TCell
public TCell(boolean isSelected, int horizontalAlign, int verticalAlign, int style) Creates a new instance of the table cell initialized with a checkbox and its state default-aligned horizontally and vertically.- Parameters:
isSelected
- The radio button selected state.horizontalAlign
- The horizontal alignment.verticalAlign
- The vertical alignment.style
- The style registered with the table, zero for none.- Throws:
IllegalArgumentException
- If the alignment or style values are incorrect.
TCell
Creates a new instance of the table cell initialized with a string and combobox default-aligned horizontally and vertically.- Parameters:
string
- The cell String.combo
- The combobox registered with the table.- Throws:
IllegalArgumentException
- If the alignment values are incorrect.
TCell
Creates a new instance of the table cell initialized with a string and combobox default-aligned horizontally and vertically.- Parameters:
string
- The cell String.combo
- The combobox registered with the table.horizontalAlign
- The horizontal alignment.verticalAlign
- The vertical alignment.style
- The style registered with the table, zero for none.- Throws:
IllegalArgumentException
- If the alignment or style values are incorrect.
Method Details
clone
Clones the table cell.- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
- If the cell fails cloning due to contents.
getRow
Gets the row for the cell.- Returns:
- The row, or null if not present in the table.
getTable
Gets the table for the cell.- Returns:
- The table, or null if not present in the table.
getColumnIndex
public int getColumnIndex()Gets the column index in a row of the cell in the table.- Returns:
- The column index, or -1 if cell contents is not the current content.
getRowIndex
public int getRowIndex()Gets the row index of the cell in the table.- Returns:
- The row index, or -1 if cell contents is not the current content.
getType
public int getType()Gets the cell type.- Returns:
- One of the values: CELL_TYPE_String, CELL_TYPE_KString, CELL_TYPE_Check, CELL_TYPE_Radio or CELL_TYPE_Combo.
isCellSelected
public boolean isCellSelected()Returns if the cell selection state is on or off.- Returns:
- true if the cell is selected, false otherwise.
getString
Converts the contents to a string, just the textual plain contents or the check state, or selected state.- Returns:
- The textual representation of the contents.
getKString
Gets the text contents when the cell is text.- Returns:
- The text contents, or null if cell is not CELL_TYPE_String.
isSelected
public boolean isSelected()Returns if the radio button is selected.- Returns:
- true if selected, or false if unselected (or not a radio button).
getCheckState
public int getCheckState()Returns if the check state.- Returns:
- One of: 0=unchecked, 1=checked, 2=third state or -1 if not a check type.
getSelection
public int getSelection()Gets the selected item for a combobox.- Returns:
- The selected item index, -1 for none.
getVerticalAlign
public int getVerticalAlign()Gets the vertical alignment of the cell.- Returns:
- One of the values: ALIGN_VERTICAL_DEFAULT, ALIGN_VERTICAL_TOP, ALIGN_VERTICAL_MIDDLE or ALIGN_VERTICAL_BOTTOM.
getHorizontalAlign
public int getHorizontalAlign()Gets the horizontal alignment of the cell.- Returns:
- One of the values: ALIGN_HORIZONTAL_DEFAULT, ALIGN_HORIZONTAL_LEFT, ALIGN_HORIZONTAL_LEADING, ALIGN_HORIZONTAL_CENTER, ALIGN_HORIZONTAL_RIGHT or ALIGN_HORIZONTAL_TRAILING.
getStyle
public int getStyle()Gets the style.- Returns:
- The registered style with the table, or zero for none.
getCombo
Gets the combo instance.- Returns:
- The combo instance, or null for none.
asCellSelected
Creates a new GCell instance that is cell selected.- Parameters:
on
- The cell selection state.- Returns:
- A new instance of the cell with cell selection state enabled.
asCellOwner
Creates a new GCell instance that is cell selected.- Parameters:
newOwner
- The new GCell owner.- Returns:
- A new instance of the cell with cell selection state enabled.
equals
Checks for equality.toString
The debug string representation of this object.