コード例 #1
0
 public void itemStateChanged(ItemEvent evt) {
   if (evt.getSource() instanceof JOAJRadioButton) {
     JOAJRadioButton rb = (JOAJRadioButton) evt.getSource();
     if (rb == b1 && evt.getStateChange() == ItemEvent.SELECTED) {
       mOffset = JOAConstants.PROFSEQUENCE;
       setXRangeToSequence();
     } else if (rb == b2 && evt.getStateChange() == ItemEvent.SELECTED) {
       mOffset = JOAConstants.PROFDISTANCE;
       setXRangeToDistance();
     } else if (rb == b3 && evt.getStateChange() == ItemEvent.SELECTED) {
       mOffset = JOAConstants.PROFTIME;
       setXRangeToTime();
     }
   } else if (evt.getSource() instanceof JOAJCheckBox) {
   } else if (evt.getSource() instanceof JOAJComboBox) {
     JOAJComboBox cb = (JOAJComboBox) evt.getSource();
     if (cb == presetColorSchemes) {
       int colorScheme = cb.getSelectedIndex();
       if (colorScheme == 0) {
         // default bg
         plotBg.setColor(JOAConstants.DEFAULT_CONTENTS_COLOR);
         axesColor.setColor(Color.black);
       } else if (colorScheme == 1) {
         // white bg
         plotBg.setColor(Color.white);
         axesColor.setColor(Color.black);
       } else {
         // color bg
         plotBg.setColor(Color.black);
         axesColor.setColor(Color.white);
       }
     } else if (cb == mSymbolPopup) {
       mCurrSymbol = cb.getSelectedIndex() + 1;
     }
   }
   generatePlotName();
 }
コード例 #2
0
  public StnPlotSpecification createPlotSpec() {
    StnPlotSpecification ps = new StnPlotSpecification();
    // get the colors
    ps.setFGColor(axesColor.getColor());
    ps.setBGColor(plotBg.getColor());

    ps.setSectionType(mOffset);
    ps.setFileViewer(mFileViewer);
    ps.setXStnVarCode(mSelYParam);
    ps.setYStnVarName(new String((String) mYParamList.getJList().getSelectedValue()));
    ps.setWinTitle(mNameField.getText());
    ps.setYGrid(mPlotYGrid.isSelected());
    ps.setXGrid(mPlotXGrid.isSelected());
    ps.setReverseY(mReverseY.isSelected());
    ps.setSymbol(mCurrSymbol);
    ps.setSymbolSize(((Integer) mSizeField.getValue()).intValue());
    ps.setConnectObs(mConnectObs.isSelected());
    ps.setLineColor(mLineColorSwatch.getColor());
    ps.setSymbolColor(mSymbolColorSwatch.getColor());

    boolean error = false;
    try {
      ps.setWinYPlotMin(Double.valueOf(yMin.getText()).doubleValue());
    } catch (NumberFormatException ex) {
      error = true;
    }

    try {
      ps.setWinYPlotMax(Double.valueOf(yMax.getText()).doubleValue());
    } catch (NumberFormatException ex) {
      error = true;
    }

    try {
      ps.setYInc(Double.valueOf(yInc.getText()).doubleValue());
    } catch (NumberFormatException ex) {
      error = true;
    }

    ps.setYTics(((Integer) yTics.getValue()).intValue());

    if (mOffset == JOAConstants.PROFSEQUENCE || mOffset == JOAConstants.PROFDISTANCE) {
      try {
        ps.setWinXPlotMin(Double.valueOf(xMin.getText()).doubleValue());
      } catch (NumberFormatException ex) {
        error = true;
      }

      try {
        ps.setWinXPlotMax(Double.valueOf(xMax.getText()).doubleValue());
      } catch (NumberFormatException ex) {
        error = true;
      }

      try {
        ps.setXInc(Double.valueOf(xInc.getText()).doubleValue());
      } catch (NumberFormatException ex) {
        error = true;
      }
    } else {

      long startTime = ((Date) mStartSpinner.getValue()).getTime();
      long endTime = ((Date) mEndSpinner.getValue()).getTime();

      ps.setWinXPlotMin(startTime);
      ps.setWinXPlotMax(endTime);
    }

    ps.setXTics(((Integer) xTics.getValue()).intValue());

    if (error) {
      // post alert
    }
    return ps;
  }