Search in sources :

Example 1 with ExpendField

use of cn.cerc.jpage.fields.ExpendField in project summer-mis by cn-cerc.

the class UIFormHorizontal method output.

@Override
public void output(HtmlWriter html) {
    readAll();
    title.output(html);
    html.print("<form method=\"%s\" id=\"%s\"", this.method, this.getId());
    if (this.action != null)
        html.print(" action=\"%s\"", this.action);
    if (this.cssClass != null)
        html.print(" class=\"%s\"", this.cssClass);
    if (this.enctype != null)
        html.print(" enctype=\"%s\"", this.enctype);
    html.println(">");
    // 输出隐藏字段
    for (AbstractField field : fields) {
        if (field.isHidden()) {
            field.output(html);
        }
    }
    html.println("<ul>");
    // 输出正常查询字段
    for (AbstractField field : fields) {
        if (!field.isHidden()) {
            html.print("<li");
            if (field.getRole() != null)
                html.print(" role='%s'", field.getRole());
            if (field instanceof ExpendField)
                html.print(" class=\"select\"");
            html.println(">");
            try {
                field.output(html);
            } catch (Exception e) {
                html.print("<label>");
                html.print(e.getMessage());
                html.print("</label>");
            }
            html.println("</li>");
        }
    }
    // 输出可折叠字段
    String hid = "hidden";
    for (AbstractField field : fields) {
        if (field instanceof ExpendField) {
            hid = ((ExpendField) field).getHiddenId();
            break;
        }
    }
    for (Component component : this.getExpender().getComponents()) {
        if (component instanceof AbstractField) {
            AbstractField field = (AbstractField) component;
            html.print("<li");
            html.print(" role='%s'", hid);
            html.print(" style=\"display: none;\"");
            html.println(">");
            try {
                field.output(html);
            } catch (Exception e) {
                html.print("<label>");
                html.print(e.getMessage());
                html.print("</label>");
            }
            html.println("</li>");
        }
    }
    html.println("</ul>");
    if (buttons != null) {
        for (AbstractField field : buttons.fields) {
            field.output(html);
        }
    }
    html.println("<div></div>");
    html.println("</form>");
    if (levelSide != null)
        levelSide.output(html);
}
Also used : AbstractField(cn.cerc.jpage.fields.AbstractField) ExpendField(cn.cerc.jpage.fields.ExpendField) Component(cn.cerc.jpage.core.Component)

Aggregations

Component (cn.cerc.jpage.core.Component)1 AbstractField (cn.cerc.jpage.fields.AbstractField)1 ExpendField (cn.cerc.jpage.fields.ExpendField)1