From d0e83bb5cf8738383caa12e7852272c748d154a8 Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Mon, 24 Jan 2011 07:50:54 +0000
Subject: [PATCH] AVATAR: Update on interactive simulation

---
 Makefile                                      |    4 +-
 .../AvatarSimulationBlock.java                |   39 +-
 .../AvatarSimulationInteraction.java          |   54 +
 .../AvatarSimulationTransaction.java          |   12 +-
 .../AvatarSpecificationSimulation.java        |  147 +-
 src/ui/AvatarDesignPanel.java                 |   17 +
 src/ui/MainGUI.java                           |   26 +-
 src/ui/TDiagramPanel.java                     |    1 +
 src/ui/TGComponent.java                       |   88 +-
 src/ui/TGConnector.java                       |   13 +
 .../AvatarInteractiveSimulationActions.java   |  219 ++
 .../AvatarInteractiveSimulationBar.java       |   73 +
 .../AvatarMainCommandsToolBar.java            |  146 ++
 .../AvatarSaveCommandsToolBar.java            |   88 +
 .../BlockTableModel.java                      |  146 ++
 .../JFrameAvatarInteractiveSimulation.java    | 1992 +++++++++++++++++
 16 files changed, 3038 insertions(+), 27 deletions(-)
 create mode 100644 src/avatartranslator/directsimulation/AvatarSimulationInteraction.java
 create mode 100755 src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationActions.java
 create mode 100755 src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationBar.java
 create mode 100755 src/ui/avatarinteractivesimulation/AvatarMainCommandsToolBar.java
 create mode 100755 src/ui/avatarinteractivesimulation/AvatarSaveCommandsToolBar.java
 create mode 100755 src/ui/avatarinteractivesimulation/BlockTableModel.java
 create mode 100755 src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java

diff --git a/Makefile b/Makefile
index 68532676f0..2430b01b7a 100755
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ GZIP = gzip -9 -f
 DEBUG  = -g
 CLASSPATH = -classpath
 CLASSPATH = -sourcepath
-PACKAGE = avatartranslator avatartranslator/touppaal avatartranslator/toturtle avatartranslator/toproverif 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/avatarrd 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 proverifspec uppaaldesc fr/inria/oasis/vercors/cttool/model remotesimulation
+PACKAGE = avatartranslator avatartranslator/directsimulation avatartranslator/tocppsim avatartranslator/touppaal avatartranslator/toturtle avatartranslator/toproverif 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/avatarrd 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 proverifspec uppaaldesc fr/inria/oasis/vercors/cttool/model remotesimulation
 BUILDER = builder.jar
 BUILD_INFO = build.txt
 BUILD_TO_MODIFY = src/ui/DefaultText.java
@@ -86,7 +86,7 @@ basic:
 ttooljar_std:
 	rm -f $(TTOOL_BIN)/$(TTOOL_BINARY)
 	cp $(TTOOL_SRC)/ui/images/$(STD_LOGO) $(TTOOL_SRC)/ui/images/$(LOGO) 
-	cd $(TTOOL_SRC);  $(JAR) cmf $(TTOOL_JAR_TXT) $(TTOOL_BIN)/$(TTOOL_BINARY) Main.class vcd/*.class avatartranslator/touppaal/*.class avatartranslator/toproverif/*.class avatartranslator/*.class avatartranslator/toturtle/*.java automata/*.class compiler/tmlparser/*.class nc/*.class  tmltranslator/*.class tmltranslator/toautomata/*.class tmatrix/*.class tmltranslator/toturtle/*.class tmltranslator/touppaal/*.class tmltranslator/tosystemc/*.class tmltranslator/tomappingsystemc/*.class tmltranslator/tomappingsystemc2/*.class  tpndescription/*.class ddtranslator/*.class launcher/*.class myutil/*.class sddescription/*.class sdtranslator/*.class translator/*.class translator/tojava/*.class  translator/tosimujava/*.class translator/touppaal/*.class translator/totpn/*.class req/ebrdd/*.java ui/*.class ui/*/*.class ui/*/*/*.class proverifspec/*.class uppaaldesc/*.class ui/images/*.* ui/images/toolbarButtonGraphics/general/*.gif ui/images/toolbarButtonGraphics/media/*.gif $(TTOOL_BIN)/$(LAUNCHER_BINARY) RTLLauncher.class launcher/*.class fr/inria/oasis/vercors/cttool/model/*.class remotesimulation/*.class
+	cd $(TTOOL_SRC);  $(JAR) cmf $(TTOOL_JAR_TXT) $(TTOOL_BIN)/$(TTOOL_BINARY) Main.class vcd/*.class avatartranslator/*.class avatartranslator/directsimulation/*.class avatartranslator/touppaal/*.class avatartranslator/toproverif/*.class avatartranslator/*.class avatartranslator/toturtle/*.java automata/*.class compiler/tmlparser/*.class nc/*.class  tmltranslator/*.class tmltranslator/toautomata/*.class tmatrix/*.class tmltranslator/toturtle/*.class tmltranslator/touppaal/*.class tmltranslator/tosystemc/*.class tmltranslator/tomappingsystemc/*.class tmltranslator/tomappingsystemc2/*.class  tpndescription/*.class ddtranslator/*.class launcher/*.class myutil/*.class sddescription/*.class sdtranslator/*.class translator/*.class translator/tojava/*.class  translator/tosimujava/*.class translator/touppaal/*.class translator/totpn/*.class req/ebrdd/*.java ui/*.class ui/*/*.class ui/*/*/*.class proverifspec/*.class uppaaldesc/*.class ui/images/*.* ui/images/toolbarButtonGraphics/general/*.gif ui/images/toolbarButtonGraphics/media/*.gif $(TTOOL_BIN)/$(LAUNCHER_BINARY) RTLLauncher.class launcher/*.class fr/inria/oasis/vercors/cttool/model/*.class remotesimulation/*.class
 
 
 launcher:
diff --git a/src/avatartranslator/directsimulation/AvatarSimulationBlock.java b/src/avatartranslator/directsimulation/AvatarSimulationBlock.java
index 98ee5c8455..071338ff7c 100644
--- a/src/avatartranslator/directsimulation/AvatarSimulationBlock.java
+++ b/src/avatartranslator/directsimulation/AvatarSimulationBlock.java
@@ -53,6 +53,11 @@ import avatartranslator.*;
 import myutil.*;
 
 public class AvatarSimulationBlock  {
+	public final static int NOT_STARTED = 0;
+	public final static int STARTED = 1;
+	public final static int COMPLETED = 2;
+	
+	
   
     private AvatarBlock block;
 	private AvatarSimulationTransaction lastTransaction;
@@ -72,6 +77,29 @@ public class AvatarSimulationBlock  {
 		return "noname";
 	}
 	
+	public int getID() {
+		if (block != null) {
+			return block.getID();
+		}
+		return -1;
+	}
+	
+	public int getStatus() {
+		if (completed) {
+			return COMPLETED;
+		}
+		
+		if (lastTransaction == null) {
+			return NOT_STARTED;
+		}
+		
+		return STARTED;
+	}
+	
+	public LinkedList<AvatarSimulationTransaction> getTransactions() {
+		return transactions;
+	}
+	
 	public LinkedList<AvatarSimulationPendingTransaction> getPendingTransactions(LinkedList<AvatarSimulationTransaction> _allTransactions, long _clockValue, int _maxTransationsInARow) {
 		LinkedList<AvatarSimulationPendingTransaction> ll = new LinkedList<AvatarSimulationPendingTransaction>();
 		
@@ -228,10 +256,9 @@ public class AvatarSimulationBlock  {
 	}
 	
 	public void makeExecutedTransaction(LinkedList<AvatarSimulationTransaction> _allTransactions, AvatarStateMachineElement _elt, long _clockValue) {
-			AvatarSimulationTransaction ast = new AvatarSimulationTransaction();
+			AvatarSimulationTransaction ast = new AvatarSimulationTransaction(_elt);
 			ast.block = block;
 			ast.asb = this;
-			ast.executedElement = _elt;
 			ast.concernedElement = null;
 			ast.initialClockValue = _clockValue;
 			ast.clockValueWhenPerformed = _clockValue;
@@ -260,4 +287,12 @@ public class AvatarSimulationBlock  {
 		lastTransaction = _ast;
 		_allTransactions.add(_ast);
 	}
+	
+	public AvatarStateMachineElement getCurrentAvatarElement() {
+		if (lastTransaction == null) {
+			return block.getStateMachine().getStartState();
+		}
+		
+		return lastTransaction.executedElement;
+	}
 }
\ No newline at end of file
diff --git a/src/avatartranslator/directsimulation/AvatarSimulationInteraction.java b/src/avatartranslator/directsimulation/AvatarSimulationInteraction.java
new file mode 100644
index 0000000000..2ba7c22cf1
--- /dev/null
+++ b/src/avatartranslator/directsimulation/AvatarSimulationInteraction.java
@@ -0,0 +1,54 @@
+/**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 AvatarSimulationInteraction
+ * Avatar: notion of driver of simulation
+ * Creation: 21/01/2011
+ * @version 1.0 21/01/2011
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+
+package avatartranslator.directsimulation;
+
+
+public interface AvatarSimulationInteraction  {
+  
+	public void setMode(int _mode);
+}
\ No newline at end of file
diff --git a/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java b/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java
index fc15cf0f77..83d0c6099a 100644
--- a/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java
+++ b/src/avatartranslator/directsimulation/AvatarSimulationTransaction.java
@@ -55,6 +55,7 @@ import myutil.*;
 public class AvatarSimulationTransaction  {
   
 	public static long ID;
+	public static LinkedList<AvatarStateMachineElement> allExecutedElements;
 	
     public AvatarBlock block;
 	public AvatarSimulationBlock asb;
@@ -65,11 +66,20 @@ public class AvatarSimulationTransaction  {
 	public long id;
 	public LinkedList<String> attributeValues;
 	
-    public AvatarSimulationTransaction() {
+    public AvatarSimulationTransaction(AvatarStateMachineElement _executeElement) {
+		executedElement = _executeElement;
+		addExecutedElement(executedElement);
     }
 	
 	public static void reinit() {
 		ID = 0;
+		allExecutedElements = new LinkedList<AvatarStateMachineElement>();
+	}
+	
+	public static void addExecutedElement(AvatarStateMachineElement _asme) {
+		if (!allExecutedElements.contains(_asme)) {
+			allExecutedElements.add(_asme);
+		}
 	}
 	
 	public static synchronized long setID() {
diff --git a/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java b/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
index 464235b6ee..a8da07ba94 100644
--- a/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
+++ b/src/avatartranslator/directsimulation/AvatarSpecificationSimulation.java
@@ -54,10 +54,17 @@ import myutil.*;
 
 
 public class AvatarSpecificationSimulation  {
-	
 	private static int MAX_TRANSACTION_IN_A_ROW = 1000; 
-  
+	
+	public final static int OTHER = 0;
+	public final static int STOPPED = 1;
+	public final static int RUNNING = 2;
+	public final static int TERMINATED = 3;
+	
+	private int mode;
+	
     private AvatarSpecification avspec;
+	private AvatarSimulationInteraction asi;
 	private long clockValue;
 	private LinkedList<AvatarSimulationBlock> blocks;
 	private LinkedList<AvatarActionOnSignal> asynchronousMessages;
@@ -65,18 +72,42 @@ public class AvatarSpecificationSimulation  {
 	private LinkedList<AvatarSimulationTransaction> allTransactions;
 	
 	private boolean stopped = false;
+	private boolean killed = false;
 	
-    public AvatarSpecificationSimulation(AvatarSpecification _avspec) {
+	private int nbOfCommands = -1; // means: until it blocks
+	
+    public AvatarSpecificationSimulation(AvatarSpecification _avspec, AvatarSimulationInteraction _asi) {
         avspec = _avspec;
+		asi = _asi;
     }
 	
+	public LinkedList<AvatarSimulationBlock> getSimulationBlocks() {
+		return blocks;
+	}
+	
+	public LinkedList<AvatarSimulationTransaction> getAllTransactions() {
+		return allTransactions;
+	}
+	
+	public long getClockValue() {
+		return clockValue;
+	}
+	
 	public void initialize() {
+		
 		// Remove composite states
 		avspec.removeCompositeStates();
 		
 		// Remove timers
 		avspec.removeTimers();
 		
+		reset();
+	}
+	
+	public void reset() {
+		killed = false;
+		unsetNbOfCommands();
+		
 		// Reinit clock
 		clockValue = 0;
 		
@@ -103,31 +134,56 @@ public class AvatarSpecificationSimulation  {
 	}
 	
 	public void runSimulation() {
+		setMode(RUNNING);
 		int index[];
 		LinkedList<AvatarSimulationPendingTransaction> selectedTransactions;
 		
-		TraceManager.addDev("Simulation started at time: " + clockValue);
 		boolean go = true;
-		while(go == true && !stopped) {
-			gatherPendingTransactions();
-			
-			if (pendingTransactions.size() == 0) {
-				go = false;
-				TraceManager.addDev("No more pending transactions");
-			} else {
-				selectedTransactions = selectTransactions(pendingTransactions);
+		stopped = true;
+		
+		if (stopped && go) {
+			setMode(STOPPED);
+			TraceManager.addDev("Simulation waiting for run");
+			waitForUnstopped();
+			if (go) {
+				setMode(RUNNING);
+			}
+		}
+		
+		TraceManager.addDev("Simulation started at time: " + clockValue);
+		
+		while((go == true) && !killed) {
+			while((go == true) && !stopped && !killed) {
+				gatherPendingTransactions();
 				
-				if (selectedTransactions.size() == 0) {
+				if (pendingTransactions.size() == 0) {
 					go = false;
-					TraceManager.addDev("Deadlock: no transaction can be selected");
+					TraceManager.addDev("No more pending transactions");
 				} else {
-					TraceManager.addDev("Nb of selected transactions: " + selectedTransactions.size());
-					go = performSelectedTransactions(selectedTransactions);
+					selectedTransactions = selectTransactions(pendingTransactions);
+					
+					if (selectedTransactions.size() == 0) {
+						go = false;
+						TraceManager.addDev("Deadlock: no transaction can be selected");
+					} else {
+						TraceManager.addDev("* * * * * Nb of selected transactions: " + selectedTransactions.size());
+						go = performSelectedTransactions(selectedTransactions);
+						TraceManager.addDev("NbOfcommands=" + nbOfCommands);
+						nbOfCommands --;
+						if (nbOfCommands == 0) {
+							stopSimulation();
+							stopSimulation(go);
+						}
+					}
+					
 				}
+			}
+			if (stopped && go && !killed) {
+				stopSimulation(go);
 				
 			}
 		}
-		
+		setMode(TERMINATED);
 		TraceManager.addDev("Simulation finished at time: " + clockValue + "\n--------------------------------------");
 		
 		printExecutedTransactions();
@@ -166,7 +222,6 @@ public class AvatarSpecificationSimulation  {
 		
 		// Then consider timed transactions
 		
-		
 		return ll;
 	}
 	
@@ -190,9 +245,63 @@ public class AvatarSpecificationSimulation  {
 	}
 	
 	
+	public synchronized void waitForUnstopped() {
+		while(stopped && !killed) {
+			try {
+				wait();
+			} catch (Exception e) {
+			}
+		}
+	}
+	
+	public synchronized void unstop() {
+		stopped = false;
+		notifyAll();
+	}
+	
 	public synchronized void stopSimulation() {
-		TraceManager.addDev("Simulation stopped");
+		TraceManager.addDev("Ask for simulation stop");
+		notifyAll();
 		stopped = true;
 	}
+	
+	public synchronized void killSimulation() {
+		TraceManager.addDev("Simulation killed");
+		killed = true;
+		stopped = true;
+		notifyAll();
+	}
+	
+	public void setMode(int _mode) {
+		mode = _mode;
+		
+		if (mode == STOPPED) {
+			unsetNbOfCommands();
+		}
+		
+		if (asi != null) {
+			asi.setMode(mode);
+		}
+	}
+	
+	public void setNbOfCommands(int _nbOfCommands) {
+		nbOfCommands = _nbOfCommands;
+	}
+	
+	public void unsetNbOfCommands() {
+		nbOfCommands = -1;
+	}
+	
+	public void stopSimulation(boolean _go) {
+		setMode(STOPPED);
+		unsetNbOfCommands();
+		TraceManager.addDev("Simulation stopped at time: " + clockValue + "\n--------------------------------------");
+		waitForUnstopped();
+		if (_go && !killed) {
+			setMode(RUNNING);
+		}
+	}
+	
+	
 
 }
\ No newline at end of file
diff --git a/src/ui/AvatarDesignPanel.java b/src/ui/AvatarDesignPanel.java
index 3aa8afea21..3fea637ebd 100644
--- a/src/ui/AvatarDesignPanel.java
+++ b/src/ui/AvatarDesignPanel.java
@@ -53,6 +53,8 @@ import java.util.*;
 import ui.avatarbd.*;
 import ui.avatarsmd.*;
 
+import myutil.*;
+
 public class AvatarDesignPanel extends TURTLEPanel {
     public AvatarBDPanel abdp; 
     public Vector validated, ignored;
@@ -162,6 +164,21 @@ public class AvatarDesignPanel extends TURTLEPanel {
         return mgui.getTitleAt(this) + " (AVATAR Design)";
     }
 	
+	public void resetMetElements() {
+		TraceManager.addDev("Reset met elements");
+		TGComponent tgc;
+		
+		
+		for(int i=0; i<panels.size(); i++) {
+			ListIterator iterator = ((TDiagramPanel)(panels.get(i))).getComponentList().listIterator();
+			while(iterator.hasNext()) {
+				tgc = (TGComponent)(iterator.next());
+				tgc.setAVATARMet(false);
+			}
+		}
+		
+	}
+	
 	/*public ArrayList<String> getAllTMLTaskNames(String _name) {
 		return tmltdp.getAllTMLTaskNames(_name);
 	}
diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java
index 15311f7160..ed252ed6ba 100755
--- a/src/ui/MainGUI.java
+++ b/src/ui/MainGUI.java
@@ -65,6 +65,7 @@ import ui.ad.*;
 import ui.atd.*;
 import ui.cd.*;
 import ui.file.*;
+import ui.avatarinteractivesimulation.*;
 import ui.interactivesimulation.*;
 import ui.iod.*;
 import ui.req.*;
@@ -264,6 +265,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 	private ArrayList<RunningInfo> runningIDs;
 	private ArrayList<LoadInfo> loadIDs;
 	private JFrameInteractiveSimulation jfis;
+	private JFrameAvatarInteractiveSimulation jfais;
     
     public MainGUI(boolean _systemcOn, boolean _lotosOn, boolean _proactiveOn, boolean _tpnOn, boolean _osOn, boolean _uppaalOn, boolean _ncOn, boolean _avatarOn, boolean _proverifOn) {
         systemcOn = _systemcOn;
@@ -3237,11 +3239,16 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         TURTLEPanel tp = getCurrentTURTLEPanel();
 		if (tp instanceof AvatarDesignPanel) {
 			TraceManager.addDev("AVATAR Simulation");
-			JDialogAvatarSimulationGeneration jgen = new JDialogAvatarSimulationGeneration(frame, this, "Simulation code generation and compilation", ConfigurationTTool.AVATARSimulationHost, ConfigurationTTool.AVATARCPPSIMCodeDirectory, ConfigurationTTool.AVATARCPPSIMCompileCommand, ConfigurationTTool.AVATARCPPSIMCodeExecuteCommand, ConfigurationTTool.AVATARCPPSIMInteractiveExecuteCommand);
+			/*JDialogAvatarSimulationGeneration jgen = new JDialogAvatarSimulationGeneration(frame, this, "Simulation code generation and compilation", ConfigurationTTool.AVATARSimulationHost, ConfigurationTTool.AVATARCPPSIMCodeDirectory, ConfigurationTTool.AVATARCPPSIMCompileCommand, ConfigurationTTool.AVATARCPPSIMCodeExecuteCommand, ConfigurationTTool.AVATARCPPSIMInteractiveExecuteCommand);
 			jgen.setSize(500, 750);
 			GraphicLib.centerOnParent(jgen);
 			jgen.setVisible(true);
-			dtree.toBeUpdated();
+			dtree.toBeUpdated();*/
+			jfais = new JFrameAvatarInteractiveSimulation(frame, this, "Interactive simulation", gtm.getAvatarSpecification());
+			jfais.setIconImage(IconManager.img9);
+			jfais.setSize(1024, 900);
+			GraphicLib.centerOnParent(jfais);
+			jfais.setVisible(true);
 		} else if ((tp instanceof TMLDesignPanel) || (tp instanceof TMLComponentDesignPanel) || (tp instanceof TMLArchiPanel))  {
 			JDialogSystemCGeneration jgen = new JDialogSystemCGeneration(frame, this, "Simulation code generation and compilation", ConfigurationTTool.SystemCHost, ConfigurationTTool.SystemCCodeDirectory, ConfigurationTTool.SystemCCodeCompileCommand, ConfigurationTTool.SystemCCodeExecuteCommand, ConfigurationTTool.SystemCCodeInteractiveExecuteCommand);
 			jgen.setSize(500, 750);
@@ -5658,6 +5665,13 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 		setDiploAnimate(!TDiagramPanel.DIPLO_ANIMATE_ON);
 	}
 	
