Package com.vaadin.ui.components.grid
Class StaticSection<ROW extends StaticSection.StaticRow<?>>
- java.lang.Object
-
- com.vaadin.ui.components.grid.StaticSection<ROW>
-
- Type Parameters:
ROW- the type of the rows in the section
- All Implemented Interfaces:
Serializable
public abstract class StaticSection<ROW extends StaticSection.StaticRow<?>> extends Object implements Serializable
Represents the header or footer section of a Grid.- Since:
- 8.0
- Author:
- Vaadin Ltd.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classStaticSection.StaticRow<CELL extends com.vaadin.ui.components.grid.StaticSection.StaticCell>Abstract base class for Grid header and footer rows.
-
Constructor Summary
Constructors Constructor Description StaticSection()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddColumn(String columnId)Adds a cell corresponding to the given column id to this section.ROWaddRowAt(int index)Adds a new row at the given index.protected abstract ROWcreateRow()Creates a new row instance.protected abstract Grid.Column<?,?>getColumnByInternalId(String internalId)protected abstract Grid<?>getGrid()protected abstract StringgetInternalIdForColumn(Grid.Column<?,?> column)ROWgetRow(int index)Returns the row at the given index.intgetRowCount()Returns the number of rows in this section.protected List<ROW>getRows()Returns an unmodifiable list of the rows in this section.protected abstract SectionStategetState(boolean markAsDirty)Returns the shared state of this section.booleanisVisible()Gets the visibility of this section.protected voidmarkAsDirty()Marks the state of this section as modified.voidreadDesign(org.jsoup.nodes.Element tableSectionElement, DesignContext designContext)Reads the declarative design from the given table section element.voidremoveColumn(String columnId)Removes the cell corresponding to the given column id.voidremoveRow(int index)Removes the row at the given index.voidremoveRow(Object row)Removes the given row from this section.voidsetVisible(boolean visible)Sets the visibility of this section.voidwriteDesign(org.jsoup.nodes.Element tableSectionElement, DesignContext designContext)Writes the declarative design to the given table section element.
-
-
-
Method Detail
-
createRow
protected abstract ROW createRow()
Creates a new row instance.- Returns:
- the new row
-
getState
protected abstract SectionState getState(boolean markAsDirty)
Returns the shared state of this section.- Parameters:
markAsDirty-trueto mark the state as modified,falseotherwise- Returns:
- the section state
-
getGrid
protected abstract Grid<?> getGrid()
-
getColumnByInternalId
protected abstract Grid.Column<?,?> getColumnByInternalId(String internalId)
-
getInternalIdForColumn
protected abstract String getInternalIdForColumn(Grid.Column<?,?> column)
-
markAsDirty
protected void markAsDirty()
Marks the state of this section as modified.
-
addRowAt
public ROW addRowAt(int index)
Adds a new row at the given index.- Parameters:
index- the index of the new row- Returns:
- the added row
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index > getRowCount()
-
removeRow
public void removeRow(int index)
Removes the row at the given index.- Parameters:
index- the index of the row to remove- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >= getRowCount()
-
removeRow
public void removeRow(Object row)
Removes the given row from this section.- Parameters:
row- the row to remove, not null- Throws:
IllegalArgumentException- if this section does not contain the row
-
getRow
public ROW getRow(int index)
Returns the row at the given index.- Parameters:
index- the index of the row- Returns:
- the row at the index
- Throws:
IndexOutOfBoundsException- ifindex < 0 || index >= getRowCount()
-
getRowCount
public int getRowCount()
Returns the number of rows in this section.- Returns:
- the number of rows
-
addColumn
public void addColumn(String columnId)
Adds a cell corresponding to the given column id to this section.- Parameters:
columnId- the id of the column for which to add a cell
-
removeColumn
public void removeColumn(String columnId)
Removes the cell corresponding to the given column id.- Parameters:
columnId- the id of the column whose cell to remove
-
writeDesign
public void writeDesign(org.jsoup.nodes.Element tableSectionElement, DesignContext designContext)Writes the declarative design to the given table section element.- Parameters:
tableSectionElement- Element to write design todesignContext- the design context
-
readDesign
public void readDesign(org.jsoup.nodes.Element tableSectionElement, DesignContext designContext) throws DesignExceptionReads the declarative design from the given table section element.- Parameters:
tableSectionElement- Element to read design fromdesignContext- the design context- Throws:
DesignException- if the table section contains unexpected children- Since:
- 7.5.0
-
getRows
protected List<ROW> getRows()
Returns an unmodifiable list of the rows in this section.- Returns:
- the rows in this section
-
setVisible
public void setVisible(boolean visible)
Sets the visibility of this section.- Parameters:
visible-trueif visible;falseif not- Since:
- 8.1.1
-
isVisible
public boolean isVisible()
Gets the visibility of this section.- Returns:
trueif visible;falseif not- Since:
- 8.1.1
-
-