From 64e0cf7ddc4490ecb5190e462b3ed77ae1200dd4 Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Tue, 24 Apr 2018 11:52:35 +0200
Subject: [PATCH] Update on dialogs for avatar and atd

---
 .idea/misc.xml                                |   2 +-
 src/main/java/ui/atd/ATDAttack.java           | 123 ++--
 .../ui/avatarbd/AvatarBDLibraryFunction.java  | 629 +++++++++--------
 src/main/java/ui/avatarbd/AvatarBDPragma.java |  14 +-
 .../java/ui/avatarbd/AvatarBDToolBar.java     |  42 +-
 src/main/java/ui/window/JDialogAttack.java    |   1 +
 .../window/JDialogAvatarLibraryFunction.java  | 637 +++++++++---------
 src/main/java/ui/window/JDialogBase.java      |  22 +
 .../java/ui/window/JDialogConstraintText.java |   1 +
 .../java/ui/window/JDialogCountermeasure.java |   1 +
 .../ui/window/JDialogPerformancePragma.java   | 263 ++++----
 src/main/java/ui/window/JDialogPragma.java    |   2 +-
 .../java/ui/window/JDialogProjection.java     | 565 ++++++++--------
 .../java/ui/window/JDialogSafetyPragma.java   | 229 ++++---
 14 files changed, 1284 insertions(+), 1247 deletions(-)

diff --git a/.idea/misc.xml b/.idea/misc.xml
index b755d8ca46..51e5191ed4 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -38,7 +38,7 @@
       <property name="caretWidth" class="java.lang.Integer" />
     </properties>
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" project-jdk-name="1.7" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build" />
   </component>
 </project>
\ No newline at end of file
diff --git a/src/main/java/ui/atd/ATDAttack.java b/src/main/java/ui/atd/ATDAttack.java
index 5d65a5723f..22ee35e5f5 100644
--- a/src/main/java/ui/atd/ATDAttack.java
+++ b/src/main/java/ui/atd/ATDAttack.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,14 +31,12 @@
  * 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.
  */
 
 
-
-
 package ui.atd;
 
 import myutil.GraphicLib;
@@ -54,17 +52,18 @@ import javax.swing.*;
 import java.awt.*;
 
 /**
-   * Class ATDAttack
-   * Attack -> SysML value type
-   * Creation: 09/12/2009
-   * @version 1.0 09/12/2009
-   * @author Ludovic APVRILLE
+ * Class ATDAttack
+ * Attack -> SysML value type
+ * Creation: 09/12/2009
+ *
+ * @author Ludovic APVRILLE
+ * @version 1.0 09/12/2009
  */
 public class ATDAttack extends TGCScalableWithInternalComponent implements SwallowedTGComponent, WithAttributes, CheckableAccessibility, CanBeDisabled {
     private int textY1 = 3;
- //   private int textY2 = 3;
+    //   private int textY2 = 3;
 
-   // private static int arc = 7;
+    // private static int arc = 7;
     //private int textX = 10;
 
     protected String oldValue = "";
@@ -79,11 +78,11 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
     private boolean displayText = true;
     private int textX = 10;
 
-    public ATDAttack(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp)  {
+    public ATDAttack(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) {
         super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
 
         width = 125;
-        height = (int)(40 * tdp.getZoom());
+        height = (int) (40 * tdp.getZoom());
         minWidth = 100;
 
         nbConnectingPoint = 24;
@@ -101,7 +100,7 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
         connectingPoint[9] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 1.0, 0.75);
         connectingPoint[10] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.25, 1.0);
         connectingPoint[11] = new ATDAttackConnectingPoint(this, 0, 0, true, true, 0.75, 1.0);
-	connectingPoint[12] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.5, 0.0);
+        connectingPoint[12] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.5, 0.0);
         connectingPoint[13] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.0, 0.5);
         connectingPoint[14] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 1.0, 0.5);
         connectingPoint[15] = new ATDCountermeasureConnectingPoint(this, 0, 0, true, true, 0.5, 1.0);
@@ -151,7 +150,6 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
             rescaled = false;
 
 
-
             // Must set the font size ..
             // Find the biggest font not greater than max_font size
             // By Increment of 1
@@ -185,9 +183,9 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
               }*/
 
 
-            float scale = (float)(f.getSize()*tdp.getZoom());
+            float scale = (float) (f.getSize() * tdp.getZoom());
             scale = Math.min(maxFontSize, scale);
-            currentFontSize = (int)scale;
+            currentFontSize = (int) scale;
             if (scale < minFontSize) {
                 displayText = false;
             } else {
@@ -208,7 +206,7 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
             g.setColor(ColorManager.ATD_ATTACK_DISABLED);
         }
 
-        g.fill3DRect(x+1, y+1, width-1, height-1, true);
+        g.fill3DRect(x + 1, y + 1, width - 1, height - 1, true);
         g.setColor(c);
 
         // Strings
