Search in sources :

Example 6 with IField

use of cn.cerc.jpage.core.IField in project summer-mis by cn-cerc.

the class MasterGridLine method output.

@Override
public void output(HtmlWriter html, int lineNo) {
    DataSet dataSet = dataSource.getDataSet();
    html.print("<tr");
    html.print(" id='%s'", "tr" + dataSet.getRecNo());
    if (this.getPrimaryKey() != null)
        html.print(" data-rowid='%s'", dataSet.getString(this.getPrimaryKey()));
    html.println(">");
    for (RowCell cell : this.getOutputCells()) {
        IField obj = cell.getFields().get(0);
        html.print("<td");
        if (cell.getColSpan() > 1)
            html.print(" colspan=\"%d\"", cell.getColSpan());
        if (cell.getStyle() != null)
            html.print(" style=\"%s\"", cell.getStyle());
        else if (obj.getWidth() == 0)
            html.print(" style=\"%s\"", "display:none");
        if (cell.getAlign() != null)
            html.print(" align=\"%s\"", cell.getAlign());
        else if (obj.getAlign() != null)
            html.print(" align=\"%s\"", obj.getAlign());
        if (cell.getRole() != null)
            html.print(" role=\"%s\"", cell.getRole());
        else if (obj.getField() != null)
            html.print(" role=\"%s\"", obj.getField());
        html.print(">");
        if (obj instanceof AbstractField) {
            AbstractField field = (AbstractField) obj;
            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("</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)

Aggregations

IField (cn.cerc.jpage.core.IField)6 AbstractField (cn.cerc.jpage.fields.AbstractField)5 IColumn (cn.cerc.jpage.core.IColumn)4 DataSet (cn.cerc.jdb.core.DataSet)3 RowCell (cn.cerc.jpage.grid.RowCell)3 HtmlWriter (cn.cerc.jpage.core.HtmlWriter)1 ButtonField (cn.cerc.jpage.fields.ButtonField)1 DataGrid (cn.cerc.jpage.grid.DataGrid)1 AbstractGridLine (cn.cerc.jpage.grid.lines.AbstractGridLine)1 ChildGridLine (cn.cerc.jpage.grid.lines.ChildGridLine)1 ExpenderGridLine (cn.cerc.jpage.grid.lines.ExpenderGridLine)1 MasterGridLine (cn.cerc.jpage.grid.lines.MasterGridLine)1 DecimalFormat (java.text.DecimalFormat)1