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 Link icon

    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 Link icon

    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 Link icon

    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 Link icon

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

    • EMPTY Link icon

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    • TCell Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

    • clone Link icon

      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 Link icon

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

      public UITable getTable()
      Gets the table for the cell.
      Returns:
      The table, or null if not present in the table.
    • getColumnIndex Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      public boolean isCellSelected()
      Returns if the cell selection state is on or off.
      Returns:
      true if the cell is selected, false otherwise.
    • getString Link icon

      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 Link icon

      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 Link icon

      public boolean isSelected()
      Returns if the radio button is selected.
      Returns:
      true if selected, or false if unselected (or not a radio button).
    • getCheckState Link icon

      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 Link icon

      public int getSelection()
      Gets the selected item for a combobox.
      Returns:
      The selected item index, -1 for none.
    • getVerticalAlign Link icon

      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 Link icon

      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 Link icon

      public int getStyle()
      Gets the style.
      Returns:
      The registered style with the table, or zero for none.
    • getCombo Link icon

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

      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 Link icon

      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 Link icon

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

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