Class TableCell

All Implemented Interfaces:
Animatable<TableCell>, CanDrop<TableCell>, Clickable<TableCell>, Draggable<TableCell>, HandleMouseEvents<TableCell>, Scrollable<TableCell>, Touchable<TableCell>

Table cell component

The component can be used with the Table, TableRow or TableHeader components. The component represents a table row. The table cell can have any JBStrap component added to it, meaning that tables can be fully customized.

Supported events:

AnimationStart AnimationEnd, Click, DoubleClick, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, Scrollable TouchCancel, TouchEnd, TouchMove, TouchStart, Drop, DragStart, DragEnd

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

    • TableCell

      public TableCell(Component<?>... components)
      Creates a table cell component, and adds the specified components to the cell.
      Parameters:
      components - The instances of the components that will be put in the cell.
    • TableCell

      public TableCell(String id, Component<?>... components)
      Creates a table cell component, and adds the specified components to the cell.
      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.)
      components - The instances of the components that will be put in the cell.
    • TableCell

      public TableCell(String content)
      Creates a table cell component, with the specified text content
      Parameters:
      content - The text that will be in the table cell
    • TableCell

      public TableCell(String id, String content)
      Creates a table cell component, with the specified text content
      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.)
      content - The text that will be in the table cell
  • Method Details

    • setContent

      public TableCell setContent(String content)
      Sets the specified text content in the cell.
      Parameters:
      content - The text that will be in the table cell
      Returns:
      The table cell component
    • getContent

      public String getContent()
      Gets the text content of the cell
      Returns:
      The text content of the cell or null, if the cell has no text content
    • 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<TableCell>
      Returns:
      If the componentwas drawn, true, otherwise false
    • setEnabled

      public TableCell setEnabled(boolean enabled)
      Enables or disables the cell. Applies to every component that is inside the cell.
      Overrides:
      setEnabled in class Component<TableCell>
      Parameters:
      enabled - true, the component is enabled, otherwise it's disabled
      Returns:
      The component