1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.tools.visualizer.processor; |
12 | |
|
13 | |
import org.mule.tools.visualizer.config.ColorRegistry; |
14 | |
import org.mule.tools.visualizer.config.GraphEnvironment; |
15 | |
import org.mule.tools.visualizer.util.MuleTag; |
16 | |
|
17 | |
import com.oy.shared.lm.graph.Graph; |
18 | |
import com.oy.shared.lm.graph.GraphNode; |
19 | |
|
20 | |
import java.util.Iterator; |
21 | |
import java.util.List; |
22 | |
|
23 | |
import org.jdom.Element; |
24 | |
|
25 | |
public class AgentProcessor extends TagProcessor |
26 | |
{ |
27 | |
public AgentProcessor(GraphEnvironment environment) |
28 | |
{ |
29 | 4 | super(environment); |
30 | 4 | } |
31 | |
|
32 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
33 | |
{ |
34 | 4 | if (!getEnvironment().getConfig().isShowAgents()) |
35 | |
{ |
36 | 4 | return; |
37 | |
} |
38 | |
|
39 | 0 | Element agents = currentElement.getChild(MuleTag.ELEMENT_AGENTS); |
40 | 0 | if (agents == null) |
41 | |
{ |
42 | 0 | return; |
43 | |
} |
44 | |
|
45 | 0 | List agentsElement = agents.getChildren(MuleTag.ELEMENT_AGENT); |
46 | 0 | for (Iterator iter = agentsElement.iterator(); iter.hasNext();) |
47 | |
{ |
48 | 0 | Element connector = (Element) iter.next(); |
49 | 0 | GraphNode connectorNode = graph.addNode(); |
50 | 0 | connectorNode.getInfo().setFillColor(ColorRegistry.COLOR_AGENTS); |
51 | 0 | String name = connector.getAttributeValue(MuleTag.ATTRIBUTE_NAME); |
52 | 0 | connectorNode.getInfo().setHeader(name); |
53 | |
|
54 | 0 | StringBuffer caption = new StringBuffer(); |
55 | |
|
56 | 0 | String className = connector.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME); |
57 | 0 | caption.append(MuleTag.ATTRIBUTE_CLASS_NAME + " :" + className + "\n"); |
58 | |
|
59 | 0 | appendProperties(connector, caption); |
60 | 0 | appendDescription(connector, caption); |
61 | 0 | connectorNode.getInfo().setCaption(caption.toString()); |
62 | 0 | } |
63 | 0 | } |
64 | |
} |