Class TCell

java.lang.Object
com.iizix.prop.ui.table.TCell
All Implemented Interfaces:
Cloneable

public class TCell extends Object implements Cloneable
The table cell contents that is used with the content provider.

This class is thread-safe and immutable.

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static 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

    Constructors
    Constructor
    Description
    TCell(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.
    TCell(KString kstring)
    Creates a new instance of the table cell initialized with the KString contents default-aligned horizontally and vertically.
    TCell(KString kstring, boolean isSelected)
    Creates a new instance of the table cell initialized with the KString contents default-aligned horizontally and vertically.
    TCell(KString kstring, int horizontalAlign, int verticalAlign, int style)
    Creates a new instance of the table cell initialized with the KString contents.
    TCell(String string)
    Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.
    TCell(String string, boolean isSelected)
    Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.
    TCell(String string, int horizontalAlign, int verticalAlign, int style)
    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 Type
    Method
    Description
    Creates a new GCell instance that is cell selected.
    asCellSelected(boolean on)
    Creates a new GCell instance that is cell selected.
    protected TCell
    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.
    Gets the combo instance.
    int
    Gets the horizontal alignment of the cell.
    Gets the text contents when the cell is text.
    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
    Gets the style.
    Gets the table for the cell.
    int
    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.
    The debug string representation of this object.

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      public static final TCell EMPTY
      An empty table cell contents.
    • EMPTY_CELL_SELECTED

      public static final TCell EMPTY_CELL_SELECTED
      An empty table cell contents, but cell is selected.
    • CELL_TYPE_String

      public static final int CELL_TYPE_String
      Cell type: String (= 0).
      See Also:
    • CELL_TYPE_KString

      public static final int CELL_TYPE_KString
      Cell type: KString (= 1).
      See Also:
    • CELL_TYPE_Check

      public static final int CELL_TYPE_Check
      Cell type: Checkbox (= 2).
      See Also:
    • CELL_TYPE_Radio

      public static final int CELL_TYPE_Radio
      Cell type: Radio button (= 3).
      See Also:
    • CELL_TYPE_Combo

      public static final int CELL_TYPE_Combo
      Cell type: Combobox (= 4).
      See Also:
    • ALIGN_HORIZONTAL_DEFAULT

      public static final int ALIGN_HORIZONTAL_DEFAULT
      Align horizontal: default (=0).
      See Also:
    • ALIGN_HORIZONTAL_LEFT

      public static final int ALIGN_HORIZONTAL_LEFT
      Align horizontal: left (= 4).
      See Also:
    • ALIGN_HORIZONTAL_LEADING

      public static final int ALIGN_HORIZONTAL_LEADING
      Align horizontal: leading (= 44).
      See Also:
    • ALIGN_HORIZONTAL_CENTER

      public static final int ALIGN_HORIZONTAL_CENTER
      Align horizontal: center (= 5).
      See Also:
    • ALIGN_HORIZONTAL_RIGHT

      public static final int ALIGN_HORIZONTAL_RIGHT
      Align horizontal: right (= 6).
      See Also:
    • ALIGN_HORIZONTAL_TRAILING

      public static final int ALIGN_HORIZONTAL_TRAILING
      Align horizontal: trailing (= 66).
      See Also:
    • ALIGN_VERTICAL_DEFAULT

      public static final int ALIGN_VERTICAL_DEFAULT
      Align vertical: default (= 0).
      See Also:
    • ALIGN_VERTICAL_TOP

      public static final int ALIGN_VERTICAL_TOP
      Align vertical: top (= 2).
      See Also:
    • ALIGN_VERTICAL_MIDDLE

      public static final int ALIGN_VERTICAL_MIDDLE
      Align vertical: middle (= 5).
      See Also:
    • ALIGN_VERTICAL_BOTTOM

      public static final int ALIGN_VERTICAL_BOTTOM
      Align vertical: bottom (= 2).
      See Also:
  • Constructor Details

    • TCell

      public TCell(String string)
      Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.
      Parameters:
      string - The cell String.
    • TCell

      public TCell(String string, boolean isSelected)
      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

      public TCell(String string, int horizontalAlign, int verticalAlign, int style)
      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

      public TCell(KString kstring)
      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

      public TCell(KString kstring, boolean isSelected)
      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

      public TCell(KString kstring, int horizontalAlign, int verticalAlign, int style)
      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

      public TCell(String string, TableCombo combo)
      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

      public 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.
      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

      protected TCell clone() throws CloneNotSupportedException
      Clones the table cell.
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException - If the cell fails cloning due to contents.
    • getRow

      public TableRow getRow()
      Gets the row for the cell.
      Returns:
      The row, or null if not present in the table.
    • getTable

      public UITable 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

      public String 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

      public KString 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

      public TableCombo getCombo()
      Gets the combo instance.
      Returns:
      The combo instance, or null for none.
    • asCellSelected

      public TCell asCellSelected(boolean on)
      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

      public TCell asCellOwner(TableCell newOwner)
      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

      public boolean equals(Object o)
      Checks for equality.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      The debug string representation of this object.
      Overrides:
      toString in class Object