private void btnProcessActionActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnProcessActionActionPerformed if (this.entity == null) { this.entity = new StoreEntity(); } else { this.entity.setId(((Number) txtId.getValue()).intValue()); } if (txtCompany.getText() != null) { entity.setCompany(txtCompany.getText()); } if (txtName.getText() != null) { entity.setProductName(txtName.getText()); } if (txtCount.getValue() != null) { entity.setCount(((Number) txtCount.getValue()).intValue()); } if (txtMinCount.getValue() != null) { entity.setMinCount(((Number) txtMinCount.getValue()).intValue()); } if (txtCode.getText() != null) { entity.setCode(txtCode.getText()); } if (txtPrice.getValue() != null) { entity.setPrice(((Number) txtPrice.getValue()).floatValue()); } if (this.action == Action.CREATE) { this.dao.saveEntity(entity); } else if (this.action == Action.UPDATE) { this.dao.updateEntity(entity); } this.dispose(); } // GEN-LAST:event_btnProcessActionActionPerformed
public void initData() { if (this.entity != null) { txtId.setValue(entity.getId()); txtCompany.setText(entity.getCompany()); txtName.setText(entity.getProductName()); txtCount.setValue(entity.getCount()); txtMinCount.setValue(entity.getMinCount()); txtPrice.setValue(entity.getPrice()); txtCode.setText(entity.getCode()); } if (this.action == Action.CREATE) { btnProcessAction.setText("Save"); } else if (this.action == Action.UPDATE) { btnProcessAction.setText("Update"); } }