Example #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);
  }
Example #2
0
  /**
   * Main constructor with no ProcessExecutionData.
   *
   * @param process Process represented.
   * @param toolBox Toolbox
   */
  public ProcessUIPanel(Process process, ToolBox toolBox) {
    this.setLayout(new BorderLayout());

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

    processExecutionData = new ProcessExecutionData(toolBox, process);
    processExecutionData.setState(ProcessExecutionData.ProcessState.IDLE);
    processExecutionData.setProcessUIPanel(this);
    processExecutionData.setInputDataMap(dataUIManager.getInputDefaultValues(process));
    processExecutionData.setOutputDataMap(dataUIManager.getOutputDefaultValues(process));

    toolBox.saveProcessExecutionData(processExecutionData);

    buildUI();
  }