org.zkoss.zkmax.zul.render.GridPaging Maven / Gradle / Ivy
/* GridPaging.java
{{IS_NOTE
Purpose:
Description:
History:
Sep 7, 2007 11:54:13 AM , Created by jumperchen
}}IS_NOTE
Copyright (C) 2007 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under GPL Version 3.0 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zkmax.zul.render;
import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.render.ComponentRenderer;
import org.zkoss.zk.ui.render.SmartWriter;
import org.zkoss.zul.Column;
import org.zkoss.zul.Grid;
/*
* {@link Grid}'s default mold.
*
* @author jumperchen
*
* @since 3.0.0
*/
public class GridPaging implements ComponentRenderer {
public void render(Component comp, Writer out) throws IOException {
final SmartWriter wh = new SmartWriter(out);
final Grid self = (Grid) comp;
final String uuid = self.getUuid();
final String zcls = self.getZclass();
wh.write("");
if (self.getPagingChild() != null && self.getPagingPosition().equals("top") || self.getPagingPosition().equals("both")) {
wh.write("")
.write(self.getPagingChild())
.write("");
}
if(self.getColumns() != null){
wh.write("")
.write("");
if(self.getColumns() != null) {
wh.write("")
.write("");
for (Iterator it = self.getColumns().getChildren().iterator(); it.hasNext();) {
final Column child = (Column) it.next();
wh.write(" ");
}
wh.write(" ");
}
wh.writeComponents(self.getHeads())
.write("
");
}
wh.write("");
if(self.getColumns() != null) {
wh.write("")
.write("");
for (Iterator it = self.getColumns().getChildren().iterator(); it.hasNext();) {
final Column child = (Column) it.next();
wh.write(" ");
}
wh.write(" ");
}
wh.writeln(self.getRows())
.write("
");
if(self.getFoot() != null){
wh.write(" ");
}
if (self.getPagingChild() != null && self.getPagingPosition().equals("bottom") || self.getPagingPosition().equals("both")) {
wh.write("")
.write(self.getPagingChild())
.write("");
}
wh.write("");
}
}