Пример #1
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);
 }
  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);
  }