public class SwingContentBuilder extends java.lang.Object implements ContentBuilder
| Modifier and Type | Class and Description |
|---|---|
static class |
SwingContentBuilder.XMLPanel |
| Constructor and Description |
|---|
SwingContentBuilder(AppContext conn,
javax.swing.JComponent content,
javax.swing.JFrame frame) |
SwingContentBuilder(AppContext conn,
javax.swing.JFrame frame) |
| 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 c,
java.lang.String text,
FormResult action)
Add an action button to the Content
|
void |
addButton(AppContext c,
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 radio_selector)
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 |
addFormTable(AppContext conn,
java.lang.Iterable<Field> f,
boolean validate) |
void |
addHeading(int level,
java.lang.String text)
Convenience routine to add a heading containing unformatted text.
|
void |
addHtml(java.lang.String 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 c,
java.lang.String text,
FormResult action)
Add an action link to the Content
|
void |
addLink(AppContext c,
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
ContentBuilder.getDetails(Object)
this may be a no-op if expended section are not supported |
int |
getAlign() |
javax.swing.border.Border |
getBorder() |
javax.swing.JComponent |
getComponent() |
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. |
java.awt.Font |
getFont() |
ContentBuilder |
getHeading(int level)
create a
ContentBuilder that appends its contents as a
heading when the ContentBuilder.addParent() method is called. |
Logger |
getLogger() |
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. |
ExtendedXMLBuilder |
getText()
create a
ExtendedXMLBuilder that appends its contents as XML
text when the SimpleXMLBuilder.appendParent() method is called. |
void |
setAlign(int align) |
void |
setBorder(javax.swing.border.Border border) |
void |
setComponentValues() |
void |
setFont(java.awt.Font f) |
boolean |
validate(Form form) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddActionButtons, addFormLabel, getSpanpublic SwingContentBuilder(AppContext conn, javax.swing.JFrame frame)
public SwingContentBuilder(AppContext conn, javax.swing.JComponent content, javax.swing.JFrame frame)
public void setFont(java.awt.Font f)
public java.awt.Font getFont()
public void setAlign(int align)
public int getAlign()
public void setBorder(javax.swing.border.Border border)
public javax.swing.border.Border getBorder()
public javax.swing.JComponent getComponent()
public void addButton(AppContext c, java.lang.String text, FormResult action)
ContentBuilderaddButton in interface ContentBuilderc - AppContextpublic void addButton(AppContext c, java.lang.String text, java.lang.String hover, FormResult action)
ContentBuilderaddButton in interface ContentBuilderc - AppContexthover - tooltip textpublic void addLink(AppContext c, java.lang.String text, FormResult action)
ContentBuilderaddLink in interface ContentBuilderc - AppContexttext - link textaction - FormResult to navigate to.public void addLink(AppContext c, java.lang.String text, java.lang.String hover, FormResult action)
ContentBuilderaddLink in interface ContentBuilderc - AppContexttext - link texthover - tooltip textaction - FormResult to navigate to.public <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, java.text.NumberFormat nf, Table<C,R> t)
ContentBuilderUIGenerator should be added via UIGenerator.addContent(ContentBuilder)addTable in interface ContentBuilderpublic 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 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 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 <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 addText(java.lang.String text)
ContentBuilderContentBuilder.getText().clean(text).appendParent().addText in interface ContentBuildertext - string to add to contentpublic void addHtml(java.lang.String text)
public void addHeading(int level,
java.lang.String text)
ContentBuilderContentBuilder.getHeading(int).addText(text).addHeading in interface ContentBuilderpublic boolean cleanFormatted(int max,
java.lang.String s)
ContentBuildercleanFormatted in interface ContentBuildermax - max line lengthpublic <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 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 void addFormTable(AppContext conn, java.lang.Iterable<Field> f)
ContentBuilderFields as a table of labels and inputs.addFormTable in interface ContentBuilderpublic void addFormTable(AppContext conn, java.lang.Iterable<Field> f, boolean validate)
public <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 radio_selector)
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 - Fieldradio_selector - 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 void setComponentValues()
public boolean validate(Form form) throws ValidateException
ValidateExceptionpublic <X> void addList(X[] list)
ContentBuilderUIGenerators will generate their content otherwise
a suitable text representation will be used.addList in interface ContentBuilderpublic <X> void addObject(X target)
ContentBuilderContentBuilder.addParent()
on child objects.addObject in interface ContentBuilderpublic <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 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 <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 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)public Logger getLogger()