コード例 #1
0
 public void selectionChanged() {
   if ((paramSelector.getSelection() != null) && (resultSelector.getSelection() != null)) {
     result =
         new Type.Function(
             paramSelector.getSelection(),
             resultSelector.getSelection(),
             checkParamName.isSelected(),
             checkResultName.isSelected());
     okListener.okEvent(true);
   } else {
     result = null;
     okListener.okEvent(false);
   }
 }
コード例 #2
0
 private void checkBoundsFields() {
   if (specifyUPB.isSelected() || specifyLWB.isSelected()) {
     try {
       upb = Double.parseDouble(UPBLabel.getText());
       lwb = Double.parseDouble(LWBLabel.getText());
       if (specifyUPB.isSelected() && specifyLWB.isSelected()) {
         okListener.okEvent(upb > lwb);
       } else {
         okListener.okEvent(true);
       }
     } catch (Exception e) {
       okListener.okEvent(false);
     }
   } else {
     okListener.okEvent(true);
   }
 }
コード例 #3
0
  public Object getResult() {
    double rlwb;
    if (yesLWB.isSelected()) {
      if (specifyLWB.isSelected()) {
        if (excLWBButton.isSelected()) rlwb = lwb + Double.MIN_VALUE;
        else rlwb = lwb;
      } else rlwb = -Double.MAX_VALUE + Double.MIN_VALUE;
    } else rlwb = -Double.MAX_VALUE;

    double rupb;
    if (yesUPB.isSelected()) {
      if (specifyUPB.isSelected()) {
        if (excUPBButton.isSelected()) rupb = upb - Double.MIN_VALUE;
        else rupb = upb;
      } else rupb = Double.MAX_VALUE - Double.MIN_VALUE;
    } else rupb = Double.MAX_VALUE;

    return new Type.Continuous(rlwb, rupb, !unspecifiedCyclic.isSelected(), yesCyclic.isSelected());
  }
コード例 #4
0
 public NewTypePanelFunction(Type.Function t) {
   super();
   tf = t;
   checkParamName.addActionListener(new checkListener());
   checkResultName.addActionListener(new checkListener());
   northPanel.setBorder(BorderFactory.createEtchedBorder());
   checkBoxPanel.setBorder(BorderFactory.createEtchedBorder());
   setLayout(new BorderLayout());
   northPanel.setLayout(new GridLayout(2, 1));
   checkBoxPanel.setLayout(new GridLayout(2, 1));
   checkBoxPanel.add(checkParamName);
   checkBoxPanel.add(checkResultName);
   checkParamName.setSelected(tf.checkParamName);
   checkResultName.setSelected(tf.checkResultName);
   paramSelector =
       new TypeFieldSelector("Parameter Type:", "Select Parameter Type...", this, tf.param);
   resultSelector =
       new TypeFieldSelector("Result Type:", "Select Result Type...", this, tf.result);
   northPanel.add(paramSelector);
   northPanel.add(resultSelector);
   add(checkBoxPanel, BorderLayout.CENTER);
   add(northPanel, BorderLayout.NORTH);
 }
