Beispiel #1
0
  /**
   * Build the UI of the given process according to the given data.
   *
   * @param processExecutionData Process data.
   * @return The UI for the configuration of the process.
   */
  public JComponent buildUIInfo(ProcessExecutionData processExecutionData) {
    JPanel panel = new JPanel(new MigLayout("fill"));
    Process p = processExecutionData.getProcess();
    // Process info
    JLabel titleContentLabel = new JLabel(p.getTitle());
    JLabel abstracContentLabel = new JLabel();
    if (p.getResume() != null) {
      abstracContentLabel.setText(p.getResume());
    } else {
      abstracContentLabel.setText("-");
      abstracContentLabel.setFont(abstracContentLabel.getFont().deriveFont(Font.ITALIC));
    }

    JPanel processPanel = new JPanel(new MigLayout());
    processPanel.setBorder(BorderFactory.createTitledBorder("Process :"));
    processPanel.add(titleContentLabel, "wrap, align left");
    processPanel.add(abstracContentLabel, "wrap, align left");

    // Input info
    JPanel inputPanel = new JPanel(new MigLayout());
    inputPanel.setBorder(BorderFactory.createTitledBorder("Inputs :"));

    for (Input i : p.getInput()) {
      inputPanel.add(new JLabel(dataUIManager.getIconFromData(i)));
      inputPanel.add(new JLabel(i.getTitle()), "align left, wrap");
      if (i.getResume() != null) {
        JLabel abstrac = new JLabel(i.getResume());
        abstrac.setFont(abstrac.getFont().deriveFont(Font.ITALIC));
        inputPanel.add(abstrac, "span 2, wrap");
      } else {
        inputPanel.add(new JLabel("-"), "span 2, wrap");
      }
    }

    // Output info
    JPanel outputPanel = new JPanel(new MigLayout());
    outputPanel.setBorder(BorderFactory.createTitledBorder("Outputs :"));

    for (Output o : p.getOutput()) {
      outputPanel.add(new JLabel(dataUIManager.getIconFromData(o)));
      outputPanel.add(new JLabel(o.getTitle()), "align left, wrap");
      if (o.getResume() != null) {
        JLabel abstrac = new JLabel(o.getResume());
        abstrac.setFont(abstrac.getFont().deriveFont(Font.ITALIC));
        outputPanel.add(abstrac, "span 2, wrap");
      } else {
        outputPanel.add(new JLabel("-"), "align center, span 2, wrap");
      }
    }

    panel.add(processPanel, "growx, wrap");
    panel.add(inputPanel, "growx, wrap");
    panel.add(outputPanel, "growx, wrap");

    return panel;
  }