Class TCell

  • All Implemented Interfaces:
    java.lang.Cloneable

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

    This class is thread-safe and immutable.

    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      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​(java.lang.String string)
      Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.
      TCell​(java.lang.String string, boolean isSelected)
      Creates a new instance of the table cell initialized with the String contents default-aligned horizontally and vertically.
      TCell​(java.lang.String string, int horizontalAlign, int verticalAlign, int style)
      Creates a new instance of the table cell initialized with the String contents.
      TCell​(java.lang.String string, TableCombo combo)
      Creates a new instance of the table cell initialized with a string and combobox default-aligned horizontally and vertically.
      TCell​(java.lang.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.
    • Field Detail

      • 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:
        Constant Field Values
      • CELL_TYPE_KString

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

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

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

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

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

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

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

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

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

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

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

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

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

        public static final int ALIGN_VERTICAL_BOTTOM
        Align vertical: bottom (= 2).
        See Also:
        Constant Field Values
    • Constructor Detail

      • TCell

        public TCell​(java.lang.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​(java.lang.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​(java.lang.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:
        java.lang.IllegalArgumentException - If the alignment or style values are incorrect.
        java.lang.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:
        java.lang.IllegalArgumentException - If the alignment values are incorrect.
        java.lang.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:
        java.lang.IllegalArgumentException - If the alignment values are incorrect.
        java.lang.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:
        java.lang.IllegalArgumentException - If the alignment or style values are incorrect.
        java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.IllegalArgumentException - If the alignment or style values are incorrect.
      • TCell

        public TCell​(java.lang.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:
        java.lang.IllegalArgumentException - If the alignment values are incorrect.
      • TCell

        public TCell​(java.lang.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:
        java.lang.IllegalArgumentException - If the alignment or style values are incorrect.
    • Method Detail

      • clone

        protected TCell clone()
                       throws java.lang.CloneNotSupportedException
        Clones the table cell.
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.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 java.lang.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​(java.lang.Object o)
        Checks for equality.
        Overrides:
        equals in class java.lang.Object
      • toString

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