Class NativeTable

All Implemented Interfaces:
AttachNotifier, ClickNotifier<NativeTable>, DetachNotifier, HasComponents, HasElement, HasEnabled, HasSize, HasStyle, HasText, Serializable

@Tag("table") public class NativeTable extends HtmlContainer implements ClickNotifier<NativeTable>
Component representing a <table> element.
Since:
24.4
See Also:
  • Constructor Details

    • NativeTable

      public NativeTable()
      Creates a new empty table.
    • NativeTable

      public NativeTable(Component... components)
      Creates a new table with the given children components.
      Parameters:
      components - the children components.
  • Method Details

    • getCaption

      public NativeTableCaption getCaption()
      Return the table's caption component. Creates a new instance if no caption is present.
      Returns:
      the table's caption.
    • getCaptionText

      public String getCaptionText()
      Return the caption text for this table.
      Returns:
      the table's caption text.
    • setCaptionText

      public void setCaptionText(String text)
      Sets the caption text for this table.
      Parameters:
      text - the caption's text
    • removeCaption

      public void removeCaption()
      Remove the caption from this table.
    • getHead

      public NativeTableHeader getHead()
      Returns the head of this table.
      Returns:
      This table's <thead> element. Creates a new one if no element was present.
    • removeHead

      public void removeHead()
      Remove the head from this table, if present.
    • getFoot

      public NativeTableFooter getFoot()
      Returns the <tfoot> element of this table.
      Returns:
      The <tfoot> element of this table. Creates a new one if none was present.
    • removeFoot

      public void removeFoot()
      Removes the foot from this table, if present.
    • getBodies

      public List<NativeTableBody> getBodies()
      Returns the list of <tbody> elements in this table.
      Returns:
      the list of table body elements of this table.
    • getBody

      public NativeTableBody getBody()
      Returns the first body element in this table. Creates one if there's none.
      Returns:
      the first <tbody> element in the table. Creates one if there's none.
    • getBody

      public NativeTableBody getBody(int index)
      Returns the <tbody> element at a given position relative to other <tbody> elements.
      Parameters:
      index - The position of the body element relative to other body elements.
      Returns:
      The table body component at the given position. If the position is 0 and there are no body elements present, a new one is created and returned.
    • addBody

      public NativeTableBody addBody()
      Adds a new body element to the table.
      Returns:
      The new body.
    • removeBody

      public void removeBody(NativeTableBody body)
      Removes a body element from the table.
      Parameters:
      body - The body component to remove.
    • removeBody

      public void removeBody(int index)
      Removes a body element at a given position.
      Parameters:
      index - The position of the body element to remove.
    • removeBody

      public void removeBody()
      Removes the first body element in the list of bodies of this table.