コード例 #5
0
  private void setupEvents() {
    specifyUPB.addActionListener(specifyUPBListener);

    specifyLWB.addActionListener(specifyLWBListener);

    yesUPB.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            if (yesUPB.isSelected()) {
              specifyUPB.setVisible(true);
              UPBLabel.setVisible(specifyUPB.isSelected());
              UPBDetailPanel.setVisible(true);
            } else {
              if (yesCyclic.isSelected()) {
                specifyUPB.setVisible(true);
                yesUPB.setSelected(true);
                UPBDetailPanel.setVisible(true);
                UPBLabel.setVisible(specifyUPB.isSelected());
              } else {
                specifyUPB.setSelected(false);
                specifyUPB.setVisible(false);
                UPBLabel.setText("0");
                UPBLabel.setVisible(false);
                UPBDetailPanel.setVisible(false);
              }
            }
          }
        });

    yesLWB.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            if (yesLWB.isSelected()) {
              specifyLWB.setVisible(true);
              LWBLabel.setVisible(specifyLWB.isSelected());
              LWBDetailPanel.setVisible(true);
            } else {
              if (yesCyclic.isSelected()) {
                specifyLWB.setVisible(true);
                yesLWB.setSelected(true);
                LWBDetailPanel.setVisible(true);
                LWBLabel.setVisible(specifyLWB.isSelected());
              } else {
                specifyLWB.setSelected(false);
                specifyLWB.setVisible(false);
                LWBLabel.setText("0");
                LWBLabel.setVisible(false);
                LWBDetailPanel.setVisible(false);
              }
            }
          }
        });

    UPBLabel.addKeyListener(listener);

    LWBLabel.addKeyListener(listener);

    yesCyclic.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            if (yesCyclic.isSelected()) {
              specifyLWB.setVisible(true);
              yesLWB.setSelected(true);
              specifyUPB.setVisible(true);
              yesUPB.setSelected(true);
              LWBLabel.setVisible(specifyLWB.isSelected());
              UPBLabel.setVisible(specifyUPB.isSelected());
            }
          }
        });
  }
コード例 #6
0
  private void setupTypeInfo(Type.Continuous t) {
    UPBDetailPanel.setVisible(false);
    LWBDetailPanel.setVisible(false);

    yesUPB.setEnabled(false);
    noUPB.setEnabled(false);
    unspecifiedUPB.setEnabled(false);
    if (t.UPB < Double.MAX_VALUE) {
      yesUPB.setSelected(true);
      specifyUPB.setVisible(true);
      UPBDetailPanel.setVisible(true);
      if (t.UPB < Double.MAX_VALUE - Double.MIN_VALUE) {
        specifyUPB.setEnabled(false);
        specifyUPB.setSelected(true);
        UPBLabel.setVisible(true);
        UPBLabel.setEnabled(false);
        UPBLabel.setText("" + t.UPB);
      } else {
        specifyUPB.setEnabled(true);
        specifyUPB.setSelected(false);
        UPBLabel.setVisible(false);
        UPBLabel.setEnabled(true);
      }
    } else {
      unspecifiedUPB.setEnabled(true);
      specifyUPB.setVisible(false);
      UPBLabel.setVisible(false);
    }

    yesLWB.setEnabled(false);
    noLWB.setEnabled(false);
    unspecifiedLWB.setEnabled(false);
    if (t.LWB > -Double.MAX_VALUE) {
      yesLWB.setSelected(true);
      specifyLWB.setVisible(true);
      LWBDetailPanel.setVisible(true);
      if (t.LWB > -Double.MAX_VALUE + Double.MIN_VALUE) {
        specifyLWB.setEnabled(false);
        specifyLWB.setSelected(true);
        LWBLabel.setVisible(true);
        LWBLabel.setEnabled(false);
        LWBLabel.setText("" + t.LWB);
      } else {
        specifyLWB.setEnabled(true);
        specifyLWB.setSelected(false);
        LWBLabel.setVisible(false);
        LWBLabel.setEnabled(true);
      }
    } else {
      unspecifiedLWB.setEnabled(true);
      specifyLWB.setVisible(false);
      LWBLabel.setVisible(false);
    }

    if (t.ckIsCyclic) {
      yesCyclic.setEnabled(false);
      noCyclic.setEnabled(false);
      unspecifiedCyclic.setEnabled(false);
      if (t.isCyclic) {
        yesCyclic.setSelected(true);
      } else {
        noCyclic.setSelected(true);
      }
    } else {
      unspecifiedCyclic.setSelected(true);
      yesCyclic.setEnabled(true);
      noCyclic.setEnabled(true);
      unspecifiedCyclic.setEnabled(true);
    }

    excUPBButton.setEnabled(true);
    incUPBButton.setEnabled(true);
    incUPBButton.setSelected(true);

    excLWBButton.setEnabled(true);
    incLWBButton.setEnabled(true);
    incLWBButton.setSelected(true);
  }