/** Refresh Query */ private void refresh() { String sql = m_sql; int pos = m_sql.lastIndexOf(" ORDER BY "); if (!showAll.isSelected()) { sql = m_sql.substring(0, pos) + s_sqlWhereSameWarehouse; if (s_sqlMinLife.length() > 0) sql += s_sqlMinLife; sql += m_sql.substring(pos); } // log.finest(sql); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = DB.prepareStatement(sql, null); pstmt.setInt(1, m_M_Product_ID); if (!showAll.isSelected()) { pstmt.setInt(2, m_M_Warehouse_ID); } rs = pstmt.executeQuery(); m_table.loadTable(rs); } catch (Exception e) { log.log(Level.SEVERE, sql, e); } finally { DB.close(rs, pstmt); rs = null; pstmt = null; } enableButtons(); }
/** Update which fields status (read-only/read-write) based on New ASI/Edit ASI checkbox. */ private final void cmd_newEdit() { final boolean rw = cbNewEdit.isSelected(); log.config("R/W=" + rw + " " + asiTemplate); // Lot final boolean isNewLot = asiTemplate == null || asiTemplate.getM_Lot_ID() <= 0; fieldLotString.setEditable(rw && isNewLot); if (fieldLot != null) { fieldLot.setReadWrite(rw); } bLot.setReadWrite(rw); // Serial No fieldSerNo.setReadWrite(rw); bSerNo.setReadWrite(rw); // Guarantee Date fieldGuaranteeDate.setReadWrite(rw); // Attribute Editors for (final CEditor editor : attributeId2editor.values()) { editor.setReadWrite(rw); } } // cmd_newEdit