Klasse UiTableList<T>

java.lang.Object
org.obrel.core.RelatedObject
de.esoco.process.param.ParameterWrapper<List<org.obrel.core.RelationType<?>>,UiTableList<T>>
de.esoco.process.ui.UiComponent<List<org.obrel.core.RelationType<?>>,UiTableList<T>>
de.esoco.process.ui.UiContainer<UiTableList<T>>
de.esoco.process.ui.UiComposite<UiTableList<T>>
de.esoco.process.ui.composite.UiTableList<T>
Alle implementierten Schnittstellen:
de.esoco.lib.property.HasSelection<UiTableList<T>.Row>, org.obrel.core.Relatable
Bekannte direkte Unterklassen:
UiPagingTableList

public class UiTableList<T> extends UiComposite<UiTableList<T>> implements de.esoco.lib.property.HasSelection<UiTableList<T>.Row>
A table-like rendering of components in a list. The header and data areas are rendered with UiListPanel instances where the list items represent the header and data rows. The table appearance is achieved by using the same column grid layout for the item content.
  • Konstruktordetails

    • UiTableList

      public UiTableList(UiContainer<?> parent)
      Creates a new instance with rows that can be expanded by selecting their header area. Expanding an item will reveal the item content and hide any other previously expanded item content.
      Parameter:
      parent - The parent container
    • UiTableList

      public UiTableList(UiContainer<?> parent, de.esoco.lib.expression.monad.Option<UiListPanel.ExpandableListStyle> expandStyle)
      Creates a new instance with rows that can be expanded by selecting their header area. Expanding an item will reveal the item content and hide any other previously expanded item content.
      Parameter:
      parent - The parent container
      expandStyle - The expand style
  • Methodendetails

    • addColumn

      public <V> UiTableList<T>.Column<V> addColumn(Function<? super T,V> getColumnData)
      Adds a column to this table.
      Parameter:
      getColumnData - A function that retrieves the column value of a table cell from a row data object
      Gibt zurück:
      The new column
    • addColumns

      public void addColumns(Function<? super T,?>... columnDataReaders)
      Adds multiple columns at once.
      Parameter:
      columnDataReaders - The
    • addEmptyTableInfo

      public void addEmptyTableInfo(Consumer<UiBuilder<?>> createEmtpyTableInfo)
      Adds components that will be displayed if a table is empty, i.e. it has now visible data rows. The argument is a function that receives an UI builder that must be used to build the empty table info component. This component will then be displayed below the table header.

      The application should not make assumptions about the layout of the builder's container and only add a single component. If it needs a more complex UI it should add a container with the required layout.

      Parameter:
      createEmtpyTableInfo - A consumer that receives a builder for the empty table info area
    • addExpandedHeader

      public UiContainer<?> addExpandedHeader(UiLayout layout)
      Creates and returns a container that allows to add expanded content to the header of this list. The content will be displayed if the header is expanded by clicking on it. This method must be invoked before the list is rendered for the first time because it needs to modify the styles of the header components to support expansion.
      Parameter:
      layout - The layout of the expanded header content panel the builder is created for
      Gibt zurück:
      The container for the expanded header content
    • getColumns

      public List<UiTableList<T>.Column<?>> getColumns()
      Returns the columns of this table.
      Gibt zurück:
      The column list
    • getData

      public final de.esoco.lib.model.DataProvider<T> getData()
      Returns the provider of the table data.
      Gibt zurück:
      The table row data provider
    • getRows

      public List<UiTableList<T>.Row> getRows()
      Returns the data rows of this table.
      Gibt zurück:
      The data row list
    • getSelection

      public UiTableList<T>.Row getSelection()
      Returns the currently selected row.
      Angegeben von:
      getSelection in Schnittstelle de.esoco.lib.property.HasSelection<T>
      Gibt zurück:
      The selected or (NULL for none)
    • onColumnSelection

      public UiTableList<T> onColumnSelection(Consumer<UiTableList<T>.Column<?>> handleColumnSelection)
      Registers a listener for column selections (i.e. clicks on column headers). The listener will be invoked with the respective column as it's argument.
      Parameter:
      handleColumnSelection - The column selection handler
      Gibt zurück:
      This instance
    • onRowSelection

      public UiTableList<T> onRowSelection(Consumer<UiTableList<T>.Row> handleRowSelection)
      Registers a listener for row selections (i.e. clicks on rows). The listener will be invoked with the respective row as it's argument.
      Parameter:
      handleRowSelection - The row selection handler
      Gibt zurück:
      This instance
    • removeRow

      public void removeRow(UiTableList<T>.Row row)
      Removes a certain row from this table.
      Parameter:
      row - The row to remove
    • setColumnPrefix

      public void setColumnPrefix(String prefix)
      Sets the prefix to be used for column titles.
      Parameter:
      prefix - The column title prefix
    • setData

      public void setData(de.esoco.lib.model.DataProvider<T> rowDataProvider)
      Sets the data provider of the table row data. This will immediately build the table rows from the data so all necessary initializations of this table should have been performed already (e.g. settings columns or an expanded row builder).
      Parameter:
      rowDataProvider - The data provider that returns the table rows
    • setExpandedRowBuilder

      public void setExpandedRowBuilder(BiConsumer<UiBuilder<?>,T> builder)
      Sets a consumer that will be invoked to build the content of expanded rows if this table has an expansion style. This can be used for rows with simple row content where the full content can be build at once. For complex cases where the expanded row content should be updated only upon row selection a UiTableList<T>.Row subclass should be used instead with overridden methods UiTableList.Row.initExpandedContent(UiBuilder) and UiTableList.Row.updateExpandedContent().

      The argument is a binary consumer that will be invoked with the builder for the row content container and the data object of the row.

      Parameter:
      builder - The builder for the row content
    • setSelection

      public void setSelection(UiTableList<T>.Row row)
      Sets the selection to a certain row.
      Angegeben von:
      setSelection in Schnittstelle de.esoco.lib.property.HasSelection<T>
      Parameter:
      row - The row to select or NULL for no selection
    • buildContent

      protected void buildContent(UiBuilder<?> builder)
      This method can be overridden by subclasses to build the content of this container. Alternatively, the content can also be built by adding components to it after creation. If both mechanisms are used in combination the call to UiContainer.buildContent(UiBuilder) will occur afterwards because it is invoked just before the container is made visible (from UiContainer.applyProperties().

      The UiBuilder argument is the same instance that is returned by UiContainer.builder().

      The default implementation of this method does nothing.

      Setzt außer Kraft:
      buildContent in Klasse UiContainer<UiTableList<T>>
      Parameter:
      builder - The builder to create the container UI with
    • createColumn

      protected <V> UiTableList<T>.Column<V> createColumn(Function<? super T,V> getColumnData)
      Creates a new column. Subclasses can override this method to return their own column subclasses, e.g. to handle special formatting or value parsing.
      Parameter:
      getColumnData - The column data access function
      Gibt zurück:
      The new column instance
    • createRow

      protected UiTableList<T>.Row createRow(UiListPanel.Item item, T rowData)
      Creates a new row. Subclasses can override this method to return their own row subclasses, e.g. to handle the row content.
      Parameter:
      item - The row item
      rowData - The row data
      Gibt zurück:
      A new row instance
    • displayRows

      protected void displayRows(int firstRow, int count)
      Update the rows of this table. This will also adjust the number of table rows (i.e. add or remove rows) to match the size of the given data set.
      Parameter:
      firstRow - The index of the first row to display
      count - The number of rows to display
    • updateData

      protected void updateData()
      Updates the table display from the data provider that has been set through setData(DataProvider). The default implementation renders all data objects from the provider. Subclasses can override this method if they need to display only part of the data, e.g. for a paging table.