private void preferredIndexFieldChanged(ChangeEvent e) {
   Integer indx = (Integer) (preferredIndexField.getValue());
   int index = indx.intValue();
   if (index != objEntityViewField.getPrefIndex()) {
     objEntityViewField.setPrefIndex(index);
   }
 }
 public void saveDisplayObjectType() {
   DOTPoint newDOTPoint =
       (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType().getCopy(null);
   final String name = _dotDefinitionDialogFrame.getNameText();
   if ((name == null) || (name.length() == 0)) {
     JOptionPane.showMessageDialog(
         new JFrame(), "Bitte geben Sie einen Namen an!", "Fehler", JOptionPane.ERROR_MESSAGE);
     return;
   }
   if (!_dotDefinitionDialogFrame.isReviseOnly()) {
     if (_dotDefinitionDialogFrame.getDotManager().containsDisplayObjectType(name)) {
       JOptionPane.showMessageDialog(
           new JFrame(),
           "Ein Darstellungstyp mit diesem Namen existiert bereits!",
           "Fehler",
           JOptionPane.ERROR_MESSAGE);
       return;
     }
   }
   newDOTPoint.setName(name);
   newDOTPoint.setInfo(_dotDefinitionDialogFrame.getInfoText());
   final Object value = _translationFactorSpinner.getValue();
   if (value instanceof Number) {
     final Number number = (Number) value;
     newDOTPoint.setTranslationFactor(number.doubleValue());
   }
   newDOTPoint.setJoinByLine(_joinByLineCheckBox.isSelected());
   _dotDefinitionDialogFrame.getDotManager().saveDisplayObjectType(newDOTPoint);
   _dotDefinitionDialogFrame.setDisplayObjectType(newDOTPoint, true);
 }
  /** Update date spinner to synchronize with the other spinners */
  private void updateDate() {
    // Get current month and year in int
    int month = ((SpinnerListModel) jspMonth.getModel()).getList().indexOf(jspMonth.getValue());
    int year = ((Integer) spinnerYear.getValue()).intValue();

    // Set a new maximum number of days for the new month and year
    SpinnerNumberModel numberModel = (SpinnerNumberModel) jspDay.getModel();
    numberModel.setMaximum(new Integer(maxDaysInMonth(year, month)));

    // Set a new current day if it exceeds the maximum
    if (((Integer) (numberModel.getValue())).intValue() > maxDaysInMonth(year, month))
      numberModel.setValue(new Integer(maxDaysInMonth(year, month)));

    // Get the current day
    int day = ((Integer) jspDay.getValue()).intValue();

    // Set a new date in the date spinner
    jspDate.setValue(new GregorianCalendar(year, month, day).getTime());
  }
 private void resetPanel() {
   cal =
       new GregorianCalendar(
           Integer.parseInt(yearSpi.getValue().toString()),
           monthBox.getSelectedIndex(),
           Integer.parseInt(lastLabel.getText()));
   startPoint_x = 20;
   startPoint_y = 10;
   panel.removeAll();
   panel.repaint();
   initCalPanel();
 }
  /*-------------------------------------------------------------------------*/
  public void commit(String name) {
    // custom impls only supported
    if (name == null) {
      return;
    }

    Map<String, DifficultyLevel> difficultyLevels = Database.getInstance().getDifficultyLevels();

    try {
      Class clazz = Class.forName(impl.getText());
      DifficultyLevel dl = (DifficultyLevel) clazz.newInstance();
      dl.setName(name);
      dl.setSortOrder((Integer) sortOrder.getValue());
      difficultyLevels.put(name, dl);
    } catch (Exception x) {
      throw new MazeException(x);
    }
  }
Beispiel #6
0
 @Override
 public String getSelectedAI() {
   return (String) aiChoices.getValue();
 }
  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;
  }
 @Override
 protected String getEnabledValue() {
   return string(((Double) spinner.getValue()).doubleValue());
 }
 /** Saves controller properties. */
 public synchronized void save() {
   ((ControllerSimpleSignal) controller).setOffset(((Double) offset.getValue()) / conversion);
   ((ControllerSimpleSignal) controller).setCycleTable(cycledata);
   super.save();
   return;
 }