Class Table
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
org.vaadin.firitin.fields.internalhtmltable.Table
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,Serializable,TableRowContainer
@Tag("table")
public class Table
extends com.vaadin.flow.component.HtmlComponent
implements TableRowContainer
Represents the html table element (
Sub elements except for rows are created when calling the respective getter, for instance
Also a table must not contain rows as direct children, when having a
Also all subsequent calls to any table row method are automatically delegated to the
<table>). Can contain
- a caption
- a column group
- a thead
- a tfoot
- a tbody or a set of table rows
Sub elements except for rows are created when calling the respective getter, for instance
getHead(). Since
<table> expects a certain order of elements, this class takes care of positioning them in the correct
order (e.g. head <thead>, then <tbody> and then <tfoot>, etc).
Also a table must not contain rows as direct children, when having a
<tbody>. Therefore, all previously to the
table assigned rows are automatically assigned to the <tbody>, when getBody() is called.
Also all subsequent calls to any table row method are automatically delegated to the
<tbody>.- Author:
- Stefan Uebe
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRow()Adds a single row instance to this container.TableRow[]addRows(int rows) Adds multiple rows to this instance based on the given integer (must be greater than 0).voidAdds the given list of rows.getBody()Returns theTableBodyfor this instance.Returns theTableCaptionfor this instance.Returns theTableColumnGroupfor this instance.getFoot()Returns theTableFootfor this instance.getHead()Returns theTableHeadfor this instance.insertRow(int index) Inserts a single row instance at the given index to this container.voidinsertRows(int index, TableRow... rows) Inserts the given rows at the given index to this instance.voidRemoves all rows.voidRemoves the body instance from this table.voidRemoves the caption instance from this table.voidRemoves the column group instance from this table.voidRemoves the foot instance from this table.voidRemoves the head instance from this table.voidremoveRow(int index) Removes the row with the given index.voidremoveRows(TableRow... rows) Removes the given rows from this instance.voidreplaceRow(int index, TableRow row) Replaces a single row instance to the given index in this container and replaces the existing row.voidReplaces a single row instance to the given index in this container and replaces the existing row.Returns the rows of this instance as a stream.Methods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitleMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface org.vaadin.firitin.fields.internalhtmltable.TableRowContainer
getChildren, getRow, getRows
-
Constructor Details
-
Table
public Table()
-
-
Method Details
-
getCaption
Returns theTableCaptionfor this instance. Creates a new instance on the first call.- Returns:
- caption
-
getColumnGroup
Returns theTableColumnGroupfor this instance. Creates a new instance on the first call.- Returns:
- column group
-
getHead
Returns theTableHeadfor this instance. Creates a new instance on the first call.- Returns:
- table head
-
removeHead
public void removeHead()Removes the head instance from this table.
Does not move any rows from the head to the table itself. That has to be done manually. -
removeFoot
public void removeFoot()Removes the foot instance from this table.
Does not move any rows from the foot to the table itself. That has to be done manually. -
removeBody
public void removeBody()Removes the body instance from this table.
Does not move any rows from the body to the table itself. That has to be done manually. -
removeCaption
public void removeCaption()Removes the caption instance from this table. -
removeColumnGroup
public void removeColumnGroup()Removes the column group instance from this table. -
getBody
Returns theTableBodyfor this instance. Creates a new instance on the first call.
When rows have been assigned to this table instance before calling this method, these rows will be reassigned to the body to prevent creating an invalid dom structure.
Any subsequent calls to this table'saddRows(TableRow...)method will be delegated to the body's one.- Returns:
- table body
-
getFoot
Returns theTableFootfor this instance. Creates a new instance on the first call.- Returns:
- foot
-
addRows
Adds the given list of rows.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
addRowsin interfaceTableRowContainer- Parameters:
rows- rows
-
insertRows
Inserts the given rows at the given index to this instance. Existing items will be placed after the inserted items.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
insertRowsin interfaceTableRowContainer- Parameters:
rows- rowsindex- to insert the rows at
-
replaceRow
Replaces a single row instance to the given index in this container and replaces the existing row.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
replaceRowin interfaceTableRowContainer- Parameters:
index- index to set the new item torow- row
-
removeRows
Removes the given rows from this instance. Items, that are not child of this instance, will lead to an exception.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
removeRowsin interfaceTableRowContainer- Parameters:
rows- rows to remove
-
streamRows
Returns the rows of this instance as a stream. Empty if no rows have been added yet.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
streamRowsin interfaceTableRowContainer- Returns:
- rows as stream
-
addRow
Adds a single row instance to this container. The created row is returned for further configuration.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
addRowin interfaceTableRowContainer- Returns:
- the created row
-
addRows
Adds multiple rows to this instance based on the given integer (must be greater than 0). The created rows are returned as an array, that can be used for further configuration.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
addRowsin interfaceTableRowContainer- Parameters:
rows- amount of rows to add- Returns:
- created row objects
-
insertRow
Inserts a single row instance at the given index to this container. Existing items will be placed after the inserted items. The created row is returned for further configuration.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
insertRowin interfaceTableRowContainer- Parameters:
index- to insert the row at- Returns:
- the created row
-
setRow
Replaces a single row instance to the given index in this container and replaces the existing row.
This method has the same functionality asreplaceRow(int, TableRow).
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
setRowin interfaceTableRowContainer- Parameters:
index- index to set the new item torow- row- See Also:
-
removeAllRows
public void removeAllRows()Removes all rows.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
removeAllRowsin interfaceTableRowContainer
-
removeRow
public void removeRow(int index) Removes the row with the given index. Noop, if no row has been found for that index.
When this table has a body, it will automatically delegate the call to the body's respective method.- Specified by:
removeRowin interfaceTableRowContainer- Parameters:
index- index to remove
-