Search in sources :

Example 6 with RowCell

use of cn.cerc.jpage.grid.RowCell 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

RowCell (cn.cerc.jpage.grid.RowCell)6 IColumn (cn.cerc.jpage.core.IColumn)3 IField (cn.cerc.jpage.core.IField)3 AbstractField (cn.cerc.jpage.fields.AbstractField)3 DataSet (cn.cerc.jdb.core.DataSet)2