From 47fe0a553a00d01c29b3a21e1bd1b6a9f34426de Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Wed, 7 Apr 2010 13:03:33 +0000
Subject: [PATCH] AVATAR: first draft

---
 Makefile                                      |   2 +-
 src/Main.java                                 |  18 +-
 src/myutil/TraceManager.java                  |  89 ++++
 src/ui/AttackTreePanel.java                   |   4 +
 src/ui/AvatarDesignPanel.java                 | 179 +++++++
 src/ui/ColorManager.java                      |   2 +
 src/ui/GTURTLEModeling.java                   | 287 ++++++++++-
 src/ui/MainGUI.java                           | 168 ++++++-
 src/ui/TDiagramPanel.java                     |  82 +++-
 src/ui/TGComponentManager.java                |  62 ++-
 src/ui/TGUIAction.java                        |  26 +-
 src/ui/TURTLEPanel.java                       |   4 +
 src/ui/TURTLEPanelPopupListener.java          |   2 +-
 src/ui/avatarbd/AvatarBDBlock.java            | 389 +++++++++++++++
 .../AvatarBDCompositionConnector.java         | 218 +++++++++
 src/ui/avatarbd/AvatarBDConnectingPoint.java  |  67 +++
 src/ui/avatarbd/AvatarBDPanel.java            | 454 ++++++++++++++++++
 src/ui/avatarbd/AvatarBDPortConnector.java    | 168 +++++++
 src/ui/avatarbd/AvatarBDToolBar.java          | 143 ++++++
 .../avatarsmd/AvatarSMDConnectingPoint.java   |  72 +++
 src/ui/avatarsmd/AvatarSMDConnector.java      |  82 ++++
 src/ui/avatarsmd/AvatarSMDPanel.java          | 173 +++++++
 src/ui/avatarsmd/AvatarSMDStartState.java     | 104 ++++
 src/ui/avatarsmd/AvatarSMDStopState.java      | 109 +++++
 src/ui/avatarsmd/AvatarSMDToolBar.java        | 121 +++++
 25 files changed, 3000 insertions(+), 25 deletions(-)
 create mode 100644 src/myutil/TraceManager.java
 create mode 100644 src/ui/AvatarDesignPanel.java
 create mode 100644 src/ui/avatarbd/AvatarBDBlock.java
 create mode 100644 src/ui/avatarbd/AvatarBDCompositionConnector.java
 create mode 100644 src/ui/avatarbd/AvatarBDConnectingPoint.java
 create mode 100644 src/ui/avatarbd/AvatarBDPanel.java
 create mode 100644 src/ui/avatarbd/AvatarBDPortConnector.java
 create mode 100644 src/ui/avatarbd/AvatarBDToolBar.java
 create mode 100644 src/ui/avatarsmd/AvatarSMDConnectingPoint.java
 create mode 100644 src/ui/avatarsmd/AvatarSMDConnector.java
 create mode 100755 src/ui/avatarsmd/AvatarSMDPanel.java
 create mode 100644 src/ui/avatarsmd/AvatarSMDStartState.java
 create mode 100644 src/ui/avatarsmd/AvatarSMDStopState.java
 create mode 100755 src/ui/avatarsmd/AvatarSMDToolBar.java

diff --git a/Makefile b/Makefile
index 7d641b0c8a..d063254fd8 100755
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,7 @@ GZIP = gzip -9 -f
 DEBUG  = -g
 CLASSPATH = -classpath
 CLASSPATH = -sourcepath
-PACKAGE = automata compiler/tmlparser vcd nc ddtranslator launcher myutil tpndescription sddescription sdtranslator translator tmltranslator tmltranslator/toautomata tmltranslator/tosystemc  tmltranslator/tomappingsystemc tmltranslator/tomappingsystemc2 tmltranslator/touppaal tmltranslator/toturtle translator/tojava translator/tosimujava translator/totpn translator/touppaal  ui ui/ad ui/cd ui/oscd ui/osad ui/dd ui/ebrdd ui/file ui/graph ui/iod ui/ncdd ui/procsd ui/prosmdui/prosmd/util ui/tmlad ui/tmlcd ui/tmldd ui/tmlcomp ui/req ui/sd ui/tree ui/ucd ui/window tmltranslator tmltranslator/toturtle req/ebrdd tmltranslator/tosystemc tmatrix uppaaldesc fr/inria/oasis/vercors/cttool/model remotesimulation
+PACKAGE = automata compiler/tmlparser vcd nc ddtranslator launcher myutil tpndescription sddescription sdtranslator translator tmltranslator tmltranslator/toautomata tmltranslator/tosystemc  tmltranslator/tomappingsystemc tmltranslator/tomappingsystemc2 tmltranslator/touppaal tmltranslator/toturtle translator/tojava translator/tosimujava translator/totpn translator/touppaal  ui ui/avatarbd ui/avatarsmd ui/ad ui/cd ui/oscd ui/osad ui/dd ui/ebrdd ui/file ui/graph ui/iod ui/ncdd ui/procsd ui/prosmdui/prosmd/util ui/tmlad ui/tmlcd ui/tmldd ui/tmlcomp ui/req ui/sd ui/tree ui/ucd ui/window tmltranslator tmltranslator/toturtle req/ebrdd tmltranslator/tosystemc tmatrix uppaaldesc fr/inria/oasis/vercors/cttool/model remotesimulation
 BUILDER = builder.jar
 BUILD_INFO = build.txt
 BUILD_TO_MODIFY = src/ui/DefaultText.java
