Exemple #1
0
  /**
   * Reset import screen. This can be used while creating totally new instance of import screen or
   * just resetting the default.
   *
   * @param setVisibleAfterReset set import screen frame visible after it has been reseted
   */
  public void resetImportScreen(boolean setVisibleAfterReset) {

    application = Session.getSession().getApplication();

    // If frame exists, set visibility to false while resetting
    if (frame != null) {
      frame.setVisible(false);
    }

    // Create new instances of conversion model, column type manager and trimmers
    conversionModel = new ConversionModel(this);
    columnTypeManager = new ColumnTypeManager(0);
    dataTrimmer = new DataTrimmer();

    // Ignore first
    dataTrimmer.addIgnoreColumnNumber(0);

    flagTrimmer = new DataTrimmer();
    flagTrimmer.addIgnoreColumnNumber(0);

    // Table has to be first to get references right
    tableFrame = new TableInternalFrame(this);
    toolsFrame = new ToolsInternalFrame(this);

    conversionModel.addConversionChangeListener(tableFrame);
    columnTypeManager.addColumnTypeChangeListener(tableFrame);
    columnTypeManager.addColumnTypeChangeListener(toolsFrame);

    frame = new JFrame("Import tool");
    mainSplit = new JSplitPane();

    frame.setLayout(new BorderLayout());
    frame.setSize(IMPORT_SCREEN_SIZE);

    mainSplit.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    mainSplit.setDividerLocation(TOOLS_FRAME_WIDTH);
    mainSplit.setLeftComponent(toolsFrame);
    mainSplit.setRightComponent(tableFrame);
    mainSplit.getLeftComponent().setMinimumSize(new Dimension(150, 0));
    mainSplit.setResizeWeight(0);

    frame.add(mainSplit, BorderLayout.CENTER);

    // Reset buttons
    changeStepPanel = null;
    frame.add(getChangeStepButtonsPanel(), BorderLayout.SOUTH);

    if (setVisibleAfterReset) {
      frame.setVisible(true);
    }
  }
Exemple #2
0
  private void finishButtonPressed() {
    // No chips selected
    if (columnTypeManager.getChipCount() == 0) {
      JOptionPane.showMessageDialog(
          this.getFrame(),
          "No chips to import. Select at least one sample.",
          "No chips selected",
          JOptionPane.ERROR_MESSAGE);
    }

    // Write data to file
    else {
      RunnableImportProcess writeToFileProcess =
          new WriteToFileProcess(
              new InformationDialog(
                  "Writing data to disk",
                  "Writing data to disk from file " + conversionModel.getInputFileName(),
                  this));
      writeToFileProcess.runProcess();
    }
  }