Search in sources :

Example 1 with Rows

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;
}
Also used : SQLException(java.sql.SQLException) Label(org.adempiere.webui.component.Label) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) Component(org.zkoss.zk.ui.Component) Vbox(org.zkoss.zul.Vbox) SQLException(java.sql.SQLException) Rows(org.zkoss.zul.Rows)

Aggregations

PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Label (org.adempiere.webui.component.Label)1 Component (org.zkoss.zk.ui.Component)1 Rows (org.zkoss.zul.Rows)1 Vbox (org.zkoss.zul.Vbox)1