Revision 37082
Added by Michele Artini about 9 years ago
GraphToImageMapHelper.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.functionality.modular.ui.workflows.sarasvati.viewer; |
2 | 2 |
|
3 |
import java.util.Set; |
|
4 |
|
|
5 | 3 |
import javax.swing.Icon; |
6 | 4 |
|
7 | 5 |
import com.googlecode.sarasvati.Node; |
8 | 6 |
import com.googlecode.sarasvati.visual.GraphToImageMapAdapter; |
9 | 7 |
|
10 | 8 |
import eu.dnetlib.functionality.modular.ui.workflows.sarasvati.icons.GraphIcon; |
11 |
import eu.dnetlib.msro.workflows.nodes.NodeStatus; |
|
12 | 9 |
|
13 | 10 |
public class GraphToImageMapHelper extends GraphToImageMapAdapter { |
14 | 11 |
|
15 | 12 |
private String workflowId; |
16 |
private Set<String> notConfiguredNodes; |
|
17 |
|
|
18 |
public GraphToImageMapHelper(final String workflowId, final Set<String> notConfiguredNodes) { |
|
13 |
|
|
14 |
public GraphToImageMapHelper(final String workflowId) { |
|
19 | 15 |
super(); |
20 | 16 |
this.workflowId = workflowId; |
21 |
this.notConfiguredNodes = notConfiguredNodes; |
|
22 | 17 |
} |
23 | 18 |
|
24 | 19 |
@Override |
25 |
public String hrefForNode (Node node) {
|
|
20 |
public String hrefForNode(final Node node) {
|
|
26 | 21 |
if (workflowId == null || workflowId.isEmpty()) { |
27 | 22 |
return "javascript:alert('TODO')"; |
28 |
} else if ( node.getName().equals("success") || node.getName().equals("failure")) {
|
|
23 |
} else if (node.getName().equals("success") || node.getName().equals("failure")) { |
|
29 | 24 |
return "javascript:void(0)"; |
30 | 25 |
} else { |
31 | 26 |
return "javascript:getScope('map').getNodeDetails('" + workflowId + "', '" + node.getName() + "')"; |
32 | 27 |
} |
33 | 28 |
} |
34 |
|
|
29 |
|
|
35 | 30 |
@Override |
36 |
public String hoverForNode (Node node) {
|
|
31 |
public String hoverForNode(final Node node) {
|
|
37 | 32 |
return "Name: " + node.getName(); |
38 | 33 |
} |
39 |
|
|
34 |
|
|
40 | 35 |
@Override |
41 |
public Icon iconForNode(Node node) { |
|
42 |
if (node.getName().equals("success") || node.getName().equals("failure") ) { |
|
43 |
return new GraphIcon(node, NodeStatus.SYSTEM); |
|
44 |
} else if (notConfiguredNodes != null && notConfiguredNodes.contains(node.getName())) { |
|
45 |
return new GraphIcon(node, NodeStatus.NOT_CONFIGURED); |
|
46 |
} else { |
|
47 |
return new GraphIcon(node, NodeStatus.CONFIGURED); |
|
48 |
} |
|
36 |
public Icon iconForNode(final Node node) { |
|
37 |
boolean b = node.getName().equals("success") || node.getName().equals("failure"); |
|
38 |
return new GraphIcon(node, b); |
|
49 | 39 |
} |
50 | 40 |
} |
Also available in: Unified diff
partial wf UI reimplementation