Beispiel #1
0
 /** Clear the log panel. */
 public void clearLogPanel() {
   try {
     logPane.getDocument().remove(1, logPane.getDocument().getLength() - 1);
   } catch (BadLocationException e) {
     LoggerFactory.getLogger(ProcessUIPanel.class).error(e.getMessage());
   }
 }
Beispiel #2
0
 /**
  * Add the provided text with the provided color to the GUI document
  *
  * @param text The text that will be added
  * @param color The color used to show the text
  */
 public void print(String text, Color color) {
   StyleContext sc = StyleContext.getDefaultStyleContext();
   AttributeSet aset = sc.addAttribute(SimpleAttributeSet.EMPTY, StyleConstants.Foreground, color);
   int len = logPane.getDocument().getLength();
   try {
     logPane.setCaretPosition(len);
     logPane.getDocument().insertString(len, text + "\n", aset);
   } catch (BadLocationException e) {
     LoggerFactory.getLogger(ProcessUIPanel.class).error("Cannot show the log message", e);
   }
   logPane.setCaretPosition(logPane.getDocument().getLength());
 }
Beispiel #3
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 buildUIExec(ProcessExecutionData processExecutionData) {
    JPanel panel = new JPanel(new MigLayout("fill"));

    JPanel executorPanel = new JPanel(new MigLayout());
    executorPanel.setBorder(BorderFactory.createTitledBorder("Executor :"));
    executorPanel.add(new JLabel("localhost"));

    JPanel statusPanel = new JPanel(new MigLayout());
    statusPanel.setBorder(BorderFactory.createTitledBorder("Status :"));
    stateLabel = new JLabel(processExecutionData.getState().getValue());
    statusPanel.add(stateLabel);

    JPanel resultPanel = new JPanel(new MigLayout());
    resultPanel.setBorder(BorderFactory.createTitledBorder("Result :"));
    for (Output o : processExecutionData.getProcess().getOutput()) {
      JLabel title = new JLabel(o.getTitle() + " : ");
      JLabel result = new JLabel();
      result.putClientProperty("URI", o.getIdentifier());
      outputJLabelList.add(result);
      resultPanel.add(title);
      resultPanel.add(result, "wrap");
    }

    JPanel logPanel = new JPanel(new BorderLayout());
    logPanel.setBorder(BorderFactory.createTitledBorder("Log :"));
    logPane = new JTextPane();
    logPane.setCaretPosition(0);
    JScrollPane scrollPane = new JScrollPane(logPane);
    logPanel.add(scrollPane, BorderLayout.CENTER);

    panel.add(executorPanel, "growx, wrap");
    panel.add(statusPanel, "growx, wrap");
    panel.add(resultPanel, "growx, wrap");
    panel.add(logPanel, "growx, growy, wrap");

    return panel;
  }