public interface ContentBuilder
Modifier and Type | Method and Description |
---|---|
default void |
addActionButtons(Form f)
Add the action buttons for a form.
|
void |
addActionButtons(Form f,
java.lang.String legend,
java.util.Set<java.lang.String> names)
A a set of action buttons to the content
|
void |
addButton(AppContext conn,
java.lang.String text,
FormResult action)
Add an action button to the Content
|
void |
addButton(AppContext conn,
java.lang.String text,
java.lang.String hover,
FormResult action)
Add an action button to the Content
|
<C,R> void |
addColumn(AppContext conn,
Table<C,R> t,
C col)
Add the data from a single column of a
Table formatted in
2 columns (key and data). |
<I,T> void |
addFormInput(AppContext conn,
Field<I> f,
T item)
Add the input for a form
Field
If the input is a RadioButtonInput then the item parameter
selects which item the input is for. |
default <I,T> void |
addFormLabel(AppContext conn,
Field<I> f)
Add the label for a form
Field |
<I,T> void |
addFormLabel(AppContext conn,
Field<I> f,
T item)
Add the label for a form
Field |
void |
addFormTable(AppContext conn,
java.lang.Iterable<Field> f)
Add a set of
Field s as a table of labels and inputs. |
void |
addHeading(int level,
java.lang.String text)
Convenience routine to add a heading containing unformatted text.
|
void |
addImage(AppContext conn,
java.lang.String alt,
java.lang.String hover,
java.lang.Integer width,
java.lang.Integer height,
ServeDataResult image)
Add an image served by a
ServeDataResult |
void |
addLink(AppContext conn,
java.lang.String text,
FormResult action)
Add an action link to the Content
|
void |
addLink(AppContext conn,
java.lang.String text,
java.lang.String hover,
FormResult action)
Add an action link to the Content
|
<X> void |
addList(java.lang.Iterable<X> list)
add a bullet list of objects to the content.
|
<X> void |
addList(java.util.Map<java.lang.String,java.lang.String> attr,
java.lang.Iterable<X> list)
add a bullet list of objects to the content.
|
<X> void |
addList(X[] list)
add a bullet list of objects to the content.
|
<X> void |
addNumberedList(int start,
java.lang.Iterable<X> list)
add a numbered list of objects to the content.
|
<X> void |
addObject(X target)
Add an object depending on its type.
|
ContentBuilder |
addParent()
append a nested panel to its parent content.
|
<C,R> void |
addTable(AppContext conn,
java.text.NumberFormat nf,
Table<C,R> t)
Add a table to the content.
|
<C,R> void |
addTable(AppContext conn,
Table<C,R> t)
Add a table to the content.
|
<C,R> void |
addTable(AppContext conn,
Table<C,R> t,
java.text.NumberFormat nf,
java.lang.String style)
Add a table to the content.
|
<C,R> void |
addTable(AppContext conn,
Table<C,R> t,
java.lang.String style)
Add a table to the content.
|
void |
addText(java.lang.String text)
Add unformatted text.
|
<X> boolean |
canAdd(X target)
Does this ContentBuilder have special handling for the object
beyond adding the string representation.
|
boolean |
cleanFormatted(int max,
java.lang.String s)
add a pre-formatted string as a text section.
|
void |
closeDetails()
finish a section started by
getDetails(Object)
this may be a no-op if expended section are not supported |
ContentBuilder |
getDetails(java.lang.Object summary_text)
get an expanding/folding section if supported
This method can either return a new
ContentBuilder or
the current object. |
ContentBuilder |
getHeading(int level)
create a
ContentBuilder that appends its contents as a
heading when the addParent() method is called. |
ContentBuilder |
getPanel(java.lang.String... type)
create a nested content panel
|
ExtendedXMLBuilder |
getSpan()
create a
ExtendedXMLBuilder that appends its contents as XML
text when the SimpleXMLBuilder.appendParent() method is called. |
default ExtendedXMLBuilder |
getSpan(java.lang.String... type)
convenience method to generate a span with defined class/types
|
ExtendedXMLBuilder |
getText()
create a
ExtendedXMLBuilder that appends its contents as XML
text when the SimpleXMLBuilder.appendParent() method is called. |
ExtendedXMLBuilder getText()
ExtendedXMLBuilder
that appends its contents as XML
text when the SimpleXMLBuilder.appendParent()
method is called.
Normally this represents a separate paragraph of text but this can be mapped
onto getSpan()
where this does not make sense for example where the
ContentBuilder
represents a heading or table cell.ExtendedXMLBuilder getSpan()
ExtendedXMLBuilder
that appends its contents as XML
text when the SimpleXMLBuilder.appendParent()
method is called.
This is intended for in-line text rather than creating a paragraph.ExtendedXMLBuilder
default ExtendedXMLBuilder getSpan(java.lang.String... type)
type
- void addText(java.lang.String text)
getText()
.clean(text).appendParent().text
- string to add to contentboolean cleanFormatted(int max, java.lang.String s)
max
- max line lengths
- ContentBuilder getHeading(int level)
ContentBuilder
that appends its contents as a
heading when the addParent()
method is called.
If the heading is to only contain text use the addHeading(int, String)
method.level
- level of headingvoid addHeading(int level, java.lang.String text)
getHeading(int)
.addText(text).level
- text
- ContentBuilder getPanel(java.lang.String... type) throws java.lang.UnsupportedOperationException
type
- Strings specifying a formatting types for the panel.java.lang.UnsupportedOperationException
ContentBuilder getDetails(java.lang.Object summary_text)
ContentBuilder
or
the current object. Once content has been added the closeDetails()
method should be called on whichever object was returned which will
perform any additional actions necessary.
If expanded/folding sections are not supported this will map to
addObject(Object)
on the summary text
and the current ContentBuilder
will be returned.summary_text
- void closeDetails()
getDetails(Object)
this may be a no-op if expended section are not supportedContentBuilder addParent() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
<X> void addObject(X target)
addParent()
on child objects.target
- <X> boolean canAdd(X target)
X
- target
- <X> void addList(java.lang.Iterable<X> list)
UIGenerator
s will generate their content otherwise
a suitable text representation will be used.list
- <X> void addNumberedList(int start, java.lang.Iterable<X> list)
UIGenerator
s will generate their content otherwise
a suitable text representation will be used.list
- <X> void addList(java.util.Map<java.lang.String,java.lang.String> attr, java.lang.Iterable<X> list)
UIGenerator
s will generate their content otherwise
a suitable text representation will be used.attr
- list
- <X> void addList(X[] list)
UIGenerator
s will generate their content otherwise
a suitable text representation will be used.list
- void addButton(AppContext conn, java.lang.String text, FormResult action)
conn
- AppContexttext
- action
- void addButton(AppContext conn, java.lang.String text, java.lang.String hover, FormResult action)
conn
- AppContexttext
- hover
- tooltip textaction
- void addLink(AppContext conn, java.lang.String text, FormResult action)
conn
- AppContexttext
- link textaction
- FormResult to navigate to.void addLink(AppContext conn, java.lang.String text, java.lang.String hover, FormResult action)
conn
- AppContexttext
- link texthover
- tooltip textaction
- FormResult to navigate to.void addImage(AppContext conn, java.lang.String alt, java.lang.String hover, java.lang.Integer width, java.lang.Integer height, ServeDataResult image)
ServeDataResult
conn
- alt
- hover
- width
- (optional, ignored if <= 0)height
- (optional, ignored if <= 0)image
- <C,R> void addTable(AppContext conn, Table<C,R> t)
UIGenerator
should be added via UIGenerator.addContent(ContentBuilder)
conn
- t
- <C,R> void addTable(AppContext conn, Table<C,R> t, java.lang.String style)
UIGenerator
should be added via UIGenerator.addContent(ContentBuilder)
conn
- t
- style
- <C,R> void addTable(AppContext conn, java.text.NumberFormat nf, Table<C,R> t)
UIGenerator
should be added via UIGenerator.addContent(ContentBuilder)
conn
- nf
- t
- <C,R> void addTable(AppContext conn, Table<C,R> t, java.text.NumberFormat nf, java.lang.String style)
UIGenerator
should be added via UIGenerator.addContent(ContentBuilder)
conn
- t
- nf
- style
- <C,R> void addColumn(AppContext conn, Table<C,R> t, C col)
Table
formatted in
2 columns (key and data).conn
- t
- col
- void addFormTable(AppContext conn, java.lang.Iterable<Field> f)
Field
s as a table of labels and inputs.conn
- f
- <I,T> void addFormLabel(AppContext conn, Field<I> f, T item)
Field
conn
- f
- Fielditem
- item (only used by RadioInputs)default <I,T> void addFormLabel(AppContext conn, Field<I> f)
Field
conn
- f
- Field<I,T> void addFormInput(AppContext conn, Field<I> f, T item)
Field
If the input is a RadioButtonInput
then the item parameter
selects which item the input is for. If item is null then
a RadioButtonInput
will output all inputs in a block.conn
- AppContextf
- Fielditem
- item (only used by RadioInputs)default void addActionButtons(Form f)
f
-