use of cn.cerc.jpage.grid.lines.ExpenderGridLine in project summer-mis by cn-cerc.
the class DataGrid method outputGrid.
@Override
public void outputGrid(HtmlWriter html) {
DataSet dataSet = this.getDataSet();
MutiPage pages = this.getPages();
double sumFieldWidth = 0;
for (RowCell cell : this.getMasterLine().getOutputCells()) sumFieldWidth += cell.getFields().get(0).getWidth();
if (sumFieldWidth < 0)
throw new RuntimeException("总列宽不允许小于1");
if (sumFieldWidth > MaxWidth)
throw new RuntimeException("总列宽不允许大于600");
html.print("<table class=\"%s\"", this.getCSSClass());
if (this.getCSSStyle() != null)
html.print(" style=\"%s\"", this.getCSSStyle());
html.println(">");
html.println("<tr>");
for (RowCell cell : this.getMasterLine().getOutputCells()) {
IField field = cell.getFields().get(0);
html.print("<th");
if (field.getWidth() == 0)
html.print(" style=\"display:none\"");
else {
double val = roundTo(field.getWidth() / sumFieldWidth * 100, -2);
html.print(" width=\"%f%%\"", val);
}
html.print("onclick=\"gridSort(this,'%s')\"", field.getField());
html.print(">");
html.print(field.getTitle());
html.println("</th>");
}
html.println("</tr>");
if (dataSet.size() > 0) {
int i = pages.getBegin();
while (i <= pages.getEnd()) {
dataSet.setRecNo(i + 1);
for (int lineNo = 0; lineNo < this.getLines().size(); lineNo++) {
AbstractGridLine line = this.getLine(lineNo);
if (line instanceof ExpenderGridLine)
line.getCell(0).setColSpan(this.getMasterLine().getFields().size());
if (line instanceof ChildGridLine && this.beforeOutput != null)
beforeOutput.process(line);
line.output(html, lineNo);
}
// 下一行
i++;
}
}
html.println("</table>");
return;
}
use of cn.cerc.jpage.grid.lines.ExpenderGridLine in project summer-mis by cn-cerc.
the class DataGrid method getExpender.
@Override
public UIComponent getExpender() {
if (expender == null) {
expender = new ExpenderGridLine(this);
this.getLines().add(expender);
}
return expender;
}
Aggregations