Search in sources :

Example 1 with AbstractField

use of cn.cerc.jpage.fields.AbstractField 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)

Example 2 with AbstractField

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

the class ExpenderGridLine method output.

@Override
public void output(HtmlWriter html, int lineNo) {
    DataSet dataSet = dataSource.getDataSet();
    html.print("<tr");
    html.print(" id='%s_%s'", "tr" + dataSet.getRecNo(), lineNo);
    html.print(" role=\"%s\"", dataSet.getRecNo());
    if (!this.isVisible())
        html.print(" style=\"display:none\"");
    html.println(">");
    for (RowCell item : this.getCells()) {
        IField objField = item.getFields().get(0);
        html.print("<td");
        if (item.getColSpan() > 1)
            html.print(" colspan=\"%d\"", item.getColSpan());
        if (item.getStyle() != null)
            html.print(" style=\"%s\"", item.getStyle());
        if (item.getAlign() != null)
            html.print(" align=\"%s\"", item.getAlign());
        else if (objField.getAlign() != null)
            html.print(" align=\"%s\"", objField.getAlign());
        if (item.getRole() != null)
            html.print(" role=\"%s\"", item.getRole());
        html.print(">");
        for (IField obj : item.getFields()) {
            if (obj instanceof AbstractField) {
                AbstractField field = (AbstractField) obj;
                html.print("<span>");
                if (!"".equals(field.getName())) {
                    html.print(field.getName());
                    html.print(": ");
                }
                if (field instanceof IColumn)
                    html.print(((IColumn) field).format(dataSource.getDataSet().getCurrent()));
                else if (field instanceof AbstractField)
                    outputField(html, field);
                else
                    throw new RuntimeException("暂不支持的数据类型:" + field.getClass().getName());
                html.println("</span>");
            }
        }
        html.println("</td>");
    }
    html.println("</tr>");
}
Also used : AbstractField(cn.cerc.jpage.fields.AbstractField) DataSet(cn.cerc.jdb.core.DataSet) IColumn(cn.cerc.jpage.core.IColumn) RowCell(cn.cerc.jpage.grid.RowCell) IField(cn.cerc.jpage.core.IField)

Example 3 with AbstractField

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

the class AbstractGrid method addField.

@Override
public void addField(IField field) {
    if (field instanceof AbstractField) {
        AbstractField obj = (AbstractField) field;
        obj.setOwner(masterLine);
    }
    masterLine.addField(field);
}
Also used : AbstractField(cn.cerc.jpage.fields.AbstractField)

Example 4 with AbstractField

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

the class UIFormVertical method output.

@Override
public void output(HtmlWriter html) {
    html.print("<form method=\"%s\" id=\"%s\"", this.method, this.getId());
    if (this.action != null) {
        html.print(String.format(" action=\"%s\"", this.action));
    }
    if (this.enctype != null) {
        html.print(" enctype=\"%s\"", this.enctype);
    }
    html.println(">");
    int i = 0;
    for (AbstractField field : fields) {
        if (field.isHidden()) {
            field.output(html);
        } else {
            i++;
        }
    }
    if (i > 0) {
        outputFields(html);
    }
    html.println("</form>");
}
Also used : AbstractField(cn.cerc.jpage.fields.AbstractField)

Example 5 with AbstractField

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

the class UIFormVertical method outputFields.

private void outputFields(HtmlWriter html) {
    html.print("<ul");
    if (this.CSSClass != null)
        html.print(" class=\"%s\"", this.CSSClass);
    html.println(">");
    for (AbstractField field : fields) {
        if (!field.isHidden()) {
            html.print("<li");
            if (field.getRole() != null)
                html.print(" role='%s'", field.getRole());
            html.print(">");
            field.output(html);
            UIText mark = field.getMark();
            if (mark != null) {
                html.println("<a href=\"javascript:displaySwitch('%s')\">", field.getId());
                html.println("<img src=\"%s\" />", UIConfig.GUIDE);
                html.println("</a>");
                html.println("</li>");
                html.println("<li role=\"%s\" style=\"display: none;\">", field.getId());
                html.print("<mark>");
                if (mark.getContent() != null)
                    html.println("%s", mark.getContent());
                for (String line : mark.getLines()) html.println("<p>%s</p>", line);
                html.println("</mark>");
                html.println("</li>");
            } else {
                html.println("</li>");
            }
        }
    }
    html.println("</ul>");
}
Also used : AbstractField(cn.cerc.jpage.fields.AbstractField) UIText(cn.cerc.jui.vcl.UIText)

Aggregations

AbstractField (cn.cerc.jpage.fields.AbstractField)11 IField (cn.cerc.jpage.core.IField)5 IColumn (cn.cerc.jpage.core.IColumn)4 RowCell (cn.cerc.jpage.grid.RowCell)3 DataSet (cn.cerc.jdb.core.DataSet)2 Component (cn.cerc.jpage.core.Component)1 HtmlWriter (cn.cerc.jpage.core.HtmlWriter)1 ButtonField (cn.cerc.jpage.fields.ButtonField)1 ExpendField (cn.cerc.jpage.fields.ExpendField)1 DataGrid (cn.cerc.jpage.grid.DataGrid)1 MasterGridLine (cn.cerc.jpage.grid.lines.MasterGridLine)1 UIText (cn.cerc.jui.vcl.UIText)1 DecimalFormat (java.text.DecimalFormat)1