+	public boolean isRunningAvatarComponent(TGComponent _tgc) {
+		if(jfais.isVisible()) {
+			return jfais.isRunningComponent(_tgc);
+		}
+		return false;
+	}
+	
 	public void setDiploAnimate(boolean b) {
 		TDiagramPanel.DIPLO_ANIMATE_ON = b;
 		TDiagramPanel tdp = getCurrentTDiagramPanel();
@@ -5666,6 +5680,14 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 		}
 	}
 	
+	public void setAvatarAnimate(boolean b) {
+		TDiagramPanel.AVATAR_ANIMATE_ON = b;
+		TDiagramPanel tdp = getCurrentTDiagramPanel();
+		if (tdp != null) {
+			tdp.repaint();
+		}
+	}
+	
 	public void setDiploIDs(boolean b) {
 		TDiagramPanel.DIPLO_ID_ON = b;
 		TDiagramPanel tdp = getCurrentTDiagramPanel();
diff --git a/src/ui/TDiagramPanel.java b/src/ui/TDiagramPanel.java
index 265ac4c18e..edca3e2273 100755
--- a/src/ui/TDiagramPanel.java
+++ b/src/ui/TDiagramPanel.java
@@ -196,6 +196,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
 	
 	// AVATAR ID -> for simulation purpose
 	public static boolean AVATAR_ID_ON;
+	public static boolean AVATAR_ANIMATE_ON;
     
     // Constructor
     public TDiagramPanel(MainGUI _mgui, TToolBar _ttb) {
diff --git a/src/ui/TGComponent.java b/src/ui/TGComponent.java
index 78e8949aff..0cebf53c2d 100755
--- a/src/ui/TGComponent.java
+++ b/src/ui/TGComponent.java
@@ -109,6 +109,7 @@ public abstract class TGComponent implements CDElement, GenericTree {
 	// AVATAR ID
 	private int AVATARID = -1;
 	private boolean AVATAR_running = false;
+	private boolean AVATAR_met = false;
 	
     
     // Zone of drawing -> relative to father if applicable
@@ -163,6 +164,7 @@ public abstract class TGComponent implements CDElement, GenericTree {
 	
 	// Zoom
 	public double dx=0, dy=0, dwidth, dheight;
+
 	
     //Constructor
     public TGComponent(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) {
@@ -190,7 +192,7 @@ public abstract class TGComponent implements CDElement, GenericTree {
     public abstract void internalDrawing(Graphics g);
     public abstract TGComponent isOnMe(int _x, int _y);
     public abstract void setState(int s);
-    
+	
     // Internal component operations
     public void setFather(TGComponent _father) {
         father = _father;
@@ -480,6 +482,79 @@ public abstract class TGComponent implements CDElement, GenericTree {
 		}
 	}
 	
+	public void setAVATARMet(boolean _b) {
+		AVATAR_met = _b;
+	}
+	
+	public void drawAVATARMet(Graphics g) {
+		int dech = 8;
+		int decw = 12;
+		g.setColor(ColorManager.CURRENT_COMMAND_RUNNING);
+		int myx, myy, mywidth;
+		if (this instanceof TGConnector) {
+			TGConnector tgco = (TGConnector)this;
+			myx = tgco.getMiddleFirstSegment().x;
+			myy = tgco.getMiddleFirstSegment().y;
+			mywidth = 2;
+		} else {
+			myx = getX();
+			myy = getY();
+			mywidth = width+1;
+		}
+		
+		g.drawLine(myx+mywidth, myy+1+dech/2, myx+mywidth + decw/3, myy+dech);
+		g.drawLine(myx+mywidth + decw/3, myy+dech, myx+mywidth + decw, myy);
+		
+	}
+	
+	public void drawAVATARComp(Graphics g) {
+		int wb = 30;
+		int hb = 10;
+		int wh = 15;
+		int hh = 20;
+		int sep = 10;
+		
+		int[] xp = new int[7];
+		int[] yp = new int[7];
+		
+		int myx, myy, myheight;
+		if (this instanceof TGConnector) {
+			TGConnector tgco = (TGConnector)this;
+			myx = tgco.getMiddleFirstSegment().x;
+			myy = tgco.getMiddleFirstSegment().y;
+			myheight = 4;
+		} else {
+			myx = getX();
+			myy = getY();
+			myheight = height;
+		}
+		
+		xp[0] = myx - sep - wb -wh;
+		yp[0] = myy + ((myheight-hb) / 2);
+		
+		xp[1] = myx - sep - wh;
+		yp[1] = myy + ((myheight-hb) / 2);
+		
+		xp[2] = myx - sep - wh;
+		yp[2] = myy + ((myheight-hh) / 2);
+		
+		xp[3] = myx - sep;
+		yp[3] = myy + (myheight / 2);
+		
+		xp[4] = myx - sep - wh;
+		yp[4] = myy + ((myheight+hh) / 2);
+		
+		xp[5] = myx - sep - wh;
+		yp[5] = myy + ((myheight+hb) / 2);
+		
+		xp[6] = myx - sep - wb -wh;
+		yp[6] = myy + ((myheight+hb) / 2);
+		
+		g.setColor(ColorManager.CURRENT_COMMAND_RUNNING);
+		g.fillPolygon(xp, yp, 7);
+	}
+		
+	
 	public void drawRunningDiploID(Graphics g, RunningInfo ri) {
 		//System.out.println("Drawing running DIPLO");
 		int wb = 30;
@@ -692,6 +767,17 @@ public abstract class TGComponent implements CDElement, GenericTree {
 			drawDiploID(g);
 		} else if (tdp.AVATAR_ID_ON) {
 			drawAVATARID(g);
+		} 
+		
+		if (tdp.AVATAR_ANIMATE_ON) {
+			//TraceManager.addDev("Avatar animate?");
+			if (AVATAR_met) {
+				drawAVATARMet(g);
+			}
+			if (tdp.getMGUI().isRunningAvatarComponent(this)) {
+				//TraceManager.addDev("Avatar animate!");
+				drawAVATARComp(g);
+			}
 		}
 		
 		if (this instanceof EmbeddedComment) {
diff --git a/src/ui/TGConnector.java b/src/ui/TGConnector.java
index ab25f53e44..fba896641d 100755
--- a/src/ui/TGConnector.java
+++ b/src/ui/TGConnector.java
@@ -174,6 +174,19 @@ public abstract class TGConnector extends TGCWithInternalComponent {
     public boolean isP2(CDElement cd) {
         return (p2 == cd);
     }
+	
+	public Point getMiddleFirstSegment() {
+		if (nbInternalTGComponent ==0) {
+			return new Point((p1.getX()+p2.getX())/2, (p1.getY()+p2.getY())/2);
+		}
+		
+		if (tgcomponent[0] instanceof TGCPointOfConnector) {
+			//TraceManager.addDev("TGCPointOfConnector");
+			return new Point((p1.getX()+tgcomponent[0].getX())/2, (p1.getY()+tgcomponent[0].getY())/2);
+		}
+		
+		return new Point((p1.getX()+p2.getX())/2, (p1.getY()+p2.getY())/2);
+	}
     
     public boolean alignTGComponents() {
         int dist_y = p2.getY() - p1.getY();
diff --git a/src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationActions.java b/src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationActions.java
new file mode 100755
index 0000000000..825bac3e22
--- /dev/null
+++ b/src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationActions.java
@@ -0,0 +1,219 @@
+/**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 AvatarInteractiveSimulationActions
+ *
+ * Creation: 21/01/2011
+ * @version 1.0 21/01/2011
+ * @author Ludovic APVRILLE
+ * @see TGComponent
+ */
+
+package ui.avatarinteractivesimulation;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+
+import javax.swing.*;
+import javax.swing.event.EventListenerList;
+
+import ui.*;
+
+public class AvatarInteractiveSimulationActions extends AbstractAction {
+    // Actions
+    public static final int ACT_RUN_SIMU = 0;
+	public static final int ACT_STOP_SIMU = 1;
+	public static final int ACT_RESET_SIMU = 2;
+	public static final int ACT_RUN_X_TIME_UNITS = 6;
+	public static final int ACT_RUN_TO_TIME = 7;
+	public static final int ACT_RUN_X_TRANSACTIONS = 8;
+	public static final int ACT_RUN_X_COMMANDS = 9;
+	
+	public static final int ACT_RUN_EXPLORATION = 20;
+	public static final int ACT_RUN_TO_NEXT_BUS_TRANSFER = 21;
+	public static final int ACT_RUN_UNTIL_CPU_EXECUTES = 22;
+	public static final int ACT_RUN_UNTIL_TASK_EXECUTES = 23;
+	public static final int ACT_RUN_UNTIL_MEMORY_ACCESS = 24;
+	public static final int ACT_RUN_UNTIL_CHANNEL_ACCESS = 25;
+	
+	public static final int ACT_SAVE_VCD = 10;
+	public static final int ACT_SAVE_HTML = 11;
+	public static final int ACT_SAVE_TXT = 12;
+	
+	public static final int ACT_PRINT_BENCHMARK = 26;
+	public static final int ACT_SAVE_BENCHMARK = 27;
+	
+	public static final int ACT_SAVE_STATE = 13;
+	public static final int ACT_RESTORE_STATE = 14;
+	
+	public static final int ACT_START_ALL = 3; 
+	public static final int ACT_STOP_ALL = 4;
+	public static final int ACT_STOP_AND_CLOSE_ALL = 5;
+	
+	public static final int ACT_UPDATE_VARIABLES = 15;
+	public static final int ACT_UPDATE_CPUS = 16;
+	public static final int ACT_UPDATE_MEMS = 17;
+	public static final int ACT_UPDATE_BUS = 18;  
+	public static final int ACT_UPDATE_TASKS = 19;
+	
+	public static final int ACT_PRINT_CPUS = 28;
+	public static final int ACT_PRINT_BUS = 29;
+   
+    public static final int NB_ACTION = 30;
+
+
+    private  static final TAction [] actions = new TAction[NB_ACTION];
+    
+    private EventListenerList listeners;
+    
+    public static final String JLF_IMAGE_DIR = "";
+    
+    public static final String LARGE_ICON = "LargeIcon";
+    
+
+    
+    public AvatarInteractiveSimulationActions(int id) {
+        if (actions[0] == null) {
+            init();
+        }
+        if (actions[id] == null) {
+            return ;
+        }
+        
+        putValue(Action.NAME, actions[id].NAME);
+        putValue(Action.SMALL_ICON, actions[id].SMALL_ICON);
+        putValue(LARGE_ICON, actions[id].LARGE_ICON);
+        putValue(Action.SHORT_DESCRIPTION, actions[id].SHORT_DESCRIPTION);
+        putValue(Action.LONG_DESCRIPTION, actions[id].LONG_DESCRIPTION);
+        //putValue(Action.MNEMONIC_KEY, new Integer(actions[id].MNEMONIC_KEY));
+        if (actions[id].MNEMONIC_KEY != 0) {
+            putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(actions[id].MNEMONIC_KEY, java.awt.event.InputEvent.CTRL_MASK));
+        }
+        putValue(Action.ACTION_COMMAND_KEY, actions[id].ACTION_COMMAND_KEY);
+        
+    }
+    
+    public void setName(int index, String name) {
+        actions[index].NAME = name;
+        putValue(Action.NAME, actions[index].NAME);
+    }
+    
+    public void init() {
+        actions[ACT_RUN_SIMU] = new TAction("run-simu", "Run simulation", IconManager.imgic1302, IconManager.imgic1302, "Run simulation", "Run simulation until next breakpoint. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_STOP_SIMU] = new TAction("stop-simu", "Stop simulation", IconManager.imgic55, IconManager.imgic55, "Stop simulation", "Stop simulation. Works only if the simulator is \"busy\"", 'S');
+		actions[ACT_RESET_SIMU] = new TAction("reset-simu", "Reset simulation", IconManager.imgic45, IconManager.imgic45, "Reset simulation", "Reset simulation", 'T');
+		actions[ACT_RUN_X_TIME_UNITS] = new TAction("run-x-time-units", "Run x time units", IconManager.imgic1300, IconManager.imgic1300, "Run x time units", "Run simulation for x units of time. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_RUN_TO_TIME] = new TAction("run-to-time", "Run to time x", IconManager.imgic1304, IconManager.imgic1304, "Run to time x", "Run simulation until time x is reached. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_RUN_X_TRANSACTIONS] = new TAction("run-x-transactions", "Run x transactions", IconManager.imgic1306, IconManager.imgic1306, "Run x transactions", "Run simulation for x transactions. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_RUN_X_COMMANDS] = new TAction("run-x-commands", "Run x commands", IconManager.imgic1308, IconManager.imgic1308, "Run x commands", "Run simulation for x commands. Works only if the simulator is \"ready\"", 'R');
+        
+		actions[ACT_RUN_EXPLORATION] = new TAction("run-exploration", "Run exploration", IconManager.imgic1326, IconManager.imgic1326, "Run exploration", "Explore branches of the simulation", 'R');
+        actions[ACT_RUN_TO_NEXT_BUS_TRANSFER] = new TAction("run-until-bus-transfer", "Run until bus transfer", IconManager.imgic1316, IconManager.imgic1316, "Run until transfer on bus", "Run until a transfer on the indicated bus is performed. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_RUN_UNTIL_CPU_EXECUTES] = new TAction("run-to-cpu", "Run until CPU executes", IconManager.imgic1320, IconManager.imgic1320, "Run until CPU executes", "Run until a CPU, given as parameter, executes. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_RUN_UNTIL_TASK_EXECUTES] = new TAction("run-to-task", "Run until a task executes", IconManager.imgic1318, IconManager.imgic1318, "Run until a task executes", "Run until a task executes. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_RUN_UNTIL_MEMORY_ACCESS] = new TAction("run-to-memory-accessd", "Run until a memory access is performed", IconManager.imgic1322, IconManager.imgic1322, "Run until a memory access is performed", "Run simulation until a memory access is performed on selected memory. Works only if the simulator is \"ready\"", 'R');
+        actions[ACT_RUN_UNTIL_CHANNEL_ACCESS] = new TAction("run--to-channel-access", "Run until a channel is accessed", IconManager.imgic1324, IconManager.imgic1324, "Run until a channel is accessed", "Run until a channel is accessed. Works only if the simulator is \"ready\"", 'R');
+		
+		actions[ACT_SAVE_VCD] = new TAction("save-vcd", "Save trace in VCD format", IconManager.imgic1310, IconManager.imgic1310, "Save trace in VCD format", "Save trace in VCD format", 'R');
+        actions[ACT_SAVE_HTML] = new TAction("save-html", "Save trace in HTML format", IconManager.imgic1312, IconManager.imgic1312, "Save trace in HTML format", "Save trace in HTML format", 'R');
+        actions[ACT_SAVE_TXT] = new TAction("save-txt", "Save trace in TXT format", IconManager.imgic1314, IconManager.imgic1314, "Save trace in TXT format", "Save trace in TXT format", 'R');
+        
+		actions[ACT_SAVE_STATE] = new TAction("save-state", "Save simulation state in File", IconManager.imgic341, IconManager.imgic341, "Save simulation state in File", "Save simulation state in File", 'R');
+        actions[ACT_RESTORE_STATE] = new TAction("restore-state", "Restore simulation state from File", IconManager.imgic339, IconManager.imgic339, "Restore simulation state from File", "Restore simulation state from File", 'R');
+        
+		actions[ACT_START_ALL] = new TAction("start-all", "Connect to simulator", IconManager.imgic53, IconManager.imgic53, "Connect", "Start the server - if it is not yet running - and connect to it", 'C');
+        actions[ACT_STOP_ALL] = new TAction("stop-all", "Quit simulation window", IconManager.imgic27, IconManager.imgic27, "Quit simulation window", "Quit the simulation window without terminating the simulation", 'Q');
+        actions[ACT_STOP_AND_CLOSE_ALL] = new TAction("stop-and-close-all", "Terminate simulation and quit", IconManager.imgic27, IconManager.imgic27, "Terminate simulation and quit", "Terminate the simulation and quit the simulation window", 'T');
+        
+		actions[ACT_UPDATE_VARIABLES] = new TAction("update-variables", "Update variables", IconManager.imgic75, IconManager.imgic75, "Update variables", "Update variables", 'R');
+        actions[ACT_UPDATE_CPUS] = new TAction("update-cpus", "Update CPU info", IconManager.imgic75, IconManager.imgic75, "Update CPU information", "Update information on CPUs", 'R');
+        actions[ACT_UPDATE_MEMS] = new TAction("update-mems", "Update Memories information", IconManager.imgic75, IconManager.imgic75, "Update Memories information", "Update information on Memories", 'R');
+        actions[ACT_UPDATE_BUS] = new TAction("update-bus", "Update bus info", IconManager.imgic75, IconManager.imgic75, "Update bus information", "Update information on busses", 'R');
+        actions[ACT_UPDATE_TASKS] = new TAction("update-tasks", "Update task information", IconManager.imgic75, IconManager.imgic75, "Update task information", "Update information on tasks", 'R');
+		
+		actions[ACT_PRINT_CPUS] = new TAction("print-cpus", "Print CPU info", IconManager.imgic75, IconManager.imgic75, "Print CPU information", "Print information on CPUs", 'R');
+		actions[ACT_PRINT_BUS] = new TAction("print-bus", "Print Bus info", IconManager.imgic75, IconManager.imgic75, "Print Bus information", "Print information on Busses", 'R');
+		
+		actions[ACT_PRINT_BENCHMARK] = new TAction("print-benchmark", "Print benchmark", IconManager.imgic29, IconManager.imgic29, "Print benchmark", "Print benchmark at simulator side", 'R');
+        actions[ACT_SAVE_BENCHMARK] = new TAction("save-benchmark", "Save benchmark", IconManager.imgic25, IconManager.imgic25, "Save benchmark", "Save benchmark at simulator side", 'R');
+        
+        
+    }
+    
+    
+    public String getActionCommand()  {
+        return (String)getValue(Action.ACTION_COMMAND_KEY);
+    }
+
+    public String getShortDescription()  {
+        return (String)getValue(Action.SHORT_DESCRIPTION);
+    }
+    
+    public String getLongDescription()  {
+        return (String)getValue(Action.LONG_DESCRIPTION);
+    }
+
+    public void actionPerformed(ActionEvent evt)  {
+        //System.out.println("Action performed");
+        if (listeners != null) {
+            Object[] listenerList = listeners.getListenerList();
+            
+            // Recreate the ActionEvent and stuff the value of the ACTION_COMMAND_KEY
+            ActionEvent e = new ActionEvent(evt.getSource(), evt.getID(),
+            (String)getValue(Action.ACTION_COMMAND_KEY));
+            for (int i = 0; i <= listenerList.length-2; i += 2) {
+                ((ActionListener)listenerList[i+1]).actionPerformed(e);
+            }
+        }
+    }
+    
+    public void addActionListener(ActionListener l)  {
+        if (listeners == null) {
+            listeners = new EventListenerList();
+        }
+        listeners.add(ActionListener.class, l);
+    }
+    
+    public void removeActionListener(ActionListener l)  {
+        if (listeners == null) {
+            return;
+        }
+        listeners.remove(ActionListener.class, l);
+    }    
+}
diff --git a/src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationBar.java b/src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationBar.java
new file mode 100755
index 0000000000..8540bcca41
--- /dev/null
+++ b/src/ui/avatarinteractivesimulation/AvatarInteractiveSimulationBar.java
@@ -0,0 +1,73 @@
+/**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 AvatarInteractiveSimulationBar
+ * Abstract toolbar to be used by simulation window
+ * Creation: 21/01/2011
+ * @version 1.0 21/01/2011
+ * @author Ludovic APVRILLE
+ * @see TGComponent
+ */
+
+package ui.avatarinteractivesimulation;
+
+import javax.swing.*;
+
+
+public abstract class AvatarInteractiveSimulationBar extends JToolBar {
+    protected JFrameAvatarInteractiveSimulation jfais;
+    
+    public AvatarInteractiveSimulationBar(JFrameAvatarInteractiveSimulation _jfais) {
+        super();
+        jfais = _jfais;
+        setOrientation(SwingConstants.HORIZONTAL);
+        setFloatable(true) ;
+        setButtons();
+    }
+    
+    // asbtract operations
+    protected abstract void setButtons();
+    
+    protected abstract void setActive(boolean b);
+    
+} // Class
+
+
+
+
+
diff --git a/src/ui/avatarinteractivesimulation/AvatarMainCommandsToolBar.java b/src/ui/avatarinteractivesimulation/AvatarMainCommandsToolBar.java
new file mode 100755
index 0000000000..e7fdd4d8c4
--- /dev/null
+++ b/src/ui/avatarinteractivesimulation/AvatarMainCommandsToolBar.java
@@ -0,0 +1,146 @@
+/**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 AvatarMainCommandsToolBar
+ * Toolbar associated with interactive simulation (main commands)
+ * Creation: 21/01/2011
+ * @version 1.0 21/01/2011
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarinteractivesimulation;
+
+import javax.swing.*;
+//import java.awt.*;
+//import java.awt.event.*;
+
+import ui.*;
+
+public class AvatarMainCommandsToolBar extends AvatarInteractiveSimulationBar {
+    
+    
+    public AvatarMainCommandsToolBar(JFrameAvatarInteractiveSimulation _jfais) {
+        super(_jfais);
+    }
+    
+    protected void setActive(boolean b) {
+		jfais.actions[AvatarInteractiveSimulationActions.ACT_RUN_SIMU].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_X_TIME_UNITS].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_TO_TIME].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_X_TRANSACTIONS].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_X_COMMANDS].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_EXPLORATION].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_TO_NEXT_BUS_TRANSFER].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CPU_EXECUTES].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_TASK_EXECUTES].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_MEMORY_ACCESS].setEnabled(b);
+		//jfais.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CHANNEL_ACCESS].setEnabled(b);
+        jfais.actions[AvatarInteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(b);
+		jfais.actions[AvatarInteractiveSimulationActions.ACT_RESET_SIMU].setEnabled(b);
+		jfais.actions[AvatarInteractiveSimulationActions.ACT_RUN_X_COMMANDS].setEnabled(b);
+		
+    }
+    
+    protected void setButtons() {
+        JButton button;
+        
+        button = this.add(jfais.actions[AvatarInteractiveSimulationActions.ACT_RESET_SIMU]);
+        button.addMouseListener(jfais.mouseHandler);
+        
+		this.addSeparator();
+		
+		button = this.add(jfais.actions[AvatarInteractiveSimulationActions.ACT_STOP_SIMU]);
+        button.addMouseListener(jfais.mouseHandler);
+        
+        button = this.add(jfais.actions[AvatarInteractiveSimulationActions.ACT_RUN_SIMU]);
+        button.addMouseListener(jfais.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(jfais.actions[AvatarInteractiveSimulationActions.ACT_RUN_X_COMMANDS]);
+        button.addMouseListener(jfais.mouseHandler);
+		
+		/*this.addSeparator();
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_TO_TIME]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_X_TIME_UNITS]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_X_TRANSACTIONS]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_X_COMMANDS]);
+        button.addMouseListener(jfis.mouseHandler);
+        
+		this.addSeparator();
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_EXPLORATION]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CPU_EXECUTES]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_TO_NEXT_BUS_TRANSFER]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_MEMORY_ACCESS]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		this.addSeparator();
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_TASK_EXECUTES]);
+        button.addMouseListener(jfis.mouseHandler);
+		
+		button = this.add(jfis.actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CHANNEL_ACCESS]);
+        button.addMouseListener(jfis.mouseHandler);*/
+		
+       
+    }
+} // Class
+
+
+
+
+
diff --git a/src/ui/avatarinteractivesimulation/AvatarSaveCommandsToolBar.java b/src/ui/avatarinteractivesimulation/AvatarSaveCommandsToolBar.java
new file mode 100755
index 0000000000..1144512f56
--- /dev/null
+++ b/src/ui/avatarinteractivesimulation/AvatarSaveCommandsToolBar.java
@@ -0,0 +1,88 @@
+/**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 AvatarSaveCommandsToolBar
+ * Toolbar associated with avatar interactive simulation (save commands)
+ * Creation: 21/01/2011
+ * @version 1.0 21/01/2011
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarinteractivesimulation;
+
+import javax.swing.*;
+
+import ui.*;
+
+public class AvatarSaveCommandsToolBar extends AvatarInteractiveSimulationBar {
+    
+    
+    public AvatarSaveCommandsToolBar(JFrameAvatarInteractiveSimulation _jfais) {
+        super(_jfais);
+    }
+    
+    protected void setActive(boolean b) {
+		jfais.actions[AvatarInteractiveSimulationActions.ACT_SAVE_VCD].setEnabled(b);
+		jfais.actions[AvatarInteractiveSimulationActions.ACT_SAVE_HTML].setEnabled(b);
+		jfais.actions[AvatarInteractiveSimulationActions.ACT_SAVE_TXT].setEnabled(b);
+    }
+    
+    protected void setButtons() {
+        JButton button;
+        
+        button = this.add(jfais.actions[AvatarInteractiveSimulationActions.ACT_SAVE_VCD]);
+        button.addMouseListener(jfais.mouseHandler);
+        
+		this.addSeparator();
+		
+		button = this.add(jfais.actions[AvatarInteractiveSimulationActions.ACT_SAVE_HTML]);
+        button.addMouseListener(jfais.mouseHandler);
+        
+		this.addSeparator();
+		
+		button = this.add(jfais.actions[AvatarInteractiveSimulationActions.ACT_SAVE_TXT]);
+        button.addMouseListener(jfais.mouseHandler);
+        
+    }
+} // Class
+
+
+
+
+
diff --git a/src/ui/avatarinteractivesimulation/BlockTableModel.java b/src/ui/avatarinteractivesimulation/BlockTableModel.java
new file mode 100755
index 0000000000..a3f024acb7
--- /dev/null
+++ b/src/ui/avatarinteractivesimulation/BlockTableModel.java
@@ -0,0 +1,146 @@
+/**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 blockTableModel
+ * Information on blocks
+ * Creation: 21/01/2011
+ * @version 1.0 21/01/2011
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.avatarinteractivesimulation;
+
+import java.util.*;
+import javax.swing.table.*;
+
+import myutil.*;
+import avatartranslator.directsimulation.*;
+
+public class BlockTableModel extends AbstractTableModel {
+	private AvatarSpecificationSimulation ass;
+	
+	private int nbOfRows;
+	
+	//private String [] names;
+	public BlockTableModel(AvatarSpecificationSimulation _ass) {
+		ass = _ass;
+		computeData();
+	}
+
+	// From AbstractTableModel
+	public int getRowCount() {
+		return nbOfRows;
+	}
+
+	public int getColumnCount() {
+		return 4;
+	}
+
+	public Object getValueAt(int row, int column) {
+		if (ass == null) {
+			return "-";
+		}
+		
+		if (column == 0) {
+			return getBlockName(row);
+		} else if (column == 1) {
+			return getBlockID(row);
+		} else if (column == 2) {
+			return getBlockStatus(row);
+		} else if (column == 3) {
+			return getBlockNbOfTransactions(row);
+		}
+		return "";
+	}
+
+	public String getColumnName(int columnIndex) {
+		switch(columnIndex) {
+		case 0:
+			return "Block Name";
+		case 1:
+			return "Block ID";
+		case 2:
+			return "State";
+		case 3:
+			return "Nb of transactions";
+		}
+		return "unknown";
+	}
+	
+	// Assumes tmlm != null
+	private String getBlockName(int row) {
+		return ass.getSimulationBlocks().get(row).getName();
+	}
+	
+	// Assumes tmlm != null
+	private String getBlockID(int row) {
+		return ""+ass.getSimulationBlocks().get(row).getID();
+	}
+	
+	public String getBlockStatus(int row) {
+		int status = ass.getSimulationBlocks().get(row).getStatus();
+		
+		switch(status) {
+		case AvatarSimulationBlock.NOT_STARTED:
+			return "not started";
+		case AvatarSimulationBlock.STARTED:
+			return "running";
+		case AvatarSimulationBlock.COMPLETED:
+			return "terminated";
+		}
+		return "unknown";
+		
+	}
+	
+	public String getBlockNbOfTransactions(int row) {
+		return  ""+ ass.getSimulationBlocks().get(row).getTransactions().size();
+	}
+	
+	private void computeData() {
+		if (ass == null) {
+			nbOfRows = 0;
+			return ;
+		}
+		
+		nbOfRows = ass.getSimulationBlocks().size();
+		
+		return;
+	}
+
+}
\ No newline at end of file
diff --git a/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
new file mode 100755
index 0000000000..3cc865aa67
--- /dev/null
+++ b/src/ui/avatarinteractivesimulation/JFrameAvatarInteractiveSimulation.java
@@ -0,0 +1,1992 @@
+/**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 JFrameAvatarInteractiveSimulation
+* Creation: 21/01/2011
+* version 1.0 21/01/2011
+* @author Ludovic APVRILLE
+* @see
+*/
+
+package ui.avatarinteractivesimulation;
+
+//import java.io.*;
+import javax.swing.*;
+//import javax.swing.event.*;
+import javax.swing.table.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+import java.util.*;
+
+
+import myutil.*;
+import ui.*;
+import ui.file.*;
+
+import avatartranslator.*;
+import avatartranslator.directsimulation.*;
+
+
+public	class JFrameAvatarInteractiveSimulation extends JFrame implements AvatarSimulationInteraction, ActionListener, Runnable, MouseListener, ItemListener/*, StoppableGUIElement, SteppedAlgorithm, ExternalCall*/ {
+	
+	
+	private static String buttonStartS = "Start simulator";
+	private static String buttonStopAndCloseS = "Stop simulator and close";
+	
+	private static int NOT_STARTED = 0;
+	private static int STARTED = 1;
+	
+	private Frame f;
+	private MainGUI mgui;
+	private String title;
+	
+	protected JButton buttonClose, buttonStart, buttonStopAndClose;
+	protected JTextArea jta;
+	protected JScrollPane jsp;
+	
+	protected Thread t;
+	protected int threadMode = 0;
+	protected boolean go;
+	
+	// Control command
+	protected JButton resetCommand, runCommand, StopCommand;
+	protected AvatarMainCommandsToolBar mctb;
+	protected AvatarSaveCommandsToolBar sctb;
+	//protected StateCommandsToolBar stctb;
+	//protected BenchmarkCommandsToolBar bctb;
+	
+	
+	// Commands
+	JPanel main, mainTop, commands, save, state, infos, outputs, cpuPanel, variablePanel; // from MGUI
+	JCheckBox latex, debug, animate, diploids, update, openDiagram, animateWithInfo;
+	JTabbedPane commandTab, infoTab;
+	protected JTextField paramMainCommand;
+	protected JTextField saveFileName;
+	protected JTextField stateFileName;
+	protected JTextField benchmarkFileName;
+	protected JComboBox cpus, busses, mems, tasks, chans;
+	
+	
+	//private String[] cpuIDs, busIDs, memIDs, taskIDs, chanIDs;
+	
+	// Status elements
+	JLabel status, time, info;
+	
+	// Task elements
+	//TaskVariableTableModel tvtm;
+	//JButton updateTaskVariableInformationButton;
+	//private JScrollPane jspTaskVariableInfo;
+	
+	// Breakpoints
+	//JPanelBreakPoints jpbp;
+	
+	// Set variables
+	//JPanelSetVariables jpsv;
+	
+	// Blocks
+	JPanel blockPanel;
+	BlockTableModel blocktm;
+	//JButton updateBlockInformationButton;
+	private JScrollPane jspBlockInfo;
+	
+	private int busyMode = 0; // Mode of AvatarSpecificationSimulation
+	
+	// For managing actions
+	public	AvatarInteractiveSimulationActions [] actions;
+    public	MouseHandler mouseHandler;
+    public  KeyListener keyHandler;
+	
+	
+	/*private Hashtable <Integer, String> valueTable;
+	private Hashtable <Integer, Integer> rowTable;
+	
+	private Hashtable <Integer, Integer> runningTable;
+	private Hashtable <String, String> diagramTable;*/
+	
+	
+	// new
+	private AvatarSpecification avspec;
+	private AvatarSpecificationSimulation ass;
+	private Thread simulationThread;
+	private boolean resetThread;
+	private boolean killThread;
+	
+	private LinkedList<TGComponent> runningTGComponents;
+	private int nbOfAllExecutedElements = 0;
+	
+	public JFrameAvatarInteractiveSimulation(Frame _f, MainGUI _mgui, String _title, AvatarSpecification _avspec) {
+		super(_title);
+		
+		f = _f;
+		mgui = _mgui;
+		title = _title;
+		avspec = _avspec;
+		
+		/*valueTable = new Hashtable<Integer, String>();
+		rowTable = new Hashtable<Integer, Integer>();
+		runningTable = new Hashtable<Integer, Integer>();
+		diagramTable = new Hashtable<String, String>();*/
+
+		setBackground(new Color(50, 40, 40, 200));
+		
+		initActions();
+		
+		initSimulation();
+		
+		makeComponents();
+		setComponents();
+	}
+	
+	private void initSimulation() {
+		runningTGComponents = new LinkedList<TGComponent>();
+		nbOfAllExecutedElements = 0;
+		resetMetElements();
+		ass = new AvatarSpecificationSimulation(avspec, this);
+		ass.initialize();
+		simulationThread = new Thread(this);
+		simulationThread.start();
+	}
+	
+	public void run() {
+		resetThread = false;
+		killThread = false;
+		
+		ass.runSimulation();
+		if (killThread) {
+			return;
+		}
+		
+		waitForResetOrKillThread();
+		
+		if (killThread) {
+			return;
+		}
+		
+		if (resetThread) {
+			TraceManager.addDev("Simulation reseted");
+			runningTGComponents = new LinkedList<TGComponent>();
+			nbOfAllExecutedElements = 0;
+			resetMetElements();
+			ass.reset();
+			run();
+		}
+		TraceManager.addDev("Simulation thread ended");
+	}
+	
+	public synchronized void waitForResetOrKillThread() {
+		TraceManager.addDev("waitForResetOrKillThread resetThread=" + resetThread + " killThread=" + killThread);
+		while ((resetThread == false) && (killThread == false)){
+			try {
+				wait();
+			} catch (Exception e) {}
+		}
+		
+		TraceManager.addDev("EndWaitForResetOrKillThread");
+	}
+	
+	public synchronized void killThread() {
+		killThread = true;
+		notifyAll();
+	}
+	
+	public synchronized void resetThread() {
+		resetThread = true;
+		TraceManager.addDev("Reset thread = " + resetThread);
+		notifyAll();
+	}
+	
+	
+	
+	private JLabel createStatusBar()  {
+        status = new JLabel("Ready...");
+		status.setForeground(ColorManager.InteractiveSimulationText);
+        status.setBorder(BorderFactory.createEtchedBorder());
+        return status;
+    }
+	
+	public void makeComponents() {
+		JPanel jp01, jp02;
+		//jp01.setPreferredSize(new Dimension(375, 400));
+		GridBagLayout gridbag01;
+		GridBagConstraints c01 ;
+		
+		//cp = new CommandParser();
+		
+		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+		Container framePanel = getContentPane();
+		framePanel.setLayout(new BorderLayout());
+		//framePanel.setBackground(ColorManager.InteractiveSimulationBackground);
+		//framePanel.setForeground(new Color(255, 166, 38));		
+		
+		//System.out.println("Button start created");
+		//buttonStart = new JButton(actions[InteractiveSimulationActions.ACT_RUN_SIMU]);
+		buttonStopAndClose = new JButton(actions[AvatarInteractiveSimulationActions.ACT_STOP_AND_CLOSE_ALL]);
+		//buttonStopAndClose = new JButton(buttonStopAndCloseS, IconManager.imgic27);
+		
+		
+		// statusBar
+        status = createStatusBar();
+		framePanel.add(status, BorderLayout.SOUTH);
+        
+        // Mouse handler
+        mouseHandler = new MouseHandler(status);
+		
+		JPanel mainpanel = new JPanel(new BorderLayout());
+		//mainpanel.setBackground(ColorManager.InteractiveSimulationBackground);
+		framePanel.add(mainpanel, BorderLayout.NORTH);
+		
+		JPanel jp = new JPanel();
+		//jp.setBackground(ColorManager.InteractiveSimulationBackground);
+		//jp.setPreferredSize(new Dimension(800, 75));
+		//jp.add(buttonStart);
+		jp.add(buttonStopAndClose);
+		mainpanel.add(jp, BorderLayout.NORTH);
+		
+		
+		GridBagLayout gridbag02 = new GridBagLayout();
+		GridBagConstraints c02 = new GridBagConstraints();
+		mainTop = new JPanel(gridbag02);
+		//mainTop.setPreferredSize(new Dimension(800, 375));
+		c02.gridheight = 1;
+		c02.weighty = 1.0;
+		c02.weightx = 1.0;
+		c02.gridwidth = 1; 
+		c02.fill = GridBagConstraints.BOTH;
+		c02.gridheight = 1;
+		
+		// Ouput textArea
+		jta = new ScrolledJTextArea();
+		jta.setBackground(ColorManager.InteractiveSimulationJTABackground);
+		jta.setForeground(ColorManager.InteractiveSimulationJTAForeground);
+		jta.setMinimumSize(new Dimension(800, 200));
+		jta.setRows(15);
+		//jta.setMaximumSize(new Dimension(800, 500));
+		jta.setEditable(false);
+		jta.setMargin(new Insets(10, 10, 10, 10));
+		jta.setTabSize(3);
+		jta.append("Interactive simulation ready to run\n");
+		Font f = new Font("Courrier", Font.BOLD, 12);
+		jta.setFont(f);
+		jsp = new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+		jsp.setViewportBorder(BorderFactory.createLineBorder(ColorManager.InteractiveSimulationBackground));
+		
+        //jsp.setColumnHeaderView(100);
+        //jsp.setRowHeaderView(30);
+		
+		
+		jsp.setMaximumSize(new Dimension(800, 400));
+		JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, mainTop, jsp);
+		//split.setBackground(ColorManager.InteractiveSimulationBackground);
+		mainpanel.add(split, BorderLayout.CENTER);
+		
+		// Commands
+		commands = new JPanel();
+		//commands.setFloatable(true);
+		//commands.setMinimumSize(new Dimension(300, 250));
+		commands.setBorder(new javax.swing.border.TitledBorder("Commands"));
+		
+		
+		mainTop.add(commands, c02);
+		
+		commandTab = new JTabbedPane();
+		//commandTab.setBackground(ColorManager.InteractiveSimulationBackground);
+		
+		// Control commands
+		jp01 = new JPanel(new BorderLayout());
+		//jp01.setMinimumSize(new Dimension(375, 400));
+		//gridbag01 = new GridBagLayout();
+		//c01 = new GridBagConstraints();
+		//jp01.setLayout(gridbag01);
+		
+		commandTab.addTab("Control", null, jp01, "Main control commands");
+		
+		
+		mctb = new AvatarMainCommandsToolBar(this);
+		jp01.add(mctb, BorderLayout.NORTH);
+		
+		jp02 = new JPanel();
+		//jp01.setPreferredSize(new Dimension(375, 400));
+		gridbag01 = new GridBagLayout();
+		c01 = new GridBagConstraints();
+		jp02.setLayout(gridbag01);
+		
+		c01.gridheight = 1;
+		c01.weighty = 1.0;
+		c01.weightx = 1.0;
+		c01.gridwidth = 1; 
+		c01.fill = GridBagConstraints.BOTH;
+		c01.gridheight = 1;
+		
+		jp02.add(new JLabel("Command parameter: "), c01);
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		paramMainCommand = new JTextField("1", 30);
+		jp02.add(paramMainCommand, c01);
+		
+		/*c01.gridwidth = 1;
+		jp02.add(new JLabel("CPUs: "), c01);
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		if (cpuIDs == null) {
+			cpus = new JComboBox();
+		} else {
+			cpus = new JComboBox(cpuIDs);
+		}
+		jp02.add(cpus, c01);
+		
+		c01.gridwidth = 1;
+		jp02.add(new JLabel("Busses: "), c01);
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		if (busIDs == null) {
+			busses = new JComboBox();
+		} else {
+			busses = new JComboBox(busIDs);
+		}
+		jp02.add(busses, c01);
+		
+		c01.gridwidth = 1;
+		jp02.add(new JLabel("Memories: "), c01);
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		if (memIDs == null) {
+			mems = new JComboBox();
+		} else {
+			mems = new JComboBox(memIDs);
+		}
+		jp02.add(mems, c01);
+		
+		c01.gridwidth = 1;
+		jp02.add(new JLabel("Tasks: "), c01);
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		if (taskIDs == null) {
+			tasks = new JComboBox();
+		} else {
+			tasks = new JComboBox(taskIDs);
+		}
+		jp02.add(tasks, c01);
+		
+		c01.gridwidth = 1;
+		jp02.add(new JLabel("Channels: "), c01);
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		if (chanIDs == null) {
+			chans = new JComboBox();
+		} else {
+			chans = new JComboBox(chanIDs);
+		}
+		jp02.add(chans, c01);*/
+		
+		jp01.add(jp02, BorderLayout.CENTER);
+		
+		
+		// Text commands
+		/*jp01 = new JPanel();
+		//jp01.setPreferredSize(new Dimension(375, 400));
+		gridbag01 = new GridBagLayout();
+		c01 = new GridBagConstraints();
+		jp01.setLayout(gridbag01);
+		
+		commandTab.addTab("Text commands", null, jp01, "Sending text commands to simulator");
+		
+		c01.gridheight = 1;
+		c01.weighty = 1.0;
+		c01.weightx = 1.0;
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		c01.fill = GridBagConstraints.BOTH;
+		c01.gridheight = 1;
+		
+		c01.gridheight = 2;
+		jp01.add(new JLabel("Enter a text command:"), c01);
+		textCommand = new JTextField(30);
+		jp01.add(textCommand, c01);
+		c01.gridheight = 1;
+		jp01.add(new JLabel(" "), c01);
+		c01.gridheight = 2;
+		sendTextCommand = new JButton("Send Command", IconManager.imgic71);
+		sendTextCommand.addMouseListener(this);
+		jp01.add(sendTextCommand, c01);
+		c01.gridheight = 1;
+		jp01.add(new JLabel(" "), c01);
+		c01.gridheight = 2;
+		printHelpTextCommands = new JButton("Help on a text command", IconManager.imgic33);
+		printHelpTextCommands.addMouseListener(this);
+		jp01.add(printHelpTextCommands, c01);
+		c01.gridheight = 1;
+		jp01.add(new JLabel(" "), c01);
+		c01.gridheight = 2;
+		listTextCommands = new JButton("List all text commands", IconManager.imgic29);
+		listTextCommands.addMouseListener(this);
+		jp01.add(listTextCommands, c01);*/
+		
+		commands.add(commandTab);
+		
+		// Set variables
+		/*jpsv = new JPanelSetVariables(this, valueTable);
+		commandTab.addTab("Set variables", null, jpsv, "Set variables");*/
+		
+		// Save commands
+		jp01 = new JPanel(new BorderLayout());
+		
+		commandTab.addTab("Save trace", null, jp01, "Save commands");
+		
+		sctb = new AvatarSaveCommandsToolBar(this);
+		jp01.add(sctb, BorderLayout.NORTH);
+		
+		jp02 = new JPanel();
+		gridbag01 = new GridBagLayout();
+		c01 = new GridBagConstraints();
+		jp02.setLayout(gridbag01);
+		
+		c01.gridheight = 1;
+		c01.weighty = 1.0;
+		c01.weightx = 1.0;
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		c01.fill = GridBagConstraints.BOTH;
+		c01.gridheight = 1;
+		
+		jp02.add(new JLabel("File name:"), c01);
+		saveFileName = new JTextField(30);
+		jp02.add(saveFileName, c01);
+		
+		jp01.add(jp02, BorderLayout.CENTER);
+		
+		// Benchmark commands
+		/*jp01 = new JPanel(new BorderLayout());
+		
+		commandTab.addTab("Benchmarks", null, jp01, "Benchmarks");
+		
+		bctb = new BenchmarkCommandsToolBar(this);
+		jp01.add(bctb, BorderLayout.NORTH);
+		
+		jp02 = new JPanel();
+		gridbag01 = new GridBagLayout();
+		c01 = new GridBagConstraints();
+		jp02.setLayout(gridbag01);
+		
+		c01.gridheight = 1;
+		c01.weighty = 1.0;
+		c01.weightx = 1.0;
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		c01.fill = GridBagConstraints.BOTH;
+		c01.gridheight = 1;
+		
+		jp02.add(new JLabel("File name:"), c01);
+		benchmarkFileName = new JTextField(30);
+		jp02.add(benchmarkFileName, c01);
+		
+		jp01.add(jp02, BorderLayout.CENTER);*/
+		
+		
+		//Info
+		infos = new JPanel(new BorderLayout());
+		infos.setMinimumSize(new Dimension(300, 250));
+		//infos.setPreferredSize(new Dimension(400, 450));
+		infos.setBorder(new javax.swing.border.TitledBorder("Simulation information"));
+		c02.gridwidth = GridBagConstraints.REMAINDER; //end row
+		mainTop.add(infos, c02);
+		
+		infoTab = new JTabbedPane();
+		infoTab.setMinimumSize(new Dimension(300, 250));
+		infos.add(infoTab, BorderLayout.NORTH);
+		
+		// Simulation time
+		jp02 = new JPanel();
+		infos.add(jp02, BorderLayout.SOUTH);
+		jp02.add(new JLabel("Status:"));
+		status = new JLabel("Unknown");
+		status.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+		jp02.add(status);
+		jp02.add(new JLabel(" "));
+		jp02.add(new JLabel("Time:"));
+		time = new JLabel("Unknown");
+		time.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+		jp02.add(time);
+		jp02.add(new JLabel(" "));
+		jp02.add(new JLabel("nb Of transactions:"));
+		info = new JLabel("Unknown");
+		info.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+		jp02.add(info);
+		
+		// Options
+		jp01 = new JPanel();
+		//jp01.setMinimumSize(new Dimension(375, 400));
+		//jp01.setPreferredSize(new Dimension(375, 400));
+		gridbag01 = new GridBagLayout();
+		c01 = new GridBagConstraints();
+		jp01.setLayout(gridbag01);
+		
+		
+		// INFORMATION
+		
+		infoTab.addTab("Options", null, jp01, "Options on simulation");
+		
+		c01.gridheight = 1;
+		c01.weighty = 1.0;
+		c01.weightx = 1.0;
+		c01.gridwidth = GridBagConstraints.REMAINDER; //end row
+		c01.fill = GridBagConstraints.BOTH;
+		c01.gridheight = 1;
+		
+		jp01.add(new JLabel(" "), c01);
+		/*latex = new JCheckBox("Generate info in Latex format");
+		jp01.add(latex, c01);*/
+		/*debug = new JCheckBox("Print messages received from server");
+		jp01.add(debug, c01);*/
+		animate = new JCheckBox("Animate UML diagrams");
+		jp01.add(animate, c01);
+		diploids = new JCheckBox("Show AVATAR IDs on UML diagrams");
+		jp01.add(diploids, c01);
+		diploids.addItemListener(this);
+		diploids.setSelected(false);
+		animateWithInfo = new JCheckBox("Show transaction progression on UML diagrams");
+		//jp01.add(animateWithInfo, c01);
+		animateWithInfo.addItemListener(this);
+		animateWithInfo.setSelected(true);
+		openDiagram = new JCheckBox("Automatically open active task diagram");
+		jp01.add(openDiagram, c01);
+		openDiagram.setSelected(true);
+		update = new JCheckBox("Automatically update information (variables)");
+		jp01.add(update, c01);
+		update.addItemListener(this);
+		update.setSelected(true);
+		
+		animate.addItemListener(this);
+		animate.setSelected(true);
+		
+		
+		TableSorter sorterPI;
+		JTable jtablePI;
+		
+		// Breakpoints
+		/*jpbp = new JPanelBreakPoints(this, points);
+		infoTab.addTab("Breakpoints", null, jpbp, "List of active breakpoints");*/
+		
+		// blocks
+		blockPanel = new JPanel();
+		blockPanel.setLayout(new BorderLayout());
+		infoTab.addTab("Blocks", IconManager.imgic1202, blockPanel, "Current state of blocks");
+		blocktm = new BlockTableModel(ass);
+	
+		sorterPI = new TableSorter(blocktm);
+		jtablePI = new JTable(sorterPI);
+		sorterPI.setTableHeader(jtablePI.getTableHeader());
+		((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(75);
+		((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(80);
+		((jtablePI.getColumnModel()).getColumn(3)).setPreferredWidth(300);
+		jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspBlockInfo = new JScrollPane(jtablePI);
+		jspBlockInfo.setWheelScrollingEnabled(true);
+		jspBlockInfo.getVerticalScrollBar().setUnitIncrement(10);
+		jspBlockInfo.setPreferredSize(new Dimension(500, 300));
+		blockPanel.add(jspBlockInfo, BorderLayout.NORTH);
+		//updateTaskInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_TASKS]);
+		//taskPanel.add(updateTaskInformationButton, BorderLayout.SOUTH);
+		
+		// Variables
+		/*variablePanel = new JPanel();
+		variablePanel.setLayout(new BorderLayout());
+		infoTab.addTab("Tasks variables", null, variablePanel, "Current value of variables");
+		if (tmap == null) {
+			tvtm = new TaskVariableTableModel(null, valueTable, rowTable);
+		} else {
+			tvtm = new TaskVariableTableModel(tmap.getTMLModeling(), valueTable, rowTable);
+		}
+		sorterPI = new TableSorter(tvtm);
+		jtablePI = new JTable(sorterPI);
+		sorterPI.setTableHeader(jtablePI.getTableHeader());
+		((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(60);
+		((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(100);
+		((jtablePI.getColumnModel()).getColumn(3)).setPreferredWidth(60);
+		((jtablePI.getColumnModel()).getColumn(4)).setPreferredWidth(100);
+		jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspTaskVariableInfo = new JScrollPane(jtablePI);
+		jspTaskVariableInfo.setWheelScrollingEnabled(true);
+		jspTaskVariableInfo.getVerticalScrollBar().setUnitIncrement(10);
+		jspTaskVariableInfo.setPreferredSize(new Dimension(500, 300));
+		variablePanel.add(jspTaskVariableInfo, BorderLayout.NORTH);
+		updateTaskVariableInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_VARIABLES]);
+		variablePanel.add(updateTaskVariableInformationButton, BorderLayout.SOUTH);*/
+		
+		// CPUs
+		/*cpuPanel = new JPanel();
+		cpuPanel.setLayout(new BorderLayout());
+		infoTab.addTab("CPUs", IconManager.imgic1100, cpuPanel, "Current state of CPUs");
+		cputm = new CPUTableModel(tmap, valueTable, rowTable);
+		sorterPI = new TableSorter(cputm);
+		jtablePI = new JTable(sorterPI);
+		sorterPI.setTableHeader(jtablePI.getTableHeader());
+		((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(75);
+		((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(700);
+		jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspCPUInfo = new JScrollPane(jtablePI);
+		jspCPUInfo.setWheelScrollingEnabled(true);
+		jspCPUInfo.getVerticalScrollBar().setUnitIncrement(10);
+		jspCPUInfo.setPreferredSize(new Dimension(500, 300));
+		cpuPanel.add(jspCPUInfo, BorderLayout.NORTH);
+		panelCPU = new JPanel(new FlowLayout());
+		updateCPUInformationButton = new JButton(actions[InteractiveSimulationActions.ACT_UPDATE_CPUS]);
+		panelCPU.add(updateCPUInformationButton);
+		printCPUInfo = new JButton(actions[InteractiveSimulationActions.ACT_PRINT_CPUS]);
+		panelCPU.add(printCPUInfo);
+		cpuPanel.add(panelCPU, BorderLayout.SOUTH);*/
+		
+		pack();
+		
+	}
+	
+	private	void initActions() {
+        actions = new AvatarInteractiveSimulationActions[AvatarInteractiveSimulationActions.NB_ACTION];
+        for(int	i=0; i<AvatarInteractiveSimulationActions.NB_ACTION; i++) {
+            actions[i] = new AvatarInteractiveSimulationActions(i);
+            actions[i].addActionListener(this);
+            //actions[i].addKeyListener(this);
+        }
+		
+		//cpuIDs = makeCPUIDs();
+		//busIDs = makeBusIDs();
+		//memIDs = makeMemIDs();
+		//taskIDs = makeTasksIDs();
+		//chanIDs = makeChanIDs();
+    }
+	
+	
+	
+	public void setComponents() {
+		setAll();
+		animateDiagrams();
+	}
+	
+	public void close() {
+		killThread();
+		ass.killSimulation();
+		dispose();
+		setVisible(false);
+		runningTGComponents.clear();
+		mgui.setAvatarAnimate(false);
+	}
+	
+	public void runSimulation() {
+		ass.unstop();
+	}
+	
+	public void runXCommands() {
+		String txt = paramMainCommand.getText();
+		int nb;
+		try {
+			nb = Math.max(1, Integer.decode(txt).intValue());
+		} catch (Exception e) {
+			nb = 1;
+		}
+		ass.setNbOfCommands(1);
+		ass.unstop();
+	}
+	
+	public void stopSimulation() {
+		ass.stopSimulation();
+	}
+	
+	public void resetSimulation() {
+		resetThread();
+		ass.killSimulation();
+	}
+	
+	
+	public void mouseClicked(MouseEvent e) {}
+	
+	public void mouseEntered(MouseEvent e) {}
+	
+	public void mouseExited(MouseEvent e) {}
+	
+	public void mousePressed(MouseEvent e){
+		/*if (e.getSource() == sendTextCommand) {
+			if (sendTextCommand.isEnabled()) {
+				sendCommand();
+			}
+		} else if (e.getSource() == printHelpTextCommands) {
+			helpOnCommand();
+		} else if (e.getSource() == listTextCommands) {
+			listTextCommands();
+		} /*else if (e.getSource() == resetCommand) {
+		sendCommand("reset");
+		} else if (e.getSource() == runCommand) {
+		sendCommand("run-to-next-breakpoint");
+		} else if (e.getSource() == StopCommand) {
+		sendCommand("stop");
+		}*/
+	}
+	
+	// Command management
+	
+	public void printSeparator() {
+		jta.append("-------------------------------------------------------------\n");
+	}
+	
+
+	
+	public void setMode(int _mode) {
+		busyMode = _mode;
+		TraceManager.addDev("****************** mode set to " + busyMode);
+		setAll();
+		
+		
+		// Diagram animation?
+		if (!(busyMode == AvatarSpecificationSimulation.RUNNING)) {
+			updateMetElements();
+			animateDiagrams();
+		}
+		
+	}
+	
+	public void setAll() {
+		boolean b= true;
+		
+		switch(busyMode) {
+		case AvatarSpecificationSimulation.STOPPED:
+			actions[AvatarInteractiveSimulationActions.ACT_RUN_SIMU].setEnabled(true);
+			actions[AvatarInteractiveSimulationActions.ACT_RUN_X_COMMANDS].setEnabled(true);
+			actions[AvatarInteractiveSimulationActions.ACT_RESET_SIMU].setEnabled(true);
+			actions[AvatarInteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(false);
+			b = true;
+			break;
+		case AvatarSpecificationSimulation.RUNNING:
+			actions[AvatarInteractiveSimulationActions.ACT_RUN_SIMU].setEnabled(false);
+			actions[AvatarInteractiveSimulationActions.ACT_RUN_X_COMMANDS].setEnabled(false);
+			actions[AvatarInteractiveSimulationActions.ACT_RESET_SIMU].setEnabled(false);
+			actions[AvatarInteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(true);
+			b = false;
+			break;
+		case AvatarSpecificationSimulation.TERMINATED:
+			actions[AvatarInteractiveSimulationActions.ACT_RUN_SIMU].setEnabled(false);
+			actions[AvatarInteractiveSimulationActions.ACT_RUN_X_COMMANDS].setEnabled(false);
+			actions[AvatarInteractiveSimulationActions.ACT_RESET_SIMU].setEnabled(true);
+			actions[AvatarInteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(false);
+			b = true;
+			break;
+		}
+		
+		actions[AvatarInteractiveSimulationActions.ACT_SAVE_VCD].setEnabled(b);
+		actions[AvatarInteractiveSimulationActions.ACT_SAVE_HTML].setEnabled(b);
+		actions[AvatarInteractiveSimulationActions.ACT_SAVE_TXT].setEnabled(b);
+		actions[AvatarInteractiveSimulationActions.ACT_PRINT_BENCHMARK].setEnabled(b);
+		actions[AvatarInteractiveSimulationActions.ACT_SAVE_BENCHMARK].setEnabled(b);
+		//actions[AvatarInteractiveSimulationActions.ACT_SAVE_STATE].setEnabled(b);
+		//actions[AvatarInteractiveSimulationActions.ACT_RESTORE_STATE].setEnabled(b);
+		
+		setLabelColors();
+	}
+	
+	public void setLabelColors() {
+		if ((time !=null) && (status != null) && (info != null)) {
+			time.setText(""+ass.getClockValue());
+			info.setText(""+ass.getAllTransactions().size());
+			switch(busyMode) {
+			case AvatarSpecificationSimulation.STOPPED:
+				status.setText("Stopped");
+				status.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+				time.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+				info.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+				break;
+			case AvatarSpecificationSimulation.RUNNING:
+				status.setText("Running...");
+				status.setForeground(ColorManager.InteractiveSimulationText_BUSY);
+				time.setForeground(ColorManager.InteractiveSimulationText_BUSY);
+				info.setForeground(ColorManager.InteractiveSimulationText_BUSY);
+				break;        
+			case AvatarSpecificationSimulation.TERMINATED:
+				status.setText("Terminated");
+				status.setForeground(ColorManager.InteractiveSimulationText_TERM);
+				time.setForeground(ColorManager.InteractiveSimulationText_TERM);
+				info.setForeground(ColorManager.InteractiveSimulationText_TERM);
+				break;
+			}
+		}
+	}
+	
+	public void resetMetElements() {
+		if (avspec.getReferenceObject() instanceof AvatarDesignPanel) {
+			((AvatarDesignPanel)(avspec.getReferenceObject())).resetMetElements();
+			
+		}
+	}
+	
+	public void updateMetElements() {
+		LinkedList<AvatarStateMachineElement> allExecutedElements = AvatarSimulationTransaction.allExecutedElements;
+		TGComponent tgc;
+		Object o;
+		
+		if (allExecutedElements.size() > nbOfAllExecutedElements) {
+			for(int i=nbOfAllExecutedElements; i<allExecutedElements.size(); i++) {
+				o = allExecutedElements.get(i).getReferenceObject();
+				if (o instanceof TGComponent) {
+					tgc = (TGComponent)o;
+					tgc.setAVATARMet(true);
+				}
+			}
+		}
+		nbOfAllExecutedElements = allExecutedElements.size();
+	}
+	
+	
+	
+	public void animateDiagrams() {
+		if (animate != null) {
+			if (animate.isSelected()) {
+				// We go through all blocks
+				runningTGComponents.clear();
+				AvatarStateMachineElement asme;
+				TGComponent tgc;
+				for(AvatarSimulationBlock block: ass.getSimulationBlocks()) {
+					asme = block.getCurrentAvatarElement();
+					if (asme != null) {
+						// Search for corresponding element in avatar spec
+						tgc = (TGComponent)(asme.getReferenceObject());
+						if (tgc != null) {
+							TraceManager.addDev("Found an object:" + tgc);
+							runningTGComponents.add(tgc);
+						}
+					}
+				}
+			}
+			mgui.setAvatarAnimate(animate.isSelected());
+		}
+	}
+	
+	public boolean isRunningComponent(TGComponent _tgc) {
+		return runningTGComponents.contains(_tgc);
+	}
+	
+	
+	// Mouse management
+	public void mouseReleased(MouseEvent e) {}
+	
+	
+	
+	/**
+	* This adapter is constructed to handle mouse over	component events.
+	*/
+    private class MouseHandler extends MouseAdapter  {
+        
+        private	JLabel label;
+        
+        /**
+		* ctor	for the	adapter.
+		* @param label	the JLabel which will recieve value of the
+		*		Action.LONG_DESCRIPTION	key.
+		*/
+        public MouseHandler(JLabel label)  {
+            setLabel(label);
+        }
+        
+        public void setLabel(JLabel label)  {
+            this.label = label;
+        }
+        
+        public void mouseEntered(MouseEvent evt)  {
+            if (evt.getSource()	instanceof AbstractButton)  {
+                AbstractButton button =	(AbstractButton)evt.getSource();
+                Action action =	button.getAction();
+                if (action != null)  {
+                    String message = (String)action.getValue(Action.LONG_DESCRIPTION);
+                    label.setText(message);
+                }
+            }
+        }
+    }
+	
+	public void	actionPerformed(ActionEvent evt)  {
+		String command = evt.getActionCommand();
+		//TraceManager.addDev("Command:" + command);
+		
+		if (command.equals(actions[AvatarInteractiveSimulationActions.ACT_RUN_SIMU].getActionCommand()))  {
+			runSimulation();
+			//TraceManager.addDev("Start simulation!");
+		} else if (command.equals(actions[AvatarInteractiveSimulationActions.ACT_RUN_X_COMMANDS].getActionCommand()))  {
+			runXCommands();
+			//TraceManager.addDev("Start simulation!");
+		} else if (command.equals(actions[AvatarInteractiveSimulationActions.ACT_STOP_SIMU].getActionCommand()))  {
+			stopSimulation();
+			//TraceManager.addDev("Start simulation!");
+		} else if (command.equals(actions[AvatarInteractiveSimulationActions.ACT_RESET_SIMU].getActionCommand()))  {
+			resetSimulation();
+			//TraceManager.addDev("Start simulation!");
+		} else if (command.equals(actions[AvatarInteractiveSimulationActions.ACT_STOP_AND_CLOSE_ALL].getActionCommand()))  {
+			close();
+			return;
+			//TraceManager.addDev("Start simulation!");
+		}
+	}
+	
+	public void error(String error) {
+		jta.append("error: " + error + "\n");
+	}
+	
+
+	public void itemStateChanged(ItemEvent e) {
+		if (e.getSource() == animate) {
+			TraceManager.addDev("Animate is ... " + animate.isSelected());
+			animateDiagrams();
+			diploids.setEnabled(animate.isSelected());
+			animateWithInfo.setEnabled(animate.isSelected());
+			openDiagram.setEnabled(animate.isSelected());
+		} else if (e.getSource() == diploids) {
+			mgui.setAVATARIDs(diploids.isSelected());
+		} /*else if (e.getSource() == animateWithInfo) {
+			mgui.setTransationProgression(animateWithInfo.isSelected());
+		}*/
+	}
+	
+	
+	/*private void printCPUs() {
+		if (latex.isSelected()) {
+			String name;
+			String tmp, tmp1;
+			int index, index1;
+			jta.append("\\begin{tabular}{|l|c|c|}\n");
+			jta.append("\\hline\n");
+			jta.append("\\texbf{CPU} & \\textbf{Load} & \\textbf{Contention delay}\n");
+			jta.append("\\hline\n");
+			for(int i=0; i<cputm.getRowCount(); i++) {
+				name = (String)(cputm.getValueAt(i, 0));
+				tmp = (String)(cputm.getValueAt(i, 2));
+				jta.append(Conversion.toLatex(name) + " &");
+				index = tmp.indexOf(';');
+				if (index == -1) {
+					jta.append(" - & - \\\\\n");
+				} else {
+					
+					
+					tmp1 = tmp.substring(0, index);
+					index1 = tmp1.indexOf(':');
+					if (index1 != -1) {
+						tmp1 = tmp1.substring(index1 + 2, tmp1.length());
+					}
+					jta.append("" + tmp1 + " &");
+					tmp1 = tmp.substring(index+1, tmp.length());
+					index1 = tmp1.indexOf(':');
+					if (index1 != -1) {
+						tmp1 = tmp1.substring(index1 + 2, tmp1.length());
+					}
+					jta.append("" + tmp1 + "\\\\\n");
+				}
+			}
+			jta.append("\\hline\n");
+		} else {
+			String name;
+			String tmp, tmp1;
+			int index, index1;
+			jta.append("\nCPUs:\n");
+			for(int i=0; i<cputm.getRowCount(); i++) {
+				name = (String)(cputm.getValueAt(i, 0));
+				tmp = (String)(cputm.getValueAt(i, 2));
+				jta.append("* " + name + "\n");
+				index = tmp.indexOf(';');
+				if (index == -1) {
+					jta.append("\t - \n");
+				} else {
+					jta.append("\t" + tmp.substring(0, index) + "\n");
+					jta.append("\t" + tmp.substring(index+1, tmp.length()) + "\n");
+				}
+			}
+		} 
+	}
+	
+	private void printBuses() {
+		if (latex.isSelected()) {
+			String name;
+			String tmp, tmp1;
+			int index, index1;
+			jta.append("\\begin{tabular}{|l|c|c|}\n");
+			jta.append("\\hline\n");
+			jta.append("\\texbf{CPU} & \\textbf{Load} & \\textbf{Contention delay}\n");
+			jta.append("\\hline\n");
+			for(int i=0; i<bustm.getRowCount(); i++) {
+				name = (String)(bustm.getValueAt(i, 0));
+				tmp = (String)(bustm.getValueAt(i, 2));
+				jta.append(Conversion.toLatex(name) + " &");
+				index = tmp.indexOf(':');
+				if (index == -1) {
+					jta.append(" - \\\\\n");
+				} else {
+					tmp1 = tmp.substring(index+2, tmp.length());
+					jta.append("" + tmp1 + "\\\\\n");
+				}
+			}
+			jta.append("\\hline\n");
+		} else {
+			String name;
+			String tmp;
+			jta.append("\nBuses:\n");
+			for(int i=0; i<bustm.getRowCount(); i++) {
+				name = (String)(bustm.getValueAt(i, 0));
+				tmp = (String)(bustm.getValueAt(i, 2));
+				jta.append("* " + name + "\n");
+				jta.append("\t" + tmp + "\n");
+			}
+		}
+	}*/
+	
+	/*private void updateVariableState(String _idvar, String _value) {
+		Integer i = getInteger(_idvar);
+		int row;
+		
+		if (i != null) {
+			try {
+				valueTable.remove(i);
+				valueTable.put(i, _value);
+				//System.out.println("Searching for old row");
+				row = (Integer)(rowTable.get(i)).intValue();
+				tvtm.fireTableCellUpdated(row, 4);
+			} catch (Exception e) {
+				TraceManager.addDev("Exception updateVariableState: " + e.getMessage() + " idvar=" + _idvar + " val=" + _value);
+			}
+		}
+		
+	}
+	
+	private void updateTaskCyclesAndState(String _id, String _extime, String _state) {
+		Integer i = getInteger(_id);
+		Integer ex = getInteger(_extime);
+		int row;
+		
+		String s = "";
+		if (_state != null) {
+			s += _state;
+		}
+		s += ";";
+		if (_extime != null) {
+			s+= _extime;
+		}
+		
+		
+		
+		if ((i != null) && (ex != null)) {
+			try {
+				valueTable.remove(i);
+				valueTable.put(i, s);
+				//System.out.println("Searching for old row");
+				row = rowTable.get(i).intValue();
+				if (_state != null) {
+					tasktm.fireTableCellUpdated(row, 2);
+				}
+				if (_extime != null) {
+					tasktm.fireTableCellUpdated(row, 3);
+				}
+				
+				Integer c = runningTable.get(i);
+				if (c != null) {
+					mgui.addRunningIDTaskState(c, _state);
+				}
+			} catch (Exception e) {
+				TraceManager.addDev("Exception updateTaskCyclesAndStates: " + e.getMessage());
+			}
+		}
+		
+	}
+	
+	private void updateCPUState(String _id, String _utilization, String contdel, String busName, String busID) {
+		Integer i = getInteger(_id);
+		int row;
+		String info;
+		
+		if (i != null) {
+			try {
+				valueTable.remove(i);
+				info = "Utilization: " + _utilization;
+				if ((contdel != null) && (busName != null) && (busID != null)) {
+					info += "; Cont. delay on " + busName + " (" + busID + "): " + contdel;
+				}
+				valueTable.put(i, info);
+				//System.out.println("Searching for old row");
+				row = (Integer)(rowTable.get(i)).intValue();
+				cputm.fireTableCellUpdated(row, 2);
+				mgui.addLoadInfo(i, getDouble(_utilization).doubleValue());
+			} catch (Exception e) {
+				TraceManager.addDev("Exception updateCPUState: " + e.getMessage() + " id=" + _id + " util=" + _utilization);
+			}
+		}
+	}
+	
+	private void updateBusState(String _id, String _utilization) {
+		Integer i = getInteger(_id);
+		int row;
+		
+		if (i != null) {
+			try {
+				valueTable.remove(i);
+				valueTable.put(i, "Utilization: " + _utilization);
+				//TraceManager.addDev("Searching for old row");
+				row = rowTable.get(i).intValue();
+				bustm.fireTableCellUpdated(row, 2);
+				mgui.addLoadInfo(i, getDouble(_utilization).doubleValue());
+			} catch (Exception e) {
+				System.err.println("Exception updateBusState: " + e.getMessage());
+			}
+		}
+	}*/
+	
+	/*public void askForUpdate() {
+		sendCommand("time");
+		if (hashOK) {
+			if (animate.isSelected()) {
+				updateTaskCommands();
+			}
+			if (update.isSelected()) {
+				updateTasks();
+				updateVariables();
+				updateCPUs();
+				updateBus();
+			}
+		}
+	}*/
+	
+
+	
+
+		
+		
+		/*else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_SIMU].getActionCommand()))  {
+            sendCommand("run-to-next-breakpoint");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_X_TIME_UNITS].getActionCommand()))  {
+            sendCommandWithPositiveInt("run-x-time-units");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_TO_TIME].getActionCommand()))  {
+            sendCommandWithPositiveInt("run-to-time");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_X_TRANSACTIONS].getActionCommand()))  {
+            sendCommandWithPositiveInt("run-x-transactions");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_X_COMMANDS].getActionCommand()))  {
+            sendCommandWithPositiveInt("run-x-commands");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_EXPLORATION].getActionCommand()))  {
+            sendCommand("run-exploration");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_TO_NEXT_BUS_TRANSFER].getActionCommand()))  {
+            toNextBusTransfer();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CPU_EXECUTES].getActionCommand()))  {
+            runUntilCPUExecutes();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_UNTIL_MEMORY_ACCESS].getActionCommand()))  {
+            toNextMemoryTransfer();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_UNTIL_TASK_EXECUTES].getActionCommand()))  {
+            runUntilTaskExecutes();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CHANNEL_ACCESS].getActionCommand()))  {
+            runUntilChannelAccess();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_VCD].getActionCommand()))  {
+            sendSaveTraceCommand("0");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_HTML].getActionCommand()))  {
+            sendSaveTraceCommand("1");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_TXT].getActionCommand()))  {
+            sendSaveTraceCommand("2");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_STATE].getActionCommand()))  {
+            sendSaveStateCommand();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RESTORE_STATE].getActionCommand()))  {
+            sendRestoreStateCommand();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_PRINT_BENCHMARK].getActionCommand()))  {
+            sendCommand("get-benchmark 0");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_SAVE_BENCHMARK].getActionCommand()))  {
+            sendSaveBenchmarkCommand();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_RESET_SIMU].getActionCommand())) {
+			mgui.resetRunningID();
+			mgui.resetLoadID();
+            sendCommand("reset");
+			askForUpdate();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_STOP_SIMU].getActionCommand())) {
+            sendCommand("stop");
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_UPDATE_VARIABLES].getActionCommand())) {
+            updateVariables();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_UPDATE_CPUS].getActionCommand())) {
+            updateCPUs();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_UPDATE_MEMS].getActionCommand())) {
+            updateMemories();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_UPDATE_BUS].getActionCommand())) {
+            updateBus();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_UPDATE_TASKS].getActionCommand())) {
+            updateTasks();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_PRINT_CPUS].getActionCommand())) {
+            printCPUs();
+        } else if (command.equals(actions[InteractiveSimulationActions.ACT_PRINT_BUS].getActionCommand())) {
+            printBuses();
+        } */
+	
+
+	
+	/*public boolean isAPositiveInt(String s) {
+		int val;
+		try {
+			val = Integer.decode(s).intValue();
+		} catch (Exception e) {
+			return false;
+		}
+		if (val > -1) {
+			return true;
+		}
+		return false;
+	}
+	
+	public Integer getInteger(String s) {
+		try {
+			return Integer.decode(s);
+		} catch (Exception e) {
+			return null;
+		}
+	}
+	
+	public Double getDouble(String s) {
+		try {
+			return new Double(s);
+		} catch (Exception e) {
+			return null;
+		}
+	}
+	
+	public void toNextBusTransfer() {
+		int id = getIDFromString(busIDs[busses.getSelectedIndex()]);
+		if (id != -1) {
+			sendCommand("run-to-next-transfer-on-bus " + id);
+		}
+	}
+	
+	public void runUntilCPUExecutes() {
+		int id = getIDFromString(cpuIDs[cpus.getSelectedIndex()]);
+		if (id != -1) {
+			sendCommand("run-until-cpu-executes " + id);
+		}
+	}
+	
+	public void toNextMemoryTransfer() {
+		int id = getIDFromString(memIDs[mems.getSelectedIndex()]);
+		if (id != -1) {
+			sendCommand("run-until-memory-access " + id);
+		}
+	}
+	
+	public void runUntilTaskExecutes() {
+		int id = getIDFromString(taskIDs[tasks.getSelectedIndex()]);
+		if (id != -1) {
+			sendCommand("run-until-task-executes " + id);
+		}
+	}
+	
+	public void runUntilChannelAccess() {
+		int id = getIDFromString(chanIDs[chans.getSelectedIndex()]);
+		if (id != -1) {
+			sendCommand("run-until-channel-access " + id);
+		}
+	}
+	
+	
+	
+	public int getIDFromString(String s) {
+		int index0 = s.indexOf("(");
+		int index1 = s.indexOf(")");
+		if ((index0 < 0) || (index1 <0) || (index1 < index0)) {
+			return -1;
+		}
+		
+		String in = s.substring(index0+1, index1);
+		
+		try {
+			return Integer.decode(in).intValue();
+		} catch (Exception e) {
+			System.err.println("Wrong string: "+ in);
+		}
+		
+		return -1;
+	}
+	
+	
+	
+	public void addBreakPoint(int _commandID) {
+		//TraceManager.addDev("Add breakpoint: " + _commandID);
+		// Check whether that breakpoint is already listed or not
+		for(Point p: points) {
+			if (p.y == _commandID) {
+				return;
+			}
+		}
+		
+		if (tmap != null) {
+			TMLTask task = tmap.getTMLTaskByCommandID(_commandID);
+			//TraceManager.addDev("Got task: " + task);
+			if (task != null) {
+				//TraceManager.addDev("Adding bkp");
+				sendCommand("add-breakpoint " + task.getID() + " " + _commandID + "\n");
+				jpbp.addExternalBreakpoint(task.getID(), _commandID);
+			}
+		}
+	}
+	
+	public void removeBreakPoint(int _commandID) {
+		TraceManager.addDev("remove breakpoint");
+		int cpt = 0;
+		for(Point p: points) {
+			if (p.y == _commandID) {
+				sendCommand("rm-breakpoint " + p.x +  " " + p.y + "\n");
+				jpbp.removeExternalBreakpoint(cpt);
+				return;
+			}
+			cpt ++;
+		}
+	}
+	
+	public void sendBreakPointList() {
+		for(Point p: points) {
+			sendCommand("add-breakpoint " + p.x + " " + p.y + "\n");
+		}
+		sendCommand("active-breakpoints 1");
+	}
+	
+	public void removeBreakpoint(Point p) {
+		if (mode == STARTED_AND_CONNECTED) {
+			sendCommand("rm-breakpoint " + p.x +  " " + p.y + "\n");
+		}
+		if (animate.isSelected()) {
+			mgui.removeBreakpoint(p);
+		}
+	}
+	
+	public void addBreakpoint(Point p) {
+		if (mode == STARTED_AND_CONNECTED) {
+			sendCommand("add-breakpoint " + p.x +  " " + p.y + "\n");
+		}
+		if (animate.isSelected()) {
+			mgui.addBreakpoint(p);
+		}
+	}
+	
+	public void printMessage(String msg) {
+		jta.append("*** " + msg + " ***\n");
+	}
+	
+
+	
+	public void activeBreakPoint(boolean active) {
+		if (mode == STARTED_AND_CONNECTED) {
+			if (active) {
+				sendCommand("active-breakpoints 1");
+			} else {
+				sendCommand("active-breakpoints 0");
+			}
+		}
+	}
+	
+	public void setVariables(int _idTask, int _idVariable, String _value) {
+		sendCommand("set-variable " + _idTask + " " + _idVariable + " " + _value);
+		sendCommand("get-variable-of-task " + _idTask + " " + _idVariable);
+	}*/
+	
+		/*protected void listTextCommands() {
+		String text = cp.getCommandList();
+		append("Available commands", text);
+	}
+	
+	protected void helpOnCommand() {
+		String text = textCommand.getText().trim();
+		String texts[] = text.split(" ");
+		text = texts[0];
+		String result = cp.getHelp(text);
+		append("Help on command: " + text, result);
+	}
+	
+	protected void sendCommand() {
+		String text = textCommand.getText().trim();
+		sendCommand(text);
+	}
+	
+	protected void sendCommand(String text) {
+		jta.append(">" + text + "\n");
+		String command = cp.transformCommandFromUserToSimulator(text);
+		if (command.length() == 0) {
+			jta.append("** Wrong command / parameters **\n");
+			return;
+		}
+		
+		try {
+			rc.send(command);
+		} catch (RemoteConnectionException rce) {
+			jta.append("** Sending command failed **\n");
+			return ;
+		} catch (Exception e) {}
+	}*/
+	
+	/*protected void append(String info, String list) {
+		jta.append("\n");
+		jta.append(info + "\n");
+		printSeparator();
+		jta.append(list);
+		jta.append("\n");
+		printSeparator();
+	}*/
+	
+	/*protected void analyzeServerAnswer(String s) {
+		//System.out.println("From server:" + s);
+		int index0 = s.indexOf("<?xml");
+		
+		if (index0 != -1) {
+			//System.out.println("toto1");
+			ssxml = s.substring(index0, s.length()) + "\n";
+		} else {
+			//System.out.println("toto2");
+			ssxml = ssxml + s + "\n";
+		}
+		
+		index0 = ssxml.indexOf("</siminfo>");
+		
+		if (index0 != -1) {
+			//System.out.println("toto3");
+			ssxml = ssxml.substring(0, index0+10);
+			loadXMLInfoFromServer(ssxml);
+			ssxml = "";
+		}
+		//System.out.println("toto4");
+		
+	}*/
+	
+	/*protected boolean loadXMLInfoFromServer(String xmldata) {
+		//jta.append("XML from server:" + xmldata + "\n\n");
+		
+		DocumentBuilderFactory dbf;
+		DocumentBuilder db;
+		
+		try {
+			dbf = DocumentBuilderFactory.newInstance();
+			db = dbf.newDocumentBuilder();
+		} catch (ParserConfigurationException e) {
+			dbf = null;
+			db = null;
+		}
+		
+		if ((dbf == null) || (db == null)) {
+			return false;
+		}
+		
+		ByteArrayInputStream bais = new ByteArrayInputStream(decodeString(xmldata).getBytes());
+		int i;
+		
+		try {
+			// building nodes from xml String
+			Document doc = db.parse(bais);
+			NodeList nl;
+			Node node;
+			
+			nl = doc.getElementsByTagName(SIMULATION_HEADER);
+			
+			if (nl == null) {
+				return false;
+			}
+			
+			for(i=0; i<nl.getLength(); i++) {
+				node = nl.item(i);
+				//System.out.println("Node = " + dnd);
+				if (node.getNodeType() == Node.ELEMENT_NODE) {
+					// create design, and get an index for it
+					return loadConfiguration(node);
+				}
+			}
+			
+		} catch (IOException e) {
+			TraceManager.addError("Error when parsing server info:" + e.getMessage());
+			return false;
+		} catch (SAXException saxe) {
+			TraceManager.addError("Error when parsing server info:" + saxe.getMessage());
+			TraceManager.addError("xml:" + xmldata);
+			return false;
+		}
+		return true;
+		
+	}
+	
+	protected boolean loadConfiguration(Node node1) {
+		NodeList diagramNl = node1.getChildNodes();
+		if (diagramNl == null) {
+			return false;
+		}
+		Element elt, elt0;
+		Node node, node0;
+		NodeList nl;
+		
+		
+		String tmp;
+		int val;
+		
+		int[] colors;
+		String msg = null;
+		String error = null;
+		String hash = null;
+		
+		String id, idvar;
+		String name;
+		String command;
+		String startTime="", finishTime="";
+		String progression="", nextCommand="";
+		String transStartTime="", transFinishTime="";
+		String util = null;
+		String value;
+		String extime;
+		String contdel;
+		String busname;
+		String busid;
+		String state;
+		
+		int k;
+		
+		//System.out.println("toto0");
+		
+		try {
+			for(int j=0; j<diagramNl.getLength(); j++) {
+				//System.out.println("Ndes: " + j);
+				node = diagramNl.item(j);
+				
+				if (node == null) {
+					TraceManager.addDev("null node");
+					return false;
+				}
+				
+				if (node.getNodeType() == Node.ELEMENT_NODE) {
+					elt = (Element)node;
+					
+					// Status
+					if (elt.getTagName().compareTo(SIMULATION_GLOBAL) == 0) {
+						
+						nl = elt.getElementsByTagName("status");
+						if ((nl != null) && (nl.getLength() > 0)) {
+							node0 = nl.item(0);
+							//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+							
+							makeStatus(node0.getTextContent());
+						}
+						
+						nl = elt.getElementsByTagName("brkreason");
+						if ((nl != null) && (nl.getLength() > 0)) {
+							node0 = nl.item(0);
+							//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+							
+							makeBrkReason(node0.getTextContent());
+						}
+						
+						nl = elt.getElementsByTagName("simtime");
+						if ((nl != null) && (nl.getLength() > 0)) {
+							gotTimeAnswerFromServer = true;
+							node0 = nl.item(0);
+							//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+							time.setText(node0.getTextContent());
+						}
+						
+						nl = elt.getElementsByTagName("msg");
+						if ((nl != null) && (nl.getLength() > 0)) {
+							node0 = nl.item(0);
+							msg = node0.getTextContent();
+						}
+						
+						nl = elt.getElementsByTagName("error");
+						if ((nl != null) && (nl.getLength() > 0)) {
+							node0 = nl.item(0);
+							error = node0.getTextContent();
+						}
+						
+						nl = elt.getElementsByTagName("hashval");
+						if ((nl != null) && (nl.getLength() > 0)) {
+							node0 = nl.item(0);
+							hash = node0.getTextContent();
+						}
+						
+					}
+					
+					if (hashOK) {
+						if (elt.getTagName().compareTo(SIMULATION_TASK) == 0) {
+							id = null;
+							name = null;
+							command = null;
+							nextCommand = null;
+							progression = null;
+							startTime = null; finishTime = null;
+							transStartTime = null; transFinishTime = null;
+							id = elt.getAttribute("id");
+							name = elt.getAttribute("name");
+							nl = elt.getElementsByTagName("currcmd");
+							if ((nl != null) && (nl.getLength() > 0)) {
+								node0 = nl.item(0);
+								if (node0.getNodeType() == Node.ELEMENT_NODE) {
+									elt0 = (Element)node0;
+									command = elt0.getAttribute("id");
+								}
+								nl = elt.getElementsByTagName("progr");
+								if ((nl != null) && (nl.getLength() > 0)) {
+									node0 = nl.item(0);
+									progression = node0.getTextContent();
+									//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								}
+								nl = elt.getElementsByTagName("starttime");
+								if ((nl != null) && (nl.getLength() > 0)) {
+									node0 = nl.item(0);
+									startTime = node0.getTextContent();
+									//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								}
+								nl = elt.getElementsByTagName("finishtime");
+								if ((nl != null) && (nl.getLength() > 0)) {
+									node0 = nl.item(0);
+									finishTime = node0.getTextContent();
+									//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								}
+								nl = elt.getElementsByTagName("transstarttime");
+								if ((nl != null) && (nl.getLength() > 0)) {
+									node0 = nl.item(0);
+									transStartTime = node0.getTextContent();
+									//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								}
+								nl = elt.getElementsByTagName("transfinishtime");
+								if ((nl != null) && (nl.getLength() > 0)) {
+									node0 = nl.item(0);
+									transFinishTime = node0.getTextContent();
+									//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								}
+								nl = elt.getElementsByTagName("nextcmd");
+								if ((nl != null) && (nl.getLength() > 0)) {
+									node0 = nl.item(0);
+									nextCommand = node0.getTextContent();
+									//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								}
+								
+							}
+							
+							//System.out.println("Got info on task " + id + " command=" + command);
+							extime = null;
+							nl = elt.getElementsByTagName("extime");
+							if ((nl != null) && (nl.getLength() > 0)) {
+								node0 = nl.item(0);
+								//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								extime =  node0.getTextContent();
+							}
+							
+							state = null;
+							nl = elt.getElementsByTagName("tskstate");
+							if ((nl != null) && (nl.getLength() > 0)) {
+								node0 = nl.item(0);
+								//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								state =  node0.getTextContent();
+								//TraceManager.addDev("TASK STATE: " + state);
+							}
+							
+							if ((id != null) && ((extime != null) || (state != null))) {
+								updateTaskCyclesAndState(id, extime, state);
+							}
+							
+							
+							if ((id != null) && (command != null)) {
+								if (nextCommand ==null) {
+									nextCommand = "-1";
+								}
+								updateRunningCommand(id, command, progression, startTime, finishTime, nextCommand, transStartTime, transFinishTime, state);
+							}
+							
+							if (openDiagram.isEnabled() && openDiagram.isSelected() && (name != null) && (command != null)) {
+								updateOpenDiagram(name, command, progression, startTime, finishTime, transStartTime, transFinishTime);
+							}
+							
+							
+							
+							
+							nl = elt.getElementsByTagName("var");
+							if ((nl != null) && (nl.getLength() > 0)) {
+								idvar = null;
+								value = null;
+								for(k=0; k<nl.getLength(); k++) {
+									node0 = nl.item(k);
+									value = node0.getTextContent();
+									if (node0.getNodeType() == Node.ELEMENT_NODE) {
+										elt0 = (Element)node0;
+										idvar = elt0.getAttribute("id");
+									}
+									if ((value != null) && (idvar != null)) {
+										updateVariableState(idvar, value);
+										jpsv.updateOnVariableValue(idvar);
+									}
+								}
+							}
+						}
+						
+						//System.out.println("toto1");
+						
+						if (elt.getTagName().compareTo(SIMULATION_CPU) == 0) {
+							id = null;
+							name = null;
+							command = null;
+							contdel = null;
+							busname = null;
+							busid = null;
+							
+							id = elt.getAttribute("id");
+							name = elt.getAttribute("name");
+							nl = elt.getElementsByTagName("util");
+							if ((nl != null) && (nl.getLength() > 0)) {
+								node0 = nl.item(0);
+								//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								util = node0.getTextContent();
+							}
+							
+							//System.out.println("toto12");
+							nl = elt.getElementsByTagName("contdel");
+							if ((nl != null) && (nl.getLength() > 0)) {
+								nl = elt.getElementsByTagName("contdel");
+								node0 = nl.item(0);
+								elt0 = (Element)node0;
+								busid = elt0.getAttribute("busID");
+								busname = elt0.getAttribute("busName");
+								//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								contdel = node0.getTextContent();
+							}
+							
+							//System.out.println("contdel: " + contdel + " busID:" + busid + " busName:" + busname);
+							
+							
+							if ((id != null) && (util != null)) {
+								updateCPUState(id, util, contdel, busname, busid);
+							}
+						}
+						
+						//System.out.println("toto2");
+						
+						if (elt.getTagName().compareTo(SIMULATION_BUS) == 0) {
+							id = null;
+							name = null;
+							command = null;
+							id = elt.getAttribute("id");
+							name = elt.getAttribute("name");
+							nl = elt.getElementsByTagName("util");
+							if ((nl != null) && (nl.getLength() > 0)) {
+								node0 = nl.item(0);
+								//System.out.println("nl:" + nl + " value=" + node0.getNodeValue() + " content=" + node0.getTextContent());
+								util = node0.getTextContent();
+							}
+							
+							//System.out.println("Got info on bus " + id + " util=" + util);
+							
+							if ((id != null) && (util != null)) {
+								updateBusState(id, util);
+							}
+						}
+					}
+				}
+			}
+		} catch (Exception e) {
+			TraceManager.addError("Exception in xml parsing " + e.getMessage() + " node= " + node1);
+			return false;
+		}
+		
+		if ((msg != null) && (error != null)) {
+			if (error.trim().equals("0")) {
+				printFromServer(msg + ": command successful");
+				if (msg.indexOf("reset") != -1) {
+					time.setText("0");
+				}
+			} else {
+				printFromServer(msg + ": command failed (error=" + error + ")");
+			}
+		} else if (msg != null) {
+			printFromServer("Server: " + msg);
+		} else {
+			printFromServer("Server: error " + error);
+		}
+		
+		if ((hash != null) && (tmap != null)) {
+			try {
+				int thehash = Integer.decode(hash).intValue();
+				
+				if (thehash != hashCode) {
+					jta.append("\n*** Simulated model is not the model currently loaded under TTool ***\n");
+					jta.append("*** Some features are therefore deactivated ***\n\n");
+					hashOK = false;
+					wrongHashCode();
+				} else {
+					askForUpdate();
+					sendBreakPointList();
+					jta.append("\n*** Simulated model is the one currently loaded under TTool ***\n");
+					hashOK = true;
+					animate.setSelected(true);
+					animate.setEnabled(true);
+					diploids.setEnabled(true);
+					animateWithInfo.setSelected(true);
+					animateWithInfo.setEnabled(true);
+					openDiagram.setEnabled(true);
+					cpus.setEnabled(true);
+					busses.setEnabled(true);
+					mems.setEnabled(true);
+					tasks.setEnabled(true);
+					chans.setEnabled(true);
+				}
+			} catch (Exception e) {
+			}
+		}
+		
+		return true;
+	}*/
+	
+	/*private void wrongHashCode() {
+		TraceManager.addDev("Wrong hash code");
+		
+		cpuPanel.setVisible(false);
+		variablePanel.setVisible(false);
+		openDiagram.setSelected(false);
+		openDiagram.setEnabled(false);
+		animate.setEnabled(false);
+		diploids.setEnabled(false);
+		animate.setSelected(false);
+		diploids.setSelected(false);
+		animateWithInfo.setSelected(false);
+		animateWithInfo.setEnabled(false);
+		update.setEnabled(false);
+		update.setSelected(false);
+		
+		cpus.setEnabled(false);
+		busses.setEnabled(false);
+		mems.setEnabled(false);
+		tasks.setEnabled(false);
+		chans.setEnabled(false);
+		cpus.removeAllItems();
+		busses.removeAllItems();
+		mems.removeAllItems();
+		tasks.removeAllItems();
+		chans.removeAllItems();
+		
+		jpsv.setEnabled(false);
+		jpsv.unsetElements();
+		
+		actions[InteractiveSimulationActions.ACT_RUN_TO_NEXT_BUS_TRANSFER].setEnabled(false);
+		actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CPU_EXECUTES].setEnabled(false);
+		actions[InteractiveSimulationActions.ACT_RUN_UNTIL_TASK_EXECUTES].setEnabled(false);
+		actions[InteractiveSimulationActions.ACT_RUN_UNTIL_MEMORY_ACCESS].setEnabled(false);
+		actions[InteractiveSimulationActions.ACT_RUN_UNTIL_CHANNEL_ACCESS].setEnabled(false);
+		
+		// Set variable tab is removed
+		// 
+		commandTab.removeTabAt(2);
+		jpsv = null;
+		
+		while(infoTab.getTabCount() > 2) {
+			infoTab.removeTabAt(2);
+		}
+		jpbp.unsetElements();
+		
+	}*/
+	
+	/*public synchronized void startThread(int mode) {
+		threadMode = mode;
+		t = new Thread(this);
+		t.start();
+		threadStarted = false;
+		//System.out.println("thread of mode:" + threadMode);
+		while(threadStarted == false) {
+			try {
+				wait();
+			} catch (InterruptedException ie) {}
+		}
+	}
+	
+	public synchronized void threadStarted() {
+		TraceManager.addDev("thread started");
+		threadStarted = true;
+		notify();
+	}
+	
+	public void makeBrkReason(String s) {
+		info.setText(s);
+	}*/
+	
+	/*public void makeStatus(String s) {
+		//System.out.println("busystatus="  + busyStatus);
+		
+		if (s.equals("busy")) {
+			status.setText("Busy");
+			setBusyStatus();
+			busyMode = 2;
+			//busyStatus = true;
+		}
+		if (s.equals("ready")) {
+			status.setText("Ready");
+			if (busyMode == 2) {
+				//System.out.println("Sending time command");
+				askForUpdate();
+				//sendCommand("time");
+			}
+			busyMode = 1;
+			setBusyStatus();
+		}
+		
+		if (s.equals("term")) {
+			status.setText("Terminated");
+			if (busyMode == 2) {
+				askForUpdate();
+			}
+			busyMode = 3;
+			setBusyStatus();
+			
+			//System.out.println("**** TERM ****");
+		}
+		setLabelColors();
+	}
+	
+	public void setBusyStatus() {
+		setAll();
+		actions[InteractiveSimulationActions.ACT_STOP_SIMU].setEnabled(busyMode == 2);
+	}*/
+	
+	/*public void setLabelColors() {
+		switch(busyMode) {
+		case 0:
+			status.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+			time.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+			info.setForeground(ColorManager.InteractiveSimulationText_UNKNOWN);
+			break;
+		case 1:
+			status.setForeground(ColorManager.InteractiveSimulationText_READY);
+			time.setForeground(ColorManager.InteractiveSimulationText_READY);
+			info.setForeground(ColorManager.InteractiveSimulationText_READY);
+			break;        
+		case 2:
+			status.setForeground(ColorManager.InteractiveSimulationText_BUSY);
+			time.setForeground(ColorManager.InteractiveSimulationText_BUSY);
+			info.setForeground(ColorManager.InteractiveSimulationText_BUSY);
+			break;
+		case 3:
+			status.setForeground(ColorManager.InteractiveSimulationText_TERM);
+			time.setForeground(ColorManager.InteractiveSimulationText_TERM);
+			info.setForeground(ColorManager.InteractiveSimulationText_TERM);
+			break;
+		}
+		
+		
+	}*/
+	
+	
+	
+} // Class
-- 
GitLab