Пример #1
0
 public boolean verify(javax.swing.JComponent input) {
   if (input == null) return false;
   try {
     if (input == distanceTextField
         || input == rLGTextField
         || input == xLGTextField
         || input == rLLTextField
         || input == xLLTextField)
       return SwingInputVerifyUtil.getDouble((javax.swing.JTextField) input) >= 0.0;
     else if (input == atReclosureTimeTextField)
       return SwingInputVerifyUtil.getDouble((javax.swing.JTextField) input) > 0.0;
   } catch (Exception e) {
     return false;
   }
   return true;
 }
Пример #2
0
  /**
   * Save editor screen data to the form
   *
   * @param errMsg error messages during the saving process.
   * @return false if there is any problem
   */
  public boolean saveEditor2Form(Vector<String> errMsg) throws Exception {
    IpssLogger.getLogger().info("NBFaultLocDataPanel saveEditor2Form() called");

    boolean ok = true;

    if (xmlFaultData.getFaultType() == AcscFaultTypeEnumType.BUS_FAULT) {
      String id = (String) this.faultBusComboBox.getSelectedItem();

      AcscBusFaultXmlType busFault = (AcscBusFaultXmlType) xmlFaultData;
      busFault.getRefBus().setBusId(id);
    } else {
      String id = (String) this.faultBranchComboBox.getSelectedItem();
      AcscBranchFaultXmlType braFault = (AcscBranchFaultXmlType) xmlFaultData;
      braFault.getRefBranch().setBranchId(id);
      // TODO  setBranch fromId, toId, cirId

      braFault.setBranchReclosure(reclosureCheckBox.isSelected());
      if (reclosureCheckBox.isSelected()) {
        if (!SwingInputVerifyUtil.largeThan(this.atReclosureTimeTextField, 0.0d)) {
          errMsg.add("Branch reclosure at Time <= 0.0");
          ok = false;
        }
        braFault
            .getReclosureTime()
            .setValue((SwingInputVerifyUtil.getDouble(this.atReclosureTimeTextField)));
        braFault.getReclosureTime().setUnit(TimePeriodUnitType.SEC);
      }

      if (this.distanceTextField.isEnabled()) {
        if (!SwingInputVerifyUtil.largeEqualThan(this.distanceTextField, 0.0d)) {
          errMsg.add("Branch fault distance < 0.0");
          ok = false;
        }
        braFault.setDistance(SwingInputVerifyUtil.getDouble(this.distanceTextField));
      }
    }

    if (this.type3PRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.FAULT_3_PHASE);
    else if (this.typeLGRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.LINE_TO_GROUND);
    else if (this.typeLLRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.LINE_TO_LINE);
    else if (this.typeLLGRadioButton.isSelected())
      xmlFaultData.setFaultCategory(AcscFaultCategoryEnumType.LINE_LINE_TO_GROUND);

    if (this.rLGTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.rLGTextField, 0.0d)) {
        errMsg.add("Fault L-G R < 0.0");
        ok = false;
      }
      xmlFaultData.getZLG().setRe(SwingInputVerifyUtil.getDouble(this.rLGTextField));
    }

    if (this.xLGTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.xLGTextField, 0.0d)) {
        errMsg.add("Fault L-G X < 0.0");
        ok = false;
      }
      xmlFaultData.getZLG().setIm(SwingInputVerifyUtil.getDouble(this.xLGTextField));
    }

    if (this.rLLTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.rLLTextField, 0.0d)) {
        errMsg.add("Fault L-L R < 0.0");
        ok = false;
      }
      xmlFaultData.getZLL().setRe(SwingInputVerifyUtil.getDouble(this.rLLTextField));
    }

    if (this.xLLTextField.isEnabled()) {
      if (!SwingInputVerifyUtil.largeEqualThan(this.xLLTextField, 0.0d)) {
        errMsg.add("Fault L-L X < 0.0");
        ok = false;
      }
      xmlFaultData.getZLL().setIm(SwingInputVerifyUtil.getDouble(this.xLLTextField));
    }

    return ok;
  }