예제 #1
0
  /**
   * Constructor with an existing processUIData.
   *
   * @param processExecutionData Data for the UI
   * @param toolBox ToolBox
   */
  public ProcessUIPanel(ProcessExecutionData processExecutionData, ToolBox toolBox) {
    this.setLayout(new BorderLayout());
    this.processExecutionData = processExecutionData;

    outputJLabelList = new ArrayList<>();
    dataUIManager = toolBox.getDataUIManager();

    buildUI();
    processExecutionData.setProcessUIPanel(this);

    // According to the process state, open the good tab
    switch (processExecutionData.getState()) {
      case IDLE:
        tabbedPane.setSelectedIndex(0);
        break;
      case RUNNING:
        tabbedPane.setSelectedIndex(2);
        break;
      case COMPLETED:
      case ERROR:
        List<String> results = new ArrayList<>();
        for (Map.Entry<URI, Object> entry : processExecutionData.getOutputDataMap().entrySet()) {
          results.add(entry.getValue().toString());
        }
        setOutputs(results, processExecutionData.getState().toString());
        tabbedPane.setSelectedIndex(2);
        break;
    }
    // Print the process execution log.
    for (Map.Entry<String, Color> entry : processExecutionData.getLogMap().entrySet()) {
      print(entry.getKey(), entry.getValue());
    }

    processExecutionData.setState(ProcessExecutionData.ProcessState.IDLE);
  }
예제 #2
0
 /** Build the UI of the ProcessFrame with the data of the processUIData. */
 private void buildUI() {
   // Adds to the tabbedPane the 3 panels
   tabbedPane = new JTabbedPane();
   tabbedPane.addTab("Configuration", buildUIConf(processExecutionData));
   tabbedPane.addTab("Information", buildUIInfo(processExecutionData));
   tabbedPane.addTab("Execution", buildUIExec(processExecutionData));
   this.add(tabbedPane, BorderLayout.CENTER);
 }
예제 #3
0
 /**
  * Run the process.
  *
  * @return True if the process has already been launch, false otherwise.
  */
 public boolean runProcess() {
   if (processExecutionData.getState().equals(ProcessExecutionData.ProcessState.IDLE)
       || processExecutionData.getState().equals(ProcessExecutionData.ProcessState.ERROR)
       || processExecutionData.getState().equals(ProcessExecutionData.ProcessState.COMPLETED)) {
     clearLogPanel();
     processExecutionData.runProcess();
     // Select the execution tab
     stateLabel.setText(processExecutionData.getState().getValue());
     tabbedPane.setSelectedIndex(tabbedPane.getTabCount() - 1);
     return false;
   } else {
     return true;
   }
 }