|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.makumba.HtmlUtils
org.makumba.HtmlChoiceWriter
public class HtmlChoiceWriter
HtmlChoiceWriter creates HTML statements for printing choice inputs. It's capable of creating dropdown and list selects, and radio buttons and checkboxes.
Note: this class is still work in progress, and its API is not to be considered 100% stable yet. Especially the static methods may change or be removed.
FIXME : documentation needs improvement.
Field Summary | |
---|---|
static int |
NO_CONV
No conversion. |
static int |
TXT2HTML
Convert text encoding to legal HTML encoding. |
Fields inherited from class org.makumba.HtmlUtils |
---|
specials, tagExamples |
Constructor Summary | |
---|---|
HtmlChoiceWriter()
Default constructor. |
|
HtmlChoiceWriter(String name)
Constructor, sets the name of the choice control. |
Method Summary | |
---|---|
String |
getCheckboxSelect()
Creates HTML statement for a select-one control. |
String |
getRadioSelect()
Creates HTML statement for a radio input control. |
String |
getSelect()
Creates HTML statement for a select control. |
String |
getSelectMultiple()
Creates HTML statement for a select-multiple HTML control. |
String |
getSelectOne()
Creates HTML statement for a select-one control. |
static String |
makeHtmlCheckboxSelect(String name,
String[] values,
String[] labels,
String[] selectedValues,
String checkboxLabelSeparator,
String[] optionSeparator,
String literalHtml,
int convert2Html)
Returns a checkbox-input statement in HTML. |
static String |
makeHtmlCheckboxSelect(String name,
String[] values,
String[] labels,
String[] selectedValues,
String checkboxLabelSeparator,
String optionSeparator,
String literalHtml,
int convert2Html)
Returns a checkbox-input statement in HTML; shorthand for only one optionSeparator. |
static String |
makeHtmlRadioSelect(String name,
String[] values,
String[] labels,
String selectedValue,
String checkboxLabelSeparator,
String[] optionSeparator,
String literalHtml,
int convert2Html)
Returns a radio-input statement in HTML. |
static String |
makeHtmlRadioSelect(String name,
String[] values,
String[] labels,
String selectedValue,
String checkboxLabelSeparator,
String optionSeparator,
String literalHtml,
int convert2Html)
Returns a radio-input statement in HTML; shorthand for only one optionSeparator. |
static String |
makeHtmlSelectMultiple(String name,
String[] values,
String[] labels,
String[] selectedValues,
int size,
String literalHtml,
int convert2Html)
Returns a select multiple statement in HTML. |
static String |
makeHtmlSelectOne(String name,
List<String> values,
List<String> labels,
String selectedValue,
String literalHtml,
int convert2Html)
Returns a select statement in HTML. |
static String |
makeHtmlSelectOne(String name,
String[] values,
String[] labels,
String selectedValue,
String literalHtml,
int convert2Html)
Returns a select statement in HTML. |
void |
setConvert2Html(int n)
Configures the encoding transformation to be applied to labels and values of the choice control. |
void |
setDeprecatedValues(List<String> deprecated)
Sets the deprecated values (zero or more). |
void |
setDeprecatedValues(String[] deprecated)
Sets the deprecated values (zero or more). |
void |
setFormIdentifier(Object formCount)
|
void |
setLabels(Iterator<String> labels)
Sets the labels of each of the options for the choice control. |
void |
setLabels(List<String> labels)
Sets the labels of each of the options for the choice control. |
void |
setLabels(String[] labels)
Sets the labels of each of the options for the choice control. |
void |
setLiteralHtml(String html)
Sets a literal html text to be included in the choice control. |
void |
setMultiple(boolean yn)
Sets whether the choice control accepts 'multiple' selections or not. |
void |
setMultiple(String mult)
Sets whether the choice control accepts 'multiple' selections or not. |
void |
setName(String name)
Sets the name of the choice control. |
void |
setOptionSeparator(List<String> s)
Sets the separator between different options. |
void |
setOptionSeparator(String s)
Sets the separator between different options. |
void |
setOptionSeparator(String[] s)
Sets the separator between different options. |
void |
setSelectedValues(List<String> selected)
Sets the selected values (zero or more). |
void |
setSelectedValues(String selected)
Sets the selected value, in case there is only one. |
void |
setSelectedValues(String[] selected)
Sets the selected values (zero or more). |
void |
setSize(int n)
Sets the size of the choice control. |
void |
setTickLabelSeparator(String s)
Sets the separator between the 'tickbox' and the label. |
void |
setValues(Iterator<String> values)
Sets the values of each of the options for the choice control. |
void |
setValues(List<String> values)
Sets the values of each of the options for the choice control. |
void |
setValues(String[] values)
Sets the values of each of the options for the choice control. |
Methods inherited from class org.makumba.HtmlUtils |
---|
detectHtml, escapeQuotes, main, maxLineLength, string2html, stripHTMLTags, text2html |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int NO_CONV
public static int TXT2HTML
Constructor Detail |
---|
public HtmlChoiceWriter()
public HtmlChoiceWriter(String name)
Method Detail |
---|
public void setName(String name)
public void setValues(List<String> values)
public void setValues(String[] values)
public void setValues(Iterator<String> values)
public void setLabels(List<String> labels)
public void setLabels(String[] labels)
public void setLabels(Iterator<String> labels)
public void setSelectedValues(String selected)
public void setSelectedValues(String[] selected)
public void setSelectedValues(List<String> selected)
public void setDeprecatedValues(String[] deprecated)
public void setDeprecatedValues(List<String> deprecated)
public void setMultiple(boolean yn)
public void setMultiple(String mult)
public void setSize(int n)
public void setConvert2Html(int n)
public void setLiteralHtml(String html)
public void setTickLabelSeparator(String s)
public void setOptionSeparator(String s)
public void setOptionSeparator(String[] s)
public void setOptionSeparator(List<String> s)
public String getSelect()
public String getSelectOne()
public String getSelectMultiple()
public String getRadioSelect()
public String getCheckboxSelect()
public static String makeHtmlSelectOne(String name, List<String> values, List<String> labels, String selectedValue, String literalHtml, int convert2Html)
name
- The name of the parameter that is set by this SELECTvalues
- List of the values (String) of the options, same order as 'labels'labels
- List of the labels (String) of the options, same order as 'values'selectedValue
- The selected value, if any (String, or null)literalHtml
- Extra HTML to be added literally to the SELECT tag.convert2Html
- Configuration whether values
and labels
must be converted ('escaped') to
HTML during the writing out. Default is "NO_CONV". Any input other than {TXT2HTML, NO_CONV} has
unpredictable result.public static String makeHtmlSelectOne(String name, String[] values, String[] labels, String selectedValue, String literalHtml, int convert2Html)
makeHtmlSelectOne(String, List, List, String, String, int)
public static String makeHtmlSelectMultiple(String name, String[] values, String[] labels, String[] selectedValues, int size, String literalHtml, int convert2Html)
name
- The name of the parameter that is set by this SELECTvalues
- Array of the values (String) of the options, same order as 'labels'labels
- Array of the labels (String) of the options, same order as 'values'selectedValues
- Array of selected values (String), if any, or null.size
- Number of lines in the input box.literalHtml
- Extra HTML to be added literally to the SELECT tag.convert2Html
- Configuration whether values
and labels
must be converted ('escaped') to
HTML during the writing out. Default is "NO_CONV". Any input other than {TXT2HTML, NO_CONV} has
unpredictable result.makeHtmlSelectOne(String, List, List, String, String, int)
public static String makeHtmlRadioSelect(String name, String[] values, String[] labels, String selectedValue, String checkboxLabelSeparator, String[] optionSeparator, String literalHtml, int convert2Html)
name
- The name of the parameter that is set by this INPUT type=RADIOvalues
- Array of the values (String) of the options, same order as 'labels'labels
- Array of the labels (String) of the options, same order as 'values'selectedValue
- The selected value, if any (String, or null)checkboxLabelSeparator
- String to separate the clickable box and the label.optionSeparator
- String[] with separators between the different Option-Elements; repeatedly cycles thru this array.literalHtml
- Extra HTML to be added literally to the SELECT tag.convert2Html
- Configuration whether values
and labels
must be converted ('escaped') to
HTML during the writing out. Default is "NO_CONV". Any input other than {TXT2HTML, NO_CONV} has
unpredictable result.makeHtmlSelectOne(String, String[], String[], String, String, int)
,
makeHtmlRadioSelect(String, String[], String[], String, String, String, String, int)
public static String makeHtmlCheckboxSelect(String name, String[] values, String[] labels, String[] selectedValues, String checkboxLabelSeparator, String[] optionSeparator, String literalHtml, int convert2Html)
name
- The name of the parameter that is set by this INPUT type=CHECKBOXvalues
- Array of the values (String) of the options, same order as 'labels'labels
- Array of the labels (String) of the options, same order as 'values'selectedValues
- Array of selected values (String), if any, or null.checkboxLabelSeparator
- String to separate the clickable box and the label.optionSeparator
- String[] with separators between the different Option-Elements; repeatedly cycles thru this array.literalHtml
- Extra HTML to be added literally to the SELECT tag.convert2Html
- Configuration whether values
and labels
must be converted ('escaped') to
HTML during the writing out. Default is "false". Any input other than {"true", "false", null} has
unpredictable result.makeHtmlSelectMultiple(String, String[], String[], String[], int, String, int)
,
makeHtmlCheckboxSelect(String, String[], String[], String[], String, String, String, int)
public static String makeHtmlRadioSelect(String name, String[] values, String[] labels, String selectedValue, String checkboxLabelSeparator, String optionSeparator, String literalHtml, int convert2Html)
makeHtmlRadioSelect(String name, String[] values, String[] labels, String selectedValue, String
checkboxLabelSeparator, String[] optionSeparator, String literalHtml, int convert2Html)
public static String makeHtmlCheckboxSelect(String name, String[] values, String[] labels, String[] selectedValues, String checkboxLabelSeparator, String optionSeparator, String literalHtml, int convert2Html)
makeHtmlCheckboxSelect(String name, String[] values, String[] labels, String[] selectedValues, String
checkboxLabelSeparator, String[] optionSeparator, String literalHtml, int convert2Html)
public void setFormIdentifier(Object formCount)
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |