Search in sources :

Example 1 with TextAreaColumn

use of db.column.TextAreaColumn in project common by zenlunatics.

the class Surveys method newAnswerColumn.

// ----------------------------------------------------------------------
private static ColumnBase<?> newAnswerColumn(String question_id, String display_name, String pre_text, String post_text, String answer_type, String type_data, boolean required, DBConnection db) {
    ColumnBase<?> column;
    if (answer_type.equals("Choices")) {
        if (type_data.charAt(0) == 'r')
            column = new Column("a" + question_id).setInputRenderer(new SelectRenderer(type_data.substring(5).split("\n")).setType(web.Select.Type.RADIO));
        else
            column = new Column("a" + question_id).setInputRenderer(new SelectRenderer(type_data.substring(6).split("\n")).setAllowNoSelection(true));
    } else if (answer_type.equals("Rating")) {
        String[] td = type_data.split("\\|");
        column = new Column("a" + question_id).setInputRenderer(new RatingInputRenderer(Integer.parseInt(td[0]), td[2], Integer.parseInt(td[1]), td[3]));
    } else {
        TextAreaColumn c = new TextAreaColumn("a" + question_id);
        if (answer_type.equals("Integer")) {
            c.setCols(10);
            c.setRows(1);
        } else if (answer_type.equals("String")) {
            c.setCols(Integer.parseInt(type_data));
            c.setRows(1);
        } else if (answer_type.equals("Text"))
            c.setCols(80);
        column = c;
    }
    column.setDisplayName(display_name);
    if (required)
        column.setIsRequired(true);
    if (pre_text != null)
        column.setPreText(pre_text);
    if (post_text != null)
        column.setPostText(post_text);
    return column;
}
Also used : TextAreaColumn(db.column.TextAreaColumn) LookupColumn(db.column.LookupColumn) BooleanColumn(db.column.BooleanColumn) Column(db.column.Column) TextAreaColumn(db.column.TextAreaColumn) SelectRenderer(db.SelectRenderer)

Aggregations

SelectRenderer (db.SelectRenderer)1 BooleanColumn (db.column.BooleanColumn)1 Column (db.column.Column)1 LookupColumn (db.column.LookupColumn)1 TextAreaColumn (db.column.TextAreaColumn)1