2774 added organization choosing to new case wizards

This commit is contained in:
William Schaefer 2017-10-10 12:09:57 -04:00
parent b87e6d6796
commit 670d6d668f
2 changed files with 45 additions and 28 deletions

View File

@ -48,20 +48,6 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
*/ */
public NewCaseVisualPanel2() { public NewCaseVisualPanel2() {
initComponents(); initComponents();
try {
this.dbManager = EamDb.getInstance();
} catch (EamDbException ex) {
dbManager = null;
}
if (dbManager == null) {
comboBoxOrgName.setEnabled(false);
bnNewOrganization.setEnabled(false);
lbPointOfContactNameText.setEnabled(false);
lbPointOfContactEmailText.setEnabled(false);
lbPointOfContactPhoneText.setEnabled(false);
} else {
loadOrganizationData();
}
} }
/** /**
@ -75,6 +61,26 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
return NbBundle.getMessage(this.getClass(), "NewCaseVisualPanel2.getName.text"); return NbBundle.getMessage(this.getClass(), "NewCaseVisualPanel2.getName.text");
} }
void setUpOrganization() {
try {
this.dbManager = EamDb.getInstance();
} catch (EamDbException ex) {
dbManager = null;
}
boolean cREnabled = (dbManager != null);
comboBoxOrgName.setEnabled(cREnabled);
bnNewOrganization.setEnabled(cREnabled);
lbPointOfContactNameText.setEnabled(cREnabled);
lbPointOfContactEmailText.setEnabled(cREnabled);
lbPointOfContactPhoneText.setEnabled(cREnabled);
if (cREnabled) {
loadOrganizationData();
} else {
selectedOrg = null;
clearOrganization();
}
}
/** /**
* This method is called from within the constructor to initialize the form. * This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always * WARNING: Do NOT modify this code. The content of this method is always
@ -213,10 +219,7 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
} }
if ("".equals(orgName)) { if ("".equals(orgName)) {
selectedOrg = null; clearOrganization();
lbPointOfContactNameText.setText("");
lbPointOfContactEmailText.setText("");
lbPointOfContactPhoneText.setText("");
return; return;
} }
@ -251,19 +254,16 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
comboBoxOrgName.addItem(org.getName()); comboBoxOrgName.addItem(org.getName());
}); });
} catch (EamDbException ex) { } catch (EamDbException ex) {
selectedOrg = null;
} }
if (!orgs.isEmpty() && null != selectedOrg) { if (null != selectedOrg) {
comboBoxOrgName.setSelectedItem(selectedOrg.getName()); comboBoxOrgName.setSelectedItem(selectedOrg.getName());
lbPointOfContactNameText.setText(selectedOrg.getPocName()); lbPointOfContactNameText.setText(selectedOrg.getPocName());
lbPointOfContactEmailText.setText(selectedOrg.getPocEmail()); lbPointOfContactEmailText.setText(selectedOrg.getPocEmail());
lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone()); lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone());
} else { } else {
comboBoxOrgName.setSelectedItem(""); clearOrganization();
lbPointOfContactNameText.setText("");
lbPointOfContactEmailText.setText("");
lbPointOfContactPhoneText.setText("");
} }
} }
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
@ -283,6 +283,13 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
private javax.swing.JLabel optionalLabel; private javax.swing.JLabel optionalLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
private void clearOrganization() {
comboBoxOrgName.setSelectedItem("");
lbPointOfContactNameText.setText("");
lbPointOfContactEmailText.setText("");
lbPointOfContactPhoneText.setText("");
}
String getCaseNumber() { String getCaseNumber() {
return caseNumberTextField.getText(); return caseNumberTextField.getText();
} }
@ -290,5 +297,14 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
String getExaminer() { String getExaminer() {
return examinerTextField.getText(); return examinerTextField.getText();
} }
String getOrganization() {
if (selectedOrg != null) {
return selectedOrg.getName();
}
else {
return "";
}
}
} }

View File

@ -47,6 +47,7 @@ class NewCaseWizardPanel2 implements WizardDescriptor.ValidatingPanel<WizardDesc
if (component == null) { if (component == null) {
component = new NewCaseVisualPanel2(); component = new NewCaseVisualPanel2();
} }
component.setUpOrganization();
return component; return component;
} }
@ -137,9 +138,9 @@ class NewCaseWizardPanel2 implements WizardDescriptor.ValidatingPanel<WizardDesc
*/ */
@Override @Override
public void storeSettings(WizardDescriptor settings) { public void storeSettings(WizardDescriptor settings) {
NewCaseVisualPanel2 currentComponent = getComponent(); settings.putProperty("caseNumber", component.getCaseNumber()); //NON-NLS
settings.putProperty("caseNumber", currentComponent.getCaseNumber()); //NON-NLS settings.putProperty("caseExaminer", component.getExaminer()); //NON-NLS
settings.putProperty("caseExaminer", currentComponent.getExaminer()); //NON-NLS settings.putProperty("caseOrganization", component.getOrganization()); //NON-NLS
} }
@Override @Override