@@ -217,55 +215,54 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
         //TraceManager.addDev("display text of attack=" + displayText);
 
         if (displayText) {
-            f = f.deriveFont((float)currentFontSize);
+            f = f.deriveFont((float) currentFontSize);
             g.setFont(f);
             //Font f0 = g.getFont();
 
-            boolean cannotWriteAttack = (height < (2 * currentFontSize + (int)(textY1 * tdp.getZoom())));
+            boolean cannotWriteAttack = (height < (2 * currentFontSize + (int) (textY1 * tdp.getZoom())));
             //TraceManager.addDev("Zoom=" + tdp.getZoom() + " Cannot write attack=" + cannotWriteAttack + "Font=" + f0);
             if (cannotWriteAttack) {
-                w  = g.getFontMetrics().stringWidth(value);
-                int h =  currentFontSize + (int)(textY1 * tdp.getZoom());
-                if ((w < (2*textX + width)) && (h < height)) {
-                    g.drawString(value, x + (width - w)/2, y + h);
+                w = g.getFontMetrics().stringWidth(value);
+                int h = currentFontSize + (int) (textY1 * tdp.getZoom());
+                if ((w < (2 * textX + width)) && (h < height)) {
+                    g.drawString(value, x + (width - w) / 2, y + h);
                 } else {
-                    w  = g.getFontMetrics().stringWidth(ster);
-                    if ((w < (2*textX + width)) && (h < height)) {
-                        g.drawString(ster, x + (width - w)/2, y + h);
+                    w = g.getFontMetrics().stringWidth(ster);
+                    if ((w < (2 * textX + width)) && (h < height)) {
+                        g.drawString(ster, x + (width - w) / 2, y + h);
                     }
                 }
             } else {
                 g.setFont(f.deriveFont(Font.BOLD));
-                int h =  currentFontSize + (int)(textY1 * tdp.getZoom());
+                int h = currentFontSize + (int) (textY1 * tdp.getZoom());
                 int cumulated = 0;
                 w = g.getFontMetrics().stringWidth(ster);
-                if ((w < (2*textX + width)) && (h < height)) {
-                    g.drawString(ster, x + (width - w)/2, y + h);
+                if ((w < (2 * textX + width)) && (h < height)) {
+                    g.drawString(ster, x + (width - w) / 2, y + h);
                     cumulated = h;
                 }
                 g.setFont(f);
-                w  = g.getFontMetrics().stringWidth(value);
-                h = cumulated + currentFontSize + (int)(textY1 * tdp.getZoom());
-                if ((w < (2*textX + width)) && (h < height)) {
+                w = g.getFontMetrics().stringWidth(value);
+                h = cumulated + currentFontSize + (int) (textY1 * tdp.getZoom());
+                if ((w < (2 * textX + width)) && (h < height)) {
                     //TraceManager.addDev("Drawing value=" + value);
-                    g.drawString(value, x + (width - w)/2, y + h);
+                    g.drawString(value, x + (width - w) / 2, y + h);
                 } else {
-		    g.drawString(value, x + (width - w)/2, y + h);
+                    g.drawString(value, x + (width - w) / 2, y + h);
                     //TraceManager.addDev("--------------------------------------------------- Cannot draw value=" + value);
                     //TraceManager.addDev("w=" + w + " val=" + (2*textX + width) + "h=" + h + " height=" + height + " zoom=" + tdp.getZoom() + " Font=" + f0);
                 }
             }
 
-	    if (!isEnabled()) {
-		String val = "disabled";
-		w = g.getFontMetrics().stringWidth(val);
-		//int h =  currentFontSize + (int)(textY1 * tdp.getZoom());
-		g.setFont(f.deriveFont(Font.ITALIC));
-		g.drawString(val, x + (width - w - 5), y + height - 2);
-	    }
+            if (!isEnabled()) {
+                String val = "disabled";
+                w = g.getFontMetrics().stringWidth(val);
+                //int h =  currentFontSize + (int)(textY1 * tdp.getZoom());
+                g.setFont(f.deriveFont(Font.ITALIC));
+                g.drawString(val, x + (width - w - 5), y + height - 2);
+            }
+
 
-	    
-	    
         } else {
             TraceManager.addDev("-------------------------------------------------- Cannot display text of attack");
         }
@@ -287,12 +284,12 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
 
         if (currentFontSize != -1) {
             if (currentFontSize != f0.getSize()) {
-                g.setFont(f0.deriveFont((float)currentFontSize));
+                g.setFont(f0.deriveFont((float) currentFontSize));
             }
         }
 
-        int w  = Math.max(g.getFontMetrics().stringWidth(value), g.getFontMetrics().stringWidth(ster));
-        int w1 = Math.max((int)(minWidth*tdp.getZoom()), w + 2 * textX);
+        int w = Math.max(g.getFontMetrics().stringWidth(value), g.getFontMetrics().stringWidth(ster));
+        int w1 = Math.max((int) (minWidth * tdp.getZoom()), w + 2 * textX);
 
         //System.out.println("width=" + width + " w1=" + w1 + " w2=" + w2 + " value=" + value);
         if (w1 != width) {
@@ -321,9 +318,9 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
         boolean error = false;
 
         JDialogAttack dialog = new JDialogAttack(frame, "Setting attack attributes", this);
-   //     dialog.setSize(450, 350);
+        //     dialog.setSize(450, 350);
         GraphicLib.centerOnParent(dialog, 450, 350);
-        dialog.setVisible( true ); // blocked until dialog has been closed
+        dialog.setVisible(true); // blocked until dialog has been closed
 
         if (!dialog.isRegularClose()) {
             return false;
@@ -351,9 +348,9 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
 
         if (error) {
             JOptionPane.showMessageDialog(frame,
-                                          "Name is non-valid",
-                                          "Error",
-                                          JOptionPane.INFORMATION_MESSAGE);
+                    "Name is non-valid",
+                    "Error",
+                    JOptionPane.INFORMATION_MESSAGE);
         }
 
         return !error;
@@ -374,31 +371,31 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
     protected String translateExtraParam() {
         StringBuffer sb = new StringBuffer("<extraparam>\n");
         sb.append("<info description=\"" + description);
-        sb.append("\" root=\"" +isRootAttack);
+        sb.append("\" root=\"" + isRootAttack);
         sb.append("\" />\n");
         sb.append("</extraparam>\n");
         return new String(sb);
     }
 
     @Override
-    public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{
+    public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException {
         //System.out.println("*** load extra synchro ***");
         try {
 
             NodeList nli;
             Node n1, n2;
             Element elt;
-      //      int t1id;
+            //      int t1id;
             String sdescription = null;
-       //     String prio;
+            //     String prio;
             String isRoot = null;
 
-            for(int i=0; i<nl.getLength(); i++) {
+            for (int i = 0; i < nl.getLength(); i++) {
                 n1 = nl.item(i);
                 //System.out.println(n1);
                 if (n1.getNodeType() == Node.ELEMENT_NODE) {
                     nli = n1.getChildNodes();
-                    for(int j=0; j<nli.getLength(); j++) {
+                    for (int j = 0; j < nli.getLength(); j++) {
                         n2 = nli.item(j);
                         //System.out.println(n2);
                         if (n2.getNodeType() == Node.ELEMENT_NODE) {
@@ -448,6 +445,4 @@ public class ATDAttack extends TGCScalableWithInternalComponent implements Swall
     }
 
 
-
-
 }
diff --git a/src/main/java/ui/avatarbd/AvatarBDLibraryFunction.java b/src/main/java/ui/avatarbd/AvatarBDLibraryFunction.java
index cb67068a67..1fa414916a 100644
--- a/src/main/java/ui/avatarbd/AvatarBDLibraryFunction.java
+++ b/src/main/java/ui/avatarbd/AvatarBDLibraryFunction.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,14 +31,12 @@
  * 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.
  */
 
 
-
-
 package ui.avatarbd;
 
 import myutil.GraphicLib;
@@ -60,8 +58,8 @@ import java.util.LinkedList;
 /**
  * This class represent a Library Function block on an avatar block diagram.
  *
- * @version 1.0 04.08.2016
  * @author Florian LUGOU
+ * @version 1.0 04.08.2016
  */
 public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent implements SwallowedTGComponent, AvatarBDStateMachineOwner, Comparable<AvatarBDLibraryFunction> {
 
@@ -93,7 +91,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
     /**
      * The vertical spacing between lines.
      */
-    private static final int paddingVertical   = 3;
+    private static final int paddingVertical = 3;
 
     /**
      * Used to know where the user double clicked
@@ -109,7 +107,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
      * Used to know where the user double clicked
      */
     private int limitSignals;
-    
+
     /**
      * Current font size.
      */
@@ -153,26 +151,17 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
     /**
      * Standard constructor for a library function block.
      *
-     * @param x
-     *      The absolute coordinate of the block along X.
-     * @param y
-     *      The absolute coordinate of the block along Y.
-     * @param minX
-     *      The minimum authorized coordinate along X.
-     * @param maxX
-     *      The maximum authorized coordinate along X.
-     * @param minY
-     *      The minimum authorized coordinate along Y.
-     * @param maxY
-     *      The maximum authorized coordinate along Y.
-     * @param pos
-     *      Indicates whether the position is considered as relative to this father's component.
-     * @param father
-     *      The father component in the diagram.
-     * @param tdp
-     *      The diagram panel.
+     * @param x      The absolute coordinate of the block along X.
+     * @param y      The absolute coordinate of the block along Y.
+     * @param minX   The minimum authorized coordinate along X.
+     * @param maxX   The maximum authorized coordinate along X.
+     * @param minY   The minimum authorized coordinate along Y.
+     * @param maxY   The maximum authorized coordinate along Y.
+     * @param pos    Indicates whether the position is considered as relative to this father's component.
+     * @param father The father component in the diagram.
+     * @param tdp    The diagram panel.
      */
-    public AvatarBDLibraryFunction (
+    public AvatarBDLibraryFunction(
             int x,
             int y,
             int minX,
@@ -204,16 +193,16 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
 
         // Find a new unused name
         int i;
-        for (i=0; i<100; i++) {
+        for (i = 0; i < 100; i++) {
             String tmpName = "LibraryFunction" + i;
-            if (this.tdp.isAvatarBlockNameUnique (tmpName) &&
-                true) { // TODO: check if no other tab has same name
+            if (this.tdp.isAvatarBlockNameUnique(tmpName) &&
+                    true) { // TODO: check if no other tab has same name
                 this.name = tmpName;
                 this.value = tmpName;
                 break;
             }
         }
-        if  (i == 100) {
+        if (i == 100) {
             // TODO: throw exception
         }
 
@@ -223,29 +212,27 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         // TODO: change that
         this.myImageIcon = IconManager.imgic700;
 
-        this.parameters = new LinkedList<TAttribute> ();
-        this.attributes = new LinkedList<TAttribute> ();
-        this.signals    = new LinkedList<AvatarSignal> ();
-        this.returnAttributes = new LinkedList<TAttribute> ();
-        this.methods = new LinkedList<AvatarMethod> ();
+        this.parameters = new LinkedList<TAttribute>();
+        this.attributes = new LinkedList<TAttribute>();
+        this.signals = new LinkedList<AvatarSignal>();
+        this.returnAttributes = new LinkedList<TAttribute>();
+        this.methods = new LinkedList<AvatarMethod>();
 
         // Ask the panel to add a tab for the state machine diagram.
         this.actionOnAdd();
     }
 
-    public TDiagramPanel getDiagramPanel () {
+    public TDiagramPanel getDiagramPanel() {
         return this.tdp;
     }
 
-    public String getFunctionName () {
+    public String getFunctionName() {
         return this.name;
     }
 
-    public String getFullyQualifiedName()
-    {
+    public String getFullyQualifiedName() {
         String result = "";
-        if (this.father != null && (this.father instanceof AvatarBDBlock))
-        {
+        if (this.father != null && (this.father instanceof AvatarBDBlock)) {
             result = ((AvatarBDBlock) this.father).getFullyQualifiedName() + ".";
         }
         result += this.name;
@@ -253,88 +240,87 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         return result;
     }
 
-    public LinkedList<TAttribute> getParameters () {
+    public LinkedList<TAttribute> getParameters() {
         return this.parameters;
     }
 
-    public void resetParameters () {
-        this.parameters = new LinkedList<TAttribute> ();
+    public void resetParameters() {
+        this.parameters = new LinkedList<TAttribute>();
     }
 
-    public void addParameter (TAttribute parameter) {
-        this.parameters.add (parameter);
+    public void addParameter(TAttribute parameter) {
+        this.parameters.add(parameter);
     }
 
-    public LinkedList<AvatarSignal> getSignals () {
+    public LinkedList<AvatarSignal> getSignals() {
         return this.signals;
     }
 
-    public void resetSignals () {
-        this.signals = new LinkedList<AvatarSignal> ();
+    public void resetSignals() {
+        this.signals = new LinkedList<AvatarSignal>();
     }
 
-    public void addSignal (AvatarSignal signal) {
-        this.signals.add (signal);
+    public void addSignal(AvatarSignal signal) {
+        this.signals.add(signal);
     }
 
-    public LinkedList<TAttribute> getAttributes () {
+    public LinkedList<TAttribute> getAttributes() {
         return this.attributes;
     }
 
-    public void resetAttributes () {
-        this.attributes = new LinkedList<TAttribute> ();
+    public void resetAttributes() {
+        this.attributes = new LinkedList<TAttribute>();
     }
 
-    public void addAttribute (TAttribute attribute) {
-        this.attributes.add (attribute);
+    public void addAttribute(TAttribute attribute) {
+        this.attributes.add(attribute);
     }
 
-    public LinkedList<TAttribute> getReturnAttributes () {
+    public LinkedList<TAttribute> getReturnAttributes() {
         return this.returnAttributes;
     }
 
-    public void resetReturnAttributes () {
-        this.returnAttributes = new LinkedList<TAttribute> ();
+    public void resetReturnAttributes() {
+        this.returnAttributes = new LinkedList<TAttribute>();
     }
 
-    public void addReturnAttribute (TAttribute returnAttribute) {
-        this.returnAttributes.add (returnAttribute);
+    public void addReturnAttribute(TAttribute returnAttribute) {
+        this.returnAttributes.add(returnAttribute);
     }
 
-    public LinkedList<AvatarMethod> getMethods () {
+    public LinkedList<AvatarMethod> getMethods() {
         return this.methods;
     }
 
-    public void resetMethods () {
-        this.methods = new LinkedList<AvatarMethod> ();
+    public void resetMethods() {
+        this.methods = new LinkedList<AvatarMethod>();
     }
 
-    public void addMethod (AvatarMethod method) {
-        this.methods.add (method);
+    public void addMethod(AvatarMethod method) {
+        this.methods.add(method);
     }
 
     @Override
-    public void internalDrawing (Graphics graph) {
-        Font font = graph.getFont ();
-        this.internalDrawingAux (graph);
-        graph.setFont (font);
+    public void internalDrawing(Graphics graph) {
+        Font font = graph.getFont();
+        this.internalDrawingAux(graph);
+        graph.setFont(font);
     }
 
     /**
      * Draws the Library Function object.
      *
-     * @param graph
-     *      The {@link Graphics} object used to draw this component.
+     * @param graph The {@link Graphics} object used to draw this component.
      */
-    private void internalDrawingAux (Graphics graph) {
+    private void internalDrawingAux(Graphics graph) {
         // Draw outer rectangle (for border)
-        Color c = graph.getColor ();
-        graph.drawRect (this.x, this.y, this.width, this.height);
+        Color c = graph.getColor();
+        graph.drawRect(this.x, this.y, this.width, this.height);
 
         // Draw inner rectangle
-        graph.setColor (ColorManager.AVATAR_LIBRARYFUNCTION);
-        graph.fillRect (this.x+1, this.y+1, this.width-1, this.height-1);
-        graph.setColor (c);
+        graph.setColor(ColorManager.AVATAR_LIBRARYFUNCTION);
+        graph.fillRect(this.x + 1, this.y + 1, this.width - 1, this.height - 1);
+        graph.setColor(c);
 
         // limits
         this.limitName = -1;
@@ -344,16 +330,16 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         // h retains the coordinate along X where an element was last drawn
         int h = 0;
 
-        int paddingVertical = (int) (AvatarBDLibraryFunction.paddingVertical * this.tdp.getZoom ());
-        int paddingHorizontal = (int) (AvatarBDLibraryFunction.paddingHorizontal * this.tdp.getZoom ());
+        int paddingVertical = (int) (AvatarBDLibraryFunction.paddingVertical * this.tdp.getZoom());
+        int paddingHorizontal = (int) (AvatarBDLibraryFunction.paddingHorizontal * this.tdp.getZoom());
 
         // Draw icon
-        this.iconIsDrawn = this.width > IconManager.iconSize + 2*paddingHorizontal && height > IconManager.iconSize + 2*paddingHorizontal;
+        this.iconIsDrawn = this.width > IconManager.iconSize + 2 * paddingHorizontal && height > IconManager.iconSize + 2 * paddingHorizontal;
         if (this.iconIsDrawn)
-            graph.drawImage (IconManager.img5100, this.x + this.width - IconManager.iconSize - paddingHorizontal, this.y + paddingHorizontal, null);
+            graph.drawImage(IconManager.img5100, this.x + this.width - IconManager.iconSize - paddingHorizontal, this.y + paddingHorizontal, null);
 
 
-        Font font = graph.getFont ();
+        Font font = graph.getFont();
 
         String ster;
         if (!this.isCrypto)
@@ -361,56 +347,56 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         else
             ster = "<<" + stereotypeCrypto + ">>";
 
-        if (this.rescaled && !this.tdp.isScaled ()) {
+        if (this.rescaled && !this.tdp.isScaled()) {
             this.rescaled = false;
             // Must set the font size...
             // Incrementally find the biggest font not greater than max_font size
             // If font is less than min_font, no text is displayed
 
             // This is the maximum font size possible
-            int maxCurrentFontSize = Math.max (0, Math.min (this.height, (int) (AvatarBDLibraryFunction.maxFontSize*this.tdp.getZoom ())));
-            font = font.deriveFont ((float) maxCurrentFontSize);
+            int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (AvatarBDLibraryFunction.maxFontSize * this.tdp.getZoom())));
+            font = font.deriveFont((float) maxCurrentFontSize);
 
             // Try to decrease font size until we get below the minimum
-            while (maxCurrentFontSize > (AvatarBDLibraryFunction.minFontSize*this.tdp.getZoom () - 1)) {
+            while (maxCurrentFontSize > (AvatarBDLibraryFunction.minFontSize * this.tdp.getZoom() - 1)) {
                 // Compute width of name of the function
-                int w0 = graph.getFontMetrics (font).stringWidth (this.value);
+                int w0 = graph.getFontMetrics(font).stringWidth(this.value);
                 // Compute width of string stereotype
-                int w1 = graph.getFontMetrics (font).stringWidth (ster);
+                int w1 = graph.getFontMetrics(font).stringWidth(ster);
 
                 // if one of the two width is small enough use this font size
-                if (Math.min (w0, w1) < this.width - (2*paddingHorizontal))
+                if (Math.min(w0, w1) < this.width - (2 * paddingHorizontal))
                     break;
 
                 // Decrease font size
-                maxCurrentFontSize --;
+                maxCurrentFontSize--;
                 // Scale the font
-                font = font.deriveFont ((float) maxCurrentFontSize);
+                font = font.deriveFont((float) maxCurrentFontSize);
             }
 
             // Box is too damn small
-            if (this.currentFontSize < AvatarBDLibraryFunction.minFontSize*this.tdp.getZoom ()) {
-                maxCurrentFontSize ++;
+            if (this.currentFontSize < AvatarBDLibraryFunction.minFontSize * this.tdp.getZoom()) {
+                maxCurrentFontSize++;
                 // Scale the font
-                font = font.deriveFont ((float) maxCurrentFontSize);
+                font = font.deriveFont((float) maxCurrentFontSize);
             }
 
             // Use this font
-            graph.setFont (font);
+            graph.setFont(font);
             this.currentFontSize = maxCurrentFontSize;
         } else
-            font = font.deriveFont (this.currentFontSize);
+            font = font.deriveFont(this.currentFontSize);
 
-        graph.setFont (font.deriveFont (Font.BOLD));
-        h = graph.getFontMetrics ().getAscent () + graph.getFontMetrics ().getLeading () + paddingVertical;
+        graph.setFont(font.deriveFont(Font.BOLD));
+        h = graph.getFontMetrics().getAscent() + graph.getFontMetrics().getLeading() + paddingVertical;
 
-        if (h + graph.getFontMetrics ().getDescent () + paddingVertical >= this.height)
+        if (h + graph.getFontMetrics().getDescent() + paddingVertical >= this.height)
             return;
 
         // Write stereotype if small enough
-        int w = graph.getFontMetrics ().stringWidth (ster);
-        if (w + 2*paddingHorizontal < this.width)
-            graph.drawString (ster, this.x + (this.width - w)/2, this.y + h);
+        int w = graph.getFontMetrics().stringWidth(ster);
+        if (w + 2 * paddingHorizontal < this.width)
+            graph.drawString(ster, this.x + (this.width - w) / 2, this.y + h);
         else {
             // try to draw with "..." instead
             if (!this.isCrypto)
@@ -418,38 +404,38 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             else
                 ster = stereotypeCrypto;
 
-            for (int stringLength = ster.length ()-1; stringLength >= 0; stringLength--) {
-                String abbrev = "<<" + ster.substring (0, stringLength) + "...>>";
-                w = graph.getFontMetrics ().stringWidth (abbrev);
-                if (w + 2*paddingHorizontal < this.width) {
-                    graph.drawString (abbrev, this.x + (this.width - w)/2, this.y + h);
+            for (int stringLength = ster.length() - 1; stringLength >= 0; stringLength--) {
+                String abbrev = "<<" + ster.substring(0, stringLength) + "...>>";
+                w = graph.getFontMetrics().stringWidth(abbrev);
+                if (w + 2 * paddingHorizontal < this.width) {
+                    graph.drawString(abbrev, this.x + (this.width - w) / 2, this.y + h);
                     break;
                 }
             }
         }
 
         // Write value if small enough
-        graph.setFont (font);
-        h += graph.getFontMetrics ().getHeight () + paddingVertical;
-        if (h + graph.getFontMetrics ().getDescent () + paddingVertical >= this.height)
+        graph.setFont(font);
+        h += graph.getFontMetrics().getHeight() + paddingVertical;
+        if (h + graph.getFontMetrics().getDescent() + paddingVertical >= this.height)
             return;
 
-        w = graph.getFontMetrics ().stringWidth (this.value);
-        if (w + 2*paddingHorizontal < this.width)
-            graph.drawString (this.value, this.x + (this.width - w)/2, this.y + h);
+        w = graph.getFontMetrics().stringWidth(this.value);
+        if (w + 2 * paddingHorizontal < this.width)
+            graph.drawString(this.value, this.x + (this.width - w) / 2, this.y + h);
         else {
             // try to draw with "..." instead
-            for (int stringLength = this.value.length ()-1; stringLength >= 0; stringLength--) {
-                String abbrev = this.value.substring (0, stringLength) + "...";
-                w = graph.getFontMetrics ().stringWidth (abbrev);
-                if (w + 2*paddingHorizontal < this.width) {
-                    graph.drawString (abbrev, this.x + (this.width - w)/2, this.y + h);
+            for (int stringLength = this.value.length() - 1; stringLength >= 0; stringLength--) {
+                String abbrev = this.value.substring(0, stringLength) + "...";
+                w = graph.getFontMetrics().stringWidth(abbrev);
+                if (w + 2 * paddingHorizontal < this.width) {
+                    graph.drawString(abbrev, this.x + (this.width - w) / 2, this.y + h);
                     break;
                 }
             }
         }
 
-        h += graph.getFontMetrics ().getDescent () + paddingVertical;
+        h += graph.getFontMetrics().getDescent() + paddingVertical;
 
         // Update lower bound of text
         this.limitName = this.y + h;
@@ -458,21 +444,21 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             return;
 
         // Draw separator
-        graph.drawLine (this.x, this.y+h, this.x+this.width, this.y+h);
+        graph.drawLine(this.x, this.y + h, this.x + this.width, this.y + h);
 
-        if (! this.tdp.areAttributesVisible ())
+        if (!this.tdp.areAttributesVisible())
             return;
 
         // Set font size
         // int attributeFontSize = Math.min (12, this.currentFontSize - 2);
-        int attributeFontSize = this.currentFontSize*5/6;
-        graph.setFont (font.deriveFont ((float) attributeFontSize));
-        int step = graph.getFontMetrics ().getHeight ();
+        int attributeFontSize = this.currentFontSize * 5 / 6;
+        graph.setFont(font.deriveFont((float) attributeFontSize));
+        int step = graph.getFontMetrics().getHeight();
 
         h += paddingVertical;
 
         // Parameters
-        for (TAttribute attr: this.parameters) {
+        for (TAttribute attr : this.parameters) {
             h += step;
             if (h >= this.height - paddingHorizontal) {
                 this.limitParameters = this.y + this.height;
@@ -480,20 +466,20 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             }
 
             // Get the string for this parameter
-            String attrString = attr.toAvatarString ();
+            String attrString = attr.toAvatarString();
 
             // Try to draw it
-            w = graph.getFontMetrics ().stringWidth (attrString);
-            if (w + 2*paddingHorizontal < this.width)
-                graph.drawString (attrString, this.x + paddingHorizontal, this.y + h);
+            w = graph.getFontMetrics().stringWidth(attrString);
+            if (w + 2 * paddingHorizontal < this.width)
+                graph.drawString(attrString, this.x + paddingHorizontal, this.y + h);
             else {
                 // If we can't, try to draw with "..." instead
                 int stringLength;
-                for (stringLength = attrString.length ()-1; stringLength >= 0; stringLength--) {
-                    String abbrev = attrString.substring (0, stringLength) + "...";
-                    w = graph.getFontMetrics ().stringWidth (abbrev);
-                    if (w + 2*paddingHorizontal < this.width) {
-                        graph.drawString (abbrev, this.x + paddingHorizontal, this.y + h);
+                for (stringLength = attrString.length() - 1; stringLength >= 0; stringLength--) {
+                    String abbrev = attrString.substring(0, stringLength) + "...";
+                    w = graph.getFontMetrics().stringWidth(abbrev);
+                    if (w + 2 * paddingHorizontal < this.width) {
+                        graph.drawString(abbrev, this.x + paddingHorizontal, this.y + h);
                         break;
                     }
                 }
@@ -504,7 +490,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             }
         }
 
-        h += graph.getFontMetrics ().getDescent () + paddingVertical;
+        h += graph.getFontMetrics().getDescent() + paddingVertical;
 
         // Remember the end of parameters
         this.limitParameters = this.y + h;
@@ -512,29 +498,29 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         if (h + paddingVertical >= this.height)
             return;
 
-        graph.drawLine (this.x, this.y+h, this.x+this.width, this.y+h);
+        graph.drawLine(this.x, this.y + h, this.x + this.width, this.y + h);
         h += paddingVertical;
 
         // Signals
-        for (AvatarSignal signal: this.signals) {
-            h += step ;
+        for (AvatarSignal signal : this.signals) {
+            h += step;
             if (h >= this.height - paddingHorizontal) {
                 this.limitSignals = this.y + this.height;
                 return;
             }
 
-            String signalString = "~ " + signal.toString ();
-            w = graph.getFontMetrics ().stringWidth (signalString);
-            if (w + 2*paddingHorizontal < this.width)
-                graph.drawString (signalString, this.x + paddingHorizontal, this.y + h);
+            String signalString = "~ " + signal.toString();
+            w = graph.getFontMetrics().stringWidth(signalString);
+            if (w + 2 * paddingHorizontal < this.width)
+                graph.drawString(signalString, this.x + paddingHorizontal, this.y + h);
             else {
                 // If we can't, try to draw with "..." instead
                 int stringLength;
-                for (stringLength = signalString.length ()-1; stringLength >= 0; stringLength--) {
-                    String abbrev = signalString.substring (0, stringLength) + "...";
-                    w = graph.getFontMetrics ().stringWidth (abbrev);
-                    if (w + 2*paddingHorizontal < this.width) {
-                        graph.drawString (abbrev, this.x + paddingHorizontal, this.y + h);
+                for (stringLength = signalString.length() - 1; stringLength >= 0; stringLength--) {
+                    String abbrev = signalString.substring(0, stringLength) + "...";
+                    w = graph.getFontMetrics().stringWidth(abbrev);
+                    if (w + 2 * paddingHorizontal < this.width) {
+                        graph.drawString(abbrev, this.x + paddingHorizontal, this.y + h);
                         break;
                     }
                 }
@@ -545,7 +531,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             }
         }
 
-        h += graph.getFontMetrics ().getDescent () + paddingVertical;
+        h += graph.getFontMetrics().getDescent() + paddingVertical;
 
         // Remember limit of signals
         this.limitSignals = this.y + h;
@@ -553,29 +539,29 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         if (h + paddingVertical >= this.height)
             return;
 
-        graph.drawLine (this.x, this.y+h, this.x+this.width, this.y+h);
+        graph.drawLine(this.x, this.y + h, this.x + this.width, this.y + h);
         h += paddingVertical;
 
         // Return Attributes
-        for (TAttribute attr: this.returnAttributes) {
+        for (TAttribute attr : this.returnAttributes) {
             h += step;
             if (h >= this.height - paddingHorizontal)
                 return;
 
             // Get the string for this return attribute
-            String attrString = attr.toAvatarString ();
+            String attrString = attr.toAvatarString();
 
-            w = graph.getFontMetrics ().stringWidth (attrString);
-            if (w + 2*paddingHorizontal < this.width)
-                graph.drawString (attrString, this.x + paddingHorizontal, this.y + h);
+            w = graph.getFontMetrics().stringWidth(attrString);
+            if (w + 2 * paddingHorizontal < this.width)
+                graph.drawString(attrString, this.x + paddingHorizontal, this.y + h);
             else {
                 // If we can't, try to draw with "..." instead
                 int stringLength;
-                for (stringLength = attrString.length ()-1; stringLength >= 0; stringLength--) {
-                    String abbrev = attrString.substring (0, stringLength) + "...";
-                    w = graph.getFontMetrics ().stringWidth (abbrev);
-                    if (w + 2*paddingHorizontal < this.width) {
-                        graph.drawString (abbrev, this.x + paddingHorizontal, this.y + h);
+                for (stringLength = attrString.length() - 1; stringLength >= 0; stringLength--) {
+                    String abbrev = attrString.substring(0, stringLength) + "...";
+                    w = graph.getFontMetrics().stringWidth(abbrev);
+                    if (w + 2 * paddingHorizontal < this.width) {
+                        graph.drawString(abbrev, this.x + paddingHorizontal, this.y + h);
                         break;
                     }
                 }
@@ -588,14 +574,14 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
     }
 
     @Override
-    public void setName (String s) {
-        this.tdp.changeStateMachineTabName (this.name, s);
+    public void setName(String s) {
+        this.tdp.changeStateMachineTabName(this.name, s);
         this.name = s;
-        this.setValue (s);
+        this.setValue(s);
     }
 
     @Override
-    public TGComponent isOnMe (int x1, int y1) {
+    public TGComponent isOnMe(int x1, int y1) {
 
         if (GraphicLib.isInRectangle(x1, y1, this.x, this.y, this.width, this.height))
             return this;
@@ -605,26 +591,26 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
 
     @Override
     public boolean editOndoubleClick(JFrame frame, int _x, int _y) {
-        int paddingHorizontal = (int) (AvatarBDLibraryFunction.paddingHorizontal*this.tdp.getZoom ());
+        int paddingHorizontal = (int) (AvatarBDLibraryFunction.paddingHorizontal * this.tdp.getZoom());
         if (this.iconIsDrawn && GraphicLib.isInRectangle(
-                    _x,
-                    _y,
-                    this.x + this.width - IconManager.iconSize - paddingHorizontal,
-                    this.y + paddingHorizontal,
-                    IconManager.iconSize,
-                    IconManager.iconSize)) {
-            this.tdp.selectTab (this.getValue ());
+                _x,
+                _y,
+                this.x + this.width - IconManager.iconSize - paddingHorizontal,
+                this.y + paddingHorizontal,
+                IconManager.iconSize,
+                IconManager.iconSize)) {
+            this.tdp.selectTab(this.getValue());
             return true;
         }
 
         // Click on the name
         if (_y < limitName) {
-            String s = (String) JOptionPane.showInputDialog (frame, "Library Function Name",
+            String s = (String) JOptionPane.showInputDialog(frame, "Library Function Name",
                     "setting value", JOptionPane.PLAIN_MESSAGE, IconManager.imgic101,
                     null,
                     this.getValue());
 
-            if (s == null || s.isEmpty () || s.equals(this.value))
+            if (s == null || s.isEmpty() || s.equals(this.value))
                 return false;
 
             if (!TAttribute.isAValidId(s, false, false)) {
@@ -635,7 +621,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
                 return false;
             }
 
-            if (!this.tdp.isAvatarBlockNameUnique (s)) {
+            if (!this.tdp.isAvatarBlockNameUnique(s)) {
                 JOptionPane.showMessageDialog(frame,
                         "Could not change the name of the Library Function: the new name is already used by another element.",
                         "Error",
@@ -644,7 +630,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             }
 
             // Update the name of the tab corresponding to the state machine of the library function
-            if (!this.tdp.changeStateMachineTabName (this.value, s)) {
+            if (!this.tdp.changeStateMachineTabName(this.value, s)) {
                 JOptionPane.showMessageDialog(frame,
                         "Could not change the name of the Library Function: this name is already used by another tab.",
                         "Error",
@@ -654,7 +640,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
 
             this.name = s;
             this.value = s;
-            this.recalculateSize ();
+            this.recalculateSize();
             this.repaint = true;
 
             return true;
@@ -663,28 +649,28 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         // Click on parameters
 
         // Create a new dialog to change parameters, signals, return values, etc.
-        JDialogAvatarLibraryFunction dialog = new JDialogAvatarLibraryFunction (
+        JDialogAvatarLibraryFunction dialog = new JDialogAvatarLibraryFunction(
                 this,
                 frame,
                 "Settings of library function " + value,
                 "Library Function");
-        this.setJDialogOptions (dialog);
-     //   dialog.setSize (650, 575);
-        GraphicLib.centerOnParent (dialog,650, 575);
+        this.setJDialogOptions(dialog);
+        //   dialog.setSize (650, 575);
+        GraphicLib.centerOnParent(dialog, 650, 575);
 
         // Focus on the right input depending on the part that was clicked.
         // FIXME: if nothing is displayed, focus will go on tab 2 instead of tab 0
         if (_y < this.limitParameters)
-            dialog.selectTabIndex (0);
+            dialog.selectTabIndex(0);
         else if (_y < this.limitSignals)
-            dialog.selectTabIndex (1);
+            dialog.selectTabIndex(1);
         else
-            dialog.selectTabIndex (2);
+            dialog.selectTabIndex(2);
 
         // Set visible and block until dialog is closed
-        dialog.setVisible (true);
+        dialog.setVisible(true);
 
-        ((AvatarBDPanel) tdp).updateAllSignalsOnConnectors ();
+        ((AvatarBDPanel) tdp).updateAllSignalsOnConnectors();
 
         // Tag so that it is rescaled
         this.rescaled = true;
@@ -692,7 +678,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
         return true;
     }
 
-    protected void setJDialogOptions (JDialogAvatarLibraryFunction jdab) {
+    protected void setJDialogOptions(JDialogAvatarLibraryFunction jdab) {
         /*
         jdab.addAccess (TAttribute.getStringAccess (TAttribute.PRIVATE));
         jdab.addType (TAttribute.getStringAvatarType (TAttribute.BOOLEAN), true);
@@ -719,10 +705,10 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
      *
      * @return The string for the corresponding XML element.
      */
-    protected String translateExtraParam () {
-        StringBuffer sb = new StringBuffer ("<extraparam>\n");
+    protected String translateExtraParam() {
+        StringBuffer sb = new StringBuffer("<extraparam>\n");
         sb.append("<CryptoLibraryFunction value=\"" + isCrypto + "\" />\n");
-        for (TAttribute attr: this.parameters) {
+        for (TAttribute attr : this.parameters) {
             sb.append("<Parameter access=\"");
             sb.append(attr.getAccess());
             sb.append("\" id=\"");
@@ -736,13 +722,13 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             sb.append("\" />\n");
         }
 
-        for(AvatarSignal signal: this.signals) {
+        for (AvatarSignal signal : this.signals) {
             sb.append("<Signal value=\"");
             sb.append(signal.toString());
             sb.append("\" />\n");
         }
 
-        for (TAttribute attr: this.returnAttributes) {
+        for (TAttribute attr : this.returnAttributes) {
             sb.append("<ReturnAttribute access=\"");
             sb.append(attr.getAccess());
             sb.append("\" id=\"");
@@ -756,7 +742,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             sb.append("\" />\n");
         }
 
-        for (TAttribute attr: this.attributes) {
+        for (TAttribute attr : this.attributes) {
             sb.append("<Attribute access=\"");
             sb.append(attr.getAccess());
             sb.append("\" id=\"");
@@ -770,7 +756,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             sb.append("\" />\n");
         }
 
-        for(AvatarMethod method: this.methods) {
+        for (AvatarMethod method : this.methods) {
             sb.append("<Method value=\"");
             sb.append(method.toSaveString());
             sb.append("\" />\n");
@@ -783,23 +769,19 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
 
     /**
      * Load a Library Function element from a XML description.
-     *
+     * <p>
      * TODO
-     * @param nl
-     *      The {@link NodeList} representing the XML extraparam node
-     * @param decX
-     *      Unused.
-     * @param decY
-     *      Unused.
-     * @param decId
-     *      Unused.
      *
+     * @param nl    The {@link NodeList} representing the XML extraparam node
+     * @param decX  Unused.
+     * @param decY  Unused.
+     * @param decId Unused.
      * @throws MalformedModelingExpresion When the provided XML is corrupted.
      */
     @Override
-    public void loadExtraParam (NodeList nl, int decX, int decY, int decId) throws MalformedModelingException {
+    public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException {
         try {
-            for(int i=0; i<nl.getLength(); i++) {
+            for (int i = 0; i < nl.getLength(); i++) {
                 Node n1 = nl.item(i);
 
                 // Ignore if it's not an element
@@ -808,7 +790,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
 
                 // Fetch the children nodes
                 NodeList nli = n1.getChildNodes();
-                for(int j=0; j<nli.getLength(); j++) {
+                for (int j = 0; j < nli.getLength(); j++) {
                     Node n2 = nli.item(j);
 
                     // Ignore if it's not an element
@@ -816,96 +798,93 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
                         continue;
                     Element elt = (Element) n2;
 
-                    switch (elt.getTagName ()) {
+                    switch (elt.getTagName()) {
                         case "CryptoLibraryFunction":
-                            if (elt.getAttribute("value").equals ("true"))
+                            if (elt.getAttribute("value").equals("true"))
                                 this.isCrypto = true;
                             break;
 
-                        case "Parameter":
-                            {
-                                Integer access = Integer.decode (elt.getAttribute ("access")).intValue ();
-                                Integer type = Integer.decode (elt.getAttribute ("type")).intValue ();
-                                String typeOther = elt.getAttribute ("typeOther");
-                                String id = elt.getAttribute("id");
-                                String valueAtt = elt.getAttribute("value");
-                                if (valueAtt.equals("null"))
-                                    valueAtt = "";
-
-                                if (TAttribute.isAValidId (id, false, false) && TAttribute.isAValidInitialValue (type, valueAtt)) {
-                                    if (type == TAttribute.NATURAL)
-                                        type = TAttribute.INTEGER;
-
-                                    TAttribute ta = new TAttribute(access, id, valueAtt, type, typeOther);
-                                    ta.isAvatar = true;
-                                    this.parameters.add (ta);
-                                }
+                        case "Parameter": {
+                            Integer access = Integer.decode(elt.getAttribute("access")).intValue();
+                            Integer type = Integer.decode(elt.getAttribute("type")).intValue();
+                            String typeOther = elt.getAttribute("typeOther");
+                            String id = elt.getAttribute("id");
+                            String valueAtt = elt.getAttribute("value");
+                            if (valueAtt.equals("null"))
+                                valueAtt = "";
+
+                            if (TAttribute.isAValidId(id, false, false) && TAttribute.isAValidInitialValue(type, valueAtt)) {
+                                if (type == TAttribute.NATURAL)
+                                    type = TAttribute.INTEGER;
+
+                                TAttribute ta = new TAttribute(access, id, valueAtt, type, typeOther);
+                                ta.isAvatar = true;
+                                this.parameters.add(ta);
                             }
+                        }
 
-                            break;
+                        break;
 
                         case "Signal":
                             String signal = elt.getAttribute("value");
 
-                            if (signal.equals ("null"))
+                            if (signal.equals("null"))
                                 break;
 
-                            AvatarSignal as = AvatarSignal.isAValidSignal (signal);
+                            AvatarSignal as = AvatarSignal.isAValidSignal(signal);
                             if (as != null)
-                                this.signals.add (as);
+                                this.signals.add(as);
                             else
                                 TraceManager.addDev("Invalid signal ignored:" + signal);
 
                             break;
 
-                        case "ReturnAttribute":
-                            {
-                                Integer access = Integer.decode (elt.getAttribute ("access")).intValue ();
-                                Integer type = Integer.decode (elt.getAttribute ("type")).intValue ();
-                                String typeOther = elt.getAttribute ("typeOther");
-                                String id = elt.getAttribute("id");
-                                String valueAtt = elt.getAttribute("value");
-                                if (valueAtt.equals("null"))
-                                    valueAtt = "";
-
-                                if (TAttribute.isAValidId (id, false, false) && TAttribute.isAValidInitialValue (type, valueAtt)) {
-                                    if (type == TAttribute.NATURAL)
-                                        type = TAttribute.INTEGER;
-
-                                    TAttribute ta = new TAttribute(access, id, valueAtt, type, typeOther);
-                                    ta.isAvatar = true;
-                                    this.returnAttributes.add (ta);
-                                }
+                        case "ReturnAttribute": {
+                            Integer access = Integer.decode(elt.getAttribute("access")).intValue();
+                            Integer type = Integer.decode(elt.getAttribute("type")).intValue();
+                            String typeOther = elt.getAttribute("typeOther");
+                            String id = elt.getAttribute("id");
+                            String valueAtt = elt.getAttribute("value");
+                            if (valueAtt.equals("null"))
+                                valueAtt = "";
+
+                            if (TAttribute.isAValidId(id, false, false) && TAttribute.isAValidInitialValue(type, valueAtt)) {
+                                if (type == TAttribute.NATURAL)
+                                    type = TAttribute.INTEGER;
+
+                                TAttribute ta = new TAttribute(access, id, valueAtt, type, typeOther);
+                                ta.isAvatar = true;
+                                this.returnAttributes.add(ta);
                             }
+                        }
 
-                            break;
+                        break;
 
-                        case "Attribute":
-                            {
-                                Integer access = Integer.decode (elt.getAttribute ("access")).intValue ();
-                                Integer type = Integer.decode (elt.getAttribute ("type")).intValue ();
-                                String typeOther = elt.getAttribute ("typeOther");
-                                String id = elt.getAttribute("id");
-                                String valueAtt = elt.getAttribute("value");
-                                if (valueAtt.equals("null"))
-                                    valueAtt = "";
-
-                                if (TAttribute.isAValidId (id, false, false) && TAttribute.isAValidInitialValue (type, valueAtt)) {
-                                    if (type == TAttribute.NATURAL)
-                                        type = TAttribute.INTEGER;
-
-                                    TAttribute ta = new TAttribute(access, id, valueAtt, type, typeOther);
-                                    ta.isAvatar = true;
-                                    this.attributes.add (ta);
-                                }
+                        case "Attribute": {
+                            Integer access = Integer.decode(elt.getAttribute("access")).intValue();
+                            Integer type = Integer.decode(elt.getAttribute("type")).intValue();
+                            String typeOther = elt.getAttribute("typeOther");
+                            String id = elt.getAttribute("id");
+                            String valueAtt = elt.getAttribute("value");
+                            if (valueAtt.equals("null"))
+                                valueAtt = "";
+
+                            if (TAttribute.isAValidId(id, false, false) && TAttribute.isAValidInitialValue(type, valueAtt)) {
+                                if (type == TAttribute.NATURAL)
+                                    type = TAttribute.INTEGER;
+
+                                TAttribute ta = new TAttribute(access, id, valueAtt, type, typeOther);
+                                ta.isAvatar = true;
+                                this.attributes.add(ta);
                             }
+                        }
 
-                            break;
+                        break;
 
                         case "Method":
                             String method = elt.getAttribute("value");
 
-                            if (method.equals ("null"))
+                            if (method.equals("null"))
                                 break;
 
                             boolean implementation = false;
@@ -920,7 +899,7 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
                             AvatarMethod am = AvatarMethod.isAValidMethod(method);
                             if (am != null) {
                                 am.setImplementationProvided(implementation);
-                                this.methods.add (am);
+                                this.methods.add(am);
                             }
 
                             break;
@@ -943,8 +922,8 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
      *
      * @return The panel of the corresponding state machine diagram.
      */
-    public AvatarSMDPanel getAvatarSMDPanel () {
-        return ((AvatarDesignPanel) (this.tdp.tp)).getAvatarSMDPanel (this.value);
+    public AvatarSMDPanel getAvatarSMDPanel() {
+        return ((AvatarDesignPanel) (this.tdp.tp)).getAvatarSMDPanel(this.value);
     }
 
     /**
@@ -953,8 +932,8 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
     public void removeCryptoElements() {
         this.isCrypto = false;
 
-        for (String method: AvatarMethod.cryptoMethods)
-            this.removeMethodIfApplicable (method);
+        for (String method : AvatarMethod.cryptoMethods)
+            this.removeMethodIfApplicable(method);
     }
 
     /**
@@ -963,23 +942,22 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
     public void addCryptoElements() {
         this.isCrypto = true;
 
-        for (String method: AvatarMethod.cryptoMethods)
-            this.addMethodIfApplicable (method);
+        for (String method : AvatarMethod.cryptoMethods)
+            this.addMethodIfApplicable(method);
     }
 
     /**
      * Removes a method from the list of methods if it exists.
      *
-     * @param methodString
-     *      The String corresponding to the method to remove.
+     * @param methodString The String corresponding to the method to remove.
      */
     private void removeMethodIfApplicable(String methodString) {
-        Iterator<AvatarMethod> iterator = this.methods.iterator ();
-        while (iterator.hasNext ()) {
-            AvatarMethod am = iterator.next ();
+        Iterator<AvatarMethod> iterator = this.methods.iterator();
+        while (iterator.hasNext()) {
+            AvatarMethod am = iterator.next();
             // TODO: replace by a more OO way...
-            if (am.toString ().equals (methodString)) {
-                iterator.remove ();
+            if (am.toString().equals(methodString)) {
+                iterator.remove();
                 break;
             }
         }
@@ -988,46 +966,45 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
     /**
      * Adds a method to the list of methods if it doesn't already exist.
      *
-     * @param methodString
-     *      The String corresponding to the method to add.
+     * @param methodString The String corresponding to the method to add.
      */
-    private void addMethodIfApplicable (String methodString) {
-        for (AvatarMethod am: this.methods)
+    private void addMethodIfApplicable(String methodString) {
+        for (AvatarMethod am : this.methods)
             // TODO: replace by a more OO way...
-            if (am.toString ().equals (methodString))
-                    return;
+            if (am.toString().equals(methodString))
+                return;
 
-        AvatarMethod am = AvatarMethod.isAValidMethod (methodString);
+        AvatarMethod am = AvatarMethod.isAValidMethod(methodString);
         if (am != null)
-            this.methods.add (am);
+            this.methods.add(am);
     }
 
     @Override
-    public String getOwnerName () {
-        return this.getFunctionName ();
+    public String getOwnerName() {
+        return this.getFunctionName();
     }
 
     @Override
-    public LinkedList<TAttribute> getAttributeList () {
-        LinkedList<TAttribute> list = new LinkedList<TAttribute> ();
-        list.addAll (this.parameters);
-        list.addAll (this.returnAttributes);
-        list.addAll (this.attributes);
+    public LinkedList<TAttribute> getAttributeList() {
+        LinkedList<TAttribute> list = new LinkedList<TAttribute>();
+        list.addAll(this.parameters);
+        list.addAll(this.returnAttributes);
+        list.addAll(this.attributes);
 
         return list;
     }
 
     @Override
-    public LinkedList<String> getAllTimerList () {
-        LinkedList<String> v = new LinkedList<String> ();
+    public LinkedList<String> getAllTimerList() {
+        LinkedList<String> v = new LinkedList<String>();
 
-        for (TAttribute a: this.parameters)
+        for (TAttribute a : this.parameters)
             if (a.getType() == TAttribute.TIMER)
                 v.add(a.getId());
-        for (TAttribute a: this.returnAttributes)
+        for (TAttribute a : this.returnAttributes)
             if (a.getType() == TAttribute.TIMER)
                 v.add(a.getId());
-        for (TAttribute a: this.attributes)
+        for (TAttribute a : this.attributes)
             if (a.getType() == TAttribute.TIMER)
                 v.add(a.getId());
 
@@ -1035,38 +1012,38 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
     }
 
     @Override
-    public TAttribute getAttributeByName (String _name) {
-        for (TAttribute a: this.parameters)
+    public TAttribute getAttributeByName(String _name) {
+        for (TAttribute a : this.parameters)
             if (a.getId().compareTo(_name) == 0)
                 return a;
-        for (TAttribute a: this.returnAttributes)
+        for (TAttribute a : this.returnAttributes)
             if (a.getId().compareTo(_name) == 0)
                 return a;
-        for (TAttribute a: this.attributes)
+        for (TAttribute a : this.attributes)
             if (a.getId().compareTo(_name) == 0)
                 return a;
         return null;
     }
 
     @Override
-    public LinkedList<AvatarSignal> getSignalList () {
-        return new LinkedList<AvatarSignal> (this.signals);
+    public LinkedList<AvatarSignal> getSignalList() {
+        return new LinkedList<AvatarSignal>(this.signals);
     }
 
     @Override
-    public LinkedList<AvatarSignal> getAllSignalList () {
-        return this.getSignalList ();
+    public LinkedList<AvatarSignal> getAllSignalList() {
+        return this.getSignalList();
     }
 
     @Override
-    public AvatarSignal getSignalNameBySignalDef (String _id) {
+    public AvatarSignal getSignalNameBySignalDef(String _id) {
         int index0 = _id.indexOf('(');
         if (index0 > -1)
             _id = _id.substring(0, index0);
 
         _id = _id.trim();
-        for (AvatarSignal as: this.signals)
-            if (as.getId().equals (_id))
+        for (AvatarSignal as : this.signals)
+            if (as.getId().equals(_id))
                 return as;
 
         return null;
@@ -1078,23 +1055,23 @@ public class AvatarBDLibraryFunction extends TGCScalableWithoutInternalComponent
             // Too large to fit in the father? -> resize it!
             this.resizeToFatherSize();
 
-            this.setCdRectangle (0, this.father.getWidth() - this.getWidth(), 0, this.father.getHeight() - this.getHeight());
-            this.setMoveCd (this.x, this.y);
+            this.setCdRectangle(0, this.father.getWidth() - this.getWidth(), 0, this.father.getHeight() - this.getHeight());
+            this.setMoveCd(this.x, this.y);
         }
     }
 
     @Override
-    public LinkedList<AvatarMethod> getMethodList () {
-        return new LinkedList<AvatarMethod> (this.methods);
+    public LinkedList<AvatarMethod> getMethodList() {
+        return new LinkedList<AvatarMethod>(this.methods);
     }
 
     @Override
-    public LinkedList<AvatarMethod> getAllMethodList () {
-        return this.getMethodList ();
+    public LinkedList<AvatarMethod> getAllMethodList() {
+        return this.getMethodList();
     }
 
     @Override
-    public int compareTo (AvatarBDLibraryFunction f) {
-        return this.name.compareTo (f.getFunctionName ());
+    public int compareTo(AvatarBDLibraryFunction f) {
+        return this.name.compareTo(f.getFunctionName());
     }
 }
diff --git a/src/main/java/ui/avatarbd/AvatarBDPragma.java b/src/main/java/ui/avatarbd/AvatarBDPragma.java
index dc9666557e..a0c6e121dd 100755
--- a/src/main/java/ui/avatarbd/AvatarBDPragma.java
+++ b/src/main/java/ui/avatarbd/AvatarBDPragma.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,7 +31,7 @@
  * 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.
  */
@@ -229,7 +229,7 @@ public class AvatarBDPragma extends TGCScalableWithoutInternalComponent {
         int i = 1;
         Font heading = new Font("heading", Font.BOLD, this.tdp.getFontSize() * 7 / 6);
         g.setFont(heading);
-        g.drawString("Model Pragmas", x + textX, y + textY + currentFontSize);
+        g.drawString("Security features", x + textX, y + textY + currentFontSize);
         g.setFont(fold);
         for (String s : models) {
             g.drawString(s, x + textX, y + textY + (i + 1) * currentFontSize);
diff --git a/src/main/java/ui/avatarbd/AvatarBDToolBar.java b/src/main/java/ui/avatarbd/AvatarBDToolBar.java
index 4177b34d9d..53de8d401c 100644
--- a/src/main/java/ui/avatarbd/AvatarBDToolBar.java
+++ b/src/main/java/ui/avatarbd/AvatarBDToolBar.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,14 +31,12 @@
  * 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.
  */
 
 
-
-
 package ui.avatarbd;
 
 import ui.MainGUI;
@@ -51,12 +49,13 @@ import javax.swing.*;
 //import java.awt.event.*;
 
 /**
-   * Class AvatarBDToolBar
-   * Implements the toolbar to be used in conjunction with the panel of an AVATAR block diagram
-   * Creation: 06/04/2010
-   * @version 1.0 06/04/2010
-   * @author Ludovic APVRILLE
-   * @see AvatarBDPanel
+ * Class AvatarBDToolBar
+ * Implements the toolbar to be used in conjunction with the panel of an AVATAR block diagram
+ * Creation: 06/04/2010
+ *
+ * @author Ludovic APVRILLE
+ * @version 1.0 06/04/2010
+ * @see AvatarBDPanel
  */
 public class AvatarBDToolBar extends TToolBar {
 
@@ -110,18 +109,21 @@ public class AvatarBDToolBar extends TToolBar {
         button = this.add(mgui.actions[TGUIAction.UML_NOTE]);
         button.addMouseListener(mgui.mouseHandler);
 
-        button = this.add(mgui.actions[TGUIAction.PRAGMA]);
+        button = this.add(mgui.actions[TGUIAction.CONNECTOR_COMMENT]);
         button.addMouseListener(mgui.mouseHandler);
 
+        this.addSeparator();
+
         button = this.add(mgui.actions[TGUIAction.SAFETY_PRAGMA]);
         button.addMouseListener(mgui.mouseHandler);
 
-        button = this.add(mgui.actions[TGUIAction.PERFORMANCE_PRAGMA]);
+        button = this.add(mgui.actions[TGUIAction.PRAGMA]);
         button.addMouseListener(mgui.mouseHandler);
 
-        button = this.add(mgui.actions[TGUIAction.CONNECTOR_COMMENT]);
+        button = this.add(mgui.actions[TGUIAction.PERFORMANCE_PRAGMA]);
         button.addMouseListener(mgui.mouseHandler);
 
+
         this.addSeparator();
 
         button = this.add(mgui.actions[TGUIAction.ABD_BLOCK]);
@@ -132,9 +134,9 @@ public class AvatarBDToolBar extends TToolBar {
         button = this.add(mgui.actions[TGUIAction.ABD_CRYPTOBLOCK]);
         button.addMouseListener(mgui.mouseHandler);
         if (MainGUI.experimentalOn) {
-        	button = this.add(mgui.actions[TGUIAction.AVATAR_FIREWALL]);
-        	button.addMouseListener(mgui.mouseHandler);
-		}
+            button = this.add(mgui.actions[TGUIAction.AVATAR_FIREWALL]);
+            button.addMouseListener(mgui.mouseHandler);
+        }
         this.addSeparator();
 
         button = this.add(mgui.actions[TGUIAction.ABD_DATATYPE]);
diff --git a/src/main/java/ui/window/JDialogAttack.java b/src/main/java/ui/window/JDialogAttack.java
index 7ea131e33f..bffac7ea29 100755
--- a/src/main/java/ui/window/JDialogAttack.java
+++ b/src/main/java/ui/window/JDialogAttack.java
@@ -134,6 +134,7 @@ public class JDialogAttack extends JDialogBase implements ActionListener  {
         c0.weighty = 1.0;
         c0.weightx = 1.0;
         c0.gridwidth = GridBagConstraints.REMAINDER; //end row
+        c0.fill = GridBagConstraints.BOTH;
         c.add(panel2, c0);
         
         c0.gridwidth = 1;
diff --git a/src/main/java/ui/window/JDialogAvatarLibraryFunction.java b/src/main/java/ui/window/JDialogAvatarLibraryFunction.java
index ab94df970f..37a3229131 100755
--- a/src/main/java/ui/window/JDialogAvatarLibraryFunction.java
+++ b/src/main/java/ui/window/JDialogAvatarLibraryFunction.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,20 +31,17 @@
  * 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.
  */
 
 
-
-
 package ui.window;
 
 import myutil.GraphicLib;
 import ui.AvatarMethod;
 import ui.AvatarSignal;
-import ui.util.IconManager;
 import ui.TAttribute;
 import ui.avatarbd.AvatarBDLibraryFunction;
 
@@ -62,8 +59,9 @@ import java.util.LinkedList;
 
 /**
  * Dialog for managing parameters, return values, attributes, methods and signals of Avatar Library Functions
- * @version 1.0 04.11.2016
+ *
  * @author Florian Lugou
+ * @version 1.0 04.11.2016
  */
 public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionListener, ListSelectionListener {
     private AvatarBDLibraryFunction bdElement;
@@ -78,7 +76,7 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
     private JButton modifyButtons[];
     private JButton upButtons[];
     private JButton downButtons[];
-    private HashMap<Integer,JList<Object>> listAttribute;
+    private HashMap<Integer, JList<Object>> listAttribute;
     private ArrayList<LinkedList<Object>> attributes;
 
     // Parameters Tab
@@ -107,64 +105,74 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
     private JTextField methodText;
 
 
-    public JDialogAvatarLibraryFunction (AvatarBDLibraryFunction bdElement, JFrame frame, String title, String attrib) {
-        super (frame, title, true);
+    public JDialogAvatarLibraryFunction(AvatarBDLibraryFunction bdElement, JFrame frame, String title, String attrib) {
+        super(frame, title, true);
 
         this.bdElement = bdElement;
         this.checkKeyword = true;
         this.checkJavaKeyword = true;
 
-        this.removeButtons = new JButton [5];
-        this.modifyButtons = new JButton [5];
-        this.upButtons = new JButton [5];
-        this.downButtons = new JButton [5];
+        this.removeButtons = new JButton[5];
+        this.modifyButtons = new JButton[5];
+        this.upButtons = new JButton[5];
+        this.downButtons = new JButton[5];
         this.listAttribute = new HashMap<>();
         this.attributes = new ArrayList<>();
 
-        LinkedList<Object> l = new LinkedList<> ();
-        for (TAttribute attr: this.bdElement.getParameters ())
-            l.add (attr.makeClone ());
+        LinkedList<Object> l = new LinkedList<>();
+        for (TAttribute attr : this.bdElement.getParameters())
+            l.add(attr.makeClone());
         this.attributes.add(l);
 
-        l = new LinkedList<> ();
-        for (AvatarSignal signal: this.bdElement.getSignals ())
-            l.add (signal.makeClone ());
+        l = new LinkedList<>();
+        for (AvatarSignal signal : this.bdElement.getSignals())
+            l.add(signal.makeClone());
         this.attributes.add(l);
 
-        l = new LinkedList<> ();
-        for (TAttribute attr: this.bdElement.getReturnAttributes ())
-            l.add (attr.makeClone ());
+        l = new LinkedList<>();
+        for (TAttribute attr : this.bdElement.getReturnAttributes())
+            l.add(attr.makeClone());
         this.attributes.add(l);
 
-        l = new LinkedList<> ();
-        for (TAttribute attr: this.bdElement.getAttributes ())
-            l.add (attr.makeClone ());
+        l = new LinkedList<>();
+        for (TAttribute attr : this.bdElement.getAttributes())
+            l.add(attr.makeClone());
         this.attributes.add(l);
 
-        l = new LinkedList<> ();
-        for (AvatarMethod meth: this.bdElement.getMethods ())
-            l.add (meth.makeClone ());
+        l = new LinkedList<>();
+        for (AvatarMethod meth : this.bdElement.getMethods())
+            l.add(meth.makeClone());
         this.attributes.add(l);
 
-        this.initComponents ();
+        this.initComponents();
 
         this.addAccess(TAttribute.getStringAccess(TAttribute.PRIVATE));
         this.addType(TAttribute.getStringAvatarType(TAttribute.BOOLEAN));
         this.addType(TAttribute.getStringAvatarType(TAttribute.INTEGER));
         this.addType(TAttribute.getStringType(TAttribute.TIMER));
-        for(String s: this.bdElement.getDiagramPanel ().getAllDataTypes())
+        for (String s : this.bdElement.getDiagramPanel().getAllDataTypes())
             this.addType(s);
         /*
         pack();
         */
     }
 
-    private void fillGenericAttributesTab (JPanel tab, int tabIndex, String tabTitle, JComboBox<String> accessBox, JTextField identifierText, JTextField initialValue, JComboBox<String> typeBox) {
+    private void fillGenericAttributesTab(JPanel tab, int tabIndex, String tabTitle, JComboBox<String> accessBox, JTextField identifierText, JTextField initialValue, JComboBox<String> typeBox) {
         // West Panel
-        JPanel panelWest = new JPanel ();
-        tab.add(panelWest, BorderLayout.WEST);
-        panelWest.setLayout (new GridBagLayout ());
-        panelWest.setBorder (new javax.swing.border.TitledBorder ("Adding " + tabTitle + "s"));
+
+        GridBagConstraints c0 = new GridBagConstraints();
+
+
+        c0.gridwidth = 1;
+        c0.gridheight = 1;
+        c0.weighty = 1.0;
+        c0.weightx = 1.0;
+        c0.fill = GridBagConstraints.BOTH;
+
+        JPanel panelWest = new JPanel();
+        tab.add(panelWest, c0);
+        panelWest.setLayout(new GridBagLayout());
+        panelWest.setBorder(new javax.swing.border.TitledBorder("Adding " + tabTitle + "s"));
         panelWest.setPreferredSize(new Dimension(300, 450));
 
         //      first line of west panel (field titles)
@@ -222,26 +230,27 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         gridConstraints.fill = GridBagConstraints.HORIZONTAL;
         gridConstraints.weightx = 1.0;
         gridConstraints.gridwidth = 3;
-        this.modifyButtons[tabIndex] = new JButton ("Modify " + tabTitle);
+        this.modifyButtons[tabIndex] = new JButton("Modify " + tabTitle);
         this.modifyButtons[tabIndex].addActionListener(this);
-        this.modifyButtons[tabIndex].setEnabled (false);
+        this.modifyButtons[tabIndex].setEnabled(false);
         panelWest.add(this.modifyButtons[tabIndex], gridConstraints);
 
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
-        JButton addButton = new JButton ("Add " + tabTitle);
+        JButton addButton = new JButton("Add " + tabTitle);
         addButton.addActionListener(this);
         panelWest.add(addButton, gridConstraints);
 
 
         // East Panel
-        JPanel panelEast = new JPanel ();
-        tab.add(panelEast, BorderLayout.EAST);
-        panelEast.setLayout (new GridBagLayout ());
-        panelEast.setBorder (new javax.swing.border.TitledBorder("Managing " + tabTitle + "s"));
-        panelEast.setPreferredSize (new Dimension (300, 450));
+        c0.gridwidth = GridBagConstraints.REMAINDER;
+        JPanel panelEast = new JPanel();
+        tab.add(panelEast, c0);
+        panelEast.setLayout(new GridBagLayout());
+        panelEast.setBorder(new javax.swing.border.TitledBorder("Managing " + tabTitle + "s"));
+        panelEast.setPreferredSize(new Dimension(300, 450));
 
         //      first line east panel
-        this.listAttribute.put(tabIndex, new JList <> (this.attributes.get(tabIndex).toArray ()));
+        this.listAttribute.put(tabIndex, new JList<>(this.attributes.get(tabIndex).toArray()));
         this.listAttribute.get(tabIndex).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
         this.listAttribute.get(tabIndex).addListSelectionListener(this);
         JScrollPane scrollPane = new JScrollPane(this.listAttribute.get(tabIndex));
@@ -280,14 +289,15 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         panelEast.add(this.removeButtons[tabIndex], gridConstraints);
     }
 
-    private JPanel initParametersTab () {
-        JPanel panelParameters = new JPanel(new BorderLayout());
-        this.parametersAccessBox = new JComboBox<String> ();
-        this.parametersIdentifierText = new JTextField ();
-        this.parametersInitialValue = new JTextField ();
-        this.parametersTypeBox = new JComboBox<String> ();
+    private JPanel initParametersTab() {
+        GridBagLayout gridbag0 = new GridBagLayout();
+        JPanel panelParameters = new JPanel(gridbag0);
+        this.parametersAccessBox = new JComboBox<String>();
+        this.parametersIdentifierText = new JTextField();
+        this.parametersInitialValue = new JTextField();
+        this.parametersTypeBox = new JComboBox<String>();
 
-        this.fillGenericAttributesTab (
+        this.fillGenericAttributesTab(
                 panelParameters,
                 0,
                 "Parameter",
@@ -299,13 +309,21 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         return panelParameters;
     }
 
-    private JPanel initSignalsTab () {
-        JPanel panelSignals = new JPanel(new BorderLayout());
+    private JPanel initSignalsTab() {
+        GridBagLayout gridbag0 = new GridBagLayout();
+        GridBagConstraints c0 = new GridBagConstraints();
+        JPanel panelSignals = new JPanel(gridbag0);
+
+        c0.gridwidth = 1;
+        c0.gridheight = 1;
+        c0.weighty = 1.0;
+        c0.weightx = 1.0;
+        c0.fill = GridBagConstraints.BOTH;
 
         // West Panel
         JPanel panelWest = new JPanel();
-        panelSignals.add (panelWest, BorderLayout.WEST);
-        panelWest.setLayout(new GridBagLayout ());
+        panelSignals.add(panelWest, c0);
+        panelWest.setLayout(new GridBagLayout());
         panelWest.setBorder(new javax.swing.border.TitledBorder("Adding Signals"));
         panelWest.setPreferredSize(new Dimension(300, 250));
 
@@ -325,8 +343,8 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         //      second line west panel
         gridConstraints.gridwidth = 1;
         gridConstraints.fill = GridBagConstraints.HORIZONTAL;
-        this.signalInOutBox = new JComboBox<String> (new String[] {"in", "out"});
-        panelWest.add (this.signalInOutBox, gridConstraints);
+        this.signalInOutBox = new JComboBox<String>(new String[]{"in", "out"});
+        panelWest.add(this.signalInOutBox, gridConstraints);
 
         this.signalText = new JTextField();
         this.signalText.setColumns(50);
@@ -343,9 +361,9 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         gridConstraints.gridheight = 1;
         gridConstraints.fill = GridBagConstraints.HORIZONTAL;
         gridConstraints.gridwidth = 1;
-        this.modifyButtons[1] = new JButton ("Modify Signal");
+        this.modifyButtons[1] = new JButton("Modify Signal");
         this.modifyButtons[1].addActionListener(this);
-        this.modifyButtons[1].setEnabled (false);
+        this.modifyButtons[1].setEnabled(false);
         panelWest.add(this.modifyButtons[1], gridConstraints);
 
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
@@ -354,14 +372,15 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         panelWest.add(addSignalButton, gridConstraints);
 
         // East Panel
+        c0.gridwidth = GridBagConstraints.REMAINDER;
         JPanel panelEast = new JPanel();
-        panelSignals.add(panelEast, BorderLayout.EAST);
-        panelEast.setLayout(new GridBagLayout ());
+        panelSignals.add(panelEast, c0);
+        panelEast.setLayout(new GridBagLayout());
         panelEast.setBorder(new javax.swing.border.TitledBorder("Managing Signals"));
         panelEast.setPreferredSize(new Dimension(300, 250));
 
         //      first line east panel
-        this.listAttribute.put(1, new JList<> (this.attributes.get(1).toArray ()));
+        this.listAttribute.put(1, new JList<>(this.attributes.get(1).toArray()));
         this.listAttribute.get(1).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
         this.listAttribute.get(1).addListSelectionListener(this);
         JScrollPane scrollPane = new JScrollPane(this.listAttribute.get(1));
@@ -383,31 +402,32 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         //      third line east panel
         gridConstraints.fill = GridBagConstraints.HORIZONTAL;
         this.upButtons[1] = new JButton("Up");
-        this.upButtons[1].setEnabled (false);
+        this.upButtons[1].setEnabled(false);
         this.upButtons[1].addActionListener(this);
         panelEast.add(this.upButtons[1], gridConstraints);
 
         this.downButtons[1] = new JButton("Down");
-        this.downButtons[1].setEnabled (false);
+        this.downButtons[1].setEnabled(false);
         this.downButtons[1].addActionListener(this);
         panelEast.add(this.downButtons[1], gridConstraints);
 
         this.removeButtons[1] = new JButton("Remove Signal");
-        this.removeButtons[1].setEnabled (false);
+        this.removeButtons[1].setEnabled(false);
         this.removeButtons[1].addActionListener(this);
         panelEast.add(this.removeButtons[1], gridConstraints);
 
         return panelSignals;
     }
 
-    private JPanel initReturnAttributesTab () {
-        JPanel panelReturnAttributes = new JPanel(new BorderLayout());
-        this.returnAttributesAccessBox = new JComboBox<String> ();
-        this.returnAttributesIdentifierText = new JTextField ();
-        this.returnAttributesInitialValue = new JTextField ();
-        this.returnAttributesTypeBox = new JComboBox<String> ();
+    private JPanel initReturnAttributesTab() {
+        GridBagLayout gridbag0 = new GridBagLayout();
+        JPanel panelReturnAttributes = new JPanel(gridbag0);
+        this.returnAttributesAccessBox = new JComboBox<String>();
+        this.returnAttributesIdentifierText = new JTextField();
+        this.returnAttributesInitialValue = new JTextField();
+        this.returnAttributesTypeBox = new JComboBox<String>();
 
-        this.fillGenericAttributesTab (
+        this.fillGenericAttributesTab(
                 panelReturnAttributes,
                 2,
                 "Return Value",
@@ -419,14 +439,15 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         return panelReturnAttributes;
     }
 
-    private JPanel initAttributesTab () {
-        JPanel panelAttributes = new JPanel(new BorderLayout());
-        this.attributesAccessBox = new JComboBox<String> ();
-        this.attributesIdentifierText = new JTextField ();
-        this.attributesInitialValue = new JTextField ();
-        this.attributesTypeBox = new JComboBox<String> ();
+    private JPanel initAttributesTab() {
+        GridBagLayout gridbag0 = new GridBagLayout();
+        JPanel panelAttributes = new JPanel(gridbag0);
+        this.attributesAccessBox = new JComboBox<String>();
+        this.attributesIdentifierText = new JTextField();
+        this.attributesInitialValue = new JTextField();
+        this.attributesTypeBox = new JComboBox<String>();
 
-        this.fillGenericAttributesTab (
+        this.fillGenericAttributesTab(
                 panelAttributes,
                 3,
                 "Local Attribute",
@@ -438,15 +459,23 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         return panelAttributes;
     }
 
-    private JPanel initMethodsTab () {
-        JPanel panelMethods = new JPanel(new BorderLayout());
+    private JPanel initMethodsTab() {
+        GridBagLayout gridbag0 = new GridBagLayout();
+        GridBagConstraints c0 = new GridBagConstraints();
+        JPanel panelMethods = new JPanel(gridbag0);
+
+        c0.gridwidth = 1;
+        c0.gridheight = 1;
+        c0.weighty = 1.0;
+        c0.weightx = 1.0;
+        c0.fill = GridBagConstraints.BOTH;
 
         // Panel West
         JPanel panelWest = new JPanel();
-        panelMethods.add(panelWest, BorderLayout.WEST);
-        panelWest.setLayout(new GridBagLayout ());
+        panelMethods.add(panelWest, c0);
+        panelWest.setLayout(new GridBagLayout());
         panelWest.setBorder(new javax.swing.border.TitledBorder("Adding Methods"));
-        panelWest.setPreferredSize(new Dimension(300, 250));
+        //panelWest.setPreferredSize(new Dimension(300, 250));
 
         //      first line west panel
         GridBagConstraints gridConstraints = new GridBagConstraints();
@@ -477,9 +506,9 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         gridConstraints.gridheight = 1;
         gridConstraints.fill = GridBagConstraints.HORIZONTAL;
         gridConstraints.gridwidth = 1;
-        this.modifyButtons[4] = new JButton ("Modify Method");
+        this.modifyButtons[4] = new JButton("Modify Method");
         this.modifyButtons[4].addActionListener(this);
-        this.modifyButtons[4].setEnabled (false);
+        this.modifyButtons[4].setEnabled(false);
         panelWest.add(this.modifyButtons[4], gridConstraints);
 
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
@@ -489,14 +518,15 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
 
 
         // Panel East
+        c0.gridwidth = GridBagConstraints.REMAINDER; //end row
         JPanel panelEast = new JPanel();
-        panelMethods.add(panelEast, BorderLayout.EAST);
-        panelEast.setLayout(new GridBagLayout ());
+        panelMethods.add(panelEast, c0);
+        panelEast.setLayout(new GridBagLayout());
         panelEast.setBorder(new javax.swing.border.TitledBorder("Managing Methods"));
-        panelEast.setPreferredSize(new Dimension(300, 250));
+        //panelEast.setPreferredSize(new Dimension(300, 250));
 
         //      first line east panel
-        this.listAttribute.put(4, new JList<> (this.attributes.get(4).toArray ()));
+        this.listAttribute.put(4, new JList<>(this.attributes.get(4).toArray()));
         this.listAttribute.get(4).setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
         this.listAttribute.get(4).addListSelectionListener(this);
         JScrollPane scrollPane = new JScrollPane(this.listAttribute.get(4));
@@ -520,17 +550,17 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
         gridConstraints.fill = GridBagConstraints.HORIZONTAL;
         this.upButtons[4] = new JButton("Up");
-        this.upButtons[4].setEnabled (false);
+        this.upButtons[4].setEnabled(false);
         this.upButtons[4].addActionListener(this);
         panelEast.add(this.upButtons[4], gridConstraints);
 
         this.downButtons[4] = new JButton("Down");
-        this.downButtons[4].setEnabled (false);
+        this.downButtons[4].setEnabled(false);
         this.downButtons[4].addActionListener(this);
         panelEast.add(this.downButtons[4], gridConstraints);
 
         this.removeButtons[4] = new JButton("Remove Method");
-        this.removeButtons[4].setEnabled (false);
+        this.removeButtons[4].setEnabled(false);
         this.removeButtons[4].addActionListener(this);
         panelEast.add(this.removeButtons[4], gridConstraints);
 
@@ -539,43 +569,48 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
 
     private void initComponents() {
         // Get container
-        Container c = this.getContentPane ();
-        c.setLayout (new GridBagLayout ());
+        Container c = this.getContentPane();
+        c.setLayout(new GridBagLayout());
+        c.setLayout(new BorderLayout());
 
-        this.setFont (new Font("Helvetica", Font.PLAIN, 14));
-        this.setDefaultCloseOperation (JFrame.DISPOSE_ON_CLOSE);
+        this.setFont(new Font("Helvetica", Font.PLAIN, 14));
+        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 
         // Add the tabs panel
         // Issue #41 Ordering of tabbed panes 
         this.tabbedPane = GraphicLib.createTabbedPane();//new JTabbedPane();
 
-        tabbedPane.addTab ("Parameters", this.initParametersTab ());            // Parameters Tab
-        tabbedPane.addTab ("Signals", this.initSignalsTab ());                  // Signals Tab
-        tabbedPane.addTab ("Return Values", this.initReturnAttributesTab ());   // Return Attributes Tab
-        tabbedPane.addTab ("Attributes", this.initAttributesTab ());            // Attributes Tab
-        tabbedPane.addTab ("Methods", this.initMethodsTab ());                  // Methods Tab
+        tabbedPane.addTab("Parameters", this.initParametersTab());            // Parameters Tab
+        tabbedPane.addTab("Signals", this.initSignalsTab());                  // Signals Tab
+        tabbedPane.addTab("Return Values", this.initReturnAttributesTab());   // Return Attributes Tab
+        tabbedPane.addTab("Attributes", this.initAttributesTab());            // Attributes Tab
+        tabbedPane.addTab("Methods", this.initMethodsTab());                  // Methods Tab
 
         GridBagConstraints gridConstraints = new GridBagConstraints();
         gridConstraints.gridwidth = 1;
-        gridConstraints.gridheight = 10;
+        gridConstraints.gridheight = 20;
         gridConstraints.weighty = 1.0;
         gridConstraints.weightx = 1.0;
         gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
-        c.add(tabbedPane, gridConstraints);
+        gridConstraints.fill = GridBagConstraints.BOTH; //end row
+        //c.add(tabbedPane, gridConstraints);
+        c.add(tabbedPane, BorderLayout.CENTER);
 
         // Add Save & Close button
         gridConstraints.gridwidth = 1;
         gridConstraints.gridheight = 1;
         gridConstraints.fill = GridBagConstraints.HORIZONTAL;
-        
-        initButtons(gridConstraints, c, this);
+
+        c.add(initBasicButtons(this), BorderLayout.SOUTH);
+
+
     }
 
-    public void selectTabIndex (int tab) {
+    public void selectTabIndex(int tab) {
         this.tabbedPane.setSelectedIndex(tab);
     }
 
-    private void highlightField (final JTextField textField) {
+    private void highlightField(final JTextField textField) {
         /*
         (new Thread () {
             public void run () {
@@ -596,30 +631,30 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         */
     }
 
-    public void actionPerformed (ActionEvent evt) {
-        Object source = evt.getSource ();
+    public void actionPerformed(ActionEvent evt) {
+        Object source = evt.getSource();
         if (source == this.closeButton) {
-            this.save ();
-            this.dispose ();
+            this.save();
+            this.dispose();
         } else if (source == this.cancelButton)
-            this.dispose ();
+            this.dispose();
         else if (source instanceof JButton) {
-            String label = ((JButton) source).getText ().split (" ", 2)[0];
+            String label = ((JButton) source).getText().split(" ", 2)[0];
             switch (label) {
                 case "Add":
-                    this.handleAdd ();
+                    this.handleAdd();
                     break;
                 case "Modify":
-                    this.handleModify ();
+                    this.handleModify();
                     break;
                 case "Up":
-                    this.handleUp ();
+                    this.handleUp();
                     break;
                 case "Down":
-                    this.handleDown ();
+                    this.handleDown();
                     break;
                 case "Remove":
-                    this.handleRemove ();
+                    this.handleRemove();
                     break;
                 default:
                     // Should not arrive here
@@ -633,108 +668,108 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         }
         */
     }
-    
-    private void save () {
-        this.bdElement.resetParameters ();
-        for (Object o: this.attributes.get(0))
-            this.bdElement.addParameter ((TAttribute) o);
-        this.bdElement.resetSignals ();
-        for (Object o: this.attributes.get(1))
-            this.bdElement.addSignal ((AvatarSignal) o);
-        this.bdElement.resetReturnAttributes ();
-        for (Object o: this.attributes.get(2))
-            this.bdElement.addReturnAttribute ((TAttribute) o);
-        this.bdElement.resetAttributes ();
-        for (Object o: this.attributes.get(3))
-            this.bdElement.addAttribute ((TAttribute) o);
-        this.bdElement.resetMethods ();
-        for (Object o: this.attributes.get(4))
-            this.bdElement.addMethod ((AvatarMethod) o);
+
+    private void save() {
+        this.bdElement.resetParameters();
+        for (Object o : this.attributes.get(0))
+            this.bdElement.addParameter((TAttribute) o);
+        this.bdElement.resetSignals();
+        for (Object o : this.attributes.get(1))
+            this.bdElement.addSignal((AvatarSignal) o);
+        this.bdElement.resetReturnAttributes();
+        for (Object o : this.attributes.get(2))
+            this.bdElement.addReturnAttribute((TAttribute) o);
+        this.bdElement.resetAttributes();
+        for (Object o : this.attributes.get(3))
+            this.bdElement.addAttribute((TAttribute) o);
+        this.bdElement.resetMethods();
+        for (Object o : this.attributes.get(4))
+            this.bdElement.addMethod((AvatarMethod) o);
     }
 
-    private void handleAdd () {
-        int selectedTab = this.tabbedPane.getSelectedIndex ();
+    private void handleAdd() {
+        int selectedTab = this.tabbedPane.getSelectedIndex();
         switch (selectedTab) {
             case 0:
-                this.addAttribute (0, this.parametersAccessBox, this.parametersIdentifierText, this.parametersInitialValue, this.parametersTypeBox, false);
+                this.addAttribute(0, this.parametersAccessBox, this.parametersIdentifierText, this.parametersInitialValue, this.parametersTypeBox, false);
                 break;
             case 1:
-                this.addSignal (false);
+                this.addSignal(false);
                 break;
             case 2:
-                this.addAttribute (2, this.returnAttributesAccessBox, this.returnAttributesIdentifierText, this.returnAttributesInitialValue, this.returnAttributesTypeBox, false);
+                this.addAttribute(2, this.returnAttributesAccessBox, this.returnAttributesIdentifierText, this.returnAttributesInitialValue, this.returnAttributesTypeBox, false);
                 break;
             case 3:
-                this.addAttribute (3, this.attributesAccessBox, this.attributesIdentifierText, this.attributesInitialValue, this.attributesTypeBox, false);
+                this.addAttribute(3, this.attributesAccessBox, this.attributesIdentifierText, this.attributesInitialValue, this.attributesTypeBox, false);
                 break;
             case 4:
-                this.addMethod (false);
+                this.addMethod(false);
                 break;
             default:
                 // Should not arrive here
         }
     }
 
-    private void addAttribute (int tabIndex, JComboBox<String> accessBox, JTextField identifierText, JTextField initialValue, JComboBox<String> typeBox, boolean modify) {
-        String identifier = identifierText.getText ();
-        if (identifier.isEmpty ()) {
+    private void addAttribute(int tabIndex, JComboBox<String> accessBox, JTextField identifierText, JTextField initialValue, JComboBox<String> typeBox, boolean modify) {
+        String identifier = identifierText.getText();
+        if (identifier.isEmpty()) {
             // Identifier is empty
-            this.highlightField (identifierText);
-            identifierText.requestFocus ();
+            this.highlightField(identifierText);
+            identifierText.requestFocus();
             return;
         }
 
-        if (!TAttribute.isAValidId (identifier, this.checkKeyword, this.checkJavaKeyword)) {
+        if (!TAttribute.isAValidId(identifier, this.checkKeyword, this.checkJavaKeyword)) {
             // Identifier should not be used
-            JOptionPane.showMessageDialog (this,
-                                          "Bad identifier '" + identifier + "': invalid identifier",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            identifierText.requestFocus ();
+            JOptionPane.showMessageDialog(this,
+                    "Bad identifier '" + identifier + "': invalid identifier",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            identifierText.requestFocus();
             return;
         }
 
-        int accessIndex = TAttribute.getAccess ((String) accessBox.getSelectedItem ());
+        int accessIndex = TAttribute.getAccess((String) accessBox.getSelectedItem());
         if (accessIndex < 0) {
             // Unknown access modifier
-            JOptionPane.showMessageDialog (this,
-                                          "Bad access modifier",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            accessBox.requestFocus ();
+            JOptionPane.showMessageDialog(this,
+                    "Bad access modifier",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            accessBox.requestFocus();
             return;
         }
 
-        int typeIndex = TAttribute.getAvatarType ((String) typeBox.getSelectedItem ());
+        int typeIndex = TAttribute.getAvatarType((String) typeBox.getSelectedItem());
         if (typeIndex < 0) {
             // Unknown type
-            JOptionPane.showMessageDialog (this,
-                                          "Bad type",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            typeBox.requestFocus ();
+            JOptionPane.showMessageDialog(this,
+                    "Bad type",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            typeBox.requestFocus();
             return;
         }
 
-        String value = initialValue.getText().trim ();
-        if (typeIndex == TAttribute.ARRAY_NAT && value.isEmpty ())
+        String value = initialValue.getText().trim();
+        if (typeIndex == TAttribute.ARRAY_NAT && value.isEmpty())
             value = "2";
-        if (!initialValue.isEnabled ())
+        if (!initialValue.isEnabled())
             value = "";
 
         if (!TAttribute.isAValidInitialValue(typeIndex, value)) {
             // Bad initial value
-            JOptionPane.showMessageDialog (this,
-                                          "The initial value is not valid",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            initialValue.requestFocus ();
+            JOptionPane.showMessageDialog(this,
+                    "The initial value is not valid",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            initialValue.requestFocus();
             return;
         }
 
         TAttribute a;
         if (typeIndex == TAttribute.OTHER)
-            a = new TAttribute(accessIndex, identifier, value, (String) typeBox.getSelectedItem ());
+            a = new TAttribute(accessIndex, identifier, value, (String) typeBox.getSelectedItem());
         else
             a = new TAttribute(accessIndex, identifier, value, typeIndex);
         a.isAvatar = true;
@@ -742,44 +777,44 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         int index;
         Object old = null;
         if (modify) {
-            index = this.listAttribute.get(tabIndex).getSelectedIndex ();
-            old = this.attributes.get(tabIndex).remove (index);
+            index = this.listAttribute.get(tabIndex).getSelectedIndex();
+            old = this.attributes.get(tabIndex).remove(index);
         } else
-            index = this.attributes.get(tabIndex).size ();
+            index = this.attributes.get(tabIndex).size();
 
         //checks whether an attribute with this identifier already belongs to the list
-        if (this.attributes.get(0).contains (a) || this.attributes.get(2).contains (a) || this.attributes.get(3).contains (a)) {
+        if (this.attributes.get(0).contains(a) || this.attributes.get(2).contains(a) || this.attributes.get(3).contains(a)) {
             if (modify)
-                this.attributes.get(tabIndex).add (index, old);
-            JOptionPane.showMessageDialog (this,
-                                          "Bad Identifier: another attribute or parameter already has the same name.",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            identifierText.requestFocus ();
+                this.attributes.get(tabIndex).add(index, old);
+            JOptionPane.showMessageDialog(this,
+                    "Bad Identifier: another attribute or parameter already has the same name.",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            identifierText.requestFocus();
             return;
         }
 
-        this.attributes.get(tabIndex).add (index, a);
-        this.listAttribute.get(tabIndex).setListData (this.attributes.get(tabIndex).toArray ());
+        this.attributes.get(tabIndex).add(index, a);
+        this.listAttribute.get(tabIndex).setListData(this.attributes.get(tabIndex).toArray());
         this.listAttribute.get(tabIndex).setSelectedIndex(index);
-        this.listAttribute.get(tabIndex).requestFocus ();
+        this.listAttribute.get(tabIndex).requestFocus();
     }
 
-    private void addMethod (boolean modify) {
-        String s = this.methodText.getText().trim ();
-        if (s.isEmpty ()) {
-            this.methodText.requestFocus ();
+    private void addMethod(boolean modify) {
+        String s = this.methodText.getText().trim();
+        if (s.isEmpty()) {
+            this.methodText.requestFocus();
             return;
         }
 
         AvatarMethod am = AvatarMethod.isAValidMethod(s);
 
         if (am == null) {
-            JOptionPane.showMessageDialog (this,
-                                          "Badly formatted method declaration",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            this.methodText.requestFocus ();
+            JOptionPane.showMessageDialog(this,
+                    "Badly formatted method declaration",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            this.methodText.requestFocus();
             return;
         }
 
@@ -788,188 +823,188 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
         int index;
         Object old = null;
         if (modify) {
-            index = this.listAttribute.get(4).getSelectedIndex ();
-            old = this.attributes.get(4).remove (index);
+            index = this.listAttribute.get(4).getSelectedIndex();
+            old = this.attributes.get(4).remove(index);
         } else
-            index = this.attributes.get(4).size ();
+            index = this.attributes.get(4).size();
 
         // Checks whether the same method already belongs to the list
-        if (this.attributes.get(4).contains (am)) {
+        if (this.attributes.get(4).contains(am)) {
             if (modify)
-                this.attributes.get(4).add (index, old);
-            JOptionPane.showMessageDialog (this,
-                                          "This method already exists",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            this.methodText.requestFocus ();
+                this.attributes.get(4).add(index, old);
+            JOptionPane.showMessageDialog(this,
+                    "This method already exists",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            this.methodText.requestFocus();
             return;
         }
 
-        this.attributes.get(4).add (index, am);
-        this.listAttribute.get(4).setListData (this.attributes.get(4).toArray ());
+        this.attributes.get(4).add(index, am);
+        this.listAttribute.get(4).setListData(this.attributes.get(4).toArray());
         this.listAttribute.get(4).setSelectedIndex(index);
-        this.listAttribute.get(4).requestFocus ();
+        this.listAttribute.get(4).requestFocus();
     }
 
-    private void addSignal (boolean modify) {
-        String s = this.signalText.getText().trim ();
-        if (s.isEmpty ()) {
-            this.signalText.requestFocus ();
+    private void addSignal(boolean modify) {
+        String s = this.signalText.getText().trim();
+        if (s.isEmpty()) {
+            this.signalText.requestFocus();
             return;
         }
 
-        AvatarSignal as = AvatarSignal.isAValidSignal (this.signalInOutBox.getSelectedIndex(), s);
+        AvatarSignal as = AvatarSignal.isAValidSignal(this.signalInOutBox.getSelectedIndex(), s);
 
         if (as == null) {
-            JOptionPane.showMessageDialog (this,
-                                          "Badly formatted signal declaration",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            this.signalText.requestFocus ();
+            JOptionPane.showMessageDialog(this,
+                    "Badly formatted signal declaration",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            this.signalText.requestFocus();
             return;
         }
 
         int index;
         Object old = null;
         if (modify) {
-            index = this.listAttribute.get(1).getSelectedIndex ();
-            old = this.attributes.get(1).remove (index);
+            index = this.listAttribute.get(1).getSelectedIndex();
+            old = this.attributes.get(1).remove(index);
         } else
-            index = this.attributes.get(1).size ();
+            index = this.attributes.get(1).size();
 
 
         // Checks whether the same signal already belongs to the list
-        if (this.attributes.get(1).contains (as)) {
+        if (this.attributes.get(1).contains(as)) {
             if (modify)
-                this.attributes.get(1).add (index, old);
-            JOptionPane.showMessageDialog (this,
-                                          "This signal already exists",
-                                          "Error",
-                                          JOptionPane.ERROR_MESSAGE);
-            this.signalText.requestFocus ();
+                this.attributes.get(1).add(index, old);
+            JOptionPane.showMessageDialog(this,
+                    "This signal already exists",
+                    "Error",
+                    JOptionPane.ERROR_MESSAGE);
+            this.signalText.requestFocus();
             return;
         }
 
-        this.attributes.get(1).add (index, as);
-        this.listAttribute.get(1).setListData (this.attributes.get(1).toArray ());
+        this.attributes.get(1).add(index, as);
+        this.listAttribute.get(1).setListData(this.attributes.get(1).toArray());
         this.listAttribute.get(1).setSelectedIndex(index);
-        this.listAttribute.get(1).requestFocus ();
+        this.listAttribute.get(1).requestFocus();
     }
 
-    private void handleModify () {
-        int selectedTab = this.tabbedPane.getSelectedIndex ();
+    private void handleModify() {
+        int selectedTab = this.tabbedPane.getSelectedIndex();
         switch (selectedTab) {
             case 0:
-                this.addAttribute (0, this.parametersAccessBox, this.parametersIdentifierText, this.parametersInitialValue, this.parametersTypeBox, true);
+                this.addAttribute(0, this.parametersAccessBox, this.parametersIdentifierText, this.parametersInitialValue, this.parametersTypeBox, true);
                 break;
             case 1:
-                this.addSignal (true);
+                this.addSignal(true);
                 break;
             case 2:
-                this.addAttribute (2, this.returnAttributesAccessBox, this.returnAttributesIdentifierText, this.returnAttributesInitialValue, this.returnAttributesTypeBox, true);
+                this.addAttribute(2, this.returnAttributesAccessBox, this.returnAttributesIdentifierText, this.returnAttributesInitialValue, this.returnAttributesTypeBox, true);
                 break;
             case 3:
-                this.addAttribute (3, this.attributesAccessBox, this.attributesIdentifierText, this.attributesInitialValue, this.attributesTypeBox, true);
+                this.addAttribute(3, this.attributesAccessBox, this.attributesIdentifierText, this.attributesInitialValue, this.attributesTypeBox, true);
                 break;
             case 4:
-                this.addMethod (true);
+                this.addMethod(true);
                 break;
             default:
                 // Should not arrive here
         }
     }
 
-    private void handleUp () {
-        int selectedTab = this.tabbedPane.getSelectedIndex ();
+    private void handleUp() {
+        int selectedTab = this.tabbedPane.getSelectedIndex();
         int i = this.listAttribute.get(selectedTab).getSelectedIndex();
         if (i != -1 && i != 0) {
-            Collections.swap (this.attributes.get(selectedTab), i, i-1);
-            this.listAttribute.get(selectedTab).setListData(this.attributes.get(selectedTab).toArray ());
-            this.listAttribute.get(selectedTab).setSelectedIndex(i-1);
+            Collections.swap(this.attributes.get(selectedTab), i, i - 1);
+            this.listAttribute.get(selectedTab).setListData(this.attributes.get(selectedTab).toArray());
+            this.listAttribute.get(selectedTab).setSelectedIndex(i - 1);
         }
     }
 
-    private void handleDown () {
-        int selectedTab = this.tabbedPane.getSelectedIndex ();
+    private void handleDown() {
+        int selectedTab = this.tabbedPane.getSelectedIndex();
         int i = this.listAttribute.get(selectedTab).getSelectedIndex();
         if (i != -1 && i != this.attributes.get(selectedTab).size() - 1) {
-            Collections.swap (this.attributes.get(selectedTab), i, i+1);
-            this.listAttribute.get(selectedTab).setListData(this.attributes.get(selectedTab).toArray ());
-            this.listAttribute.get(selectedTab).setSelectedIndex(i+1);
+            Collections.swap(this.attributes.get(selectedTab), i, i + 1);
+            this.listAttribute.get(selectedTab).setListData(this.attributes.get(selectedTab).toArray());
+            this.listAttribute.get(selectedTab).setSelectedIndex(i + 1);
         }
     }
 
-    private void handleRemove () {
-        int selectedTab = this.tabbedPane.getSelectedIndex ();
+    private void handleRemove() {
+        int selectedTab = this.tabbedPane.getSelectedIndex();
         switch (selectedTab) {
             case 0:
-                this.removeAttribute (0);
+                this.removeAttribute(0);
                 break;
             case 1:
-                this.removeSignal ();
+                this.removeSignal();
                 break;
             case 2:
-                this.removeAttribute (2);
+                this.removeAttribute(2);
                 break;
             case 3:
-                this.removeAttribute (3);
+                this.removeAttribute(3);
                 break;
             case 4:
-                this.removeMethod ();
+                this.removeMethod();
                 break;
             default:
                 // Should not arrive here
         }
     }
 
-    private void removeAttribute (int tabIndex) {
-        int i = this.listAttribute.get(tabIndex).getSelectedIndex ();
+    private void removeAttribute(int tabIndex) {
+        int i = this.listAttribute.get(tabIndex).getSelectedIndex();
         if (i != -1) {
-            ((TAttribute) this.attributes.get(tabIndex).get (i)).setAccess (-1);
-            this.attributes.get(tabIndex).remove (i);
-            this.listAttribute.get(tabIndex).setListData (this.attributes.get(tabIndex).toArray ());
+            ((TAttribute) this.attributes.get(tabIndex).get(i)).setAccess(-1);
+            this.attributes.get(tabIndex).remove(i);
+            this.listAttribute.get(tabIndex).setListData(this.attributes.get(tabIndex).toArray());
         }
     }
 
-    private void removeSignal () {
-        int i = this.listAttribute.get(1).getSelectedIndex ();
+    private void removeSignal() {
+        int i = this.listAttribute.get(1).getSelectedIndex();
         if (i != -1) {
-            this.attributes.get(1).remove (i);
-            this.listAttribute.get(1).setListData(this.attributes.get(1).toArray ());
+            this.attributes.get(1).remove(i);
+            this.listAttribute.get(1).setListData(this.attributes.get(1).toArray());
         }
     }
 
-    private void removeMethod () {
+    private void removeMethod() {
         int i = this.listAttribute.get(4).getSelectedIndex();
-        if (i!= -1) {
-            this.attributes.get(4).remove (i);
-            this.listAttribute.get(4).setListData (this.attributes.get(4).toArray ());
+        if (i != -1) {
+            this.attributes.get(4).remove(i);
+            this.listAttribute.get(4).setListData(this.attributes.get(4).toArray());
         }
     }
 
-    public void valueChanged (ListSelectionEvent e) {
-        int selectedTab = this.tabbedPane.getSelectedIndex ();
-        int i = this.listAttribute.get(selectedTab).getSelectedIndex() ;
+    public void valueChanged(ListSelectionEvent e) {
+        int selectedTab = this.tabbedPane.getSelectedIndex();
+        int i = this.listAttribute.get(selectedTab).getSelectedIndex();
 
         this.removeButtons[selectedTab].setEnabled(i != -1);
         this.modifyButtons[selectedTab].setEnabled(i != -1);
         this.upButtons[selectedTab].setEnabled(i > 0);
-        this.downButtons[selectedTab].setEnabled(i != -1 && i < this.attributes.get(selectedTab).size ()-1);
+        this.downButtons[selectedTab].setEnabled(i != -1 && i < this.attributes.get(selectedTab).size() - 1);
 
         if (selectedTab == 1) { // Signals
             if (i == -1)
-                this.signalText.setText ("");
+                this.signalText.setText("");
             else {
-                AvatarSignal as = (AvatarSignal) (this.attributes.get(1).get (i));
-                this.signalText.setText (as.toBasicString());
-                this.signalInOutBox.setSelectedIndex (as.getInOut());
+                AvatarSignal as = (AvatarSignal) (this.attributes.get(1).get(i));
+                this.signalText.setText(as.toBasicString());
+                this.signalInOutBox.setSelectedIndex(as.getInOut());
             }
         } else if (selectedTab == 4) { // Methods
             if (i == -1)
-                this.methodText.setText ("");
+                this.methodText.setText("");
             else {
-                AvatarMethod am = (AvatarMethod) (this.attributes.get(4).get (i));
-                this.methodText.setText (am.toString());
+                AvatarMethod am = (AvatarMethod) (this.attributes.get(4).get(i));
+                this.methodText.setText(am.toString());
             }
         } else { // Attributes
             JTextField textField, initialValue;
@@ -993,39 +1028,39 @@ public class JDialogAvatarLibraryFunction extends JDialogBase implements ActionL
             }
 
             if (i == -1) {
-                textField.setText ("");
-                initialValue.setText ("");
+                textField.setText("");
+                initialValue.setText("");
                 accessBox.setSelectedIndex(0);
                 typeBox.setSelectedIndex(0);
             } else {
-                TAttribute a = (TAttribute) (this.attributes.get(selectedTab).get (i));
-                textField.setText (a.getId ());
+                TAttribute a = (TAttribute) (this.attributes.get(selectedTab).get(i));
+                textField.setText(a.getId());
                 initialValue.setText(a.getInitialValue());
-                this.select (accessBox, TAttribute.getStringAccess(a.getAccess()));
+                this.select(accessBox, TAttribute.getStringAccess(a.getAccess()));
                 if (a.getType() == TAttribute.OTHER)
-                    this.select (typeBox, a.getTypeOther());
+                    this.select(typeBox, a.getTypeOther());
                 else
-                    this.select (typeBox, TAttribute.getStringAvatarType(a.getType()));
+                    this.select(typeBox, TAttribute.getStringAvatarType(a.getType()));
             }
         }
     }
 
     public void addAccess(String s) {
-        this.parametersAccessBox.addItem (s);
-        this.attributesAccessBox.addItem (s);
-        this.returnAttributesAccessBox.addItem (s);
+        this.parametersAccessBox.addItem(s);
+        this.attributesAccessBox.addItem(s);
+        this.returnAttributesAccessBox.addItem(s);
     }
 
     public void addType(String s) {
-        this.parametersTypeBox.addItem (s);
-        this.attributesTypeBox.addItem (s);
-        this.returnAttributesTypeBox.addItem (s);
+        this.parametersTypeBox.addItem(s);
+        this.attributesTypeBox.addItem(s);
+        this.returnAttributesTypeBox.addItem(s);
     }
 
-    public void select (JComboBox<String> jcb, String text) {
-        for (int i=0; i < jcb.getItemCount(); i++) {
+    public void select(JComboBox<String> jcb, String text) {
+        for (int i = 0; i < jcb.getItemCount(); i++) {
             String s = jcb.getItemAt(i);
-            if (s.equals (text)) {
+            if (s.equals(text)) {
                 jcb.setSelectedIndex(i);
                 return;
             }
diff --git a/src/main/java/ui/window/JDialogBase.java b/src/main/java/ui/window/JDialogBase.java
index 4e4dd62806..b3aacf69d6 100644
--- a/src/main/java/ui/window/JDialogBase.java
+++ b/src/main/java/ui/window/JDialogBase.java
@@ -79,6 +79,28 @@ public class JDialogBase extends JDialog {
 		this.getRootPane().setDefaultButton(closeButton);
 	}
 
+	protected JPanel initBasicButtons(ActionListener al) {
+		JPanel buttonPanel = new JPanel(new GridBagLayout());
+		GridBagConstraints gridConstraints = new GridBagConstraints();
+		gridConstraints.gridwidth = 1;
+		gridConstraints.gridheight = 1;
+		gridConstraints.weighty = 1.0;
+		gridConstraints.weightx = 1.0;
+		gridConstraints.fill = GridBagConstraints.BOTH; //end row
+
+		cancelButton = new JButton("Cancel", IconManager.imgic27);
+		cancelButton.addActionListener(al);
+		buttonPanel.add(cancelButton, gridConstraints);
+
+		gridConstraints.gridwidth = GridBagConstraints.REMAINDER; //end row
+
+		closeButton = new JButton("Save and close", IconManager.imgic25);
+		closeButton.addActionListener(al);
+		buttonPanel.add(closeButton, gridConstraints);
+
+		return buttonPanel;
+	}
+
 
 
 	protected void initButtons(Container c,
diff --git a/src/main/java/ui/window/JDialogConstraintText.java b/src/main/java/ui/window/JDialogConstraintText.java
index 52def0b2f7..d58e9a9c30 100755
--- a/src/main/java/ui/window/JDialogConstraintText.java
+++ b/src/main/java/ui/window/JDialogConstraintText.java
@@ -134,6 +134,7 @@ public class JDialogConstraintText extends JDialogBase implements ActionListener
         c0.weighty = 1.0;
         c0.weightx = 1.0;
         c0.gridwidth = GridBagConstraints.REMAINDER; //end row
+        c0.fill = GridBagConstraints.BOTH;
         c.add(panel2, c0);
 
         c0.gridwidth = 1;
diff --git a/src/main/java/ui/window/JDialogCountermeasure.java b/src/main/java/ui/window/JDialogCountermeasure.java
index f03d2c3a21..2b36507d22 100755
--- a/src/main/java/ui/window/JDialogCountermeasure.java
+++ b/src/main/java/ui/window/JDialogCountermeasure.java
@@ -143,6 +143,7 @@ public class JDialogCountermeasure extends JDialogBase implements ActionListener
         c0.weighty = 1.0;
         c0.weightx = 1.0;
         c0.gridwidth = GridBagConstraints.REMAINDER; //end row
+        c0.fill = GridBagConstraints.BOTH;
         c.add(panel2, c0);
 
         c0.gridwidth = 1;
diff --git a/src/main/java/ui/window/JDialogPerformancePragma.java b/src/main/java/ui/window/JDialogPerformancePragma.java
index d4e0979e3a..ab990ef7b2 100644
--- a/src/main/java/ui/window/JDialogPerformancePragma.java
+++ b/src/main/java/ui/window/JDialogPerformancePragma.java
@@ -37,8 +37,6 @@
  */
 
 
-
-
 package ui.window;
 
 import ui.util.IconManager;
@@ -54,8 +52,9 @@ import java.util.HashMap;
  * Class JDialogPragma
  * Dialog for entering a note
  * Creation: 06/12/2003
- * @version 1.0 06/12/2003
+ *
  * @author Ludovic APVRILLE, Letitia LI
+ * @version 1.0 06/12/2003
  */
 public class JDialogPerformancePragma extends JDialogBase implements ActionListener {
 
@@ -69,7 +68,10 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
     protected JMenu help;
     protected JPopupMenu helpPopup;
     public HashMap<String, java.util.List<String>> blockAttributeMap = new HashMap<String, java.util.List<String>>();
-    /** Creates new form  */
+
+    /**
+     * Creates new form
+     */
     public JDialogPerformancePragma(Frame f, String title, String _text) {
         super(f, title, true);
         text = _text;
@@ -96,9 +98,9 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
             popupMenu.setOpaque(false);
             popupMenu.setBorder(null);
 
-            popupMenu.add(list = createSuggestionList(linePosition ,position, subWord), BorderLayout.CENTER);
+            popupMenu.add(list = createSuggestionList(linePosition, position, subWord), BorderLayout.CENTER);
             //Show popupMenu only if there are matching suggestions
-            if (list.getModel().getSize() >0){
+            if (list.getModel().getSize() > 0) {
                 popupMenu.show(textarea, location.x, textarea.getBaseline(0, 0) + location.y);
             }
         }
@@ -112,23 +114,20 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
 
         private JList createSuggestionList(int linePosition, final int position, final String subWord) {
             ArrayList<String> matches = new ArrayList<String>();
-            if (linePosition<6){
+            if (linePosition < 6) {
                 matches.add("Latency(");
-            }
-
-            else if (!subWord.contains(".")){
-                for (String block: blockAttributeMap.keySet()){
-                    if (block.startsWith(subWord)){
+            } else if (!subWord.contains(".")) {
+                for (String block : blockAttributeMap.keySet()) {
+                    if (block.startsWith(subWord)) {
                         matches.add(block);
                     }
                 }
-            }
-            else {
+            } else {
                 String block = subWord.split("\\.")[0];
-                if (blockAttributeMap.containsKey(block)){
-                    for (String attr: blockAttributeMap.get(block)){
-                        if (attr.startsWith(subWord.split("\\.")[1])){
-                            matches.add(block+"."+attr);
+                if (blockAttributeMap.containsKey(block)) {
+                    for (String attr : blockAttributeMap.get(block)) {
+                        if (attr.startsWith(subWord.split("\\.")[1])) {
+                            matches.add(block + "." + attr);
                         }
                     }
                 }
@@ -140,13 +139,13 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
             list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
             list.setSelectedIndex(0);
             list.addMouseListener(new MouseAdapter() {
-                    @Override
-                    public void mouseClicked(MouseEvent e) {
-                        if (e.getClickCount() == 2) {
-                            insertSelection();
-                        }
+                @Override
+                public void mouseClicked(MouseEvent e) {
+                    if (e.getClickCount() == 2) {
+                        insertSelection();
                     }
-                });
+                }
+            });
 
             return list;
         }
@@ -154,7 +153,7 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
 
         public boolean insertSelection() {
             //Note that it will not add if the selection will not fit on the current line
-            if (!popupMenu.isVisible()){
+            if (!popupMenu.isVisible()) {
                 return false;
             }
             if (list.getSelectedValue() != null) {
@@ -184,22 +183,24 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
             final int position = textarea.getCaretPosition();
             list.setSelectedIndex(index);
             SwingUtilities.invokeLater(new Runnable() {
-                    @Override
-                    public void run() {
-                        textarea.setCaretPosition(position);
-                    }
-                });
+                @Override
+                public void run() {
+                    textarea.setCaretPosition(position);
+                }
+            });
         }
     }
+
     private SuggestionPanel suggestion;
+
     protected void showSuggestionLater() {
         SwingUtilities.invokeLater(new Runnable() {
-                @Override
-                public void run() {
-                    showSuggestion();
-                }
+            @Override
+            public void run() {
+                showSuggestion();
+            }
 
-            });
+        });
     }
 
     protected void showSuggestion() {
@@ -215,7 +216,7 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
         String text = textarea.getText();
         int start = Math.max(0, position - 1);
         while (start > 0) {
-            if (!text.substring(start,start+1).equals("(") && !text.substring(start,start+1).equals(")") && !text.substring(start,start+1).equals(",") ) {
+            if (!text.substring(start, start + 1).equals("(") && !text.substring(start, start + 1).equals(")") && !text.substring(start, start + 1).equals(",")) {
                 start--;
             } else {
                 start++;
@@ -231,23 +232,22 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
         if (subWord.length() < 1) {
             return;
         }
-        start=Math.max(0,position-1);
-        while (start>0){
+        start = Math.max(0, position - 1);
+        while (start > 0) {
             //Find previous new line position
-            if (!String.valueOf(text.charAt(start)).matches(".")){
+            if (!String.valueOf(text.charAt(start)).matches(".")) {
                 break;
-            }
-            else {
+            } else {
                 start--;
             }
         }
-        suggestion = new SuggestionPanel(textarea, position, subWord, location, position-start-1);
+        suggestion = new SuggestionPanel(textarea, position, subWord, location, position - start - 1);
         SwingUtilities.invokeLater(new Runnable() {
-                @Override
-                public void run() {
-                    textarea.requestFocusInWindow();
-                }
-            });
+            @Override
+            public void run() {
+                textarea.requestFocusInWindow();
+            }
+        });
     }
 
     private void hideSuggestion() {
@@ -263,40 +263,40 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
         setFont(f);
         c.setLayout(new BorderLayout());
         //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);	
-        
+
         helpPopup = new JPopupMenu();
-		//JTextArea jft = new JTextArea("UPPAAL pragmas");
-		//helpPopup.add(jft);
-		JLabel t = new JLabel("");
-		JLabel header= new JLabel(" 	Performance Pragma");
-		Font headerFont=new Font(t.getFont().getName(),Font.BOLD,t.getFont().getSize()+2);
-		header.setFont(headerFont);
-		helpPopup.add(header);
-		//Text
-		helpPopup.add(new JLabel(" Performance Pragma allow us to query and record "));
-		helpPopup.add(new JLabel(" the latency (in cycles) between two events after simulation"));
-		helpPopup.add(new JLabel(" Depending on the format of the pragma, results can be the"));
-		helpPopup.add(new JLabel(" numeric average latency value or a verified true/false result"));		
-		
-		JLabel example =new JLabel(" Examples:");
-		example.setFont(headerFont);
-		helpPopup.add(example);
-		
-		Font exFont=new Font(t.getFont().getName(),Font.ITALIC,t.getFont().getSize());
-		JLabel t1 = new JLabel(" Latency(block1.state1, block2.s)<10:");
-		t1.setFont(exFont);
-		helpPopup.add(t1);
-		helpPopup.add(new JLabel(" Will be marked with a green check mark or "));
-		helpPopup.add(new JLabel(" red cross depending on simulation results"));		
-	
-		JLabel t2 = new JLabel(" Latency(block1.state1, block2.s)?:");
-		t2.setFont(exFont);
-		helpPopup.add(t2);
-		
-		helpPopup.add(new JLabel(" Will be marked with the average latency"));
-		helpPopup.add(new JLabel(" time after simulation"));	
-		helpPopup.setPreferredSize(new Dimension(600,250));
-        
+        //JTextArea jft = new JTextArea("UPPAAL pragmas");
+        //helpPopup.add(jft);
+        JLabel t = new JLabel("");
+        JLabel header = new JLabel(" 	Performance Pragma");
+        Font headerFont = new Font(t.getFont().getName(), Font.BOLD, t.getFont().getSize() + 2);
+        header.setFont(headerFont);
+        helpPopup.add(header);
+        //Text
+        helpPopup.add(new JLabel(" Performance Pragma allow us to query and record "));
+        helpPopup.add(new JLabel(" the latency (in cycles) between two events after simulation"));
+        helpPopup.add(new JLabel(" Depending on the format of the pragma, results can be the"));
+        helpPopup.add(new JLabel(" numeric average latency value or a verified true/false result"));
+
+        JLabel example = new JLabel(" Examples:");
+        example.setFont(headerFont);
+        helpPopup.add(example);
+
+        Font exFont = new Font(t.getFont().getName(), Font.ITALIC, t.getFont().getSize());
+        JLabel t1 = new JLabel(" Latency(block1.state1, block2.s)<10:");
+        t1.setFont(exFont);
+        helpPopup.add(t1);
+        helpPopup.add(new JLabel(" Will be marked with a green check mark or "));
+        helpPopup.add(new JLabel(" red cross depending on simulation results"));
+
+        JLabel t2 = new JLabel(" Latency(block1.state1, block2.s)?:");
+        t2.setFont(exFont);
+        helpPopup.add(t2);
+
+        helpPopup.add(new JLabel(" Will be marked with the average latency"));
+        helpPopup.add(new JLabel(" time after simulation"));
+        helpPopup.setPreferredSize(new Dimension(600, 250));
+
         textarea = new JTextArea();
 
         textarea.setEditable(true);
@@ -310,52 +310,50 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
         menuBar.add(help);
         setJMenuBar(menuBar);
         textarea.addKeyListener(new KeyListener() {
-                @Override
-                public void keyTyped(KeyEvent e) {
-                    if (e.getKeyChar() == KeyEvent.VK_ENTER || e.getKeyChar() == KeyEvent.VK_TAB) {
-                        if (suggestion != null) {
-                            if (suggestion.insertSelection()) {
-                                e.consume();
-                                final int position = textarea.getCaretPosition();
-                                SwingUtilities.invokeLater(new Runnable() {
-                                        @Override
-                                        public void run() {
-                                            try {
-                                                textarea.getDocument().remove(position - 1, 1);
-                                            } catch (BadLocationException e) {
-                                                e.printStackTrace();
-                                            }
-                                        }
-                                    });
-                            }
+            @Override
+            public void keyTyped(KeyEvent e) {
+                if (e.getKeyChar() == KeyEvent.VK_ENTER || e.getKeyChar() == KeyEvent.VK_TAB) {
+                    if (suggestion != null) {
+                        if (suggestion.insertSelection()) {
+                            e.consume();
+                            final int position = textarea.getCaretPosition();
+                            SwingUtilities.invokeLater(new Runnable() {
+                                @Override
+                                public void run() {
+                                    try {
+                                        textarea.getDocument().remove(position - 1, 1);
+                                    } catch (BadLocationException e) {
+                                        e.printStackTrace();
+                                    }
+                                }
+                            });
                         }
                     }
                 }
+            }
 
-                @Override
-                public void keyReleased(KeyEvent e) {
-                    if (e.getKeyCode() == KeyEvent.VK_DOWN && suggestion != null) {
-                        suggestion.moveDown();
-                    } else if (e.getKeyCode() == KeyEvent.VK_UP && suggestion != null) {
-                        suggestion.moveUp();
-                    } else if (Character.isWhitespace(e.getKeyChar())) {
-                        hideSuggestion();
-                    }
-                    else if (Character.isLetter(e.getKeyChar())){
-                        showSuggestionLater();
-                    }
+            @Override
+            public void keyReleased(KeyEvent e) {
+                if (e.getKeyCode() == KeyEvent.VK_DOWN && suggestion != null) {
+                    suggestion.moveDown();
+                } else if (e.getKeyCode() == KeyEvent.VK_UP && suggestion != null) {
+                    suggestion.moveUp();
+                } else if (Character.isWhitespace(e.getKeyChar())) {
+                    hideSuggestion();
+                } else if (Character.isLetter(e.getKeyChar())) {
+                    showSuggestionLater();
                 }
+            }
 
-                @Override
-                public void keyPressed(KeyEvent e) {
-                    if (e.getKeyCode() == KeyEvent.VK_DOWN && suggestion != null) {
-                        e.consume();
-                    } else if (e.getKeyCode() == KeyEvent.VK_UP && suggestion != null) {
-                        e.consume();
-                    }
+            @Override
+            public void keyPressed(KeyEvent e) {
+                if (e.getKeyCode() == KeyEvent.VK_DOWN && suggestion != null) {
+                    e.consume();
+                } else if (e.getKeyCode() == KeyEvent.VK_UP && suggestion != null) {
+                    e.consume();
                 }
-            });
-
+            }
+        });
 
 
         JScrollPane jsp = new JScrollPane(textarea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
@@ -363,11 +361,10 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
         c.add(jsp, BorderLayout.CENTER);
 
 
-
         close = new JButton("Ok", IconManager.imgic25);
         cancel = new JButton("Cancel", IconManager.imgic27);
 
-        help.setPreferredSize(new Dimension(30,30));
+        help.setPreferredSize(new Dimension(30, 30));
 
         close.setPreferredSize(new Dimension(150, 30));
         cancel.setPreferredSize(new Dimension(150, 30));
@@ -375,24 +372,24 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
         close.addActionListener(this);
         cancel.addActionListener(this);
         help.addMouseListener(new MouseAdapter() {
-                @Override
-                public void mousePressed(MouseEvent e) {
-                    help();
-                }
-            });
+            @Override
+            public void mousePressed(MouseEvent e) {
+                help();
+            }
+        });
         JPanel jp = new JPanel();
-        jp.add(close);
         jp.add(cancel);
+        jp.add(close);
 
         c.add(jp, BorderLayout.SOUTH);
 
     }
 
-    public void actionPerformed(ActionEvent evt)  {
+    public void actionPerformed(ActionEvent evt) {
         //String command = evt.getActionCommand();
 
         // Compare the action command to the known actions.
-        if (evt.getSource() == cancel)  {
+        if (evt.getSource() == cancel) {
             cancel();
         } else if (evt.getSource() == close) {
             close();
@@ -408,11 +405,11 @@ public class JDialogPerformancePragma extends JDialogBase implements ActionListe
         text = textarea.getText();
         dispose();
     }
-    public void help(){
-        if (!helpPopup.isVisible()){
+
+    public void help() {
+        if (!helpPopup.isVisible()) {
             helpPopup.show(help, 20, 20);
-        }
-        else {
+        } else {
             helpPopup.setVisible(false);
         }
     }
diff --git a/src/main/java/ui/window/JDialogPragma.java b/src/main/java/ui/window/JDialogPragma.java
index 6127890ef5..b9918ad98d 100755
--- a/src/main/java/ui/window/JDialogPragma.java
+++ b/src/main/java/ui/window/JDialogPragma.java
@@ -381,8 +381,8 @@ public class JDialogPragma extends JDialogBase implements ActionListener {
             }
         });
         JPanel jp = new JPanel();
-        jp.add(close);
         jp.add(cancel);
+        jp.add(close);
 
         c.add(jp, BorderLayout.SOUTH);
 
diff --git a/src/main/java/ui/window/JDialogProjection.java b/src/main/java/ui/window/JDialogProjection.java
index 2392b1fa40..732b6de43b 100755
--- a/src/main/java/ui/window/JDialogProjection.java
+++ b/src/main/java/ui/window/JDialogProjection.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,14 +31,12 @@
  * 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.
  */
 
 
-
-
 package ui.window;
 
 import launcher.LauncherException;
@@ -65,10 +63,11 @@ import java.util.Vector;
  * Class JDialogProjection
  * Dialog for managing Tclasses to be validated
  * Creation: 30/06/2004
- * @version 1.0 30/06/2004
+ *
  * @author Ludovic APVRILLE
+ * @version 1.0 30/06/2004
  */
-public class JDialogProjection extends JDialog implements ActionListener, ListSelectionListener, Runnable  {
+public class JDialogProjection extends JDialog implements ActionListener, ListSelectionListener, Runnable {
     private static boolean isAldebaranSelected = false;
     private static boolean isOminSelected = false;
     private static boolean isStrongSelected = true;
@@ -76,28 +75,28 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
 
     private LinkedList<TClassAndGateDS> gatesIgnored;
     private LinkedList<TClassAndGateDS> gatesProjected;
-    
+
     private MainGUI mgui;
-    
+
     private String aldebaranHost;
     private String aldebaranPath;
     private String bcgioPath;
     private String bcgminPath;
-    
+
     private String inputData;
     private String fileName;
-    
-    
+
+
     // mode and thred management
     protected int mode;
     protected RshClient rshc;
     protected Thread t;
-    
+
     protected final static int NO_OPTIONS = 0;
     protected final static int NOT_STARTED = 1;
     protected final static int STARTED = 2;
     protected final static int STOPPED = 3;
-    
+
     //subpanels
     private JPanel panel1, panel2, panel3, panel4;
     private JList<TClassAndGateDS> listIgnored;
@@ -107,86 +106,88 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
     private JButton addOneIgnored;
     private JButton allIgnored;
     protected JTextArea jta;
-    
+
     private JRadioButton omin, imin;
     private JRadioButton aldebaran, bcgmin;
     private JRadioButton strong, branching;
-    
+
     // Main Panel
     private JButton start, stop, close;
-    
-    /** Creates new form  */
+
+    /**
+     * Creates new form
+     */
     public JDialogProjection(Frame f, MainGUI _mgui, TClassDiagramPanel tcd, TURTLEModeling tm, String _aldebaranHost, String _aldebaranPath, String _bcgminPath, String _bcgioPath, String _inputData, String _fileName, String title) {
         super(f, title, true);
-        
+
         mgui = _mgui;
-        
+
         aldebaranHost = _aldebaranHost;
         aldebaranPath = _aldebaranPath;
         bcgioPath = _bcgioPath;
         bcgminPath = _bcgminPath;
         inputData = _inputData;
         fileName = _fileName;
-        
+
         if (tcd != null) {
             initGates(tcd);
         }
-        
+
         if (tm != null) {
             initGates(tm);
         }
-        
+
         initComponents();
         myInitComponents();
         pack();
-        
+
         //getGlassPane().addMouseListener( new MouseAdapter() {});
         getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     }
-    
+
     private void initGates(TClassDiagramPanel tcd) {
-        gatesIgnored = new LinkedList<TClassAndGateDS> ();
-        gatesProjected = new LinkedList<TClassAndGateDS> ();
-        
+        gatesIgnored = new LinkedList<TClassAndGateDS>();
+        gatesProjected = new LinkedList<TClassAndGateDS>();
+
         java.util.List<TGComponent> list = tcd.getComponentList();
-        for (TGComponent tgc: list)
+        for (TGComponent tgc : list)
             if (tgc instanceof TClassInterface) {
-                TClassInterface tci = (TClassInterface)tgc;
+                TClassInterface tci = (TClassInterface) tgc;
                 java.util.List<TAttribute> gates = tci.getGates();
-                for (TAttribute ta: gates) {
+                for (TAttribute ta : gates) {
                     TClassAndGateDS tcg = new TClassAndGateDS(tci, ta);
-                    gatesIgnored.add (tcg);
+                    gatesIgnored.add(tcg);
                 }
             }
-        
+
         Collections.sort(gatesIgnored);
     }
-    
+
     private void initGates(TURTLEModeling tm) {
         //System.out.println("*** init gates tm ***");
-        gatesIgnored = new LinkedList<TClassAndGateDS> ();
-        gatesProjected = new LinkedList<TClassAndGateDS> ();
-        
-        for(int i=0; i<tm.classNb(); i++) {
+        gatesIgnored = new LinkedList<TClassAndGateDS>();
+        gatesProjected = new LinkedList<TClassAndGateDS>();
+
+        for (int i = 0; i < tm.classNb(); i++) {
             TClass t = tm.getTClassAtIndex(i);
             Vector<Gate> gateList = t.getGateList();
-            for(int j=0; j<gateList.size(); j++) {
+            for (int j = 0; j < gateList.size(); j++) {
                 Gate g = gateList.elementAt(j);
                 TClassAndGateDS tcg = new TClassAndGateDS(t, g);
-                gatesIgnored.add (tcg);
+                gatesIgnored.add(tcg);
             }
-            
+
         }
-        
+
         Collections.sort(gatesIgnored);
     }
-    
-    
+
+
     private void myInitComponents() {
         mode = NO_OPTIONS;
         setButtons();
     }
-    
+
     private void initComponents() {
         Container c = getContentPane();
         GridBagLayout gridbag1 = new GridBagLayout();
@@ -196,37 +197,37 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
         setFont(new Font("Helvetica", Font.PLAIN, 14));
         c.setLayout(new BorderLayout());
         setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-        
+
         // ignored list
-        
+
         JPanel panelTop = new JPanel();
         panelTop.setLayout(new BorderLayout());
-        
+
         panel1 = new JPanel();
         panel1.setLayout(new BorderLayout());
         panel1.setBorder(new javax.swing.border.TitledBorder("Gates ignored"));
-        listIgnored = new JList<TClassAndGateDS> (gatesIgnored.toArray (new TClassAndGateDS[0]));
+        listIgnored = new JList<TClassAndGateDS>(gatesIgnored.toArray(new TClassAndGateDS[0]));
         //listIgnored.setPreferredSize(new Dimension(200, 250));
-        listIgnored.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
+        listIgnored.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
         listIgnored.addListSelectionListener(this);
         JScrollPane scrollPane1 = new JScrollPane(listIgnored);
         panel1.add(scrollPane1, BorderLayout.CENTER);
         panel1.setPreferredSize(new Dimension(400, 250));
         panelTop.add(panel1, BorderLayout.WEST);
-        
+
         // validated list
         panel2 = new JPanel();
         panel2.setLayout(new BorderLayout());
         panel2.setBorder(new javax.swing.border.TitledBorder("Gates taken into account"));
-        listProjected = new JList<TClassAndGateDS> (gatesProjected.toArray (new TClassAndGateDS[0]));
+        listProjected = new JList<TClassAndGateDS>(gatesProjected.toArray(new TClassAndGateDS[0]));
         //listProjected.setPreferredSize(new Dimension(200, 250));
-        listProjected.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
+        listProjected.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
         listProjected.addListSelectionListener(this);
         JScrollPane scrollPane2 = new JScrollPane(listProjected);
         panel2.add(scrollPane2, BorderLayout.CENTER);
         panel2.setPreferredSize(new Dimension(400, 250));
         panelTop.add(panel2, BorderLayout.EAST);
-        
+
         // radio buttons
         panel4 = new JPanel();
         panel4.setLayout(gridbag4);
@@ -285,59 +286,59 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
 
         panelTop.add(panel4, BorderLayout.SOUTH);
         activeAldebaran(isAldebaranSelected);
-        
+
         ButtonGroup bg = new ButtonGroup();
         bg.add(aldebaran);
         bg.add(bcgmin);
-        
+
         bg = new ButtonGroup();
         bg.add(omin);
         bg.add(imin);
-        
+
         bg = new ButtonGroup();
         bg.add(strong);
         bg.add(branching);
-        
+
         // central buttons
         panel3 = new JPanel();
         panel3.setLayout(gridbag1);
-        
+
         c1.weighty = 1.0;
         c1.weightx = 1.0;
         c1.gridwidth = GridBagConstraints.REMAINDER; //end row
         c1.fill = GridBagConstraints.HORIZONTAL;
         c1.gridheight = 1;
-        
+
         allProjected = new JButton(IconManager.imgic50);
         allProjected.setPreferredSize(new Dimension(50, 25));
         allProjected.addActionListener(this);
         allProjected.setActionCommand("allProjected");
         panel3.add(allProjected, c1);
-        
+
         addOneProjected = new JButton(IconManager.imgic48);
         addOneProjected.setPreferredSize(new Dimension(50, 25));
         addOneProjected.addActionListener(this);
         addOneProjected.setActionCommand("addOneProjected");
         panel3.add(addOneProjected, c1);
-        
+
         panel3.add(new JLabel(" "), c1);
-        
+
         addOneIgnored = new JButton(IconManager.imgic46);
         addOneIgnored.addActionListener(this);
         addOneIgnored.setPreferredSize(new Dimension(50, 25));
         addOneIgnored.setActionCommand("addOneIgnored");
         panel3.add(addOneIgnored, c1);
-        
+
         allIgnored = new JButton(IconManager.imgic44);
         allIgnored.addActionListener(this);
         allIgnored.setPreferredSize(new Dimension(50, 25));
         allIgnored.setActionCommand("allIgnored");
         panel3.add(allIgnored, c1);
-        
+
         panelTop.add(panel3, BorderLayout.CENTER);
-        
+
         c.add(panelTop, BorderLayout.NORTH);
-        
+
         // textarea panel
         jta = new ScrolledJTextArea();
         jta.setEditable(false);
@@ -347,40 +348,40 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
         Font f = new Font("Courrier", Font.BOLD, 12);
         jta.setFont(f);
         JScrollPane jsp = new JScrollPane(jta, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
-        
+
         c.add(jsp, BorderLayout.CENTER);
-        
-        
+
+
         // Button panel;
         start = new JButton("Start", IconManager.imgic53);
         stop = new JButton("Stop", IconManager.imgic55);
         close = new JButton("Close", IconManager.imgic27);
-        
+
         start.setPreferredSize(new Dimension(100, 30));
         stop.setPreferredSize(new Dimension(100, 30));
         close.setPreferredSize(new Dimension(100, 30));
-        
+
         start.addActionListener(this);
         stop.addActionListener(this);
         close.addActionListener(this);
-        
+
         JPanel jp2 = new JPanel();
         jp2.add(start);
         jp2.add(stop);
         jp2.add(close);
-        
+
         c.add(jp2, BorderLayout.SOUTH);
     }
-    
-    public void	actionPerformed(ActionEvent evt)  {
+
+    public void actionPerformed(ActionEvent evt) {
         String command = evt.getActionCommand();
-        
+
         // Compare the action command to the known actions.
         if (evt.getSource() == aldebaran) {
-          activeAldebaran(true);
+            activeAldebaran(true);
         } else if (evt.getSource() == bcgmin) {
-          activeAldebaran(false);
-        } else if (command.equals("Start"))  {
+            activeAldebaran(false);
+        } else if (command.equals("Start")) {
             startProcess();
         } else if (command.equals("Stop")) {
             stopProcess();
@@ -398,92 +399,92 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
     }
 
     public void activeAldebaran(boolean b) {
-      omin.setEnabled(b);
-      imin.setEnabled(b);
-      strong.setEnabled(!b);
-      branching.setEnabled(!b);
+        omin.setEnabled(b);
+        imin.setEnabled(b);
+        strong.setEnabled(!b);
+        branching.setEnabled(!b);
     }
-    
-    
+
+
     private void addOneIgnored() {
-        int [] list = listProjected.getSelectedIndices();
-        LinkedList<TClassAndGateDS> v = new LinkedList<TClassAndGateDS> ();
-        for (int i=0; i<list.length; i++){
-            TClassAndGateDS o = gatesProjected.get (list[i]);
-            gatesIgnored.add (o);
-            v.add (o);
+        int[] list = listProjected.getSelectedIndices();
+        LinkedList<TClassAndGateDS> v = new LinkedList<TClassAndGateDS>();
+        for (int i = 0; i < list.length; i++) {
+            TClassAndGateDS o = gatesProjected.get(list[i]);
+            gatesIgnored.add(o);
+            v.add(o);
         }
-        
+
         gatesProjected.removeAll(v);
         moveSynchronizedGatesAsWell(gatesIgnored, gatesProjected);
         Collections.sort(gatesIgnored);
-        listIgnored.setListData(gatesIgnored.toArray (new TClassAndGateDS[0]));
-        listProjected.setListData(gatesProjected.toArray (new TClassAndGateDS[0]));
+        listIgnored.setListData(gatesIgnored.toArray(new TClassAndGateDS[0]));
+        listProjected.setListData(gatesProjected.toArray(new TClassAndGateDS[0]));
         checkMode();
         setButtons();
     }
-    
+
     private void addOneProjected() {
-        int [] list = listIgnored.getSelectedIndices();
-        LinkedList<TClassAndGateDS> v = new LinkedList<TClassAndGateDS> ();
-        for (int i=0; i<list.length; i++){
-            TClassAndGateDS o = gatesIgnored.get (list[i]);
-            gatesProjected.add (o);
-            v.add (o);
+        int[] list = listIgnored.getSelectedIndices();
+        LinkedList<TClassAndGateDS> v = new LinkedList<TClassAndGateDS>();
+        for (int i = 0; i < list.length; i++) {
+            TClassAndGateDS o = gatesIgnored.get(list[i]);
+            gatesProjected.add(o);
+            v.add(o);
         }
-        
+
         gatesIgnored.removeAll(v);
         moveSynchronizedGatesAsWell(gatesProjected, gatesIgnored);
         Collections.sort(gatesProjected);
-        listIgnored.setListData(gatesIgnored.toArray (new TClassAndGateDS[0]));
-        listProjected.setListData(gatesProjected.toArray (new TClassAndGateDS[0]));
+        listIgnored.setListData(gatesIgnored.toArray(new TClassAndGateDS[0]));
+        listProjected.setListData(gatesProjected.toArray(new TClassAndGateDS[0]));
         checkMode();
         setButtons();
     }
-    
+
     private void allProjected() {
         gatesProjected.addAll(gatesIgnored);
         Collections.sort(gatesProjected);
-        gatesIgnored.clear ();
-        listIgnored.setListData(gatesIgnored.toArray (new TClassAndGateDS[0]));
-        listProjected.setListData(gatesProjected.toArray (new TClassAndGateDS[0]));
+        gatesIgnored.clear();
+        listIgnored.setListData(gatesIgnored.toArray(new TClassAndGateDS[0]));
+        listProjected.setListData(gatesProjected.toArray(new TClassAndGateDS[0]));
         checkMode();
         setButtons();
     }
-    
+
     private void allIgnored() {
         gatesIgnored.addAll(gatesProjected);
         Collections.sort(gatesIgnored);
-        gatesProjected.clear ();
-        listIgnored.setListData(gatesIgnored.toArray (new TClassAndGateDS[0]));
-        listProjected.setListData(gatesProjected.toArray (new TClassAndGateDS[0]));
+        gatesProjected.clear();
+        listIgnored.setListData(gatesIgnored.toArray(new TClassAndGateDS[0]));
+        listProjected.setListData(gatesProjected.toArray(new TClassAndGateDS[0]));
         checkMode();
         setButtons();
     }
-    
+
     private void moveSynchronizedGatesAsWell(LinkedList<TClassAndGateDS> toCheck, LinkedList<TClassAndGateDS> toPickup) {
         TClassAndGateDS tcg1;
         MasterGateManager mgm = mgui.gtm.getNewMasterGateManager();
         //Gate g;
         GroupOfGates gog, gog1;
-        
 
-        for (TClassAndGateDS tcg: toCheck) {
+
+        for (TClassAndGateDS tcg : toCheck) {
             gog = mgm.groupOf(tcg.getTClassName(), tcg.getGateName());
             if (gog != null) {
-                for(int j=0; j<toPickup.size(); j++) {
-                    tcg1 = toPickup.get (j);
+                for (int j = 0; j < toPickup.size(); j++) {
+                    tcg1 = toPickup.get(j);
                     gog1 = mgm.groupOf(tcg1.getTClassName(), tcg1.getGateName());
                     if (gog1 == gog) {
-                        toCheck.add (tcg1);
-                        toPickup.remove (j);
+                        toCheck.add(tcg1);
+                        toPickup.remove(j);
                         j--;
                     }
                 }
             }
         }
     }
-    
+
     public void checkMode() {
         if (gatesProjected.size() > 0) {
             mode = NOT_STARTED;
@@ -491,9 +492,9 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
             mode = NO_OPTIONS;
         }
     }
-    
+
     private void setButtons() {
-        switch(mode) {
+        switch (mode) {
             case NO_OPTIONS:
                 listProjected.setEnabled(true);
                 listIgnored.setEnabled(true);
@@ -539,37 +540,37 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
                 break;
         }
     }
-    
+
     private void unsetButtonsList() {
         addOneProjected.setEnabled(false);
         addOneIgnored.setEnabled(false);
         allProjected.setEnabled(false);
         allIgnored.setEnabled(false);
     }
-    
+
     private void setButtonsList() {
         int i1 = listIgnored.getSelectedIndex();
         int i2 = listProjected.getSelectedIndex();
-        
+
         if (i1 == -1) {
             addOneProjected.setEnabled(false);
         } else {
             addOneProjected.setEnabled(true);
         }
-        
+
         if (i2 == -1) {
             addOneIgnored.setEnabled(false);
         } else {
             addOneIgnored.setEnabled(true);
         }
-        
-        if (gatesIgnored.size() ==0) {
+
+        if (gatesIgnored.size() == 0) {
             allProjected.setEnabled(false);
         } else {
             allProjected.setEnabled(true);
         }
-        
-        if (gatesProjected.size() ==0) {
+
+        if (gatesProjected.size() == 0) {
             allIgnored.setEnabled(false);
             //closeButton.setEnabled(false);
             //closeButton.setEnabled(false);
@@ -578,218 +579,224 @@ public class JDialogProjection extends JDialog implements ActionListener, ListSe
             //closeButton.setEnabled(true);
         }
     }
-    
+
     public void valueChanged(ListSelectionEvent e) {
         setButtons();
     }
-    
+
     public void closeDialog() {
         if (mode == STARTED) {
             stopProcess();
         }
         dispose();
     }
-    
+
     public void stopProcess() {
         if (rshc != null) {
             try {
                 rshc.stopCommand();
             } catch (LauncherException le) {
-                
+
             }
             rshc = null;
         }
-        mode = 	STOPPED;
+        mode = STOPPED;
         setButtons();
     }
-    
+
     public void startProcess() {
         t = new Thread(this);
         mode = STARTED;
         setButtons();
         t.start();
     }
-    
+
     public void run() {
         String cmd1 = "";
         String autproj;
         String autprojdot;
-     //   String data;
+        //   String data;
         int id = 0;
         String filenamebcg;
         Point p;
-		
-		RshClient rshctmp = null;
-		
+
+        RshClient rshctmp = null;
+
 
         try {
-          // saving current options
-          isAldebaranSelected = aldebaran.isSelected();
-          isOminSelected = omin.isSelected();
-          isStrongSelected = strong.isSelected();
+            // saving current options
+            isAldebaranSelected = aldebaran.isSelected();
+            isOminSelected = omin.isSelected();
+            isStrongSelected = strong.isSelected();
 
             mgui.gtm.reinitRGAUTPROJDOT();
             jta.append("Modifying original RG\n");
             //System.out.println("Input data = " + inputData);
-            
+
             autproj = mgui.gtm.performProjection(inputData, gatesProjected);
-            
+
             if (autproj == null) {
                 jta.append("\nError: the RG could not be prepared for minimization\n");
             } else {
-              jta.append("\nRemoving ignored gates\n");
+                jta.append("\nRemoving ignored gates\n");
                 if (isAldebaranSelected) {
 
-                //System.out.println("Output data = " + autproj);
-                
-                //jta.append(autproj);
-
-                //mgui.gtm.setRGAUTPROJ(autproj);
-                //mgui.saveRGAutProj();
-                
-                if ((aldebaranHost == null) || (aldebaranHost.length() == 0)) {
-                    jta.append("No Aldebaran installed -> cannot performed minimization\n");
-                    mgui.gtm.setRGAUTPROJ(autproj);
-                    mgui.saveRGAutProj();
-                } else {
-                    jta.append("Minimization with Aldebaran\n");
-                    rshc = new RshClient(aldebaranHost);
-					rshctmp = rshc;
-                    id = rshc.getId();
-                    fileName = FileUtils.addBeforeFileExtension(fileName, "_" + id);
-                    jta.append("Session id on launcher="+id + " ; working on " + fileName + "\n");
-
-                    rshc.deleteFile(fileName);
-                    jta.append("Sending data\n");
-                    rshc.sendFileData(fileName, autproj);
-                    cmd1 = aldebaranPath;
-                    if (omin.isSelected()) {
-                        cmd1 +=  " -omin ";
+                    //System.out.println("Output data = " + autproj);
+
+                    //jta.append(autproj);
+
+                    //mgui.gtm.setRGAUTPROJ(autproj);
+                    //mgui.saveRGAutProj();
+
+                    if ((aldebaranHost == null) || (aldebaranHost.length() == 0)) {
+                        jta.append("No Aldebaran installed -> cannot performed minimization\n");
+                        mgui.gtm.setRGAUTPROJ(autproj);
+                        mgui.saveRGAutProj();
                     } else {
-                        cmd1 +=  " -imin ";
-                    }
-                    cmd1 += fileName;
-                    jta.append("Performing minimization\n");
-                    autproj = processCmd(cmd1);
+                        jta.append("Minimization with Aldebaran\n");
+                        rshc = new RshClient(aldebaranHost);
+                        rshctmp = rshc;
+                        id = rshc.getId();
+                        fileName = FileUtils.addBeforeFileExtension(fileName, "_" + id);
+                        jta.append("Session id on launcher=" + id + " ; working on " + fileName + "\n");
 
-                    // Print info on minimized graph
-                    p = FormatManager.nbStateTransitionRGAldebaran(autproj);
-                    jta.append("\n" + p.x + " state(s), " + p.y + " transition(s)\n\n");
+                        rshc.deleteFile(fileName);
+                        jta.append("Sending data\n");
+                        rshc.sendFileData(fileName, autproj);
+                        cmd1 = aldebaranPath;
+                        if (omin.isSelected()) {
+                            cmd1 += " -omin ";
+                        } else {
+                            cmd1 += " -imin ";
+                        }
+                        cmd1 += fileName;
+                        jta.append("Performing minimization\n");
+                        autproj = processCmd(cmd1);
 
-                    mgui.gtm.setRGAUTPROJ(autproj);
-                    mgui.saveRGAutProj();
-                    jta.append("Minimization done\n");
-                    //jta.append(autproj);
-                    
-                    // AUT proj dot
-                    jta.append("\nConverting to dotty format\n");
-                    rshc.sendFileData(fileName, autproj);
-                    cmd1 = bcgioPath + " -aldebaran " + fileName + " -graphviz " + fileName + ".dot";
-                    autproj = processCmd(cmd1);
-                    autprojdot = rshc.getFileData(fileName + ".dot");
-                    mgui.gtm.setRGAUTPROJDOT(autprojdot);
-                    mgui.saveRGAutProjDOT();
-                    rshc.deleteFile(fileName);
-                    rshc.deleteFile(fileName + ".dot");
-                    rshc.freeId(id);
-                }
-                } else {
-                  // BCGMIN
-                  if ((aldebaranHost == null) || (aldebaranHost.length() == 0) ||(bcgminPath.length() == 0)) {
-                    jta.append("No bcgmin installed -> cannot performed minimization\n");
-                    mgui.gtm.setRGAUTPROJ(autproj);
-                    mgui.saveRGAutProj();
+                        // Print info on minimized graph
+                        p = FormatManager.nbStateTransitionRGAldebaran(autproj);
+                        jta.append("\n" + p.x + " state(s), " + p.y + " transition(s)\n\n");
+
+                        mgui.gtm.setRGAUTPROJ(autproj);
+                        mgui.saveRGAutProj();
+                        jta.append("Minimization done\n");
+                        //jta.append(autproj);
+
+                        // AUT proj dot
+                        jta.append("\nConverting to dotty format\n");
+                        rshc.sendFileData(fileName, autproj);
+                        cmd1 = bcgioPath + " -aldebaran " + fileName + " -graphviz " + fileName + ".dot";
+                        autproj = processCmd(cmd1);
+                        autprojdot = rshc.getFileData(fileName + ".dot");
+                        mgui.gtm.setRGAUTPROJDOT(autprojdot);
+                        mgui.saveRGAutProjDOT();
+                        rshc.deleteFile(fileName);
+                        rshc.deleteFile(fileName + ".dot");
+                        rshc.freeId(id);
+                    }
                 } else {
-                    jta.append("Minimization with bcgmin\n");
-                    rshc = new RshClient(aldebaranHost);
-                    id = rshc.getId();
-					rshctmp = rshc;
-                    fileName = FileUtils.addBeforeFileExtension(fileName, "_" + id);
-                    filenamebcg = FileUtils.changeFileExtension(fileName, "bcg");
-                    jta.append("Session id on launcher="+id + " ; working on " + fileName + "\n");
-
-                    jta.append("Sending data\n");
-                    rshc.sendFileData(fileName, autproj);
-                    
-                    // Converting to bcg format
-                    jta.append("Converting data to bcg format\n");
-                    cmd1 = bcgioPath + " -aldebaran " + fileName + " -bcg " + filenamebcg;
-                    /*data =*/ processCmd(cmd1);
-
-                    cmd1 = bcgminPath;
-                    if (isStrongSelected) {
-                        cmd1 +=  " -strong ";
+                    // BCGMIN
+                    if ((aldebaranHost == null) || (aldebaranHost.length() == 0) || (bcgminPath.length() == 0)) {
+                        jta.append("No bcgmin installed -> cannot performed minimization\n");
+                        mgui.gtm.setRGAUTPROJ(autproj);
+                        mgui.saveRGAutProj();
                     } else {
-                        cmd1 +=  " -branching ";
-                    }
-                    cmd1 += filenamebcg+ " " + filenamebcg;
-                    jta.append("Performing minimization\n");
-                    /*data =*/ processCmd(cmd1);
-                    jta.append("Minimization done\n");
-
-                    jta.append("Converting data to aut format\n");
-                    cmd1 = bcgioPath + " -bcg " + filenamebcg+ " -aldebaran " + fileName;
-                    /*data = */processCmd(cmd1);
-
-                    jta.append("Getting aut data\n");
-                    autproj = rshc.getFileData(fileName);
-                    
-                    // Print info on minimized graph
-                    p = FormatManager.nbStateTransitionRGAldebaran(autproj);
-                    jta.append("\n" + p.x + " state(s), " + p.y + " transition(s)\n\n");
-
-                    mgui.gtm.setRGAUTPROJ(autproj);
-                    mgui.saveRGAutProj();
-                    //jta.append(autproj);
+                        jta.append("Minimization with bcgmin\n");
+                        rshc = new RshClient(aldebaranHost);
+                        id = rshc.getId();
+                        rshctmp = rshc;
+                        fileName = FileUtils.addBeforeFileExtension(fileName, "_" + id);
+                        filenamebcg = FileUtils.changeFileExtension(fileName, "bcg");
+                        jta.append("Session id on launcher=" + id + " ; working on " + fileName + "\n");
 
-                    // AUT proj dot
-                    jta.append("\nConverting to dotty format\n");
-                    rshc.sendFileData(fileName, autproj);
-                    cmd1 = bcgioPath + " -bcg " + filenamebcg + " -graphviz " + fileName + ".dot";
-                    /*data =*/ processCmd(cmd1);
-                    jta.append("Getting dot data\n");
-                    autprojdot = rshc.getFileData(fileName + ".dot");
-                    mgui.gtm.setRGAUTPROJDOT(autprojdot);
-                    mgui.saveRGAutProjDOT();
-                    
-                    fileName = FileUtils.removeFileExtension(fileName);
-                    rshc.deleteFile(fileName + ".aut");
-                    rshc.deleteFile(fileName + ".bcg");
-                    rshc.deleteFile(fileName + ".aut.dot");
-                    rshc.deleteFile(fileName + ".o");
-                    rshc.deleteFile(fileName + "@1.o");
-                    rshc.freeId(id);
-                }
+                        jta.append("Sending data\n");
+                        rshc.sendFileData(fileName, autproj);
+
+                        // Converting to bcg format
+                        jta.append("Converting data to bcg format\n");
+                        cmd1 = bcgioPath + " -aldebaran " + fileName + " -bcg " + filenamebcg;
+                        /*data =*/
+                        processCmd(cmd1);
+
+                        cmd1 = bcgminPath;
+                        if (isStrongSelected) {
+                            cmd1 += " -strong ";
+                        } else {
+                            cmd1 += " -branching ";
+                        }
+                        cmd1 += filenamebcg + " " + filenamebcg;
+                        jta.append("Performing minimization\n");
+                        /*data =*/
+                        processCmd(cmd1);
+                        jta.append("Minimization done\n");
+
+                        jta.append("Converting data to aut format\n");
+                        cmd1 = bcgioPath + " -bcg " + filenamebcg + " -aldebaran " + fileName;
+                        /*data = */
+                        processCmd(cmd1);
+
+                        jta.append("Getting aut data\n");
+                        autproj = rshc.getFileData(fileName);
+
+                        // Print info on minimized graph
+                        p = FormatManager.nbStateTransitionRGAldebaran(autproj);
+                        jta.append("\n" + p.x + " state(s), " + p.y + " transition(s)\n\n");
+
+                        mgui.gtm.setRGAUTPROJ(autproj);
+                        mgui.saveRGAutProj();
+                        //jta.append(autproj);
+
+                        // AUT proj dot
+                        jta.append("\nConverting to dotty format\n");
+                        rshc.sendFileData(fileName, autproj);
+                        cmd1 = bcgioPath + " -bcg " + filenamebcg + " -graphviz " + fileName + ".dot";
+                        /*data =*/
+                        processCmd(cmd1);
+                        jta.append("Getting dot data\n");
+                        autprojdot = rshc.getFileData(fileName + ".dot");
+                        mgui.gtm.setRGAUTPROJDOT(autprojdot);
+                        mgui.saveRGAutProjDOT();
+
+                        fileName = FileUtils.removeFileExtension(fileName);
+                        rshc.deleteFile(fileName + ".aut");
+                        rshc.deleteFile(fileName + ".bcg");
+                        rshc.deleteFile(fileName + ".aut.dot");
+                        rshc.deleteFile(fileName + ".o");
+                        rshc.deleteFile(fileName + "@1.o");
+                        rshc.freeId(id);
+                    }
                 }
             }
 
             jta.append("Done\n");
-            
+
         } catch (LauncherException le) {
             jta.append("Error:" + le.getMessage() + "\n");
-			try{
-				if (rshctmp != null) {
-					rshctmp.freeId(id);
-				}
-			} catch (LauncherException leb) {}
+            try {
+                if (rshctmp != null) {
+                    rshctmp.freeId(id);
+                }
+            } catch (LauncherException leb) {
+            }
             mode = STOPPED;
             setButtons();
             return;
         } catch (Exception e) {
             mode = STOPPED;
-			try{
-				if (rshctmp != null) {
-					rshctmp.freeId(id);
-				}
-			} catch (LauncherException leb) {}
+            try {
+                if (rshctmp != null) {
+                    rshctmp.freeId(id);
+                }
+            } catch (LauncherException leb) {
+            }
             setButtons();
             return;
         }
-        
+
         mode = STOPPED;
         setButtons();
     }
-    
+
     protected String processCmd(String cmd) throws LauncherException {
         rshc.setCmd(cmd);
         String s = null;
diff --git a/src/main/java/ui/window/JDialogSafetyPragma.java b/src/main/java/ui/window/JDialogSafetyPragma.java
index e44f1c6ec9..8e8f0fb242 100644
--- a/src/main/java/ui/window/JDialogSafetyPragma.java
+++ b/src/main/java/ui/window/JDialogSafetyPragma.java
@@ -1,26 +1,26 @@
 /* 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,
@@ -31,14 +31,12 @@
  * 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.
  */
 
 
-
-
 package ui.window;
 
 import ui.util.IconManager;
@@ -54,13 +52,14 @@ import java.util.HashMap;
  * Class JDialogPragma
  * Dialog for entering a note
  * Creation: 06/12/2003
- * @version 1.0 06/12/2003
+ *
  * @author Ludovic APVRILLE, Letitia LI
+ * @version 1.0 06/12/2003
  */
 public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
-    
+
     protected String text;
-    
+
     //components
     protected JTextArea textarea;
     protected JButton close;
@@ -68,22 +67,25 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
     protected JMenuBar menuBar;
     protected JMenu help;
     protected JPopupMenu helpPopup;
-	public HashMap<String, java.util.List<String>> blockAttributeMap = new HashMap<String, java.util.List<String>>();
-    /** Creates new form  */
+    public HashMap<String, java.util.List<String>> blockAttributeMap = new HashMap<String, java.util.List<String>>();
+
+    /**
+     * Creates new form
+     */
     public JDialogSafetyPragma(Frame f, String title, String _text) {
         super(f, title, true);
         text = _text;
-        
+
         initComponents();
         pack();
     }
 //Suggestion Panel code from: http://stackoverflow.com/questions/10873748/how-to-show-autocomplete-as-i-type-in-jtextarea
 
     public class SuggestionPanel {
-	private final String[] pragma = {"A[]", "E<>", "A<>", "E[]", "min(", "max("};
-	//Form list of all blocks
-	//For each block, create a list of all attribute strings and states
-	
+        private final String[] pragma = {"A[]", "E<>", "A<>", "E[]", "min(", "max("};
+        //Form list of all blocks
+        //For each block, create a list of all attribute strings and states
+
         private JList list;
         private JPopupMenu popupMenu;
         private String subWord;
@@ -96,12 +98,12 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
             popupMenu.removeAll();
             popupMenu.setOpaque(false);
             popupMenu.setBorder(null);
-			
-            popupMenu.add(list = createSuggestionList(linePosition ,position, subWord), BorderLayout.CENTER);
-	    //Show popupMenu only if there are matching suggestions
-	    	if (list.getModel().getSize() >0){
+
+            popupMenu.add(list = createSuggestionList(linePosition, position, subWord), BorderLayout.CENTER);
+            //Show popupMenu only if there are matching suggestions
+            if (list.getModel().getSize() > 0) {
                 popupMenu.show(textarea, location.x, textarea.getBaseline(0, 0) + location.y);
-	    	}
+            }
         }
 
         public void hide() {
@@ -111,34 +113,33 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
             }
         }
 
-	private JList createSuggestionList(int linePosition, final int position, final String subWord) {
-	    ArrayList<String> matches = new ArrayList<String>();
-	    if (linePosition<3){
-	        for (String p: pragma) {
-          	    if (p.startsWith(subWord)){
-					matches.add(p);
-			    }
-			}
-	    }
-		
-		if (!subWord.contains(".")){
-			for (String block: blockAttributeMap.keySet()){
-				if (block.startsWith(subWord)){
-					matches.add(block);
-				}
-			}
-		}
-		else {
-			String block = subWord.split("\\.")[0];
-			if (blockAttributeMap.containsKey(block)){
-				for (String attr: blockAttributeMap.get(block)){
-					if (attr.startsWith(subWord.split("\\.")[1])){
-						matches.add(block+"."+attr);
-					}
-				}
-			}
-		}
-	    String[] data = new String[matches.size()];
+        private JList createSuggestionList(int linePosition, final int position, final String subWord) {
+            ArrayList<String> matches = new ArrayList<String>();
+            if (linePosition < 3) {
+                for (String p : pragma) {
+                    if (p.startsWith(subWord)) {
+                        matches.add(p);
+                    }
+                }
+            }
+
+            if (!subWord.contains(".")) {
+                for (String block : blockAttributeMap.keySet()) {
+                    if (block.startsWith(subWord)) {
+                        matches.add(block);
+                    }
+                }
+            } else {
+                String block = subWord.split("\\.")[0];
+                if (blockAttributeMap.containsKey(block)) {
+                    for (String attr : blockAttributeMap.get(block)) {
+                        if (attr.startsWith(subWord.split("\\.")[1])) {
+                            matches.add(block + "." + attr);
+                        }
+                    }
+                }
+            }
+            String[] data = new String[matches.size()];
             data = matches.toArray(data);
             JList<String> list = new JList<>(data);
             list.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
@@ -152,16 +153,16 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
                     }
                 }
             });
-	    
+
             return list;
         }
 
-	
+
         public boolean insertSelection() {
-		//Note that it will not add if the selection will not fit on the current line
-	    if (!popupMenu.isVisible()){
-		return false;
-	    }
+            //Note that it will not add if the selection will not fit on the current line
+            if (!popupMenu.isVisible()) {
+                return false;
+            }
             if (list.getSelectedValue() != null) {
                 try {
                     final String selectedSuggestion = ((String) list.getSelectedValue()).substring(subWord.length());
@@ -196,8 +197,10 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
             });
         }
     }
-     private SuggestionPanel suggestion;
-     protected void showSuggestionLater() {
+
+    private SuggestionPanel suggestion;
+
+    protected void showSuggestionLater() {
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
@@ -236,17 +239,16 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
         if (subWord.length() < 1) {
             return;
         }
-		start=Math.max(0,position-1);
-		while (start>0){
-			//Find previous new line position
-			if (!String.valueOf(text.charAt(start)).matches(".")){
-				break;
-			}
-			else {
-				start--;
-			}
-		}
-        suggestion = new SuggestionPanel(textarea, position, subWord, location, position-start-1);
+        start = Math.max(0, position - 1);
+        while (start > 0) {
+            //Find previous new line position
+            if (!String.valueOf(text.charAt(start)).matches(".")) {
+                break;
+            } else {
+                start--;
+            }
+        }
+        suggestion = new SuggestionPanel(textarea, position, subWord, location, position - start - 1);
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
@@ -262,7 +264,7 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
     }
 
     protected void initComponents() {
-        
+
 
         Container c = getContentPane();
         Font f = new Font("Helvetica", Font.PLAIN, 14);
@@ -271,10 +273,10 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
         //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);	
         helpPopup = new JPopupMenu();
 
-		
-		helpPopup.add(new JLabel(IconManager.imgic7009));
-		
-		helpPopup.setPreferredSize(new Dimension(600,900));
+
+        helpPopup.add(new JLabel(IconManager.imgic7009));
+
+        helpPopup.setPreferredSize(new Dimension(600, 900));
         textarea = new JTextArea();
 
         textarea.setEditable(true);
@@ -282,12 +284,12 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
         textarea.setTabSize(3);
         textarea.append(text);
         textarea.setFont(new Font("times", Font.PLAIN, 12));
-		JMenuBar menuBar = new JMenuBar();
-		menuBar.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
-		help = new JMenu("?");
-		menuBar.add(help);
-		setJMenuBar(menuBar);
-		textarea.addKeyListener(new KeyListener() {
+        JMenuBar menuBar = new JMenuBar();
+        menuBar.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+        help = new JMenu("?");
+        menuBar.add(help);
+        setJMenuBar(menuBar);
+        textarea.addKeyListener(new KeyListener() {
             @Override
             public void keyTyped(KeyEvent e) {
                 if (e.getKeyChar() == KeyEvent.VK_ENTER || e.getKeyChar() == KeyEvent.VK_TAB) {
@@ -318,85 +320,82 @@ public class JDialogSafetyPragma extends JDialogBase implements ActionListener {
                     suggestion.moveUp();
                 } else if (Character.isWhitespace(e.getKeyChar())) {
                     hideSuggestion();
-                }
-		else if (Character.isLetter(e.getKeyChar())){
+                } else if (Character.isLetter(e.getKeyChar())) {
                     showSuggestionLater();
                 }
             }
 
             @Override
             public void keyPressed(KeyEvent e) {
-		if (e.getKeyCode() == KeyEvent.VK_DOWN && suggestion != null) {
-                   e.consume();
+                if (e.getKeyCode() == KeyEvent.VK_DOWN && suggestion != null) {
+                    e.consume();
                 } else if (e.getKeyCode() == KeyEvent.VK_UP && suggestion != null) {
                     e.consume();
-                } 
+                }
             }
         });
 
 
-	
         JScrollPane jsp = new JScrollPane(textarea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
         jsp.setPreferredSize(new Dimension(300, 300));
         c.add(jsp, BorderLayout.CENTER);
-        
 
 
         close = new JButton("Ok", IconManager.imgic25);
         cancel = new JButton("Cancel", IconManager.imgic27);
-        
-	help.setPreferredSize(new Dimension(30,30));
+
+        help.setPreferredSize(new Dimension(30, 30));
 
         close.setPreferredSize(new Dimension(150, 30));
         cancel.setPreferredSize(new Dimension(150, 30));
-        
+
         close.addActionListener(this);
         cancel.addActionListener(this);
         help.addMouseListener(new MouseAdapter() {
-                @Override
-                public void mousePressed(MouseEvent e) {
-                    help();
-                }
-            });
+            @Override
+            public void mousePressed(MouseEvent e) {
+                help();
+            }
+        });
         JPanel jp = new JPanel();
-        jp.add(close);
         jp.add(cancel);
-        
+        jp.add(close);
+
         c.add(jp, BorderLayout.SOUTH);
-	
     }
-    
-    public void	actionPerformed(ActionEvent evt)  {
+
+    public void actionPerformed(ActionEvent evt) {
         String command = evt.getActionCommand();
-        
+
         // Compare the action command to the known actions.
-        if (command.equals("Cancel"))  {
+        if (command.equals("Cancel")) {
             cancel();
         } else if (command.equals("Ok")) {
             close();
         }
-	
+
     }
-    
+
     public void cancel() {
         dispose();
     }
-    
+
     public void close() {
         text = textarea.getText();
         dispose();
     }
-    public void help(){
-	if (!helpPopup.isVisible()){
-	    helpPopup.show(help, 20, 20);
-	}
-	else {
-	    helpPopup.setVisible(false);
-	}
+
+    public void help() {
+        if (!helpPopup.isVisible()) {
+            helpPopup.show(help, 20, 20);
+        } else {
+            helpPopup.setVisible(false);
+        }
     }
+
     public String getText() {
         return text;
     }
-    
-    
+
+
 }
-- 
GitLab