Class Table

All Implemented Interfaces:
Animatable<Table>, CanDrop<Table>, Draggable<Table>, HandleHotKey<Table>, Scrollable<Table>

public class Table extends Component<Table> implements Animatable<Table>, Scrollable<Table>, HandleHotKey<Table>, CanDrop<Table>, Draggable<Table>

Simple HTML Table component

A simple HTML table can be created with this component. The table header can be implemented with the TableHeader component. The table rows can be implemented with the TableRow component.

Supported events:

AnimationStart AnimationEnd, Scrollable Drop, DragStart, DragEnd HotKey

Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • Table

      public Table()
      Creates an empty table component
    • Table

      public Table(String id)
      Creates an empty table component with the specified ID
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
  • Method Details

    • addComponent

      public Table addComponent(Component<?> component)
      Adds the specified table header or table row component to the table.
      Overrides:
      addComponent in class Component<Table>
      Parameters:
      component - The table row or table header component
      Returns:
      The component
      Throws:
      IllegalArgumentExceptionIf - the specified component is not a TableRow or TableHeader component, or does not extend from either of those two components.
    • removeComponent

      public Table removeComponent(Component<?> component)
      Description copied from class: Component
      Removes the specified subcomponent.
      Overrides:
      removeComponent in class Component<Table>
      Parameters:
      component - The component instance
      Returns:
      The component
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<Table>
      Returns:
      If the componentwas drawn, true, otherwise false
    • setEnabled

      public Table setEnabled(boolean enabled)
      Enables or disables the table component on the interface. If a component is enabled or disabled, every row, column and cell in the table component will also be enabled or disabled.
      Overrides:
      setEnabled in class Component<Table>
      Parameters:
      enabled - true, the component is enabled, otherwise it's disabled
      Returns:
      The component
    • getComponents

      public List<Component<?>> getComponents()
      Description copied from class: Component
      Gets every previously added subcomponent
      Overrides:
      getComponents in class Component<Table>
      Returns:
      A collection of every subcomponent that was added to the component. If there are none, the collection will be empty
    • replaceComponent

      public Table replaceComponent(Component<?> oldComponent, Component<?> newComponent)
      Description copied from class: Component
      Replaces a previously added subcomponent with the specified new subcomponent. The new component will be in the place of the old one, meaning the order of the components won't change.
      Overrides:
      replaceComponent in class Component<Table>
      Parameters:
      oldComponent - The to be replaced component.
      newComponent - The new component
      Returns:
      The component