/** Performs the action of loading a session from a file. */
  public void actionPerformed(ActionEvent e) {
    DataModel dataModel = getDataEditor().getSelectedDataModel();

    if (!(dataModel instanceof DataSet)) {
      JOptionPane.showMessageDialog(JOptionUtils.centeringComp(), "Must be a tabular data set.");
      return;
    }

    this.dataSet = (DataSet) dataModel;

    SpinnerNumberModel spinnerNumberModel = new SpinnerNumberModel(getNumLags(), 0, 20, 1);
    JSpinner jSpinner = new JSpinner(spinnerNumberModel);
    jSpinner.setPreferredSize(jSpinner.getPreferredSize());

    spinnerNumberModel.addChangeListener(
        new ChangeListener() {
          public void stateChanged(ChangeEvent e) {
            SpinnerNumberModel model = (SpinnerNumberModel) e.getSource();
            setNumLags(model.getNumber().intValue());
          }
        });

    JPanel panel = new JPanel();
    panel.setLayout(new BorderLayout());

    Box b = Box.createVerticalBox();
    Box b1 = Box.createHorizontalBox();
    b1.add(new JLabel("Number of time lags: "));
    b1.add(Box.createHorizontalGlue());
    b1.add(Box.createHorizontalStrut(15));
    b1.add(jSpinner);
    b1.setBorder(new EmptyBorder(10, 10, 10, 10));
    b.add(b1);

    panel.add(b, BorderLayout.CENTER);

    EditorWindow editorWindow = new EditorWindow(panel, "Create time series data", "Save", true);
    DesktopController.getInstance().addEditorWindow(editorWindow);
    editorWindow.setVisible(true);

    editorWindow.addInternalFrameListener(
        new InternalFrameAdapter() {
          public void internalFrameClosed(InternalFrameEvent e) {
            EditorWindow window = (EditorWindow) e.getSource();

            if (!window.isCanceled()) {
              if (dataSet.isContinuous()) {
                createContinuousTimeSeriesData();
              } else if (dataSet.isDiscrete()) {
                createDiscreteTimeSeriesData();
              } else {
                JOptionPane.showMessageDialog(
                    JOptionUtils.centeringComp(),
                    "Data set must be either continuous or discrete.");
              }
            }
          }
        });
  }
Пример #2
0
  /** Must pass knowledge from getMappings. If null, creates new Knowledge2 object. */
  private void openKnowledgeEditor() {
    if (this.getParams() == null) {
      throw new NullPointerException(
          "Parameter object must not be " + "null if you want to launch a OldKnowledgeEditor.");
    }

    IKnowledge knowledge = this.getParams().getKnowledge();

    KnowledgeEditor knowledgeEditor =
        new KnowledgeEditor(knowledge, varNames, params.getSourceGraph());
    EditorWindow window =
        new EditorWindow(knowledgeEditor, knowledgeEditor.getName(), "Save", false, this);
    DesktopController.getInstance().addEditorWindow(window, JLayeredPane.PALETTE_LAYER);
    window.setVisible(true);
  }
Пример #3
0
  public void actionPerformed(ActionEvent e) {
    DataSet dataSet = (DataSet) dataEditor.getSelectedDataModel();
    if (dataSet == null || dataSet.getNumColumns() == 0) {
      JOptionPane.showMessageDialog(
          findOwner(), "Cannot display a scatter plot for an empty data set.");
      return;
    }

    JPanel panel = new ScatterPlotView(dataSet);
    EditorWindow editorWindow = new EditorWindow(panel, "Scatter Plots", "Save", true, dataEditor);

    //        JPanel dialog = createScatterPlotDialog(null, null);
    //        EditorWindow editorWindow = new EditorWindow(dialog, "Scatter Plots", "Save", true,
    // dataEditor);

    DesktopController.getInstance().addEditorWindow(editorWindow, JLayeredPane.PALETTE_LAYER);
    editorWindow.pack();
    editorWindow.setVisible(true);
  }
Пример #4
0
  public void actionPerformed(ActionEvent e) {
    DataSet dataSet = (DataSet) dataEditor.getSelectedDataModel();
    if (dataSet == null || dataSet.getNumColumns() == 0) {
      JOptionPane.showMessageDialog(
          findOwner(), "Cannot run normality tests on an empty data set.");
      return;
    }
    // if there are missing values warn and don't display q-q plot.
    //        if(DataUtils.containsMissingValue(dataSet)){
    //            JOptionPane.showMessageDialog(findOwner(), new JLabel("<html>Data has missing
    // values, " +
    //                    "remove all missing values before<br>" +
    //                    "running normality tests.</html>"));
    //            return;
    //        }

    JPanel panel = createNormalityTestDialog(null);

    EditorWindow window = new EditorWindow(panel, "Normality Tests", "Close", false, dataEditor);
    DesktopController.getInstance().addEditorWindow(window, JLayeredPane.PALETTE_LAYER);
    window.setVisible(true);
  }