Search in sources :

Example 1 with InputHtmlSetSelectedStatement

use of com.twinsoft.convertigo.beans.statements.InputHtmlSetSelectedStatement in project convertigo by convertigo.

the class EventStatementGenerator method addSelect.

public void addSelect(String selectBy, String selectType, boolean[] checks, String[] values, String[] contents) {
    String comment = "";
    String value = null;
    for (int i = 0; i < checks.length; i++) {
        comment += Integer.toString(i) + " -> value: '" + values[i] + "'\ncontent: '" + contents[i] + "'\n";
        if (checks[i]) {
            if (value == null) {
                value = Integer.toString(i);
            } else {
                if (value.startsWith("["))
                    value = value.substring(1, value.length() - 1);
                value = "[" + value + ", " + Integer.toString(i) + "]";
            }
        }
    }
    String var_name = addVariableFormPrefixe(selectType, value);
    String xpath = getXPath("SELECT", selectBy, selectType);
    if (value.startsWith("["))
        var_name = "eval(''+" + var_name + ")";
    AbstractEventStatement stat = new InputHtmlSetSelectedStatement(xpath, var_name, InputSelectEvent.MOD_INDEX);
    stat.setComment(comment);
    addStatement(stat);
}
Also used : InputHtmlSetSelectedStatement(com.twinsoft.convertigo.beans.statements.InputHtmlSetSelectedStatement) AbstractEventStatement(com.twinsoft.convertigo.beans.statements.AbstractEventStatement)

Aggregations

AbstractEventStatement (com.twinsoft.convertigo.beans.statements.AbstractEventStatement)1 InputHtmlSetSelectedStatement (com.twinsoft.convertigo.beans.statements.InputHtmlSetSelectedStatement)1