public class ReportBuilder<D> extends Object
ReportBuilder.of("Hotel Report") .add(Hotel::getName, "Hotel", NAME) .add(Hotel::getCity, "City", CITY) .add(Hotel::getStreet, "Street") .build(httpServletRequest, httpServletResponse, resource);
Modifier and Type | Class and Description |
---|---|
static class |
ReportBuilder.Url
URL constants
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
ajaxEnabled
is An AJAX enabled?
|
protected HttpParameter |
ajaxRequestParam
AJAX request param
|
protected boolean |
autoSubmmitOnLoad
Call an autosubmit on first load
|
protected ReportBuilderConfig |
config
Table builder config
|
protected Injector |
footer
Print an empty text by default
|
protected Injector |
formAdditions
Form injector
|
protected GridBuilder<D> |
gridBuilder
Grid builder
|
protected Injector |
header
Print a config title by default
|
protected Injector |
htmlHeader
Extension is empty by default
|
protected Supplier<Injector> |
javascritWriter
Javascript writer
|
Constructor and Description |
---|
ReportBuilder(HtmlConfig config) |
ReportBuilder(CharSequence title) |
ReportBuilder(ReportBuilderConfig config) |
ReportBuilder(ReportBuilderConfig config,
GridBuilder<D> builder) |
Modifier and Type | Method and Description |
---|---|
<V> ReportBuilder<D> |
add(Function<D,V> column) |
<V> ReportBuilder<D> |
add(Function<D,V> column,
CharSequence title) |
<V> ReportBuilder<D> |
add(Function<D,V> column,
CharSequence title,
HttpParameter param) |
<V> ReportBuilder<D> |
add(Function<D,V> column,
Injector title) |
<V> ReportBuilder<D> |
add(Function<D,V> column,
Injector title,
HttpParameter param) |
ReportBuilder<D> |
addColumn(Column<D> column,
CharSequence title) |
ReportBuilder<D> |
addColumn(Column<D> column,
Injector title) |
ReportBuilder<D> |
addOrder(CharSequence title)
Add new column for a row counting
|
void |
build(javax.servlet.http.HttpServletRequest input,
javax.servlet.http.HttpServletResponse output,
Function<GridBuilder<D>,Stream<D>> resource)
Build the HTML page including a table
|
void |
build(javax.servlet.http.HttpServletRequest input,
javax.servlet.http.HttpServletResponse output,
Stream<D> resource)
Build the HTML page including a table
|
protected void |
doAjax(javax.servlet.http.HttpServletRequest input,
JsonBuilder output,
Function<GridBuilder<D>,Stream<D>> resource)
Return lighlited text in HTML format according a regular expression
|
ColumnModel<D,?> |
getColumn(int index)
Get column model by index
|
int |
getColumnSize()
Returns a count of columns
|
ColumnModel<D,?> |
getSortedColumn()
Get sorted column or a stub of the sorted column was not found
|
protected void |
printHtmlBody(javax.servlet.http.HttpServletRequest input,
HtmlElement html,
Function<GridBuilder<D>,Stream<D>> resource) |
protected void |
printTableBody(Element table,
javax.servlet.http.HttpServletRequest input,
Function<GridBuilder<D>,Stream<D>> resource) |
ReportBuilder<D> |
setAjaxEnabled(boolean ajaxEnabled)
Enable of disable an AJAX feature, default value si
true |
ReportBuilder<D> |
setAjaxRequestParam(HttpParameter ajaxRequestParam) |
ReportBuilder<D> |
setEmbeddedIcons(boolean embeddedIcons) |
ReportBuilder<D> |
setFooter(Injector footer) |
ReportBuilder<D> |
setFormAdditions(Injector formItem)
Deprecated.
|
ReportBuilder<D> |
setFormItem(Injector formItem) |
ReportBuilder<D> |
setHeader(Injector header) |
ReportBuilder<D> |
setHtmlHeader(Injector htmlHeader) |
ReportBuilder<D> |
setJavascritWriter(Supplier<Injector> javascritWriter) |
protected void |
setSort(ColumnModel sort)
Mark a column as sortable
|
<V> ReportBuilder<D> |
sortable()
Add a sortable indicator to the last column model
|
<V> ReportBuilder<D> |
sortable(boolean ascending)
Add a sortable indicator to the last column model
|
<V> ReportBuilder<D> |
sortable(Direction direction)
Add a sortable indicator to the last column model
|
@Nonnull protected final GridBuilder<D> gridBuilder
protected final ReportBuilderConfig config
@Nonnull protected HttpParameter ajaxRequestParam
protected boolean ajaxEnabled
protected boolean autoSubmmitOnLoad
public ReportBuilder(@Nonnull CharSequence title)
public ReportBuilder(@Nonnull HtmlConfig config)
public ReportBuilder(@Nonnull ReportBuilderConfig config)
public ReportBuilder(@Nonnull ReportBuilderConfig config, @Nonnull GridBuilder<D> builder)
@Nonnull public <V> ReportBuilder<D> add(Function<D,V> column)
@Nonnull public <V> ReportBuilder<D> add(Function<D,V> column, CharSequence title)
@Nonnull public <V> ReportBuilder<D> add(Function<D,V> column, CharSequence title, @Nullable HttpParameter param)
@Nonnull public <V> ReportBuilder<D> add(Function<D,V> column, Injector title, @Nullable HttpParameter param)
@Nonnull public ReportBuilder<D> addColumn(@Nonnull Column<D> column, @Nonnull CharSequence title)
@Nonnull public ReportBuilder<D> addColumn(@Nonnull Column<D> column, @Nonnull Injector title)
@Nonnull public ReportBuilder<D> addOrder(@Nonnull CharSequence title)
public ColumnModel<D,?> getColumn(int index)
public int getColumnSize()
@Nonnull public <V> ReportBuilder<D> sortable()
@Nonnull public <V> ReportBuilder<D> sortable(@Nullable boolean ascending)
ascending
- Ascending or descending direction of the sort@Nonnull public <V> ReportBuilder<D> sortable(@Nonnull Direction direction)
direction
- The null
value shows an unused sorting action.@Nonnull public ColumnModel<D,?> getSortedColumn()
@Nonnull public ReportBuilder<D> setAjaxRequestParam(@Nonnull HttpParameter ajaxRequestParam)
@Nonnull public ReportBuilder<D> setHtmlHeader(@Nonnull Injector htmlHeader)
@Nonnull public ReportBuilder<D> setHeader(@Nonnull Injector header)
@Nonnull public ReportBuilder<D> setFooter(@Nonnull Injector footer)
@Nonnull public ReportBuilder<D> setFormItem(@Nonnull Injector formItem)
@Deprecated @Nonnull public ReportBuilder<D> setFormAdditions(@Nonnull Injector formItem)
setFormItem(org.ujorm.tools.web.ao.Injector)
rather.public ReportBuilder<D> setAjaxEnabled(boolean ajaxEnabled)
true
public ReportBuilder<D> setJavascritWriter(@Nonnull Supplier<Injector> javascritWriter)
public ReportBuilder<D> setEmbeddedIcons(boolean embeddedIcons) throws IllegalStateException
IllegalStateException
public void build(@Nonnull javax.servlet.http.HttpServletRequest input, @Nonnull javax.servlet.http.HttpServletResponse output, @Nonnull Stream<D> resource)
public void build(@Nonnull javax.servlet.http.HttpServletRequest input, @Nonnull javax.servlet.http.HttpServletResponse output, @Nonnull Function<GridBuilder<D>,Stream<D>> resource)
protected void setSort(@Nonnull ColumnModel sort)
protected void printHtmlBody(@Nonnull javax.servlet.http.HttpServletRequest input, @Nonnull HtmlElement html, @Nonnull Function<GridBuilder<D>,Stream<D>> resource)
protected void printTableBody(@Nonnull Element table, @Nonnull javax.servlet.http.HttpServletRequest input, @Nonnull Function<GridBuilder<D>,Stream<D>> resource)
protected void doAjax(@Nonnull javax.servlet.http.HttpServletRequest input, @Nonnull JsonBuilder output, @Nonnull Function<GridBuilder<D>,Stream<D>> resource) throws javax.servlet.ServletException, IOException
input
- servlet requestoutput
- A JSON writerjavax.servlet.ServletException
- if a servlet-specific error occursIOException
- if an I/O error occursCopyright 2019-2022, Pavel Ponec