コード例 #1
0
 private void txAskingIdFocusLost(
     java.awt.event.FocusEvent evt) { // GEN-FIRST:event_txAskingIdFocusLost
   txAskingId.setText(GUIUtils.strNumber(txAskingId.getText(), null, null));
   if (!txAskingId.getText().isEmpty()) {
     Asking asking = askingDAO.get(Integer.valueOf(txAskingId.getText()));
     if (asking != null) {
       txDate.setText(GUIUtils.formatDate(asking.getDate()));
       txName.setText(
           asking.getSecondName() + " " + asking.getFirstName() + " " + asking.getMiddleName());
     }
   }
 } // GEN-LAST:event_txAskingIdFocusLost
コード例 #2
0
 private void validateForm() {
   List<String> errors = new ArrayList<String>();
   GUIUtils.strDate(txDate.getText(), labDate.getText(), errors);
   if (!txReplyDate.getText().isEmpty()) {
     GUIUtils.strDate(txReplyDate.getText(), labReplyDate.getText(), errors);
   }
   if (!txAskingId.getText().isEmpty()) {
     Asking asking = askingDAO.get(Integer.valueOf(txAskingId.getText()));
     if (asking == null) {
       JOptionPane.showMessageDialog(null, "Обращение с указанным номером не найдено");
     }
   }
   GUIUtils.showErrors(errors);
 }
コード例 #3
0
 private void btnSaveActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnSaveActionPerformed
   validateForm();
   try {
     claim.setAsking(askingDAO.get(Integer.valueOf(txAskingId.getText())));
   } catch (NumberFormatException e) {
     claim.setAsking(null);
   }
   claim.setDate(GUIUtils.str2Date(txDate.getText()));
   claim.setDescription(txDescription.getText());
   claim.setName(txName.getText());
   claim.setOffice((String) slOffice.getSelectedItem());
   claim.setReason((String) slReason.getSelectedItem());
   claim.setReplyDate(GUIUtils.str2Date(txReplyDate.getText()));
   claim.setStatus((String) slStatus.getSelectedItem());
   if (claim.getId() == null) {
     claimDAO.add(claim);
   } else {
     claimDAO.update(claim);
   }
 } // GEN-LAST:event_btnSaveActionPerformed