use of org.zkoss.zul.Rows in project adempiere by adempiere.
the class DynamicDashBoard method createRows.
/**
*
* @return Rows <BR>
*
*
* This method creates the Rows
*/
public Rows createRows() {
Vbox msgbox = new Vbox();
Label rowItem = null;
Rows rows = new Rows();
ResultSet rs = null;
if (rows.getChildren() != null) {
List<Component> childs = rows.getChildren();
for (Component cmp : childs) {
rows.removeChild(cmp);
}
}
PreparedStatement pstmt = null;
pstmt = DB.prepareStatement(sqlQuery.toString(), null);
try {
rs = pstmt.executeQuery();
try {
if (rs.next()) {
grid.setVisible(true);
msgbox.setVisible(false);
prepareRow(rs, lable, rows);
while (rs.next()) {
prepareRow(rs, lable, rows);
}
} else {
vbox.removeChild(msgbox);
grid.setVisible(false);
msgbox.setVisible(true);
if (msgbox != null && msgbox.getChildren().size() > 0) {
msgbox.removeChild(rowItem);
}
grid.setVisible(false);
msgbox.setVisible(true);
String msg = Msg.getMsg(Env.getCtx(), "NO_DATA");
rowItem = new Label(msg);
rowItem.setParent(msgbox);
msgbox.setParent(vbox);
}
} catch (SQLException e) {
logger.log(Level.SEVERE, "SQL faile");
}
} catch (Exception e) {
logger.log(Level.SEVERE, e.toString() + " Check for configured Zoom Tab having Primary key of Table:" + table.getTableName());
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
logger.log(Level.SEVERE, "Unable to close Resultset:" + e);
}
}
}
return rows;
}
Aggregations