com.arsdigita.acs
Class HtmlWidgets

java.lang.Object
  |
  +--com.arsdigita.acs.HtmlWidgets

public final class HtmlWidgets
extends Object

Class for HTML-generating widgets.


Constructor Summary
HtmlWidgets()
           
 
Method Summary
static String columnTypeWidget(String name)
           
static String dateWidget(String fieldName)
           
static String fieldFormElement(String field_name, String column_type, String default_value)
          Creates a HTML form fragment of a type appropriate for the type of data expected (e.g.
static String htmlOptions(DataSource ds, String selected)
          Assumes that in the given DataSource, the first column should be used as the option text, and the second column should be used as the option value.
static String htmlOptions(String[][] objects, String selected)
          Returns a list of HTML option tags from an array of arrays of String pairs.
static String htmlOptions(String[] values, String[] text, String selected)
          Returns a list of HTML option tags.
static String htmlOptions(Vector vals, Vector text, String selected)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlWidgets

public HtmlWidgets()
Method Detail

htmlOptions

public static final String htmlOptions(String[] values,
                                       String[] text,
                                       String selected)
Returns a list of HTML option tags. values is the list of option values, text is the text to display after each option tag, and selected is the default (selected) option.

htmlOptions

public static final String htmlOptions(Vector vals,
                                       Vector text,
                                       String selected)

htmlOptions

public static final String htmlOptions(String[][] objects,
                                       String selected)
                                throws ACSException
Returns a list of HTML option tags from an array of arrays of String pairs. The first of the pair is the option value, the second is the text to be displayed.
Parameters:
objects - an array of arrays of name value pairs. ie, something of the form:
                new Object[][] = { {"true", "HTML"},
                                   {"false", "Plain text"} }
selected - the value of the default (selected) option

htmlOptions

public static final String htmlOptions(DataSource ds,
                                       String selected)
                                throws DataSourceException
Assumes that in the given DataSource, the first column should be used as the option text, and the second column should be used as the option value.

fieldFormElement

public static final String fieldFormElement(String field_name,
                                            String column_type,
                                            String default_value)
Creates a HTML form fragment of a type appropriate for the type of data expected (e.g. radio buttons if the type is boolean). The column_type can be any of the following: integer, number, date, text (up to 4000 characters), text_short (up to 200 characters), boolean, and special (no form element will be provided).

columnTypeWidget

public static final String columnTypeWidget(String name)

dateWidget

public static final String dateWidget(String fieldName)