コード例 #1
0
 private void selectPolicyInformationInTable(PolicyInformation policyInfo) {
   for (int i = 0; i < jtPolicyInformation.getRowCount(); i++) {
     if (policyInfo.equals(jtPolicyInformation.getValueAt(i, 0))) {
       jtPolicyInformation.changeSelection(i, 0, false, false);
       return;
     }
   }
 }
コード例 #2
0
  private void removeSelectedPolicyInformation() {
    int selectedRow = jtPolicyInformation.getSelectedRow();

    if (selectedRow != -1) {
      PolicyInformation policyInfo =
          (PolicyInformation) jtPolicyInformation.getValueAt(selectedRow, 0);

      policyInformation.remove(policyInfo);

      reloadPolicyInformationTable();
      selectFirstPolicyInformationInTable();
      updateButtonControls();
    }
  }
コード例 #3
0
  private void editSelectedPolicyInformation() {
    int selectedRow = jtPolicyInformation.getSelectedRow();

    if (selectedRow != -1) {
      PolicyInformation policyInfo =
          (PolicyInformation) jtPolicyInformation.getValueAt(selectedRow, 0);

      Container container = getTopLevelAncestor();

      try {
        DPolicyInformationChooser dPolicyNameChooser = null;

        if (container instanceof JDialog) {
          dPolicyNameChooser =
              new DPolicyInformationChooser((JDialog) container, title, policyInfo);
          dPolicyNameChooser.setLocationRelativeTo(container);
          dPolicyNameChooser.setVisible(true);
        } else if (container instanceof JFrame) {
          dPolicyNameChooser = new DPolicyInformationChooser((JFrame) container, title, policyInfo);
          dPolicyNameChooser.setLocationRelativeTo(container);
          dPolicyNameChooser.setVisible(true);
        }

        PolicyInformation newPolicyInfo = dPolicyNameChooser.getPolicyInformation();

        if (newPolicyInfo == null) {
          return;
        }

        policyInformation.remove(policyInfo);
        policyInformation.add(newPolicyInfo);

        populate();
        selectPolicyInformationInTable(newPolicyInfo);
      } catch (IOException ex) {
        DError dError = null;

        if (container instanceof JDialog) {
          dError = new DError((JDialog) container, ex);
        } else {
          dError = new DError((JFrame) container, ex);
        }

        dError.setLocationRelativeTo(container);
        dError.setVisible(true);
      }
    }
  }