blob: bccf99febc970b29e9128e5c637aff71149d90fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package org.cristalise.gui.tabs.execution;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import org.cristalise.gui.MainFrame;
import org.cristalise.kernel.entity.agent.Job;
import org.cristalise.kernel.utils.Logger;
/**
* Each job gets a RequestButton
*/
public class RequestButton extends JButton implements ActionListener {
Job myJob;
ActivityViewer parent;
public RequestButton(Job myJob, ActivityViewer parent) {
super();
this.myJob = myJob;
this.parent = parent;
String label = myJob.getTransition().getName();
if (myJob.hasOutcome()) {
setBackground(Color.white);
try {
if (myJob.getSchemaName().equals("Errors")) setBackground(Color.pink);
} catch (Exception e) {
Logger.error(e);
MainFrame.exceptionDialog(e);
setEnabled(false);
}
}
super.setText(label);
addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent event) {
parent.execute(myJob);
}
}
|