View Javadoc

1   /*
2    * $Id: ConnectionStrategyProcessor.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
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 org.jdom.Element;
21  
22  public class ConnectionStrategyProcessor extends TagProcessor
23  {
24  
25      public ConnectionStrategyProcessor(GraphEnvironment environment)
26      {
27          super(environment);
28      }
29  
30      public void process(Graph graph, Element currentElement, GraphNode parent)
31      {
32          // Process connection strategy
33          Element cs = currentElement.getChild(MuleTag.ELEMENT_CONNECTION_STRATEGY);
34          if (cs != null)
35          {
36              GraphNode csNode = graph.addNode();
37              csNode.getInfo().setFillColor(ColorRegistry.COLOR_CONNECTION_STRATEGY);
38              csNode.getInfo().setHeader(cs.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME));
39  
40              StringBuffer caption = new StringBuffer();
41              appendProperties(cs, caption);
42              appendDescription(cs, caption);
43              csNode.getInfo().setCaption(caption.toString());
44              addRelation(graph, parent, csNode, null);
45          }
46      }
47  }