public class GridBuilder<D> extends Object
Modifier and Type | Field and Description |
---|---|
protected List<ColumnModel<D,?>> |
columns
Columns
|
protected GridBuilderConfig |
config
Table builder config
|
Constructor and Description |
---|
GridBuilder(GridBuilderConfig config) |
GridBuilder(HtmlConfig config) |
GridBuilder(CharSequence title) |
Modifier and Type | Method and Description |
---|---|
<V> GridBuilder<D> |
add(Function<D,V> column) |
<V> GridBuilder<D> |
add(Function<D,V> column,
CharSequence title) |
<V> GridBuilder<D> |
add(Function<D,V> column,
CharSequence title,
HttpParameter param) |
<V> GridBuilder<D> |
add(Function<D,V> column,
Injector title) |
<V> GridBuilder<D> |
add(Function<D,V> column,
Injector title,
HttpParameter param) |
GridBuilder<D> |
addColumn(Column<D> column,
CharSequence title) |
GridBuilder<D> |
addColumn(Column<D> column,
Injector title) |
protected <V> GridBuilder<D> |
addInternal(Function<D,V> column,
CharSequence title,
HttpParameter param) |
GridBuilder<D> |
addOrder(CharSequence title)
Add new column for a row counting
|
void |
build(ApiElement parent,
ColumnModel sortedColumn,
Function<GridBuilder<D>,Stream<D>> resource)
Build the HTML page including a table
|
void |
build(ApiElement parent,
Function<GridBuilder<D>,Stream<D>> resource)
Build the HTML page including a table
|
ColumnModel<D,?> |
getColumn(int index)
Get column model by index
|
Stream<ColumnModel<D,?>> |
getColumns()
Returns all table columns in a stream
|
int |
getColumnSize()
Returns a count of columns
|
ColumnModel<D,?> |
getSortedColumn()
Get sorted column or a stub of the sorted column was not found
|
boolean |
isSortable()
Returns the true in case the table is sortable.
|
boolean |
isSortableCalculated()
Calculate if the table has an sortable column
|
protected void |
printTable(Element parent,
Function<GridBuilder<D>,Stream<D>> resource)
Print table
|
protected void |
setSort(ColumnModel sort)
Mark a column as sorted
|
<V> GridBuilder<D> |
sortable()
Add a sortable indicator to the last column model
|
<V> GridBuilder<D> |
sortable(boolean ascending)
Add a sortable indicator to the last column model
|
<V> GridBuilder<D> |
sortable(Direction direction)
Add a sortable indicator to the last column model
|
protected final List<ColumnModel<D,?>> columns
protected final GridBuilderConfig config
public GridBuilder(@Nonnull CharSequence title)
public GridBuilder(@Nonnull HtmlConfig config)
public GridBuilder(@Nonnull GridBuilderConfig config)
@Nonnull public <V> GridBuilder<D> add(Function<D,V> column)
@Nonnull public <V> GridBuilder<D> add(Function<D,V> column, CharSequence title)
@Nonnull public <V> GridBuilder<D> add(Function<D,V> column, CharSequence title, @Nullable HttpParameter param)
@Nonnull public <V> GridBuilder<D> add(Function<D,V> column, Injector title, @Nullable HttpParameter param)
@Nonnull public GridBuilder<D> addColumn(@Nonnull Column<D> column, @Nonnull CharSequence title)
@Nonnull public GridBuilder<D> addColumn(@Nonnull Column<D> column, @Nonnull Injector title)
@Nonnull public GridBuilder<D> addOrder(@Nonnull CharSequence title)
@Nonnull protected <V> GridBuilder<D> addInternal(@Nonnull Function<D,V> column, @Nonnull CharSequence title, @Nullable HttpParameter param)
public ColumnModel<D,?> getColumn(int index)
public int getColumnSize()
@Nonnull public <V> GridBuilder<D> sortable()
@Nonnull public <V> GridBuilder<D> sortable(@Nullable boolean ascending)
ascending
- Ascending or descending direction of the sort@Nonnull public <V> GridBuilder<D> sortable(@Nonnull Direction direction)
direction
- The null
value shows an unused sorting action.@Nonnull public ColumnModel<D,?> getSortedColumn()
public void build(@Nonnull ApiElement parent, @Nonnull Function<GridBuilder<D>,Stream<D>> resource)
public void build(@Nonnull ApiElement parent, @Nonnull ColumnModel sortedColumn, @Nonnull Function<GridBuilder<D>,Stream<D>> resource)
protected void setSort(@Nonnull ColumnModel sort)
protected void printTable(@Nonnull Element parent, @Nonnull Function<GridBuilder<D>,Stream<D>> resource)
parent
- If a name of the element is a "table"
or an empty text
then do not create new table element.resource
- Data sourcepublic final boolean isSortable()
public boolean isSortableCalculated()
public Stream<ColumnModel<D,?>> getColumns()
Copyright 2019-2022, Pavel Ponec