public class TextContentBuilder extends java.lang.Object implements ContentBuilder, ExtendedXMLBuilder
ContentBuilder that generates plain text.| Constructor and Description |
|---|
TextContentBuilder() |
| Modifier and Type | Method and Description |
|---|---|
void |
addActionButtons(Form f,
java.lang.String legend,
java.util.Set<java.lang.String> actions)
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
|
SimpleXMLBuilder |
addClass(java.lang.CharSequence s)
Convenience method to add an additional class attribute using
the HTML convention that multiple classes are represented
as one attribute with values separated by spaces.
|
<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. |
<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
Fields 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.
|
SimpleXMLBuilder |
appendParent()
Append the contents of this builder to the parent (if any).
|
SimpleXMLBuilder |
attr(java.lang.String name,
java.lang.CharSequence s)
Add an attribute.
|
void |
br()
Insert line break.
|
<X> boolean |
canAdd(X target)
Does this ContentBuilder have special handling for the object
beyond adding the string representation.
|
SimpleXMLBuilder |
clean(char c) |
SimpleXMLBuilder |
clean(java.lang.CharSequence s)
append text to the document escaping any characters that might be interpreted as XML markup.
|
SimpleXMLBuilder |
clean(java.lang.Number i)
Append text representation of the number
|
boolean |
cleanFormatted(int max,
java.lang.String s)
add a pre-formatted string as a text section.
|
SimpleXMLBuilder |
close()
close the last opened tag.
|
void |
closeDetails()
finish a section started by
ContentBuilder.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 ContentBuilder.addParent() method is called. |
SimpleXMLBuilder |
getNested()
Get a new SimpleXMLBuilder of the same type as this object.
|
ContentBuilder |
getPanel(java.lang.String... type)
create a nested content panel
|
SimpleXMLBuilder |
getParent()
Get the parent object.
|
ExtendedXMLBuilder |
getSpan()
create a
ExtendedXMLBuilder that appends its contents as XML
text when the SimpleXMLBuilder.appendParent() method is called. |
ExtendedXMLBuilder |
getText()
create a
ExtendedXMLBuilder that appends its contents as XML
text when the SimpleXMLBuilder.appendParent() method is called. |
void |
nbs()
Insert a non-breaking space.
|
SimpleXMLBuilder |
open(java.lang.String tag)
open a tag
|
SimpleXMLBuilder |
open(java.lang.String tag,
java.lang.String[][] attr)
open a tag with attributes.
|
boolean |
setEscapeUnicode(boolean escape_unicode)
Should high code-point unicode characters be escaped to
avoid charset problems.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddActionButtons, addFormLabel, getSpanattrpublic ExtendedXMLBuilder getText()
ContentBuilderExtendedXMLBuilder 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 ContentBuilder.getSpan() where this does not make sense for example where the
ContentBuilder represents a heading or table cell.getText in interface ContentBuilderpublic ExtendedXMLBuilder getSpan()
ContentBuilderExtendedXMLBuilder 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.getSpan in interface ContentBuilderExtendedXMLBuilderpublic void addText(java.lang.String text)
ContentBuilderContentBuilder.getText().clean(text).appendParent().addText in interface ContentBuildertext - string to add to contentpublic boolean cleanFormatted(int max,
java.lang.String s)
ContentBuildercleanFormatted in interface ContentBuildermax - max line lengthpublic ContentBuilder getHeading(int level)
ContentBuilderContentBuilder that appends its contents as a
heading when the ContentBuilder.addParent() method is called.
If the heading is to only contain text use the ContentBuilder.addHeading(int, String) method.getHeading in interface ContentBuilderlevel - level of headingpublic void addHeading(int level,
java.lang.String text)
ContentBuilderContentBuilder.getHeading(int).addText(text).addHeading in interface ContentBuilderpublic ContentBuilder getPanel(java.lang.String... type) throws java.lang.UnsupportedOperationException
ContentBuildergetPanel in interface ContentBuildertype - Strings specifying a formatting types for the panel.java.lang.UnsupportedOperationExceptionpublic ContentBuilder addParent() throws java.lang.UnsupportedOperationException
ContentBuilderaddParent in interface ContentBuilderjava.lang.UnsupportedOperationExceptionpublic <X> void addObject(X target)
ContentBuilderContentBuilder.addParent()
on child objects.addObject in interface ContentBuilderaddObject in interface SimpleXMLBuilderpublic <X> boolean canAdd(X target)
ContentBuildercanAdd in interface ContentBuilderpublic <X> void addList(java.lang.Iterable<X> list)
ContentBuilderUIGenerators will generate their content otherwise
a suitable text representation will be used.addList in interface ContentBuilderpublic <X> void addNumberedList(int start,
java.lang.Iterable<X> list)
ContentBuilderUIGenerators will generate their content otherwise
a suitable text representation will be used.addNumberedList in interface ContentBuilderpublic <X> void addList(X[] list)
ContentBuilderUIGenerators will generate their content otherwise
a suitable text representation will be used.addList in interface ContentBuilderpublic void addButton(AppContext conn, java.lang.String text, FormResult action)
ContentBuilderaddButton in interface ContentBuilderconn - AppContextpublic void addButton(AppContext conn, java.lang.String text, java.lang.String hover, FormResult action)
ContentBuilderaddButton in interface ContentBuilderconn - AppContexthover - tooltip textpublic void addLink(AppContext conn, java.lang.String text, java.lang.String hover, FormResult action)
ContentBuilderaddLink in interface ContentBuilderconn - AppContexttext - link texthover - tooltip textaction - FormResult to navigate to.public void addLink(AppContext conn, java.lang.String text, FormResult action)
ContentBuilderaddLink in interface ContentBuilderconn - AppContexttext - link textaction - FormResult to navigate to.public <C,R> void addTable(AppContext conn, java.text.NumberFormat nf, Table<C,R> t)
ContentBuilderUIGenerator should be added via UIGenerator.addContent(ContentBuilder)addTable in interface ContentBuilderpublic <C,R> void addTable(AppContext conn, Table<C,R> t)
ContentBuilderUIGenerator should be added via UIGenerator.addContent(ContentBuilder)addTable in interface ContentBuilderpublic <C,R> void addTable(AppContext conn, Table<C,R> t, java.text.NumberFormat nf, java.lang.String style)
ContentBuilderUIGenerator should be added via UIGenerator.addContent(ContentBuilder)addTable in interface ContentBuilderpublic <C,R> void addTable(AppContext conn, Table<C,R> t, java.lang.String style)
ContentBuilderUIGenerator should be added via UIGenerator.addContent(ContentBuilder)addTable in interface ContentBuilderpublic <C,R> void addColumn(AppContext conn, Table<C,R> t, C col)
ContentBuilderTable formatted in
2 columns (key and data).addColumn in interface ContentBuilderpublic void addFormTable(AppContext conn, java.lang.Iterable<Field> f)
ContentBuilderFields as a table of labels and inputs.addFormTable in interface ContentBuilderpublic <I,T> void addFormLabel(AppContext conn, Field<I> f, T item)
ContentBuilderFieldaddFormLabel in interface ContentBuilderf - Fielditem - item (only used by RadioInputs)public <I,T> void addFormInput(AppContext conn, Field<I> f, T item)
ContentBuilderField
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.addFormInput in interface ContentBuilderconn - AppContextf - Fielditem - item (only used by RadioInputs)public void addActionButtons(Form f, java.lang.String legend, java.util.Set<java.lang.String> actions)
ContentBuilderaddActionButtons in interface ContentBuilderf - Formlegend - optional legend for the button setactions - Set of action namespublic java.lang.String toString()
toString in class java.lang.Objectpublic SimpleXMLBuilder clean(java.lang.CharSequence s)
SimpleXMLBuilderclean in interface SimpleXMLBuilderpublic SimpleXMLBuilder clean(char c)
clean in interface SimpleXMLBuilderpublic SimpleXMLBuilder clean(java.lang.Number i)
SimpleXMLBuilderclean in interface SimpleXMLBuilderi - Number to formatpublic SimpleXMLBuilder open(java.lang.String tag)
SimpleXMLBuilderopen in interface SimpleXMLBuilderpublic SimpleXMLBuilder open(java.lang.String tag, java.lang.String[][] attr)
SimpleXMLBuilderopen in interface SimpleXMLBuildertag - tag to openattr - array of name,value pairspublic SimpleXMLBuilder attr(java.lang.String name, java.lang.CharSequence s)
SimpleXMLBuilderattr in interface SimpleXMLBuildername - String attribute names - CharSequence attribute value or null for no valuepublic SimpleXMLBuilder close()
SimpleXMLBuilderclose in interface SimpleXMLBuilderpublic SimpleXMLBuilder getNested() throws java.lang.UnsupportedOperationException
SimpleXMLBuilderSimpleXMLBuilder.appendParent() method.
The calling code need only hold a reference to the current builder as the
SimpleXMLBuilder.appendParent() method returns the parent.getNested in interface SimpleXMLBuilderjava.lang.UnsupportedOperationExceptionpublic SimpleXMLBuilder appendParent() throws java.lang.UnsupportedOperationException
SimpleXMLBuilderappendParent in interface SimpleXMLBuilderjava.lang.UnsupportedOperationExceptionpublic SimpleXMLBuilder getParent()
SimpleXMLBuildergetParent in interface SimpleXMLBuilderpublic boolean setEscapeUnicode(boolean escape_unicode)
SimpleXMLBuildersetEscapeUnicode in interface SimpleXMLBuilderpublic void nbs()
ExtendedXMLBuildernbs in interface ExtendedXMLBuilderpublic void br()
ExtendedXMLBuilderbr in interface ExtendedXMLBuilderpublic <X> void addList(java.util.Map<java.lang.String,java.lang.String> attr,
java.lang.Iterable<X> list)
ContentBuilderUIGenerators will generate their content otherwise
a suitable text representation will be used.addList in interface ContentBuilderpublic ContentBuilder getDetails(java.lang.Object summary_text)
ContentBuilderContentBuilder or
the current object. Once content has been added the ContentBuilder.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
ContentBuilder.addObject(Object) on the summary text
and the current ContentBuilder will be returned.getDetails in interface ContentBuilderpublic void closeDetails()
ContentBuilderContentBuilder.getDetails(Object)
this may be a no-op if expended section are not supportedcloseDetails in interface ContentBuilderpublic SimpleXMLBuilder addClass(java.lang.CharSequence s)
ExtendedXMLBuilderaddClass in interface ExtendedXMLBuilders - CharSequence attribute value or null for no valuepublic void addImage(AppContext conn, java.lang.String alt, java.lang.String hover, java.lang.Integer width, java.lang.Integer height, ServeDataResult image)
ContentBuilderServeDataResultaddImage in interface ContentBuilderwidth - (optional, ignored if <= 0)height - (optional, ignored if <= 0)