diff --git a/src/Main.java b/src/Main.java
index 3fc57ee941..9046d11127 100755
--- a/src/Main.java
+++ b/src/Main.java
@@ -65,6 +65,8 @@ public class Main implements ActionListener {
     public static boolean os = false;
     public static boolean uppaal = true;
     public static boolean nc = true ; // Network calculus
+	public static boolean avatar = false ; // avatar profile
+	
     public static void main(String[] args) {
       
         System.out.println("\n*** Your TTool version is: " + DefaultText.getFullVersion() + " ***\n");
@@ -121,11 +123,11 @@ public class Main implements ActionListener {
             if (args[i].compareTo("-diplodocus") == 0) {
                 systemc = true;
                 lotos = true;
-                System.out.println("diplodocus features activated (SystemC, LOTOS) - these are beta features that are meant to be used only for research purpose");
+                System.out.println("Diplodocus features activated");
             }
 			if (args[i].compareTo("-nodiplodocus") == 0) {
                 systemc = false;
-                System.out.println("diplodocus features deactivated (SystemC) - these are beta features that are meant to be used only for research purpose");
+                System.out.println("Diplodocus features deactivated");
             }
             if (args[i].compareTo("-proactive") == 0) {
                 proactive = true;
@@ -141,6 +143,16 @@ public class Main implements ActionListener {
 				nc = false;
                 System.out.println("Network calculus features unactivated - these are beta features that are meant to be used only for research purpose");
             }
+			
+			if (args[i].compareTo("-avatar") ==0 )  {
+				avatar = true;
+                System.out.println("AVATAR activated - these are beta features that are meant to be used only for research purpose");
+            }
+			
+			if (args[i].compareTo("-noavatar") ==0 )  {
+				avatar = false;
+                System.out.println("AVATAR unactivated - these are beta features that are meant to be used only for research purpose");
+            }
 	    
             if (args[i].compareTo("-os") == 0) {
                 os = true;
@@ -182,7 +194,7 @@ public class Main implements ActionListener {
         
         // making main window
         splashFrame.setMessage("Creating main window");
-        MainGUI mainGUI = new MainGUI(systemc, lotos, proactive, tpn, os, uppaal, nc);
+        MainGUI mainGUI = new MainGUI(systemc, lotos, proactive, tpn, os, uppaal, nc, avatar);
         splashFrame.setMessage("Building graphical components");
         mainGUI.build();
         
diff --git a/src/myutil/TraceManager.java b/src/myutil/TraceManager.java
new file mode 100644
index 0000000000..c8bb517275
--- /dev/null
+++ b/src/myutil/TraceManager.java
@@ -0,0 +1,89 @@
+/**Copyright or  or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class TraceManager
+ * Creation: 07/04/2010
+ * @version 1.1 07/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package myutil;
+
+import java.io.*;
+
+
+public class TraceManager {
+	public final static int TO_CONSOLE = 0;
+	public final static int TO_FILE = 1;
+	public final static int TO_BUFFER = 2;
+	public final static int TO_DEVNULL = 3;
+	
+    public static int userPolicy = TO_CONSOLE;
+    public static int devPolicy = TO_CONSOLE;
+	public static int errPolicy = TO_CONSOLE;
+    
+	public static void addDev(String _s) {
+		switch(devPolicy) {
+		case TO_CONSOLE:
+			System.out.println(_s);
+		default:
+			System.out.println(_s);
+		}
+	}
+	
+	public static void addUser(String _s) {
+		switch(userPolicy) {
+		case TO_CONSOLE:
+			System.out.println(_s);
+		default:
+			System.out.println(_s);
+		}
+	}
+	
+	public static void addError(String _s) {
+		switch(errPolicy) {
+		case TO_CONSOLE:
+			System.err.println(_s);
+		default:
+			System.err.println(_s);
+		}
+	}
+
+    
+} // Class TraceManager
diff --git a/src/ui/AttackTreePanel.java b/src/ui/AttackTreePanel.java
index 7288cac472..a0c43aeb3c 100755
--- a/src/ui/AttackTreePanel.java
+++ b/src/ui/AttackTreePanel.java
@@ -142,5 +142,9 @@ public class AttackTreePanel extends TURTLEPanel {
 		
         return false;
     }
+	
+	public boolean isATDEnabled() {
+        return true;
+    }
     
 }
diff --git a/src/ui/AvatarDesignPanel.java b/src/ui/AvatarDesignPanel.java
new file mode 100644
index 0000000000..c56be8bebf
--- /dev/null
+++ b/src/ui/AvatarDesignPanel.java
@@ -0,0 +1,179 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarDesignPanel
+ * Management of Avatar block panels
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see MainGUI
+ */
+ 
+package ui;
+
+import java.awt.*;
+import javax.swing.*;
+import javax.swing.event.*;
+import java.util.*;
+import ui.avatarbd.*;
+import ui.avatarsmd.*;
+
+public class AvatarDesignPanel extends TURTLEPanel {
+    public AvatarBDPanel abdp; 
+    public Vector validated, ignored;
+    
+    public AvatarDesignPanel(MainGUI _mgui) {
+        super(_mgui);
+        tabbedPane = new JTabbedPane();
+        cl = new ChangeListener() {
+            public void stateChanged(ChangeEvent e){
+                mgui.paneDesignAction(e);
+            }
+        };
+        tabbedPane.addChangeListener(cl);
+        tabbedPane.addMouseListener(new TURTLEPanelPopupListener(this, mgui));
+    }
+    
+   public AvatarSMDPanel getAvatarSMDPanel(String name) {
+        AvatarSMDPanel asmdp;
+        for(int i=1; i<panels.size(); i++) {
+            asmdp = (AvatarSMDPanel)(panels.elementAt(i));
+            if (asmdp.getName().compareTo(name) ==0) {
+                return asmdp;
+            }
+        }
+        return null;
+    }
+    
+    public void addAvatarStateMachineDiagramPanel(String s) {
+        JPanel toolBarPanel = new JPanel();
+        toolBarPanel.setLayout(new BorderLayout());
+        
+        AvatarSMDToolBar toolBarActivity = new AvatarSMDToolBar(mgui);
+        toolbars.add(toolBarActivity);
+        
+        AvatarSMDPanel asmdp = new AvatarSMDPanel(mgui, toolBarActivity);
+        asmdp.tp = this;
+        asmdp.setName(s);
+        JScrollDiagramPanel jsp	= new JScrollDiagramPanel(asmdp);
+        asmdp.jsp = jsp;
+        jsp.setWheelScrollingEnabled(true);
+        jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT);
+        toolBarPanel.add(toolBarActivity, BorderLayout.NORTH);
+        toolBarPanel.add(jsp, BorderLayout.CENTER);
+        panels.add(asmdp);
+        tabbedPane.addTab(s, IconManager.imgic63, toolBarPanel, "Opens the state machine of " + s);
+   
+        return;
+    }
+    
+    public void init() {
+         
+        //  Class Diagram toolbar
+        AvatarBDToolBar toolBarAvatarBD = new AvatarBDToolBar(mgui);
+        toolbars.add(toolBarAvatarBD);
+        
+        toolBarPanel = new JPanel();
+        toolBarPanel.setLayout(new BorderLayout());
+        
+        //Class	diagram
+        abdp = new AvatarBDPanel(mgui, toolBarAvatarBD);
+        abdp.setName("AVATAR Block Diagram");
+        abdp.tp = this;
+        tdp = abdp;
+        panels.add(abdp); // Always first in list
+        JScrollDiagramPanel jsp	= new JScrollDiagramPanel(abdp);
+        abdp.jsp = jsp;
+        jsp.setWheelScrollingEnabled(true);
+        jsp.getVerticalScrollBar().setUnitIncrement(mgui.INCREMENT);
+        toolBarPanel.add(toolBarAvatarBD, BorderLayout.NORTH);
+        toolBarPanel.add(jsp, BorderLayout.CENTER);
+        tabbedPane.addTab("AVATAR Design", IconManager.imgic62, toolBarPanel, "Opens the AVATAR Design");
+        tabbedPane.setSelectedIndex(0);
+        
+        //jsp.setVisible(true);
+ 
+    }
+    
+    public String saveHeaderInXml() {
+        return "<Modeling type=\"AVATAR Design\" nameTab=\"" + mgui.getTabName(this) + "\" >\n"; 
+    }
+    
+    public String saveTailInXml() {
+        return "</Modeling>\n\n\n";
+    }
+    
+    public String toString() {
+        return mgui.getTitleAt(this) + " (AVATAR Design)";
+    }
+	
+	/*public ArrayList<String> getAllTMLTaskNames(String _name) {
+		return tmltdp.getAllTMLTaskNames(_name);
+	}
+	
+	public ArrayList<String> getAllTMLCommunicationNames(String _name) {
+		return tmltdp.getAllTMLCommunicationNames(_name);
+	}
+	
+	public ArrayList<String> getAllNonMappedTMLTaskNames(String _name, TMLArchiDiagramPanel _tadp, boolean ref, String name) {
+		return tmltdp.getAllNonMappedTMLTaskNames(_name, _tadp, ref, name);
+	}
+	
+	public TMLTaskOperator getTaskByName(String _name) {
+		return tmltdp.getTaskByName(_name);
+	}
+	
+	public void getListOfBreakPoints(ArrayList<Point> points) {
+		TGComponent tgc;
+		ListIterator iterator = tmltdp.getComponentList().listIterator();
+		TMLTaskOperator tmlto;
+		TMLActivityDiagramPanel tmladp;
+		
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TMLTaskOperator) {
+                tmlto = (TMLTaskOperator)tgc;
+				if (tmlto.getDIPLOID() != -1) {
+					tmladp = getTMLActivityDiagramPanel(tmlto.getValue());
+					tmladp.getListOfBreakPoints(points, tmlto.getDIPLOID());
+				}
+			}
+		}
+	}*/
+    
+}
\ No newline at end of file
diff --git a/src/ui/ColorManager.java b/src/ui/ColorManager.java
index 0b71001fe7..d1533b6c29 100755
--- a/src/ui/ColorManager.java
+++ b/src/ui/ColorManager.java
@@ -126,6 +126,8 @@ public class ColorManager {
 	public static final Color ATD_ROOT_ATTACK = new Color(243, 131, 10);
 	public static final Color ATD_CONSTRAINT = new Color(191, 153, 161);
 	
+	public static final Color AVATAR_BLOCK = new Color(128, 180, 205);
+	
     public static final Color DIAGRAM_BACKGROUND = Color.white;
 	
 	public static final Color MainTabbedPane = new Color(231, 214, 176);
diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java
index 584f6c2a57..3aae8b4c45 100755
--- a/src/ui/GTURTLEModeling.java
+++ b/src/ui/GTURTLEModeling.java
@@ -74,6 +74,10 @@ import ui.ucd.*;
 import ui.tree.*;
 import ui.window.*;
 
+// AVATAR
+import ui.avatarbd.*;
+import ui.avatarsmd.*;
+
 import ui.tmlad.*;
 import ui.tmlcd.*;
 import ui.tmlcompd.*;
@@ -1499,7 +1503,6 @@ public class GTURTLEModeling {
 
 
 	// BUILDING A TURTLE MODELING AND CHECKING IT
-
 	public boolean checkTURTLEModeling(Vector tclasses, DesignPanel dp, boolean overideSyntaxChecking) {
 		// Builds a TURTLE modeling from diagrams
 		//warnings = new Vector();
@@ -1549,7 +1552,6 @@ public class GTURTLEModeling {
 
 
 	// SAVING AND LOADING IN XML
-
 	public static String transformString(String s) {
 		if (s != null) {
 			s = Conversion.replaceAllChar(s, '&', "&amp;");
@@ -1611,6 +1613,17 @@ public class GTURTLEModeling {
 		String str;
 
 		s = tdp.saveComponentInXML(tgc);
+		
+		if (tgc instanceof AvatarBDBlock) {
+			AvatarSMDPanel asmdp = mgui.getAvatarSMDPanel(mgui.getCurrentSelectedIndex(), tgc.getValue());
+			s.append(asmdp.saveInXML());
+			LinkedList<AvatarBDBlock> list = ((AvatarBDBlock)tgc).getFullBlockList();
+			for(AvatarBDBlock b:list) {
+				asmdp = mgui.getAvatarSMDPanel(mgui.getCurrentSelectedIndex(), b.getValue());
+				s.append(asmdp.saveInXML());
+			}
+			
+		}
 
 		if (tgc instanceof TCDTClass) {
 			TActivityDiagramPanel tadp = mgui.getActivityDiagramPanel(mgui.getCurrentSelectedIndex(), tgc.getValue());
@@ -1727,6 +1740,19 @@ public class GTURTLEModeling {
 			}
 		}
 		
+		v = tdp.selectedAvatarBDBlocks();
+		if ((v != null) && (v.size() > 0)) {
+			//System.out.println("Saving TML activity diagram Panel...");
+			AvatarBDBlock abdb;
+			AvatarSMDPanel asmdp;
+			for(int i=0; i<v.size(); i++) {
+				abdb = (AvatarBDBlock)(v.elementAt(i));
+				asmdp = mgui.getAvatarSMDPanel(mgui.getCurrentSelectedIndex(), abdb.getBlockName());
+				s.append(asmdp.saveInXML());
+				
+			}
+		}
+		
 		v = tdp.selectedCPrimitiveComponent();
 		if ((v != null) && (v.size() > 0)) {
 			//System.out.println("Saving TML activity diagram Panel...");
@@ -1749,7 +1775,7 @@ public class GTURTLEModeling {
 		str = new String(sb);
 		str = encodeString(str);
 
-		//System.out.println("Copy done");
+		System.out.println("Copy done");
 		//System.out.println(str);
 
 		return str;
@@ -2527,8 +2553,7 @@ public class GTURTLEModeling {
 						makePostLoading(tosadp, beginIndex);
 					}
 				}
-			} else if (tdp instanceof ProactiveCSDPanel)
-			{
+			} else if (tdp instanceof ProactiveCSDPanel) {
 				//cuenta=beginIndex+1;
 				cuenta=mgui.tabs.size()-1;
 				nl = doc.getElementsByTagName("ProactiveCSDPanelCopy");
@@ -2669,7 +2694,102 @@ public class GTURTLEModeling {
 						makePostLoading(psmdp, beginIndex);
 					}
 				}
+				
+			// AVATAR
+			} else if (tdp instanceof AvatarBDPanel) {
+				nl = doc.getElementsByTagName("AVATARBlockDiagramPanelCopy");
+				docCopy = doc;
+
+				if (nl == null) {
+					return;
+				}
+
+				//System.out.println("Toto 1");
+
+
+				AvatarBDPanel abdp = (AvatarBDPanel)tdp;
+
+
+				for(i=0; i<nl.getLength(); i++) {
+					adn = nl.item(i);
+					if (adn.getNodeType() == Node.ELEMENT_NODE) {
+						elt = (Element) adn;
+
+						if (abdp == null) {
+							throw new MalformedModelingException();
+						}
+
+						//int xSel = Integer.decode(elt.getAttribute("xSel")).intValue();
+						//int ySel = Integer.decode(elt.getAttribute("ySel")).intValue();
+						//int widthSel = Integer.decode(elt.getAttribute("widthSel")).intValue();
+						//int heightSel = Integer.decode(elt.getAttribute("heightSel")).intValue();
+
+						decX = _decX;
+						decY = _decY;
+
+						abdp.loadExtraParameters(elt);
+
+						//System.out.println("Toto 2");
+
+						//System.out.println("TML task diagram : " + tmltdp.getName() + " components");
+						makeXMLComponents(elt.getElementsByTagName("COMPONENT"), abdp);
+						//System.out.println("Toto 3");
+						makePostProcessing(abdp);
+						//System.out.println("TML task diagram : " + tmltdp.getName() + " connectors");
+						makeXMLConnectors(elt.getElementsByTagName("CONNECTOR"), abdp);
+						//System.out.println("TML task diagram : " + tmltdp.getName() + " subcomponents");
+						makeXMLComponents(elt.getElementsByTagName("SUBCOMPONENT"), abdp);
+						//System.out.println("TML task diagram : " + tmltdp.getName() + " real points");
+						connectConnectorsToRealPoints(abdp);
+						abdp.structureChanged();
+						//System.out.println("TML task diagram : " + tmltdp.getName() + " post loading " + beginIndex);
+						makePostLoading(abdp, beginIndex);
+						//System.out.println("TML task diagram : " + tmltdp.getName() + " post loading done");
+					}
+				}
+			} else if (tdp instanceof AvatarSMDPanel) {
+				nl = doc.getElementsByTagName("AVATARStateMachineDiagramPanelCopy");
+
+				if (nl == null) {
+					return;
+				}
+
+				AvatarSMDPanel asmdp = (AvatarSMDPanel)tdp;
+
+				for(i=0; i<nl.getLength(); i++) {
+					adn = nl.item(i);
+					if (adn.getNodeType() == Node.ELEMENT_NODE) {
+						elt = (Element) adn;
+
+						if (asmdp == null) {
+							throw new MalformedModelingException();
+						}
+
+						//int xSel = Integer.decode(elt.getAttribute("xSel")).intValue();
+						//int ySel = Integer.decode(elt.getAttribute("ySel")).intValue();
+						//int widthSel = Integer.decode(elt.getAttribute("widthSel")).intValue();
+						//int heightSel = Integer.decode(elt.getAttribute("heightSel")).intValue();
+
+						decX = _decX;
+						decY = _decY;
+
+						//tmladp.loadExtraParameters(elt);
+
+						//System.out.println("Activity diagram : " + tmladp.getName() + " components");
+						makeXMLComponents(elt.getElementsByTagName("COMPONENT"), asmdp);
+						//System.out.println("Activity diagram : " + tmladp.getName() + " connectors");
+						makeXMLConnectors(elt.getElementsByTagName("CONNECTOR"), asmdp);
+						//System.out.println("Activity diagram : " + tmladp.getName() + " subcomponents");
+						makeXMLComponents(elt.getElementsByTagName("SUBCOMPONENT"), asmdp);
+						//System.out.println("Activity diagram : " + tadp.getName() + " real points");
+						connectConnectorsToRealPoints(asmdp);
+						asmdp.structureChanged();
+						//System.out.println("Activity diagram : " + tadp.getName() + " post loading");
+						makePostLoading(asmdp, beginIndex);
+					}
+				}
 			}
+			
 		} catch (IOException e) {
 			System.out.println("500 ");
 			throw new MalformedModelingException();
@@ -2804,7 +2924,11 @@ public class GTURTLEModeling {
 	public void loadModeling(Node node) throws  MalformedModelingException, SAXException {
 		Element elt = (Element) node;
 		String type = elt.getAttribute("type");
-		if (type.compareTo("Design") == 0) {
+		// AVATAR
+		if (type.compareTo("AVATAR Design") == 0) {
+			loadAvatarDesign(node);
+		// TURTLE 
+		} else if (type.compareTo("Design") == 0) {
 			loadDesign(node);
 		} else if (type.compareTo("Analysis") == 0) {
 			loadAnalysis(node);
@@ -2830,6 +2954,37 @@ public class GTURTLEModeling {
 			throw new MalformedModelingException();
 		}
 	}
+	
+	public void loadAvatarDesign(Node node) throws  MalformedModelingException, SAXException {
+		Element elt = (Element) node;
+		String nameTab;
+		NodeList diagramNl;
+		int indexDesign;
+
+
+		nameTab = elt.getAttribute("nameTab");
+
+		indexDesign = mgui.createAvatarDesign(nameTab);
+
+		diagramNl = node.getChildNodes();
+
+		for(int j=0; j<diagramNl.getLength(); j++) {
+			//System.out.println("Design nodes: " + j);
+			node = diagramNl.item(j);
+			if (node.getNodeType() == Node.ELEMENT_NODE) {
+				elt = (Element)node;
+				if (elt.getTagName().compareTo("AVATARBlockDiagramPanel") == 0) {
+					// Class diagram
+					loadAvatarBD(elt, indexDesign);
+				} else { // Managing activity diagrams
+					if (elt.getTagName().compareTo("AVATARStateMachineDiagramPanel") == 0) {
+						// Managing activity diagrams
+						loadAvatarSMD(elt, indexDesign);
+					}
+				}
+			}
+		}
+	}
 
 	public void loadDesign(Node node) throws  MalformedModelingException, SAXException {
 		Element elt = (Element) node;
@@ -3244,7 +3399,37 @@ public class GTURTLEModeling {
 		}
 	}
 
+	// AVATAR
+	public void loadAvatarBD(Element elt, int indexDesign) throws  MalformedModelingException, SAXException {
+
+		String name;
+		TDiagramPanel tdp;
+
+		// class diagram name
+		name = elt.getAttribute("name");
+		mgui.setAvatarBDName(indexDesign, name);
+		tdp = mgui.getMainTDiagramPanel(indexDesign);
+
+		loadDiagram(elt, tdp);
+	}
+	
+	public void loadAvatarSMD(Element elt, int indexDesign) throws  MalformedModelingException, SAXException {
+		String name;
+
+		name = elt.getAttribute("name");
+		TraceManager.addDev("Loading SMD of:" + name);
+		AvatarSMDPanel asmdp = mgui.getAvatarSMDPanel(indexDesign, name);
+
+		if (asmdp == null) {
+			throw new MalformedModelingException();
+		}
+
+		asmdp.removeAll();
+
+		loadDiagram(elt, asmdp);
+	}
 
+	// TURTLE Design
 	public void loadTClassDiagram(Element elt, int indexDesign) throws  MalformedModelingException, SAXException {
 
 		String name;
@@ -3656,6 +3841,82 @@ public class GTURTLEModeling {
 			throw new MalformedModelingException();
 		}
 	}
+	
+	public void loadAvatarSMD(TDiagramPanel tdp, String oldValue, String newValue) throws MalformedModelingException {
+		System.out.println("---> Load activity diagram of old=" + oldValue + " new=" + newValue);
+		try {
+			NodeList smdNl = docCopy.getElementsByTagName("AVATARStateMachineDiagramPanel");
+
+			//System.out.println("Loading state machine diagram of " + newValue + " Before : " + oldValue);
+			//System.out.println("smdNL: " + smdNl);
+
+			if (smdNl == null) {
+				System.out.println("AVATAR: null doc");
+				throw new MalformedModelingException();
+			}
+
+			Node adn;
+			Element elt;
+			AvatarSMDPanel asmdp;
+			String name;
+			int decXTmp = decX;
+			int decYTmp = decY;
+			int decIdTmp = decId;
+
+			for(int i=0; i<smdNl.getLength(); i++) {
+				adn = smdNl.item(i);
+				if (adn.getNodeType() == Node.ELEMENT_NODE) {
+					elt = (Element) adn;
+					// class diagram name
+					name = elt.getAttribute("name");
+					System.out.println("Name of activity diagram=" + name);
+
+					if (name.equals(oldValue)) {
+						int indexDesign = mgui.getMajorIndexOf(tdp);
+
+						if (indexDesign < 0) {
+							throw new MalformedModelingException();
+						}
+
+						asmdp = mgui.getAvatarSMDPanel(indexDesign, newValue);
+
+						System.out.println("Searching panel: " + newValue);
+
+						if (asmdp == null) {
+							throw new MalformedModelingException();
+						}
+
+						System.out.println("Panel ok");
+
+						decX = 0; decY = 0; decId = 0;
+						
+						
+						asmdp.removeAll();
+						
+						loadDiagramInformation(elt, asmdp);
+						
+						//System.out.println("Activity diagram : " + tadp.getName() + " components");
+						makeXMLComponents(elt.getElementsByTagName("COMPONENT"), asmdp);
+						//System.out.println("Activity diagram : " + tadp.getName() + " connectors");
+						makeXMLConnectors(elt.getElementsByTagName("CONNECTOR"), asmdp);
+						//System.out.println("Activity diagram : " + tadp.getName() + " subcomponents");
+						makeXMLComponents(elt.getElementsByTagName("SUBCOMPONENT"), asmdp);
+						//System.out.println("Activity diagram : " + tadp.getName() + " real points");
+						connectConnectorsToRealPoints(asmdp);
+						asmdp.structureChanged();
+						//System.out.println("Activity diagram : " + tadp.getName() + " post loading");
+						makePostLoading(asmdp, 0);
+					}
+				}
+			}
+			decX = decXTmp;
+			decY = decYTmp;
+			decId = decIdTmp;
+		} catch (SAXException saxe) {
+			System.out.println("501 " + saxe.getMessage());
+			throw new MalformedModelingException();
+		}
+	}
 
 	public void loadTMLActivityDiagram(TDiagramPanel tdp, String oldValue, String newValue) throws MalformedModelingException {
 		//System.out.println("---> Load TML activity diagram");
@@ -3885,11 +4146,12 @@ public class GTURTLEModeling {
 				tgc = father.getInternalTGComponent(fatherNum);
 
 				if (tgc == null) {
-					// to be added to its father -> swallow component
+					// To be added to its father -> swallow component
 					if (father instanceof SwallowTGComponent) {
 						tgc = TGComponentManager.addComponent(myX, myY, myType, tdp);
 						if (tgc instanceof SwallowedTGComponent) {
 							((SwallowTGComponent)father).addSwallowedTGComponent(tgc, myX, myY);
+							TraceManager.addDev("Swallowed to father = " + father.getValue() + ". My name=" + myName + " decId=" + decId);
 						} else {
 							throw new MalformedModelingException();
 						}
@@ -3946,6 +4208,12 @@ public class GTURTLEModeling {
 					}
 				}
 				
+				if ((tgc instanceof AvatarBDBlock) && (decId >0)){
+					if (tdp.isAlreadyAnAvatarBDBlockName(myValue)) {
+						myValue = tdp.findAvatarBDBlockName(myValue+"_");
+					}
+				}
+				
 				if ((tgc instanceof TMLCPrimitiveComponent) && (decId >0)){
 					if (tdp.isAlreadyATMLPrimitiveComponentName(myValue)) {
 						myValue = tdp.findTMLPrimitiveComponentName(myValue+"_");
@@ -3964,6 +4232,11 @@ public class GTURTLEModeling {
 					loadActivityDiagram(tdp, oldClassName, myValue);
 				}
 
+				if ((tgc instanceof AvatarBDBlock) && (decId >0)){
+					//System.out.println("Going to load ad of task " + oldClassName + " myValue=" + myValue);
+					loadAvatarSMD(tdp, oldClassName, myValue);
+				}
+				
 				if ((tgc instanceof TMLTaskOperator) && (decId >0)){
 					//System.out.println("Going to load ad of task " + oldClassName + " myValue=" + myValue);
 					loadTMLActivityDiagram(tdp, oldClassName, myValue);
diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java
index bf4fda1188..e2081f3b29 100755
--- a/src/ui/MainGUI.java
+++ b/src/ui/MainGUI.java
@@ -84,6 +84,10 @@ import ui.tmldd.*;
 import ui.procsd.*;
 import ui.prosmd.*;
 
+// AVATAR
+import ui.avatarbd.*;
+import ui.avatarsmd.*;
+
 public	class MainGUI implements ActionListener, WindowListener, KeyListener {
     
     public static boolean systemcOn;
@@ -93,6 +97,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
     public static boolean osOn;
     public static boolean uppaalOn;
 	public static boolean ncOn;
+	public static boolean avatarOn;
 	
 	public final static int LOTOS = 0;
 	public final static int RT_LOTOS = 1;
@@ -252,7 +257,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 	ArrayList<RunningInfo> runningIDs;
 	JFrameInteractiveSimulation jfis;
     
-    public MainGUI(boolean _systemcOn, boolean _lotosOn, boolean _proactiveOn, boolean _tpnOn, boolean _osOn, boolean _uppaalOn, boolean _ncOn) {
+    public MainGUI(boolean _systemcOn, boolean _lotosOn, boolean _proactiveOn, boolean _tpnOn, boolean _osOn, boolean _uppaalOn, boolean _ncOn, boolean _avatarOn) {
         systemcOn = _systemcOn;
         lotosOn = _lotosOn;
         proactiveOn = _proactiveOn;
@@ -260,6 +265,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         osOn = _osOn;
         uppaalOn = _uppaalOn;
 		ncOn = _ncOn;
+		avatarOn = _avatarOn;
     }
     
     
@@ -273,7 +279,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         } catch	(Exception e) {	ErrorGUI.exit(ErrorGUI.GUI);}
         
         // Creating main container
-        frame =	new JFrame("TURTLE Toolkit");
+        frame =	new JFrame("TTool");
         frame.addWindowListener(this);
         frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE );
         frame.setIconImage(IconManager.img8);
@@ -793,6 +799,22 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         rp.init();
         return index;
     }
+	
+	private int addAvatarDesignPanel(String name, int index) {
+        if (index == -1) {
+            index = tabs.size();
+        }
+        AvatarDesignPanel adp = new AvatarDesignPanel(this);
+        tabs.add(index, adp);
+        mainTabbedPane.add(adp.tabbedPane, index);
+        mainTabbedPane.setToolTipTextAt(index, "Open AVATAR design diagrams");
+        mainTabbedPane.setTitleAt(index, name);
+        mainTabbedPane.setIconAt(index, IconManager.imgic14);
+        //mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams");
+        adp.init();
+        //ystem.out.println("Design added");
+        return index;
+    }
     
     private int addDesignPanel(String name, int index) {
         if (index == -1) {
@@ -978,6 +1000,23 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         //System.out.println("TURTLE OS Design added index=" + index);
         return index;
     }
+	
+	private int addAVATARDesignPanel(String name, int index) {
+		
+        if (index == -1) {
+            index = tabs.size();
+        }
+        AvatarDesignPanel avdp = new AvatarDesignPanel(this);
+        tabs.add(index, avdp);
+        mainTabbedPane.add(avdp.tabbedPane, index);
+        mainTabbedPane.setToolTipTextAt(index, "Open AVATAR Design");
+        mainTabbedPane.setTitleAt(index, name);
+        mainTabbedPane.setIconAt(index, IconManager.imgic60);
+        //mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams");
+        avdp.init();
+        //System.out.println("TURTLE OS Design added index=" + index);
+        return index;
+    }
     
     private int addProActiveDesignPanel(String name, int index) {
         if (index == -1) {
@@ -1010,7 +1049,13 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         return index;
     }
     
-    public int createDesign(String name) {
+    public int createAvatarDesign(String name) {
+        int index = addAvatarDesignPanel(name, -1);
+        mainTabbedPane.setSelectedIndex(index);
+        return index;
+    }
+	
+	public int createDesign(String name) {
         int index = addDesignPanel(name, -1);
         mainTabbedPane.setSelectedIndex(index);
         return index;
@@ -1310,10 +1355,17 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
     }
 	
 	public void newNCDesign() {
-        System.out.println("NEW NC DESIGN");
+        //System.out.println("NEW NC DESIGN");
         addNCDesignPanel("NC Design", -1);
         ((TURTLEPanel)tabs.elementAt(tabs.size()-1)).tabbedPane.setSelectedIndex(0);
         mainTabbedPane.setSelectedIndex(tabs.size()-1);
+    }    
+	
+	public void newAVATARBD() {
+        System.out.println("NEW AVATAR BD");
+        addAVATARDesignPanel("AVATAR Design", -1);
+        ((TURTLEPanel)tabs.elementAt(tabs.size()-1)).tabbedPane.setSelectedIndex(0);
+        mainTabbedPane.setSelectedIndex(tabs.size()-1);
     }
     
     public void newProactiveDesign() {
@@ -3788,6 +3840,16 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
     public int getIdButtonSelected() {
         return idButtonSelected;
     }
+	
+	public void addAvatarBlock(TURTLEPanel tp, String s)	{
+        //System.out.println("ADD TML Task=" + s);
+        if (!(tp instanceof AvatarDesignPanel)) {
+            return;
+        }
+        
+        ((AvatarDesignPanel)tp).addAvatarStateMachineDiagramPanel(s);
+        setPanelMode();
+    }
     
     public void addTClass(TURTLEPanel tp, String s)	{
         if (!(tp instanceof DesignPanel)) {
@@ -3910,6 +3972,21 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
             return;
         }
         
+        for(int i = 0; i<tp.tabbedPane.getTabCount(); i++) {
+            if (tp.tabbedPane.getTitleAt(i).equals(s)) {
+                tp.tabbedPane.removeTabAt(i);
+                tp.panels.removeElementAt(i);
+                setPanelMode();
+                return;
+            }
+        }
+    }
+	
+	public void removeAvatarBlock(TURTLEPanel tp, String s)	{
+        if (!(tp instanceof AvatarDesignPanel)) {
+            return;
+        }
+        
         for(int i = 0; i<tp.tabbedPane.getTabCount(); i++) {
             if (tp.tabbedPane.getTitleAt(i).equals(s)) {
                 tp.tabbedPane.removeTabAt(i);
@@ -4004,6 +4081,19 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 		return ((TMLComponentDesignPanel)(tp)).tmlctdp.getCompositeComponentByName(componentName);
 	}
     
+	public AvatarSMDPanel getAvatarSMDPanel(int indexDesign, String name) {
+		
+        TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(indexDesign));
+        if (tp == null) {
+			System.out.println("null TP");
+            return null;
+        }
+        if (tp instanceof AvatarDesignPanel) {
+            return ((AvatarDesignPanel)tp).getAvatarSMDPanel(name);
+        }
+		System.out.println("null ADP :" + name);
+        return null;
+    }
     
     public TActivityDiagramPanel getActivityDiagramPanel(int indexDesign, String name) {
         TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(indexDesign));
@@ -4065,7 +4155,12 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         return cpt;
     }
     
-    public void setClassDiagramName(int indexDesign, String name) {
+    public void setAvatarBDName(int indexDesign, String name) {
+        TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(indexDesign));
+        tp.tabbedPane.setTitleAt(0, name);
+    }
+	
+	 public void setClassDiagramName(int indexDesign, String name) {
         TURTLEPanel tp = (TURTLEPanel)(tabs.elementAt(indexDesign));
         tp.tabbedPane.setTitleAt(0, name);
     }
@@ -4851,6 +4946,40 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         return false;
     }
 	
+	public boolean newAvatarBDBlockName(TURTLEPanel tp, String old, String niou) {
+		//System.out.println("Panel=" + tp + " Old  task name = " + old + " New task name=" + niou);
+        JTabbedPane jtp = tp.tabbedPane;
+        for(int i = 0; i<jtp.getTabCount(); i++) {
+			//System.out.println("jtp  = " + jtp.getTitleAt(i));
+            if (jtp.getTitleAt(i).equals(niou)) {
+                return false;
+            }
+        }
+        //System.out.println("old " + old + " niou " + niou);
+        for(int i = 0; i<jtp.getTabCount(); i++) {
+            //System.out.println("Tab " + i + " = " + mainTabbedPane.getTitleAt(i));
+			//System.out.println("jtp  = " + jtp.getTitleAt(i));
+            if (jtp.getTitleAt(i).equals(old)) {
+                jtp.setTitleAt(i, niou);
+                jtp.setToolTipTextAt(i, "Opens the state machine of " + niou);
+                TDiagramPanel tdp;
+                //change panel name
+                for(int j=0; j<tp.panels.size(); j++) {
+                    tdp = (TDiagramPanel)(tp.panels.elementAt(j));
+                    if (tdp.getName().equals(old)) {
+                        tdp.setName(niou);
+						//System.out.println("Renamed to " + niou);
+                    }
+                }
+                
+                return true;
+            }
+        }
+        // internal error
+        ErrorGUI.exit(ErrorGUI.ERROR_TAB);
+        return false;
+    }
+	
 	public boolean nameComponentInUse(TURTLEPanel tp, String old, String niou) {
         JTabbedPane jtp = tp.tabbedPane;
         for(int i = 0; i<jtp.getTabCount(); i++) {
@@ -5568,6 +5697,25 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
             actionOnButton(TGComponentManager.EDIT, -1);
         } else if (command.equals(actions[TGUIAction.UML_NOTE].getActionCommand())) {
             actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.UML_NOTE);
+			
+		// AVATAR BD
+		} else if (command.equals(actions[TGUIAction.ABD_BLOCK].getActionCommand())) {
+            actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.AVATARBD_BLOCK);
+		} else if (command.equals(actions[TGUIAction.ABD_COMPOSITION_CONNECTOR].getActionCommand())) {
+            actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.AVATARBD_COMPOSITION_CONNECTOR);	
+		} else if (command.equals(actions[TGUIAction.ABD_PORT_CONNECTOR].getActionCommand())) {
+            actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.AVATARBD_PORT_CONNECTOR);
+			
+		// AVATAR SMD
+		} else if (command.equals(actions[TGUIAction.ASMD_EDIT].getActionCommand())) {
+            actionOnButton(TGComponentManager.EDIT, -1); 
+		} else if (command.equals(actions[TGUIAction.ASMD_START].getActionCommand())) {
+            actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.AVATARSMD_START_STATE);
+		} else if (command.equals(actions[TGUIAction.ASMD_STOP].getActionCommand())) {
+            actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.AVATARSMD_STOP_STATE);
+		} else if (command.equals(actions[TGUIAction.ASMD_CONNECTOR].getActionCommand())) {
+            actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.AVATARSMD_CONNECTOR);
+			
         } else if (command.equals(actions[TGUIAction.TCD_ASSOCIATION].getActionCommand())) {
             actionOnButton(TGComponentManager.CONNECTOR, TGComponentManager.CONNECTOR_ASSOCIATION);
         } else if (command.equals(actions[TGUIAction.TCD_CONNECTOR_ATTRIBUTE].getActionCommand())) {
@@ -5944,7 +6092,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         private MainGUI mgui;
         private JPopupMenu menu;
         
-        private JMenuItem rename, remove, moveRight, moveLeft, newDesign, newAnalysis, newDeployment, newRequirement, newTMLDesign, newTMLComponentDesign, newTMLArchi, newProactiveDesign, newTURTLEOSDesign, newNCDesign, sort, clone, newAttackTree;
+        private JMenuItem rename, remove, moveRight, moveLeft, newDesign, newAnalysis, newDeployment, newRequirement, newTMLDesign, newTMLComponentDesign, newTMLArchi, newProactiveDesign, newTURTLEOSDesign, newNCDesign, sort, clone, newAttackTree, newAVATARBD;
         
         public PopupListener(MainGUI _mgui) {
             mgui = _mgui;
@@ -5988,6 +6136,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
             newProactiveDesign = createMenuItem("New Proactive Design");
             newTURTLEOSDesign = createMenuItem("New TURTLE-OS Design");
 			newNCDesign = createMenuItem("New Network Calculus Design");
+			newAVATARBD = createMenuItem("New AVATAR Block Diagram");
             
             menu = new JPopupMenu("TURTLE analysis, design and deployment / DIPLODOCUS design / Proactive design");
             menu.add(moveLeft);
@@ -6041,6 +6190,11 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 				menu.addSeparator();
                 menu.add(newNCDesign);
 			}
+			
+			if (avatarOn) {
+				menu.addSeparator();
+                menu.add(newAVATARBD);
+			}
             
         }
         
@@ -6122,6 +6276,8 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
                     mgui.newTURTLEOSDesign();
                 } else if (e.getSource() == newNCDesign) {
                     mgui.newNCDesign();
+                } else if (e.getSource() == newAVATARBD) {
+                    mgui.newAVATARBD();
                 }
             }
         };
diff --git a/src/ui/TDiagramPanel.java b/src/ui/TDiagramPanel.java
index 11837fd494..d27fb93e56 100755
--- a/src/ui/TDiagramPanel.java
+++ b/src/ui/TDiagramPanel.java
@@ -66,6 +66,10 @@ import ui.ncdd.*;
 
 import ui.atd.*;
 
+
+// AVATAR
+import ui.avatarbd.*;
+
 // Added by Solange
 import ui.procsd.*;
 
@@ -1159,6 +1163,26 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         return v;
     }
 	
+	public Vector selectedAvatarBDBlocks() {
+        TGComponent tgc;
+        //AvatarBDBlock b;
+        Vector v = null;
+        Iterator iterator = componentList.listIterator();
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if ((tgc.isSelected()) && (tgc instanceof AvatarBDBlock)) {
+                if (v == null) {
+                    v = new Vector();
+                }
+                v.addElement(tgc);
+				LinkedList<AvatarBDBlock> list = ((AvatarBDBlock)tgc).getFullBlockList();
+				v.addAll(list);
+            }
+        }
+        return v;
+    }
+	
 	public Vector selectedCPrimitiveComponent() {
         TGComponent tgc;
         TMLCPrimitiveComponent tcomp;
@@ -1934,7 +1958,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
             mgui.gtm.copyModelingFromXML(this, clone, _tgc.getX() + 50, _tgc.getY() + 25);
         } catch (MalformedModelingException mme) {
             System.out.println("Clone Exception: " + mme.getMessage());
-            JOptionPane.showMessageDialog(mgui.getFrame(), "Exception", "Clone creation failed", JOptionPane.INFORMATION_MESSAGE);
+            JOptionPane.showMessageDialog(mgui.getFrame(), "Clone creation failed", "Exception", JOptionPane.INFORMATION_MESSAGE);
         }
         bringToBack(_tgc);
         mgui.changeMade(this, NEW_COMPONENT);
@@ -2209,6 +2233,31 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         return false;
     }
 	
+	public boolean isAlreadyAnAvatarBDBlockName(String name) {
+        AvatarBDBlock b;
+        Object o;
+        int i;
+        Iterator iterator = componentList.listIterator();
+        
+        while(iterator.hasNext()) {
+            o = (TGComponent)(iterator.next());
+            if (o instanceof AvatarBDBlock) {
+                b = (AvatarBDBlock)o;
+                if (b.getBlockName().equals(name)) {
+                    return true;
+                }
+				LinkedList<AvatarBDBlock> list = b.getFullBlockList();
+				for(AvatarBDBlock ab: list) {
+					 if (ab.getBlockName().equals(name)) {
+						 return true;
+					 }
+				}
+				
+            }
+        }
+        return false;
+    }
+	
 	public boolean isAlreadyATMLPrimitiveComponentName(String name) {
         TMLCPrimitiveComponent pc;
         Object o;
@@ -2440,6 +2489,37 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         }
         return name;
     }
+	
+	public String findAvatarBDBlockName(String name) {
+        boolean ok;
+        int i;
+        int index = 0;
+        AvatarBDBlock t;
+        Object o;
+        Iterator iterator;
+        
+        while(index >= 0) {
+            ok = true;
+            iterator = componentList.listIterator();
+            while(iterator.hasNext()) {
+                o = (TGComponent)(iterator.next());
+                if (o instanceof AvatarBDBlock) {
+                    t = (AvatarBDBlock)o;
+                    if (t.getValue().equals(name + index)) {
+                        ok = false;
+                    }
+					if (t.hasInternalBlockWithName(name+index)) {
+						ok = false;
+					}
+                }
+            }
+            if (ok) {
+                return name + index;
+            }
+            index ++;
+        }
+        return name;
+    }
     
     public String findTObjectName(String name) {
         boolean ok;
diff --git a/src/ui/TGComponentManager.java b/src/ui/TGComponentManager.java
index 205a67c761..6feb6c7f43 100755
--- a/src/ui/TGComponentManager.java
+++ b/src/ui/TGComponentManager.java
@@ -74,6 +74,10 @@ import ui.osad.*;
 
 import ui.ncdd.*;
 
+
+import ui.avatarbd.*;
+import ui.avatarsmd.*;
+
 public class TGComponentManager {
     
     public static final int NONE = -1;
@@ -280,9 +284,16 @@ public class TGComponentManager {
     public static final int NCDD_TRAFFIC_ARTIFACT = 4002;
 	public static final int NCDD_ROUTE_ARTIFACT = 4003;
 	
+	// AVATAR BD -> starts at 5000
+	public static final int AVATARBD_BLOCK = 5000;
+	public static final int AVATARBD_COMPOSITION_CONNECTOR = 5001;
+	public static final int AVATARBD_PORT_CONNECTOR = 5002;
+	
+	// AVATAR SMD -> starts at 5100
+	public static final int AVATARSMD_START_STATE = 5100;
+    public static final int AVATARSMD_STOP_STATE = 5101;
+	public static final int AVATARSMD_CONNECTOR = 5102;
 	
-
-
     
     public static final int EDIT = -1;
     public static final int COMPONENT = 0;
@@ -292,6 +303,18 @@ public class TGComponentManager {
     public final static TGComponent addComponent(int x, int y, int id, TDiagramPanel tdp) {
         TGComponent tgc = null;
         switch (id) {
+			// AVATAR
+			case AVATARBD_BLOCK:
+                tgc = new AvatarBDBlock(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
+                break;
+			case AVATARSMD_START_STATE:
+                tgc = new AvatarSMDStartState(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
+                break;
+			case AVATARSMD_STOP_STATE:
+                tgc = new AvatarSMDStopState(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
+                break;
+				
+			// Others
             case TAD_DETERMINISTIC_DELAY:
                 tgc = new TADDeterministicDelay(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
                 break;
@@ -700,7 +723,25 @@ public class TGComponentManager {
 
 
     public final static int getType(TGComponent tgc) {
-        if (tgc instanceof 	TADDeterministicDelay) {
+		// AVATAR
+		// AVATAR BD
+		if (tgc instanceof AvatarBDBlock) {
+			return AVATARBD_BLOCK;
+		} else if (tgc instanceof AvatarBDCompositionConnector) {
+			return AVATARBD_COMPOSITION_CONNECTOR;	
+		} else if (tgc instanceof AvatarBDPortConnector) {
+			return AVATARBD_PORT_CONNECTOR;
+			
+		// AVATAR SMD
+		} else if (tgc instanceof AvatarSMDStartState) {
+			return AVATARSMD_START_STATE;
+		} else if (tgc instanceof AvatarSMDStopState) {
+			return AVATARSMD_STOP_STATE;
+		} else if (tgc instanceof AvatarSMDConnector) {
+			return AVATARSMD_CONNECTOR;
+			
+		// Others
+		} else if (tgc instanceof 	TADDeterministicDelay) {
             return 	TAD_DETERMINISTIC_DELAY;
         } else if (tgc instanceof TADParallel) {
             return TAD_PARALLEL;
@@ -1036,6 +1077,21 @@ public class TGComponentManager {
     public final static TGConnector addConnector(int x, int y, int id, TDiagramPanel tdp, TGConnectingPoint p1, TGConnectingPoint p2, Vector listPoint) {
         TGConnector tgc = null;
         switch(id) {
+			// AVATAR
+			// AVATAR BD
+			case AVATARBD_COMPOSITION_CONNECTOR:
+                tgc = new AvatarBDCompositionConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint);
+                break;
+			case AVATARBD_PORT_CONNECTOR:
+                tgc = new AvatarBDPortConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint);
+                break;
+				
+			// AVATAR SMD
+			case AVATARSMD_CONNECTOR:
+                tgc = new AvatarSMDConnector(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint);
+                break;
+			
+			// Others
             case CONNECTOR_AD_DIAGRAM:
                 tgc = new TGConnectorFullArrow(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp, p1, p2, listPoint);
                 break;
diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java
index e859f8e4e5..3aad5dcad6 100755
--- a/src/ui/TGUIAction.java
+++ b/src/ui/TGUIAction.java
@@ -293,6 +293,16 @@ public class TGUIAction extends AbstractAction {
 	public static final int ATD_COMPOSITION_CONNECTOR = 288;
 	public static final int ATD_CONSTRAINT = 287;
 	
+	// AVATAR Block Diagram
+	public static final int ABD_BLOCK = 289;
+	public static final int ABD_COMPOSITION_CONNECTOR = 290;
+	public static final int ABD_PORT_CONNECTOR = 295;
+	
+	// AVATAR State Machine
+	public static final int ASMD_EDIT = 291;
+	public static final int ASMD_CONNECTOR = 292;
+	public static final int ASMD_START = 293;
+	public static final int ASMD_STOP = 294;
     
     public static final int ACT_MODEL_CHECKING = 25;
     public static final int ACT_GEN_RTLOTOS = 27;
@@ -400,7 +410,7 @@ public class TGUIAction extends AbstractAction {
     //Action for the help button created by Solange
     public static final int PRUEBA_1 = 205;
 
-    public static final int NB_ACTION = 289;
+    public static final int NB_ACTION = 296;
 
     private  static final TAction [] actions = new TAction[NB_ACTION];
     
@@ -778,8 +788,18 @@ public class TGUIAction extends AbstractAction {
 
         actions[EXTERNAL_ACTION_1] = new TAction("user-command-1", "User command 1", IconManager.imgic338, IconManager.imgic338, "User command 1", "Execute the user command #1", '0');
         actions[EXTERNAL_ACTION_2] = new TAction("user-command-2", "User command 2", IconManager.imgic338, IconManager.imgic338, "User command 2", "Execute the user command #2", '0');
-
-
+		
+		// AVATAR Block Diagrams
+		actions[ABD_BLOCK] = new TAction("abd-block", "Add a block", IconManager.imgic1070, IconManager.imgic1070, "Block", "Add a SysML Block to the currently opened AVATAR Block Diagram", 0);
+        actions[ABD_COMPOSITION_CONNECTOR] = new TAction("abd-composition-connector", "Add a composition connector between blocks", IconManager.imgic1076, IconManager.imgic1076, "Composition connector", "Add a composition between blocks of the currently opened AVATAR Block Diagram", 0);
+		actions[ABD_PORT_CONNECTOR] = new TAction("abd-port-connector", "Add a composition connector between blocks", IconManager.imgic1076, IconManager.imgic1076, "Port connector", "Add a port link between blocks of the currently opened AVATAR Block Diagram", 0);
+		
+		// AVATAR State Machine diagrams
+		actions[ASMD_EDIT] = new TAction("edit-asmd-diagram", "Edit AVATAR state machine diagram", IconManager.imgic100, IconManager.imgic101, "Edit AVATAR state machine diagram", "Make it possible to edit the currently opened AVATAR state machine diagram", 0);
+        actions[ASMD_CONNECTOR] = new TAction("add-asmd-connector", "Connect two operators together", IconManager.imgic202, IconManager.imgic202, "Connect two operators together", "Connect two operators of the currently opened AVATAR state machine diagram", 0);
+        actions[ASMD_START] = new TAction("add-asmd-start", "Add Start state", IconManager.imgic222, IconManager.imgic222, "Start", "Add a start state to the currently opened AVATAR state machine diagram", 0);
+        actions[ASMD_STOP] = new TAction("add-asmd-stop", "Add Stop", IconManager.imgic210, IconManager.imgic210, "Stop", "Add a termination state to the currently opened AVATAR state machine diagram", 0);
+        
     }
     
     
diff --git a/src/ui/TURTLEPanel.java b/src/ui/TURTLEPanel.java
index 8a5b2b9b50..bb8617600e 100755
--- a/src/ui/TURTLEPanel.java
+++ b/src/ui/TURTLEPanel.java
@@ -248,6 +248,10 @@ public abstract class TURTLEPanel implements GenericTree {
         return false;
     }
 	
+	public boolean isATDEnabled() {
+        return false;
+    }
+	
 	public MainGUI getMainGUI() {
 		return mgui;
 	}
diff --git a/src/ui/TURTLEPanelPopupListener.java b/src/ui/TURTLEPanelPopupListener.java
index 94c0ffa5ed..a47c676900 100755
--- a/src/ui/TURTLEPanelPopupListener.java
+++ b/src/ui/TURTLEPanelPopupListener.java
@@ -152,7 +152,7 @@ public class TURTLEPanelPopupListener extends MouseAdapter /* popup menus onto t
         newreq.setEnabled(tp.isReqEnabled());
 		newebrdd.setEnabled(tp.isReqEnabled());
         newprosmd.setEnabled(tp.isProSMDEnabled());
-        
+        newatd.setEnabled(tp.isATDEnabled());
     }
     
     private Action listener = new AbstractAction() {
diff --git a/src/ui/avatarbd/AvatarBDBlock.java b/src/ui/avatarbd/AvatarBDBlock.java
new file mode 100644
index 0000000000..874ea29180
--- /dev/null
+++ b/src/ui/avatarbd/AvatarBDBlock.java
@@ -0,0 +1,389 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarBDBlock
+ * Node. To be used in AVATAR Block Diagrams
+ * Creation: 06/04/2010
+ * @version 1.1 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarbd;
+
+import java.awt.*;
+import java.util.*;
+import javax.swing.*;
+
+import org.w3c.dom.*;
+
+import myutil.*;
+import ui.*;
+import ui.window.*;
+
+
+public class AvatarBDBlock extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent {
+    private int textY1 = 3;
+    private String stereotype = "block";
+	
+	private int maxFontSize = 12;
+	private int minFontSize = 4;
+	private int currentFontSize = -1;
+	private boolean displayText = true;
+	private int textX = 1;
+	
+	public String oldValue;
+    
+    public AvatarBDBlock(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp)  {
+        super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
+        
+        width = 250;
+        height = 200;
+        minWidth = 5;
+        minHeight = 2;
+        
+        nbConnectingPoint = 16;
+        connectingPoint = new TGConnectingPoint[16];
+        
+        connectingPoint[0] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.0, 0.0);
+        connectingPoint[1] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.5, 0.0);
+        connectingPoint[2] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 1.0, 0.0);
+        connectingPoint[3] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.0, 0.5);
+        connectingPoint[4] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 1.0, 0.5);
+        connectingPoint[5] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.0, 1.0);
+        connectingPoint[6] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.5, 1.0);
+        connectingPoint[7] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 1.0, 1.0);
+        
+        connectingPoint[8] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.25, 0.0);
+        connectingPoint[9] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.75, 0.0);
+        connectingPoint[10] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.0, 0.25);
+        connectingPoint[11] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 1.0, 0.25);
+        connectingPoint[12] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.0, 0.75);
+        connectingPoint[13] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 1.0, 0.75);
+        connectingPoint[14] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.25, 1.0);
+        connectingPoint[15] = new AvatarBDConnectingPoint(this, 0, 0, true, true, 0.75, 1.0);
+        
+        addTGConnectingPointsComment();
+        
+        nbInternalTGComponent = 0;
+        
+        moveable = true;
+        editable = true;
+        removable = true;
+        userResizable = true;
+        
+        name = tdp.findAvatarBDBlockName("Block");
+		setValue(name);
+		oldValue = value;
+		
+		currentFontSize = maxFontSize;
+		oldScaleFactor = tdp.getZoom();
+        
+        myImageIcon = IconManager.imgic700;
+		
+		actionOnAdd();
+    }
+    
+    public void internalDrawing(Graphics g) {
+		String ster = "<<" + stereotype + ">>";
+		Font f = g.getFont();
+		Font fold = f;
+		
+		//System.out.println("width=" + width + " height=" + height);
+		
+		if ((rescaled) && (!tdp.isScaled())) {
+			
+			if (currentFontSize == -1) {
+				currentFontSize = f.getSize();
+			}
+			rescaled = false;
+			// Must set the font size ..
+			// Find the biggest font not greater than max_font size
+			// By Increment of 1
+			// Or decrement of 1
+			// If font is less than 4, no text is displayed
+			
+			int maxCurrentFontSize = Math.max(0, Math.min(height, maxFontSize));
+			int w0, w1, w2;
+			f = f.deriveFont((float)maxCurrentFontSize);
+			g.setFont(f);
+			//System.out.println("max current font size:" + maxCurrentFontSize);
+			while(maxCurrentFontSize > (minFontSize-1)) {
+				w0 = g.getFontMetrics().stringWidth(value);
+				w1 = g.getFontMetrics().stringWidth(ster);
+				w2 = Math.min(w0, w1);
+				if (w2 < (width - (2*textX))) {
+					break;
+				}
+				maxCurrentFontSize --;
+				f = f.deriveFont((float)maxCurrentFontSize);
+				g.setFont(f);
+			}
+			currentFontSize = maxCurrentFontSize;
+			
+			if(currentFontSize <minFontSize) {
+				displayText = false;
+			} else {
+				displayText = true;
+				f = f.deriveFont((float)currentFontSize);
+				g.setFont(f);
+			}
+			
+		}
+		
+		//System.out.println("Current font size:" + currentFontSize);
+		
+		Color c = g.getColor();
+		g.draw3DRect(x, y, width, height, true);
+		
+		g.setColor(ColorManager.AVATAR_BLOCK);
+		g.fill3DRect(x+1, y+1, width-1, height-1, true);
+		g.setColor(c);
+        
+        // Strings
+		int w;
+		if (displayText) {
+			f = f.deriveFont((float)currentFontSize);
+			Font f0 = g.getFont();
+			g.setFont(f.deriveFont(Font.BOLD));
+			
+			w = g.getFontMetrics().stringWidth(ster);
+			int h =  currentFontSize + (int)(textY1 * tdp.getZoom());
+			if ((w < (2*textX + width)) && (h < height)) {
+				g.drawString(ster, x + (width - w)/2, y +h);
+			}
+			g.setFont(f0);
+			w  = g.getFontMetrics().stringWidth(value);
+			h = 2* (currentFontSize + (int)(textY1 * tdp.getZoom()));
+			if ((w < (2*textX + width)) && (h < height)) {
+				g.drawString(value, x + (width - w)/2, y + h);
+			}
+		}
+		
+		g.setFont(fold);
+        /*int w  = g.getFontMetrics().stringWidth(ster);
+		Font f = g.getFont();
+		g.setFont(f.deriveFont(Font.BOLD));
+        g.drawString(ster, x + (width - w)/2, y + textY1);
+		g.setFont(f);
+        w  = g.getFontMetrics().stringWidth(value);
+        g.drawString(value, x + (width - w)/2, y + textY2);*/
+		
+		// Icon
+		//g.drawImage(IconManager.imgic1100.getImage(), x + 4, y + 4, null);
+		//g.drawImage(IconManager.img9, x + width - 20, y + 4, null);
+    }
+    
+    public TGComponent isOnOnlyMe(int x1, int y1) {
+        
+        if (GraphicLib.isInRectangle(x1, y1, x, y, width, height)) {
+            return this;
+        }
+        return null;
+    }
+    
+    public String getStereotype() {
+        return stereotype;
+        
+    }
+    
+    public String getNodeName() {
+        return name;
+    }
+    
+   public boolean editOndoubleClick(JFrame frame) {
+        oldValue = value;
+        
+        //String text = getName() + ": ";
+        String s = (String)JOptionPane.showInputDialog(frame, "Block name",
+        "setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101,
+        null,
+        getValue());
+        
+        if ((s != null) && (s.length() > 0) && (!s.equals(oldValue))) {
+            //boolean b;
+            if (!TAttribute.isAValidId(s, false, false)) {
+                JOptionPane.showMessageDialog(frame,
+                "Could not change the name of the Block: the new name is not a valid name",
+                "Error",
+                JOptionPane.INFORMATION_MESSAGE);
+                return false;
+            }
+            
+            if (!tdp.isBlockNameUnique(s)) {
+                JOptionPane.showMessageDialog(frame,
+                "Could not change the name of the Block: the new name is already in use",
+                "Error",
+                JOptionPane.INFORMATION_MESSAGE);
+                return false;
+            }
+            
+            setValue(s);
+            recalculateSize();
+            
+            
+            
+            if (tdp.actionOnDoubleClick(this)) {
+                return true;
+            } else {
+                JOptionPane.showMessageDialog(frame,
+                "Could not change the name of the Block: this name is already in use",
+                "Error",
+                JOptionPane.INFORMATION_MESSAGE);
+                setValue(oldValue);
+            }
+        }
+        return false;
+    }
+    
+    
+    public int getType() {
+        return TGComponentManager.AVATARBD_BLOCK;
+    }
+    
+    public void addSwallowedTGComponent(TGComponent tgc, int x, int y) {
+		boolean swallowed = false;
+		
+		for(int i=0; i<nbInternalTGComponent; i++) {
+			if (tgcomponent[i] instanceof SwallowTGComponent) {
+				if (tgcomponent[i].isOnMe(x, y) != null) {
+					swallowed = true;
+					((SwallowTGComponent)tgcomponent[i]).addSwallowedTGComponent(tgc, x, y);
+					break;
+				}
+			}
+        }
+		
+		if (swallowed) {
+			return;
+		}
+		
+        //System.out.println("Add swallow component");
+        // Choose its position
+        
+        // Make it an internal component
+        // It's one of my son
+        tgc.setFather(this);
+        tgc.setDrawingZone(true);
+        
+        //Set its coordinates
+        if (tgc instanceof AvatarBDBlock) {
+            //tgc.setCdRectangle((width/2) - tgc.getWidth(), (width/2), spacePt, height-spacePt);
+            //System.out.println("cdRect comp swallow");
+            ((AvatarBDBlock)tgc).resizeWithFather();
+            //tgc.setCdRectangle(0, width - tgc.getWidth(), 0, height - tgc.getHeight());
+            //tgc.setCd(x, y);
+        }
+        
+        // else unknown*/
+        
+        //add it
+        addInternalComponent(tgc, 0);
+    }
+    
+    public void removeSwallowedTGComponent(TGComponent tgc) {
+        removeInternalComponent(tgc);
+    }
+    
+	 public String getBlockName() {
+       return value;
+    }
+    
+
+    
+    public void hasBeenResized() {
+        for(int i=0; i<nbInternalTGComponent; i++) {
+            if (tgcomponent[i] instanceof AvatarBDBlock) {
+                ((AvatarBDBlock)tgcomponent[i]).resizeWithFather();
+            }
+        }
+		
+		if (getFather() != null) {
+			resizeWithFather();
+		}
+        
+    }
+	
+	public void resizeWithFather() {
+        if ((father != null) && (father instanceof AvatarBDBlock)) {
+			// Too large to fit in the father? -> resize it!
+			resizeToFatherSize();
+			
+            setCdRectangle(0, father.getWidth() - getWidth(), 0, father.getHeight() - getHeight());
+            setMoveCd(x, y);
+        }
+    }
+	
+	public LinkedList<AvatarBDBlock> getBlockList() {
+        LinkedList<AvatarBDBlock> list = new LinkedList<AvatarBDBlock>();
+        for(int i=0; i<nbInternalTGComponent; i++) {
+            if (tgcomponent[i] instanceof AvatarBDBlock) {
+                list.add((AvatarBDBlock)(tgcomponent[i]));
+            }
+        }
+        return list;
+    }
+	
+	public LinkedList<AvatarBDBlock> getFullBlockList() {
+        LinkedList<AvatarBDBlock> list = new LinkedList<AvatarBDBlock>();
+        for(int i=0; i<nbInternalTGComponent; i++) {
+            if (tgcomponent[i] instanceof AvatarBDBlock) {
+                list.add((AvatarBDBlock)(tgcomponent[i]));
+				list.addAll(((AvatarBDBlock)tgcomponent[i]).getFullBlockList());
+            }
+        }
+        return list;
+    }
+	
+	public boolean hasInternalBlockWithName(String name) {
+		LinkedList<AvatarBDBlock> list  = getFullBlockList();
+		for(AvatarBDBlock b: list) {
+			if (b.getValue().compareTo(name) ==0) {
+				return true;
+			}
+		}
+		return false;
+	}
+	
+	
+    
+   	public int getDefaultConnector() {
+        return TGComponentManager.AVATARBD_COMPOSITION_CONNECTOR;
+      }
+    
+}
diff --git a/src/ui/avatarbd/AvatarBDCompositionConnector.java b/src/ui/avatarbd/AvatarBDCompositionConnector.java
new file mode 100644
index 0000000000..d0eda8c213
--- /dev/null
+++ b/src/ui/avatarbd/AvatarBDCompositionConnector.java
@@ -0,0 +1,218 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+* Class AvatarBDCompositionConnector
+* Connector used in AVATAR Block Diagrams
+* Creation: 06/04/2010
+* @version 1.0 06/04/2010
+* @author Ludovic APVRILLE
+* @see
+*/
+
+package ui.avatarbd;
+
+
+
+import java.awt.*;
+import java.awt.geom.*;
+import javax.swing.*;
+import java.util.*;
+
+import org.w3c.dom.*;
+
+import myutil.*;
+import ui.*;
+import ui.cd.*;
+import ui.window.*;
+
+public  class AvatarBDCompositionConnector extends TGConnector implements ScalableTGComponent{
+    protected int d = 20;
+	protected int D = 26;
+    //protected int widthValue, heightValue, maxWidthValue, h;
+	protected Polygon p;
+	protected int xp1, xp2, yp1, yp2;
+	protected double oldScaleFactor;
+	protected boolean rescaled;
+	
+    
+    public AvatarBDCompositionConnector(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) {
+        super(_x, _y,  _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint);
+        myImageIcon = IconManager.imgic202;
+        value = "{info}";
+        editable = true;
+		oldScaleFactor = tdp.getZoom();
+		rescaled = true;
+    }
+    
+    protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){
+        /*if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) {
+		g.drawLine(x1, y1, x2, y2);
+        } else {
+		GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true);
+        }*/
+		if ((p == null) || (rescaled) || (xp1 != x1) || (xp2 != x2) || (yp1 != y1) || (yp2 != y2)){
+			p = new Polygon();
+			xp1 = x1;
+			xp2 = x2;
+			yp1 = y1;
+			yp2 = y2;
+			Double alpha;
+			
+			int dd = (int)(d*tdp.getZoom());
+			int DD = (int)(D*tdp.getZoom());
+			
+			if (x1 == x2) {
+				if (y1 > y2) {
+					p.addPoint(x2, y2+DD);
+					p.addPoint(x2+(dd/2), y2+(DD/2));
+					p.addPoint(x2, y2);
+					p.addPoint(x2-(dd/2), y2+(DD/2));
+				} else {
+					p.addPoint(x2, y2-DD);
+					p.addPoint(x2+(dd/2), y2-(DD/2));
+					p.addPoint(x2, y2);
+					p.addPoint(x2-(dd/2), y2-(DD/2));
+				}
+			} else {
+				double xd[] = new double[4];
+				double yd[] = new double[4];
+				/* Previous way of computing the diamond
+				double a = ((double)y1-y2)/(x1-x2);
+				
+				alpha = Math.atan(a);
+				if (x2 < x1) {
+				x2 = (int)(x2 + (Math.cos(alpha)*D));
+				y2 = (int)(y2 + (Math.sin(alpha)*D));
+				} else {
+				x2 = (int)(x2 - (Math.cos(alpha)*D));
+				y2 = (int)(y2 - (Math.sin(alpha)*D));
+				}
+				
+				int distance;
+				for(int i=0; i<4; i++){
+				if ((i%2) == 0) {
+				distance = D;
+				} else {
+				distance = d;
+				}
+				xd[i] = x2 + (Math.cos(alpha)*distance);
+				yd[i] = y2 + (Math.sin(alpha)*distance);
+				p.addPoint((int)xd[i], (int)yd[i]);
+				alpha = alpha + (Math.PI/2);
+				}*/
+				
+				//P
+				xd[0] = x2;
+				yd[0] = y2;
+				
+				int x0 = x1 - x2;
+				int y0 = y1 - y2;
+				double k = 1/(Math.sqrt((x0*x0)+(y0*y0)));
+				double u = x0*k;
+				double v = y0*k;
+				
+				double Ex = DD*u;
+				double Ey = DD*v;
+				double Fx = dd*v;
+				double Fy = -dd*u;
+				
+				//Q
+				xd[1] = x2+((Ex+Fx)/2);
+				yd[1] = y2+((Ey+Fy)/2);
+				
+				//R
+				xd[2] = x2+Ex;
+				yd[2] = y2+Ey;
+				
+				//S
+				xd[3] = xd[1] - Fx;
+				yd[3] = yd[1] - Fy;
+				
+				for(int i=0; i<4; i++) {
+					p.addPoint((int)xd[i], (int)yd[i]);
+				}
+			}
+			
+		}
+		g.fillPolygon(p);
+		g.drawLine(x1, y1, x2, y2);
+		rescaled = false;
+    }
+	
+	public TGComponent extraIsOnOnlyMe(int x1, int y1) {
+		if (p != null) {
+			if (p.contains(x1, y1)) {
+				return this;
+			}
+		}
+		
+        return null;
+    }
+	
+	public void rescale(double scaleFactor){
+		//System.out.println("Rescale connector");
+		int xx, yy;
+		
+		for(int i=0; i<nbInternalTGComponent; i++) {
+			xx = tgcomponent[i].getX();
+			yy = tgcomponent[i].getY();
+			//System.out.println("Internal comp xx= " + xx + "  y==" + yy);
+			tgcomponent[i].dx = (tgcomponent[i].dx + xx) / oldScaleFactor * scaleFactor;
+			tgcomponent[i].dy = (tgcomponent[i].dy + yy) / oldScaleFactor * scaleFactor;
+			xx = (int)(tgcomponent[i].dx);
+			tgcomponent[i].dx = tgcomponent[i].dx - xx;
+			yy = (int)(tgcomponent[i].dy);
+			tgcomponent[i].dy = tgcomponent[i].dy - yy;
+			
+			tgcomponent[i].setCd(xx, yy);
+			
+			//System.out.println("Internal comp xx= " + xx + "  y==" + yy);
+        }
+		
+		oldScaleFactor = scaleFactor;
+		rescaled = true;
+	}
+    
+    
+    public int getType() {
+        return TGComponentManager.AVATARBD_COMPOSITION_CONNECTOR;
+    }
+	
+	
+    
+}
diff --git a/src/ui/avatarbd/AvatarBDConnectingPoint.java b/src/ui/avatarbd/AvatarBDConnectingPoint.java
new file mode 100644
index 0000000000..1aecc576a1
--- /dev/null
+++ b/src/ui/avatarbd/AvatarBDConnectingPoint.java
@@ -0,0 +1,67 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarBDConnectingPoint
+ * Definition of connecting points on which connectors can be connected on AVATAR State Machine Diagrams
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarbd;
+
+import ui.*;
+
+public class AvatarBDConnectingPoint extends  TGConnectingPointWidthHeight {
+    
+    public AvatarBDConnectingPoint(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) {
+        super(_container, _x, _y, _in, _out, _w, _h);
+    }
+    
+    public boolean isCompatibleWith(int type) {
+        if (type == TGComponentManager.AVATARBD_COMPOSITION_CONNECTOR) {
+            return true;
+        }
+		if (type == TGComponentManager.AVATARBD_PORT_CONNECTOR) {
+            return true;
+        }
+        return false;
+    }
+    
+}
diff --git a/src/ui/avatarbd/AvatarBDPanel.java b/src/ui/avatarbd/AvatarBDPanel.java
new file mode 100644
index 0000000000..5541a730b5
--- /dev/null
+++ b/src/ui/avatarbd/AvatarBDPanel.java
@@ -0,0 +1,454 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarBDPanel
+ * Panel for drawing AVATAR blocks
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarbd;
+
+
+import org.w3c.dom.*;
+
+import ui.*;
+import ui.tmldd.*;
+import java.util.*;
+
+public class AvatarBDPanel extends TDiagramPanel {
+    
+    public  AvatarBDPanel(MainGUI mgui, TToolBar _ttb) {
+        super(mgui, _ttb);
+        TDiagramMouseManager tdmm = new TDiagramMouseManager(this);
+        addMouseListener(tdmm);
+        addMouseMotionListener(tdmm);
+    }
+    
+    public boolean actionOnDoubleClick(TGComponent tgc) {
+        //System.out.println("Action");
+        if (tgc instanceof AvatarBDBlock) {
+            AvatarBDBlock b = (AvatarBDBlock)tgc;
+			//System.out.println("oldValue:" + b.oldValue);
+            return mgui.newAvatarBDBlockName(tp, b.oldValue, b.getValue());
+        } /*else if (tgc instanceof TMLActivityDiagramBox) {
+            if (tgc.getFather() instanceof TMLTaskOperator) {
+                mgui.selectTab(tp, tgc.getFather().getValue());
+            }*/
+            //return false; // because no change made on any diagram
+        //}
+        return false;
+    }
+    
+    public boolean actionOnAdd(TGComponent tgc) {
+        //System.out.println("Action on add!");
+        if (tgc instanceof AvatarBDBlock) {
+            AvatarBDBlock abdb = (AvatarBDBlock)(tgc);
+            System.out.println(" *** add Avatar block *** name=" + abdb.getBlockName());
+            mgui.addAvatarBlock(tp, abdb.getBlockName());
+            return true;
+        } 
+        return false;
+    }
+    
+    public boolean actionOnRemove(TGComponent tgc) {
+		//System.out.println("Action on remove!");
+        if (tgc instanceof AvatarBDBlock) {
+            AvatarBDBlock abdb = (AvatarBDBlock)(tgc);
+            //System.out.println(" *** add tclass *** name=" + tmlt.getTaskName());
+            mgui.removeAvatarBlock(tp, abdb.getBlockName());
+			LinkedList<AvatarBDBlock> list  = abdb.getFullBlockList();
+			for(AvatarBDBlock b: list) {
+				mgui.removeAvatarBlock(tp, b.getBlockName());
+			}
+            return true;
+        } 
+        return false;
+    }
+    
+    public boolean actionOnValueChanged(TGComponent tgc) {
+        if (tgc instanceof AvatarBDBlock) {
+            return actionOnDoubleClick(tgc);
+        }
+        return false;
+    }
+    
+    public String getXMLHead() {
+        return "<AVATARBlockDiagramPanel name=\"" + name + "\"" + sizeParam() + displayParam() +" >";
+    }
+    
+    public String getXMLTail() {
+        return "</AVATARBlockDiagramPanel>";
+    }
+    
+    public String getXMLSelectedHead() {
+        return "<AVATARBlockDiagramPanelCopy name=\"" + name + "\" xSel=\"" + xSel + "\" ySel=\"" + ySel + "\" widthSel=\"" + widthSel + "\" heightSel=\"" + heightSel + "\" >";
+    }
+    
+    public String getXMLSelectedTail() {
+        return "</AVATARBlockDiagramPanelCopy>";
+    }
+    
+    public String getXMLCloneHead() {
+        return "<AVATARBlockDiagramPanelCopy name=\"" + name + "\" xSel=\"" + 0 + "\" ySel=\"" + 0 + "\" widthSel=\"" + 0 + "\" heightSel=\"" + 0 + "\" >";
+    }
+    
+    public String getXMLCloneTail() {
+        return "</AVATARBlockDiagramPanelCopy>";
+    }
+    
+
+    
+    /*public boolean areAttributesVisible() {
+        return attributesVisible;
+    }
+    
+    
+    public boolean areChannelVisible() {
+        return synchroVisible;
+    }
+    
+    public void setAttributesVisible(boolean b) {
+        attributesVisible = b;
+    }
+    
+    
+    public void setChannelVisible(boolean b) {
+        channelVisible = b;
+    }*/
+    
+    public String displayParam() {
+        String s = "";
+        /*if (channelsVisible) {
+            s += " channels=\"true\"";
+        } else {
+            s += " channels=\"false\"";
+        }
+        if (eventsVisible) {
+            s += " events=\"true\"";
+        } else {
+            s += " events=\"false\"";
+        }
+        if (requestsVisible) {
+            s += " requests=\"true\"";
+        } else {
+            s += " requests=\"false\"";
+        }*/
+        
+        return s;
+    }
+    
+    /*public boolean isConnectedToTasks(TMLCompositionOperator co) {
+        if ((getTask1ToWhichIamConnected(co) != null) && (getTask2ToWhichIamConnected(co) != null)) {
+            return true;
+        }
+        return false;
+    }
+    
+    public TMLTaskInterface getTask1ToWhichIamConnected(TMLCompositionOperator co) {
+        TGConnectorTMLAssociationNav tgctmlan = getTGConnectorAssociationOf(co);
+        TGComponent tgc;
+        //System.out.println("tmlan t1?");
+        if (tgctmlan != null) {
+            //System.out.println("tmlan found t1");
+            tgc = getTopComponentToWhichBelongs(tgctmlan.getTGConnectingPointP1());
+            if ((tgc != null) && (tgc instanceof TMLTaskInterface)) {
+                return (TMLTaskInterface) tgc;
+            }
+        }
+        return null;
+    }
+    
+    public TMLTaskInterface getTask2ToWhichIamConnected(TMLCompositionOperator co) {
+        TGConnectorTMLAssociationNav tgctmlan = getTGConnectorAssociationOf(co);
+        TGComponent tgc;
+        //System.out.println("tmlan t2?");
+        if (tgctmlan != null) {
+            //System.out.println("tmlan found t2");
+            tgc = getTopComponentToWhichBelongs(tgctmlan.getTGConnectingPointP2());
+            if ((tgc != null) && (tgc instanceof TMLTaskInterface)) {
+                return (TMLTaskInterface) tgc;
+            }
+        }
+        return null;
+    }
+    
+    public TGConnectorTMLAssociationNav getTGConnectorAssociationOf(TMLCompositionOperator tcd) {
+        int i;
+        TGConnectingPoint p1, p2;
+        TGConnector tgco;
+        TGConnectorTMLCompositionOperator tgcoco;
+        TGComponent tgc;
+        
+        for(i=0; i<tcd.getNbConnectingPoint(); i++) {
+            //System.out.println("titi");
+            p1 = tcd.tgconnectingPointAtIndex(i);
+            tgco = getConnectorConnectedTo(p1);
+            if (tgco != null) {
+                //System.out.println("Found tgco");
+            }
+            if ((tgco != null) && (tgco instanceof TGConnectorTMLCompositionOperator)){
+                //System.out.println("toto");
+                tgcoco = (TGConnectorTMLCompositionOperator)tgco;
+                if (p1 == tgcoco.getTGConnectingPointP1()) {
+                    p2 = tgcoco.getTGConnectingPointP2();
+                } else {
+                    p2 = tgcoco.getTGConnectingPointP1();
+                }
+                
+                // p2 now contains the connecting point of a association
+                tgc = getComponentToWhichBelongs(p2);
+                if ((tgc != null) && (!p2.isFree()) && (tgc instanceof TGConnectorTMLAssociationNav)) {
+                     //System.out.println("tutu");
+                    return (TGConnectorTMLAssociationNav)tgc;
+                }
+            }
+        }
+        return null;
+    }
+    
+    public boolean connectedToVisible(TGConnectorTMLAssociationNav tgconav) {
+        TGConnectorTMLCompositionOperator tgcoco = tgconav.getTGConnectorTMLCompositionOperator();
+        if (tgcoco == null) {
+            return true;
+        }
+        return connectedToVisible(tgcoco);
+    }
+    
+    public boolean connectedToVisible(TGConnectorTMLCompositionOperator tgcoco) {
+        TGConnectingPoint p2 = tgcoco.getTGConnectingPointP2();
+        TGComponent tgc = getComponentToWhichBelongs(p2);
+        if (tgc instanceof TMLCompositionOperator) {
+            return ((TMLCompositionOperator)tgc).isToggledVisible();
+        }
+        return false;
+    }
+    
+    /*public void makePostLoadingProcessing() throws MalformedModelingException {
+        TGComponent tgc;
+        Iterator iterator = componentList.listIterator();
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TCDTObject) {
+                ((TCDTObject)tgc).postLoadingProcessing();
+            }
+        }
+    }
+    
+    public TCDTData findTData(String name) {
+        TGComponent tgc;
+        Iterator iterator = componentList.listIterator();
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TCDTData) {
+                if (tgc.getValue().equals(name)) {
+                    return (TCDTData)tgc;
+                }
+            }
+        }
+        
+        return null;
+    }
+    
+    public TCDTClass getTCDTClass(String name) {
+        TGComponent tgc;
+        Iterator iterator = componentList.listIterator();
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TCDTClass) {
+                if (((TCDTClass)tgc).getClassName().equals(name)) {
+                    return (TCDTClass)tgc;
+                }
+            }
+        }
+        
+        return null;
+    }
+    
+    public boolean areAllVisible() {
+        return channelsVisible && eventsVisible && requestsVisible;
+    }
+    
+    public boolean areChannelsVisible() {
+        return channelsVisible;
+    }
+    
+    public boolean areEventsVisible() {
+        return eventsVisible;
+    }
+    
+    public boolean areRequestsVisible() {
+        return requestsVisible;
+    }
+    
+    public void setChannelsVisible(boolean b) {
+        channelsVisible = b;
+    }
+    
+    public void setEventsVisible(boolean b) {
+        eventsVisible = b;
+    }
+    
+    public void setRequestsVisible(boolean b) {
+        requestsVisible = b;
+    }*/
+    
+    public void loadExtraParameters(Element elt) {
+        String s;
+        //System.out.println("Extra parameter");
+        /*try {
+            s = elt.getAttribute("channels");
+            //System.out.println("S=" + s);
+            if (s.compareTo("false") ==0) {
+                setChannelsVisible(false);
+            } else {
+                setChannelsVisible(true);
+            }
+            s = elt.getAttribute("events");
+            if (s.compareTo("false") ==0) {
+                setEventsVisible(false);
+            } else {
+                setEventsVisible(true);
+            }
+            s = elt.getAttribute("requests");
+            if (s.compareTo("false") ==0) {
+                setRequestsVisible(false);
+            } else {
+                setRequestsVisible(true);
+            }
+            
+        } catch (Exception e) {
+            // Model was saved in an older version of TTool
+            //System.out.println("older format");
+            setChannelsVisible(true);
+            setEventsVisible(true);
+            setRequestsVisible(true);
+        }*/
+    }
+	
+	/*public ArrayList<String> getAllTMLTaskNames(String _topname) {
+		TGComponent tgc;
+        Iterator iterator = componentList.listIterator();
+		ArrayList<String> list = new ArrayList<String>();
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TMLTaskOperator) {
+				list.add(_topname + "::" + ((TMLTaskOperator)tgc).getTaskName());
+            }
+        }
+		
+		return list;
+	}
+	
+	public ArrayList<String> getAllTMLCommunicationNames(String _topname) {
+		TGComponent tgc;
+        Iterator iterator = componentList.listIterator();
+		ArrayList<String> list = new ArrayList<String>();
+		String name = "";
+		String type = "";
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TMLCompositionOperator) {
+				if (tgc instanceof TMLEventOperator) {
+					name = ((TMLEventOperator)tgc).getEventName();
+					type = "Event";
+				}
+				if (tgc instanceof TMLChannelOperator) {
+					name = ((TMLChannelOperator)tgc).getChannelName();
+					type = "Channel";
+				}
+				if (tgc instanceof TMLRequestOperator) {
+					name = ((TMLRequestOperator)tgc).getRequestName();
+					type = "Request";
+				}
+				
+				list.add(_topname + "::" + name + " (" + type + ")");
+            }
+        }
+		
+		return list;
+	}
+	
+	public ArrayList<String> getAllNonMappedTMLTaskNames(String _topName, TMLArchiDiagramPanel _tadp, boolean ref, String _name) {
+		TGComponent tgc;
+        Iterator iterator = componentList.listIterator();
+		ArrayList<String> list = new ArrayList<String>();
+		String name;
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TMLTaskOperator) {
+				name = ((TMLTaskOperator)tgc).getTaskName();
+				if (ref && name.equals(_name)) {
+					list.add(_topName + "::" + name);
+				} else {
+					if (!_tadp.isMapped(_topName,  name)) {
+							list.add(_topName + "::" + name);
+					}
+				}
+            }
+        }
+		
+		return list;
+	}
+	
+	public TMLTaskOperator getTaskByName(String _name) {
+		TGComponent tgc;
+        Iterator iterator = componentList.listIterator();
+		ArrayList<String> list = new ArrayList<String>();
+        
+        while(iterator.hasNext()) {
+            tgc = (TGComponent)(iterator.next());
+            if (tgc instanceof TMLTaskOperator) {
+				if (((TMLTaskOperator)tgc).getTaskName().equals(_name)) {
+					return ((TMLTaskOperator)tgc);
+				}
+            }
+        }
+		
+		return null;
+	}*/
+    
+}
diff --git a/src/ui/avatarbd/AvatarBDPortConnector.java b/src/ui/avatarbd/AvatarBDPortConnector.java
new file mode 100644
index 0000000000..7fe743dda9
--- /dev/null
+++ b/src/ui/avatarbd/AvatarBDPortConnector.java
@@ -0,0 +1,168 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarBDPortConnector
+ * Connector used in AVATAR Block Diagrams
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarbd;
+
+
+import java.awt.*;
+import java.awt.geom.*;
+import javax.swing.*;
+import java.util.*;
+
+import org.w3c.dom.*;
+
+import myutil.*;
+import ui.*;
+import ui.window.*;
+
+public  class AvatarBDPortConnector extends TGConnector implements ScalableTGComponent {
+    //protected int arrowLength = 10;
+    //protected int widthValue, heightValue, maxWidthValue, h;
+	protected int c = 10; //square length 
+	protected double oldScaleFactor;
+	protected int fontSize = 12;
+	
+    
+    public AvatarBDPortConnector(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) {
+        super(_x, _y,  _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint);
+        myImageIcon = IconManager.imgic202;
+        value = "";
+        editable = true;
+		oldScaleFactor = tdp.getZoom();
+    }
+    
+    protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){
+        /*if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) {
+            g.drawLine(x1, y1, x2, y2);
+        } else {
+            GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true);
+        }*/
+		
+		//g.drawLine(x1, y1, x2, y2);
+		int cz = (int)(tdp.getZoom() * c);
+		g.fillRect(x2-(cz/2), y2-(cz/2), cz, cz);
+		g.fillRect(p1.getX()-(cz/2), p1.getY()-(cz/2), cz, cz);
+		
+		Point p = GraphicLib.intersectionRectangleSegment(x2-(cz/2), y2-(cz/2), cz, cz, x1, y1, x2, y2);
+		if (p == null) {
+			//System.out.println("null point");
+		} else {
+		if (Point2D.distance(x1, y1, p.x, p.y) < GraphicLib.longueur * 1.5) {
+			//System.out.println("p.x=" + p.x + " x1=" + x1 + "p.y=" + p.y + " y1=" + y1);
+			if ((p.x != x1) || (p.y != y1)) {
+				g.drawLine(x1, y1, p.x, p.y);
+				//System.out.println("drawn");
+			}
+        } else {
+            GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, p.x, p.y, true);
+        }
+		}
+		
+		if (value.length() > 0) {
+			Font f = g.getFont();
+			if (tdp.getZoom() < 1) {
+				Font f0 =  f.deriveFont((float)(fontSize*tdp.getZoom()));
+				g.setFont(f0);
+			}
+			g.drawString(value, x2-(cz/2), y2-(cz/2)-1);
+			g.setFont(f);
+		}
+	
+    }
+	
+	public boolean editOndoubleClick(JFrame frame) {
+        String oldValue = value;
+        String text = getName() + "Connector";
+        String s = (String)JOptionPane.showInputDialog(frame, text,
+        "Setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101,
+        null,
+        getValue());
+        
+        if (s != null) {
+            s = Conversion.removeFirstSpaces(s);
+        }
+		
+		//System.out.println("emptytext=" + emptyText);
+        
+        if ((s != null) && (!s.equals(oldValue))) {
+            setValue(s);
+            return true;
+        }
+         
+        return false;
+    }
+    
+    
+    public int getType() {
+        return TGComponentManager.AVATARBD_PORT_CONNECTOR;
+    }
+	
+	public void rescale(double scaleFactor){
+		//System.out.println("Rescale connector");
+		int xx, yy;
+		
+		for(int i=0; i<nbInternalTGComponent; i++) {
+			xx = tgcomponent[i].getX();
+			yy = tgcomponent[i].getY();
+			//System.out.println("Internal comp xx= " + xx + "  y==" + yy);
+			tgcomponent[i].dx = (tgcomponent[i].dx + xx) / oldScaleFactor * scaleFactor;
+			tgcomponent[i].dy = (tgcomponent[i].dy + yy) / oldScaleFactor * scaleFactor;
+			xx = (int)(tgcomponent[i].dx);
+			tgcomponent[i].dx = tgcomponent[i].dx - xx;
+			yy = (int)(tgcomponent[i].dy);
+			tgcomponent[i].dy = tgcomponent[i].dy - yy;
+			
+			tgcomponent[i].setCd(xx, yy);
+			
+			//System.out.println("Internal comp xx= " + xx + "  y==" + yy);
+        }
+		
+		oldScaleFactor = scaleFactor;
+	}
+	
+
+    
+}
diff --git a/src/ui/avatarbd/AvatarBDToolBar.java b/src/ui/avatarbd/AvatarBDToolBar.java
new file mode 100644
index 0000000000..43196bf0ce
--- /dev/null
+++ b/src/ui/avatarbd/AvatarBDToolBar.java
@@ -0,0 +1,143 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarBDToolBar
+ * Implements the toolbar to be used in conjunction with the panel of an AVATAR block diagram
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see AvatarBDPanel
+ */
+
+package ui.avatarbd;
+
+import javax.swing.*;
+//import java.awt.*;
+//import java.awt.event.*;
+
+import ui.*;
+
+public class AvatarBDToolBar extends TToolBar {
+    
+    public AvatarBDToolBar(MainGUI _mgui) {
+        super(_mgui);
+        
+    }
+    
+    protected void setActive(boolean b) {
+		mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(b);
+		mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(b);
+		
+		mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(b);
+		mgui.updateZoomInfo();
+		
+        mgui.actions[TGUIAction.IOD_EDIT].setEnabled(b);
+        mgui.actions[TGUIAction.UML_NOTE].setEnabled(b);
+        mgui.actions[TGUIAction.CONNECTOR_COMMENT].setEnabled(b);
+		
+		mgui.actions[TGUIAction.ABD_BLOCK].setEnabled(b);
+		mgui.actions[TGUIAction.ABD_COMPOSITION_CONNECTOR].setEnabled(b);
+		mgui.actions[TGUIAction.ABD_PORT_CONNECTOR].setEnabled(b);
+		
+        //mgui.actions[TGUIAction.ATD_ATTACK].setEnabled(b);
+		
+		 //mgui.actions[TGUIAction.ATD_ATTACK_CONNECTOR].setEnabled(b);
+		 
+		 //mgui.actions[TGUIAction.ATD_CONSTRAINT].setEnabled(b);
+		
+		//mgui.actions[TGUIAction.ACT_TOGGLE_ATTR].setEnabled(b);
+        
+    }
+    
+    protected void setButtons() {
+        JButton button;
+        
+        button = this.add(mgui.actions[TGUIAction.IOD_EDIT]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        this.addSeparator();
+        
+        button = this.add(mgui.actions[TGUIAction.UML_NOTE]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        button = this.add(mgui.actions[TGUIAction.CONNECTOR_COMMENT]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        this.addSeparator();
+        
+        button = this.add(mgui.actions[TGUIAction.ABD_BLOCK]);
+        button.addMouseListener(mgui.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(mgui.actions[TGUIAction.ABD_COMPOSITION_CONNECTOR]);
+        button.addMouseListener(mgui.mouseHandler);
+		
+        this.addSeparator();
+		
+		button = this.add(mgui.actions[TGUIAction.ABD_PORT_CONNECTOR]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        /*button = this.add(mgui.actions[TGUIAction.ATD_ATTACK]);
+        button.addMouseListener(mgui.mouseHandler);
+		
+        this.addSeparator();
+        
+		button = this.add(mgui.actions[TGUIAction.ATD_CONSTRAINT]);
+        button.addMouseListener(mgui.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(mgui.actions[TGUIAction.ATD_ATTACK_CONNECTOR]);
+        button.addMouseListener(mgui.mouseHandler);
+		
+		this.addSeparator();
+		this.addSeparator();
+		
+		button = this.add(mgui.actions[TGUIAction.ACT_TOGGLE_ATTR]);
+        button.addMouseListener(mgui.mouseHandler);*/
+		
+		
+    }
+    
+} // Class
+
+
+
+
+
diff --git a/src/ui/avatarsmd/AvatarSMDConnectingPoint.java b/src/ui/avatarsmd/AvatarSMDConnectingPoint.java
new file mode 100644
index 0000000000..362ea8a650
--- /dev/null
+++ b/src/ui/avatarsmd/AvatarSMDConnectingPoint.java
@@ -0,0 +1,72 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarSMDConnectingPoint
+ * Definition of connecting points on which connectors of AVATAR State Machine Diagram can be connected
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see 
+ */
+ 
+package ui.avatarsmd;
+
+//import java.awt.*;
+import ui.*;
+
+public class AvatarSMDConnectingPoint extends  TGConnectingPointWidthHeight{
+
+	public AvatarSMDConnectingPoint(CDElement _container, int _x, int _y, boolean _in, boolean _out, double _w, double _h) {
+		super(_container, _x, _y, _in, _out, _w, _h);
+	}
+
+	public boolean isCompatibleWith(int type) {
+		if (type == TGComponentManager.AVATARSMD_CONNECTOR) {
+			return true;	
+		}
+		return false;
+	}
+       
+}
+
+
+
+
+    
+
+
diff --git a/src/ui/avatarsmd/AvatarSMDConnector.java b/src/ui/avatarsmd/AvatarSMDConnector.java
new file mode 100644
index 0000000000..d547b39849
--- /dev/null
+++ b/src/ui/avatarsmd/AvatarSMDConnector.java
@@ -0,0 +1,82 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarSMDConnector
+ * Basic connector with a full arrow at the end. Used in state machine
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarsmd;
+
+import java.awt.*;
+import java.awt.geom.*;
+import java.util.*;
+
+import myutil.*;
+import ui.*;
+
+public  class AvatarSMDConnector extends TGConnector {
+    protected int arrowLength = 10;
+    
+    public AvatarSMDConnector(int _x, int _y, int _minX, int _minY, int _maxX, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp, TGConnectingPoint _p1, TGConnectingPoint _p2, Vector _listPoint) {
+        super(_x, _y,  _minX, _minY, _maxX, _maxY, _pos, _father, _tdp, _p1, _p2, _listPoint);
+        myImageIcon = IconManager.imgic202;
+    }
+    
+    protected void drawLastSegment(Graphics g, int x1, int y1, int x2, int y2){
+        if (Point2D.distance(x1, y1, x2, y2) < GraphicLib.longueur * 1.5) {
+            g.drawLine(x1, y1, x2, y2);
+        } else {
+            GraphicLib.arrowWithLine(g, 1, 0, 10, x1, y1, x2, y2, true);
+        }
+    }
+    
+    public int getType() {
+        return TGComponentManager.AVATARSMD_CONNECTOR;
+    }
+}
+
+
+
+
+
+
+
diff --git a/src/ui/avatarsmd/AvatarSMDPanel.java b/src/ui/avatarsmd/AvatarSMDPanel.java
new file mode 100755
index 0000000000..9bd8a27a93
--- /dev/null
+++ b/src/ui/avatarsmd/AvatarSMDPanel.java
@@ -0,0 +1,173 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarSMDPanel
+ * Panel used for drawing state machine diagrams of AVATAR blocks
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarsmd;
+
+//import java.awt.*;
+import java.util.*;
+
+//import org.w3c.dom.*;
+//import org.xml.sax.*;
+//import javax.xml.parsers.*;
+
+import ui.*;
+
+public class AvatarSMDPanel extends TDiagramPanel {
+    
+    public  AvatarSMDPanel(MainGUI mgui, TToolBar _ttb) {
+        super(mgui, _ttb);
+        addComponent(400, 50, TGComponentManager.AVATARSMD_START_STATE, false);
+        TDiagramMouseManager tdmm = new TDiagramMouseManager(this);
+        addMouseListener(tdmm);
+        addMouseMotionListener(tdmm);
+    }
+    
+    public boolean actionOnDoubleClick(TGComponent tgc) {
+        return false;
+    }
+    
+    public boolean actionOnAdd(TGComponent tgc) {
+        return false;
+    }
+    public boolean actionOnValueChanged(TGComponent tgc) {
+        return false;
+    }
+    
+    public  boolean actionOnRemove(TGComponent tgc) {
+        return false;
+    }
+    
+    public String getXMLHead() {
+        return "<AVATARStateMachineDiagramPanel name=\"" + name + "\"" + sizeParam() + " >";
+    }
+    
+    public String getXMLTail() {
+        return "</AVATARStateMachineDiagramPanel>";
+    }
+    
+    public String getXMLSelectedHead() {
+        return "<AVATARStateMachineDiagramPanelCopy name=\"" + name + "\" xSel=\"" + xSel + "\" ySel=\"" + ySel + "\" widthSel=\"" + widthSel + "\" heightSel=\"" + heightSel + "\" >";
+    }
+    
+    public String getXMLSelectedTail() {
+        return "</AVATARStateMachineDiagramPanelCopy>";
+    }
+    
+    public String getXMLCloneHead() {
+        return "<AVATARStateMachineDiagramPanelCopy name=\"" + name + "\" xSel=\"" + 0 + "\" ySel=\"" + 0 + "\" widthSel=\"" + 0 + "\" heightSel=\"" + 0 + "\" >";
+    }
+    
+    public String getXMLCloneTail() {
+        return "</AVATARStateMachineDiagramPanelCopy>";
+    }
+    
+    public void makeGraphicalOptimizations() {
+        // Segments of connector that mask components
+        
+        // Components over others
+        
+        // Position correctly guards of choice
+    }
+    
+    /*public void enhance() {
+        //System.out.println("enhance");
+        Vector v = new Vector();
+        Object o;
+        Iterator iterator = componentList.listIterator();
+        
+        while(iterator.hasNext()) {
+            o = iterator.next();
+            if (o instanceof TMLADStartState){
+                enhance(v, (TMLADStartState)o);
+            }
+        }
+        
+        mgui.changeMade(this, MOVE_CONNECTOR);
+        repaint();
+    }
+    
+    public void enhance(Vector v, TGComponent tgc) {
+        TGComponent tgc1;
+        TGConnector tgcon;
+        int i;
+        
+        //System.out.println("Enhancing: " + tgc);
+        
+        if (tgc == null) {
+            return;
+        }
+        
+        if (v.contains(tgc)) {
+            return;
+        }
+        
+        v.add(tgc);
+        
+        //System.out.println("Nb of nexts: " + tgc.getNbNext());
+        if (!(tgc instanceof TMLADStartState)) {
+            for(i=0; i<tgc.getNbNext(); i++) {
+                tgc1 = getNextTGComponent(tgc, i);
+                tgcon = getNextTGConnector(tgc, i);
+                if (tgcon.getAutomaticDrawing()) {
+                    if ((tgc1 != null) && (tgcon != null)) {
+                        tgcon.alignOrMakeSquareTGComponents();
+                    }
+                }
+            }
+        }
+        
+        // Explore next elements
+        for(i=0; i<tgc.getNbNext(); i++) {
+            tgc1 = getNextTGComponent(tgc, i);
+            enhance(v, tgc1);
+        }
+    }*/
+	
+	public boolean hasAutoConnect() {
+		return true;
+	}
+    
+}
diff --git a/src/ui/avatarsmd/AvatarSMDStartState.java b/src/ui/avatarsmd/AvatarSMDStartState.java
new file mode 100644
index 0000000000..4769114368
--- /dev/null
+++ b/src/ui/avatarsmd/AvatarSMDStartState.java
@@ -0,0 +1,104 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarSMDStartState
+ * Used to start a new state machine of an AVATAR block
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarsmd;
+
+import java.awt.*;
+import java.awt.geom.*;
+
+import myutil.*;
+import ui.*;
+
+public class AvatarSMDStartState extends TGCWithoutInternalComponent implements EmbeddedComment{
+    private int lineLength = 5;
+    
+    public AvatarSMDStartState(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp)  {
+        super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
+        
+        width = 15;
+        height = 15;
+        
+        nbConnectingPoint = 1;
+        connectingPoint = new TGConnectingPoint[1];
+        connectingPoint[0] = new AvatarSMDConnectingPoint(this, 0, lineLength, false, true, 0.5, 1.0);
+        
+        nbInternalTGComponent = 0;
+        
+        moveable = true;
+        editable = false;
+        removable = true;
+        
+        name = "start state";
+        
+        myImageIcon = IconManager.imgic222;
+    }
+    
+    public void internalDrawing(Graphics g) {
+        g.fillOval(x, y, width, height);
+        g.drawLine(x+(width/2), y+height, x+(width/2), y + lineLength + height);
+    }
+    
+    public TGComponent isOnMe(int _x, int _y) {
+        if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
+            return this;
+        }
+        
+        if ((int)(Line2D.ptSegDistSq(x+(width/2), y+height, x+(width/2), y + lineLength + height, _x, _y)) < distanceSelected) {
+			return this;	
+		}
+        
+        return null;
+    }
+    
+    public int getType() {
+        return TGComponentManager.AVATARSMD_START_STATE;
+    }
+    
+    public int getDefaultConnector() {
+      return TGComponentManager.AVATARSMD_CONNECTOR;
+    }
+    
+}
diff --git a/src/ui/avatarsmd/AvatarSMDStopState.java b/src/ui/avatarsmd/AvatarSMDStopState.java
new file mode 100644
index 0000000000..e40ee63ad1
--- /dev/null
+++ b/src/ui/avatarsmd/AvatarSMDStopState.java
@@ -0,0 +1,109 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ *
+ * /**
+ * Class AvatarSMDStopState
+ * Used to terminate a new state machine of an AVATAR block
+ * Creation: 06/04/2010
+ * @version 1.0 06/04/2010
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarsmd;
+
+import java.awt.*;
+
+import myutil.*;
+import ui.*;
+
+public class AvatarSMDStopState extends TGCWithoutInternalComponent implements EmbeddedComment, AllowedBreakpoint {
+    private int internalCircleSize = 16;
+    private int lineLength = 5;
+    
+    public AvatarSMDStopState(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp)  {
+        super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
+        
+        width = 20;
+        height = 20;
+        
+        nbConnectingPoint = 1;
+        connectingPoint = new TGConnectingPoint[1];
+        connectingPoint[0] = new AvatarSMDConnectingPoint(this, 0, - lineLength, true, false, 0.5, 0.0);
+        
+        nbInternalTGComponent = 0;
+        
+        moveable = true;
+        editable = false;
+        removable = true;
+        
+        name = "stop state";
+        
+        myImageIcon = IconManager.imgic210;
+    }
+    
+    public void internalDrawing(Graphics g) {
+        ColorManager.setColor(g, state, 0);
+        g.fillOval(x + (width - internalCircleSize)/2, y + (height - internalCircleSize)/2, internalCircleSize, internalCircleSize);
+        g.drawOval(x, y, width, height);
+        g.drawLine(x+(width/2), y, x+(width/2), y - lineLength);
+    }
+    
+    
+    public TGComponent isOnMe(int _x, int _y) {
+        if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
+            return this;
+        }
+        return null;
+    }
+    
+    public int getType() {
+        return TGComponentManager.AVATARSMD_STOP_STATE;
+    }
+	
+	public int getDefaultConnector() {
+      return TGComponentManager.AVATARSMD_CONNECTOR;
+    }
+    
+}
+
+
+
+
+
+
+
diff --git a/src/ui/avatarsmd/AvatarSMDToolBar.java b/src/ui/avatarsmd/AvatarSMDToolBar.java
new file mode 100755
index 0000000000..4ffd05f03a
--- /dev/null
+++ b/src/ui/avatarsmd/AvatarSMDToolBar.java
@@ -0,0 +1,121 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class AvatarSMDToolBar
+ * Toolbar associated with AVATAR state Machines
+ * Creation: 06/04/2010
+ * @version 1.0 28/10/2005
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarsmd;
+
+import javax.swing.*;
+//import java.awt.*;
+//import java.awt.event.*;
+
+import ui.*;
+
+public class AvatarSMDToolBar extends TToolBar {
+    
+    
+    public AvatarSMDToolBar(MainGUI _mgui) {
+        super(_mgui);
+    }
+    
+    protected void setActive(boolean b) {
+        mgui.actions[TGUIAction.ASMD_EDIT].setEnabled(b);
+        mgui.actions[TGUIAction.UML_NOTE].setEnabled(b);
+        mgui.actions[TGUIAction.ASMD_CONNECTOR].setEnabled(b);
+        mgui.actions[TGUIAction.ASMD_START].setEnabled(b);
+        mgui.actions[TGUIAction.ASMD_STOP].setEnabled(b);
+		
+		mgui.actions[TGUIAction.ACT_ZOOM_MORE].setEnabled(false);
+		mgui.actions[TGUIAction.ACT_ZOOM_LESS].setEnabled(false);
+		mgui.actions[TGUIAction.ACT_SHOW_ZOOM].setEnabled(false);
+		mgui.updateZoomInfo();
+    }
+    
+    protected void setButtons() {
+        JButton button;
+        
+        button = this.add(mgui.actions[TGUIAction.ASMD_EDIT]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        this.addSeparator();
+        
+        button = this.add(mgui.actions[TGUIAction.UML_NOTE]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        this.addSeparator();
+        
+		button = this.add(mgui.actions[TGUIAction.ASMD_CONNECTOR]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        this.addSeparator();
+        
+        button = this.add(mgui.actions[TGUIAction.ASMD_START]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        button = this.add(mgui.actions[TGUIAction.ASMD_STOP]);
+        button.addMouseListener(mgui.mouseHandler);
+        
+        
+        /*this.addSeparator();
+        
+        button = this.add(mgui.actions[TGUIAction.ACT_ENHANCE]);
+        button.addMouseListener(mgui.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(mgui.actions[TGUIAction.ACT_TOGGLE_INTERNAL_COMMENT]);
+        button.addMouseListener(mgui.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(mgui.actions[TGUIAction.ACT_TOGGLE_DIPLO_ID]);
+        button.addMouseListener(mgui.mouseHandler);*/
+       
+    }
+} // Class
+
+
+
+
+
-- 
GitLab