From e41f03ebedd72c771e7fd5f7d721c5a7930f006d Mon Sep 17 00:00:00 2001
From: dblouin <dominique.blouin@telecom-paristech.fr>
Date: Mon, 25 Feb 2019 14:04:24 +0100
Subject: [PATCH] Issue #31: Implementing zoom

---
 src/main/java/ui/TGScalableComponent.java     | 43 ++++++++++
 src/main/java/ui/ad/TADActionState.java       | 11 ++-
 src/main/java/ui/ad/TADChoice.java            | 42 +++++++---
 src/main/java/ui/ad/TADForLoop.java           | 11 ++-
 src/main/java/ui/tmlad/TMLADDelay.java        |  4 +-
 .../java/ui/tmlad/TMLADDelayInterval.java     |  4 +-
 src/main/java/ui/tmlad/TMLADEncrypt.java      | 23 +++++-
 src/main/java/ui/tmlad/TMLADExecC.java        |  4 +-
 .../java/ui/tmlad/TMLADExecCInterval.java     |  4 +-
 src/main/java/ui/tmlad/TMLADExecI.java        |  4 +-
 .../java/ui/tmlad/TMLADExecIInterval.java     |  4 +-
 src/main/java/ui/tmlad/TMLADForLoop.java      |  4 +-
 .../java/ui/tmlad/TMLADNotifiedEvent.java     | 29 ++++++-
 src/main/java/ui/tmlad/TMLADRandom.java       |  8 +-
 src/main/java/ui/tmlad/TMLADReadChannel.java  |  4 +-
 src/main/java/ui/tmlad/TMLADSendEvent.java    |  8 +-
 src/main/java/ui/tmlad/TMLADSendRequest.java  |  9 ++-
 .../ui/tmlcompd/TMLCPrimitiveComponent.java   | 81 ++++++++++---------
 18 files changed, 223 insertions(+), 74 deletions(-)

diff --git a/src/main/java/ui/TGScalableComponent.java b/src/main/java/ui/TGScalableComponent.java
index 4158bf9b9b..000a37b8fd 100644
--- a/src/main/java/ui/TGScalableComponent.java
+++ b/src/main/java/ui/TGScalableComponent.java
@@ -1,17 +1,48 @@
 package ui;
 
+/**
+ * Issue #31
+ * @author dblouin
+ *
+ */
 public abstract class TGScalableComponent extends TGComponent implements ScalableTGComponent {
 	
 	protected boolean rescaled;
 	
 	protected double oldScaleFactor;
 
+	protected int currentFontSize;
+	protected boolean displayText;
+	protected int textX; // border for ports
+	protected double dtextX;
+	protected int textY;
+	protected double dtextY;
+	protected int arc = 5;
+	protected double darc;
+
 	public TGScalableComponent(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);
 		
 		rescaled = false;
         oldScaleFactor = tdp.getZoom();//1.0;
+        textX = 15;
+        dtextX = textX * oldScaleFactor;
+        textX = (int) dtextX;
+        dtextX = dtextX - textX;
+
+        textY = 15;
+        dtextY = textY * oldScaleFactor;
+        textY = (int) dtextY;
+        dtextY = dtextY - textY;
+
+        arc = 5;
+        darc = arc * oldScaleFactor;
+        arc = (int) darc;
+        darc = darc - arc;
+        
+        currentFontSize = -1;
+    	displayText = true;
 	}
 
     protected void initScaling(int w, int h) {
@@ -80,6 +111,18 @@ public abstract class TGScalableComponent extends TGComponent implements Scalabl
         y = (int)(dy);
         dy = dy - y;
         
+        dtextX = (textX + dtextX) * factor;
+        textX = (int) (dtextX);
+        dtextX = dtextX - textX;
+
+        dtextY = (textY + dtextY) * factor;
+        textY = (int) (dtextY);
+        dtextY = dtextY - textY;
+
+        darc = (arc + darc) * factor;
+        arc = (int) (darc);
+        darc = darc - arc;
+        
         // Issue #81: We also need to update max coordinate values
         maxX *= factor;
         maxY *= factor;
diff --git a/src/main/java/ui/ad/TADActionState.java b/src/main/java/ui/ad/TADActionState.java
index a99752dca2..2150082f81 100755
--- a/src/main/java/ui/ad/TADActionState.java
+++ b/src/main/java/ui/ad/TADActionState.java
@@ -54,9 +54,11 @@ import java.awt.geom.Line2D;
  */
 public class TADActionState extends TADOneLineText/* Issue #69 TGCOneLineText*/ implements PreJavaCode, PostJavaCode, CheckableAccessibility, ActionStateErrorHighlight {
     protected int lineLength = 5;
-    protected int textX =  5;
-    protected int textY =  15;
-    protected int arc = 5;
+    
+    // Issue #31
+//    protected int textX =  5;
+//    protected int textY =  15;
+    //protected int arc = 5;
 	
 	protected int stateAction = 0; // 0: unchecked 1: attribute; 2: gate; 3:unknown
 
@@ -68,6 +70,9 @@ public class TADActionState extends TADOneLineText/* Issue #69 TGCOneLineText*/
         height = 20;
         minWidth = 30;
         
+        // Issue #31
+        textX = 5;
+        
         createConnectingPoints();
 //        nbConnectingPoint = 2;
 //        connectingPoint = new TGConnectingPoint[2];
diff --git a/src/main/java/ui/ad/TADChoice.java b/src/main/java/ui/ad/TADChoice.java
index c5f064e56c..6764e6f8a8 100755
--- a/src/main/java/ui/ad/TADChoice.java
+++ b/src/main/java/ui/ad/TADChoice.java
@@ -66,7 +66,8 @@ public class TADChoice extends TADComponentWithSubcomponents/* Issue #69  TGCWit
     
 	protected int lineOutLength = 25;
     
-	private int textX1, textY1, textX2, textY2, textX3, textY3;
+//	Issue # 31 private int textX1, textY1, textX2, textY2, textX3, textY3;
+	private double dtextX1, dtextY1, dtextX2, dtextY2, dtextX3, dtextY3;
     
     protected int stateOfError = 0;
     
@@ -75,12 +76,14 @@ public class TADChoice extends TADComponentWithSubcomponents/* Issue #69  TGCWit
         
         width = 30;
         height = 30;
-        textX1 = -lineOutLength;
-        textY1 = height/2 - 5;
-        textX2 = width + 5;
-        textY2 = height/2 - 5;
-        textX3 = width /2 + 5;
-        textY3 = height + 15;
+        
+        // Issue #31
+        dtextX1 = -lineOutLength;
+        dtextY1 = height/2 - 5;
+        dtextX2 = width + 5;
+        dtextY2 = height/2 - 5;
+        dtextX3 = width /2 + 5;
+        dtextY3 = height + 15;
         
         createConnectingPoints();
 //        nbConnectingPoint = 4;
@@ -120,6 +123,21 @@ public class TADChoice extends TADComponentWithSubcomponents/* Issue #69  TGCWit
         myImageIcon = IconManager.imgic208;
     }
 
+    // Issue #31
+    @Override
+    public void rescale( final double scaleFactor ) {
+    	super.rescale( scaleFactor );
+
+    	final double factor = scaleFactor / oldScaleFactor;
+
+    	dtextX1 = dtextX1 * factor;
+        dtextY1 = dtextY1 * factor;
+        dtextX2 = dtextX2 * factor;
+        dtextY2 = dtextY2 * factor;
+        dtextX3 = dtextX3 * factor;
+        dtextY3 = dtextY3 * factor;
+    }
+
     protected void createConnectingPoints() {
         nbConnectingPoint = 4;
         connectingPoint = new TGConnectingPoint[nbConnectingPoint];
@@ -131,17 +149,21 @@ public class TADChoice extends TADComponentWithSubcomponents/* Issue #69  TGCWit
     }
     
     protected void createGuards() {
-        TGCOneLineText tgc = new TGCOneLineText(x+textX1, y+textY1, textX1-50, textX1+5, textY1, textY1 + 25, true, this, tdp);
+    	
+    	// Issue #31
+        TGCOneLineText tgc = new TGCOneLineText((int)(x+dtextX1), (int)(y+dtextY1), (int)(dtextX1-50), (int)(dtextX1+5), (int)dtextY1, (int)(dtextY1 + 25), true, this, tdp);
         tgc.setValue( EMPTY_GUARD_TEXT );
         tgc.setName("guard 1");
         tgcomponent[ 0 ] = tgc;
         
-        tgc = new TGCOneLineText(x+textX2, y+textY2, textX2, textX2+20, textY2, textY2+25, true, this, tdp);
+    	// Issue #31
+        tgc = new TGCOneLineText((int)(x+dtextX2), (int)(y+dtextY2), (int)dtextX2, (int)(dtextX2+20), (int)dtextY2, (int)(dtextY2+25), true, this, tdp);
         tgc.setValue( EMPTY_GUARD_TEXT );
         tgc.setName("guard 2");
         tgcomponent[ 1 ] = tgc;
         
-        tgc = new TGCOneLineText(x+textX3, y+textY3, textX3, textX3+20, textY3, textY3+25, true, this, tdp);
+    	// Issue #31
+        tgc = new TGCOneLineText((int)(x+dtextX3), (int)(y+dtextY3), (int)dtextX3, (int)(dtextX3+20), (int)dtextY3, (int)(dtextY3+25), true, this, tdp);
         tgc.setValue( EMPTY_GUARD_TEXT );
         tgc.setName("guard 3");
         tgcomponent[ 2 ] = tgc;
diff --git a/src/main/java/ui/ad/TADForLoop.java b/src/main/java/ui/ad/TADForLoop.java
index e0dafe7cf0..2cba1c92d4 100644
--- a/src/main/java/ui/ad/TADForLoop.java
+++ b/src/main/java/ui/ad/TADForLoop.java
@@ -26,9 +26,11 @@ public abstract class TADForLoop extends TADComponentWithoutSubcomponents implem
 	protected static final int INDEX_EXIT_LOOP = 2;
 
 	protected int lineLength = 5;
-    protected int textX =  5;
-    protected int textY =  15;
-    protected int arc = 5;
+	
+	// Issue #31
+//    protected int textX =  5;
+//    protected int textY =  15;
+//    protected int arc = 5;
 
     protected int stateOfError = 0;
 
@@ -46,6 +48,9 @@ public abstract class TADForLoop extends TADComponentWithoutSubcomponents implem
 		width = 30;
         height = 20;
         minWidth = 30;
+        
+        // Issue #31
+        textX =  5;
 
         moveable = true;
         editable = true;
diff --git a/src/main/java/ui/tmlad/TMLADDelay.java b/src/main/java/ui/tmlad/TMLADDelay.java
index 4a936c36df..30b948bc28 100755
--- a/src/main/java/ui/tmlad/TMLADDelay.java
+++ b/src/main/java/ui/tmlad/TMLADDelay.java
@@ -55,7 +55,9 @@ import java.awt.geom.Line2D;
  */
 public class TMLADDelay extends TADComponentWithSubcomponents /* Issue #69 TGCWithInternalComponent*/ implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     private int lineLength = 5;
-    private int textX, textY;
+    
+    // Issue #31
+    //private int textX, textY;
 //    private int ilength = 10;
 //    private int lineLength1 = 2;
 	
diff --git a/src/main/java/ui/tmlad/TMLADDelayInterval.java b/src/main/java/ui/tmlad/TMLADDelayInterval.java
index d7234a8439..4ac73a9260 100755
--- a/src/main/java/ui/tmlad/TMLADDelayInterval.java
+++ b/src/main/java/ui/tmlad/TMLADDelayInterval.java
@@ -55,7 +55,9 @@ import java.awt.geom.Line2D;
  */
 public class TMLADDelayInterval extends TADComponentWithSubcomponents /* Issue #69 TGCWithInternalComponent*/ implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     private int lineLength = 5;
-	private int textX, textY;
+    
+    // Isseu #31
+	//private int textX, textY;
 //    private int ilength = 10;
 //    private int lineLength1 = 2;
 	private int incrementY = 3;
diff --git a/src/main/java/ui/tmlad/TMLADEncrypt.java b/src/main/java/ui/tmlad/TMLADEncrypt.java
index f3fac8dc34..8cd5c2e85b 100755
--- a/src/main/java/ui/tmlad/TMLADEncrypt.java
+++ b/src/main/java/ui/tmlad/TMLADEncrypt.java
@@ -65,8 +65,11 @@ public class TMLADEncrypt extends TADComponentWithoutSubcomponents/* Issue #69 T
     //  private int textX, textY;
     private int ex = 5;
     private int textHeight = 8;
-    private int ilength = 12;
-    private int lineLength1 = 3;
+    
+    // Issue #31
+    private double dlength = 12;
+    private double dlineLength1 = 3;
+    
     public String type = "";
     public String message_overhead = "";
     public String size = "";
@@ -127,6 +130,10 @@ public class TMLADEncrypt extends TADComponentWithoutSubcomponents/* Issue #69 T
         g.drawLine(x + (width / 2), y, x + (width / 2), y - lineLength);
         g.drawLine(x + (width / 2), y + height + ex, x + (width / 2), y + lineLength + height + ex);
 
+        // Issue #31
+        final int ilength = (int) dlength;
+        final int lineLength1 = (int) dlineLength1;
+        
         if (type.equals("Symmetric Encryption")) {
             //S
             g.drawLine(x + ex, y + (height - ilength) / 4, x + width - ex, y + (height - ilength) / 4);
@@ -161,6 +168,7 @@ public class TMLADEncrypt extends TADComponentWithoutSubcomponents/* Issue #69 T
             g.drawLine(x + ex / 2 + 1, y + (height - ilength) / 2, x + width / 2, y + (height - ilength) / 2 + ilength);
             g.drawLine(x + width - ex / 2 - 1, y + (height - ilength) / 2, x + width / 2, y + (height - ilength) / 2 + ilength);
         } else if (type.equals("Hash")) {
+        	//H
             g.drawLine(x + (width / 2) - lineLength1, y + (height - ilength) / 2, x + (width / 2) - lineLength1, y + (height - ilength) / 2 + ilength);
             g.drawLine(x + (width / 2) + lineLength1, y + (height - ilength) / 2, x + (width / 2) + lineLength1, y + (height - ilength) / 2 + ilength);
             g.drawLine(x + (width / 2) - lineLength1, y + (height - ilength) / 2 + ilength / 2, x + (width / 2) + lineLength1, y + (height - ilength) / 2 + ilength / 2);
@@ -309,4 +317,15 @@ public class TMLADEncrypt extends TADComponentWithoutSubcomponents/* Issue #69 T
     public void setStateAction(int _stateAction) {
         stateOfError = _stateAction;
     }
+    
+    // Issue #31
+    @Override
+    public void rescale( final double scaleFactor ) {
+    	super.rescale(scaleFactor);
+    	
+        final double factor = scaleFactor / oldScaleFactor;
+    	
+        dlength = dlength * factor;
+        dlineLength1 = dlineLength1 * factor;
+    }
 }
diff --git a/src/main/java/ui/tmlad/TMLADExecC.java b/src/main/java/ui/tmlad/TMLADExecC.java
index c7be2687dd..dc3741854b 100755
--- a/src/main/java/ui/tmlad/TMLADExecC.java
+++ b/src/main/java/ui/tmlad/TMLADExecC.java
@@ -55,7 +55,9 @@ import java.awt.geom.Line2D;
  */
 public class TMLADExecC extends TADComponentWithSubcomponents /* Issue #69 TGCWithInternalComponent*/ implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     private int lineLength = 5;
-    private int textX, textY;
+    
+    // Issue #31
+    //private int textX, textY;
     private int ilength = 10;
     private int lineLength1 = 2;
 	
diff --git a/src/main/java/ui/tmlad/TMLADExecCInterval.java b/src/main/java/ui/tmlad/TMLADExecCInterval.java
index bf07c7eafe..03c2ab9913 100755
--- a/src/main/java/ui/tmlad/TMLADExecCInterval.java
+++ b/src/main/java/ui/tmlad/TMLADExecCInterval.java
@@ -55,7 +55,9 @@ import java.awt.geom.Line2D;
  */
 public class TMLADExecCInterval extends TADComponentWithSubcomponents /* Issue #69 TGCWithInternalComponent*/ implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     private int lineLength = 5;
-    private int textX, textY;
+    
+    // Issue #31
+    //private int textX, textY;
     private int ilength = 10;
     private int lineLength1 = 2;
 	
diff --git a/src/main/java/ui/tmlad/TMLADExecI.java b/src/main/java/ui/tmlad/TMLADExecI.java
index 024b0c5760..46a006318f 100755
--- a/src/main/java/ui/tmlad/TMLADExecI.java
+++ b/src/main/java/ui/tmlad/TMLADExecI.java
@@ -55,7 +55,9 @@ import java.awt.geom.Line2D;
  */
 public class TMLADExecI extends TADComponentWithSubcomponents /* Issue #69 TGCWithInternalComponent*/ implements EmbeddedComment, AllowedBreakpoint, CheckableLatency, BasicErrorHighlight {
     private int lineLength = 5;
-    private int textX, textY;
+    
+    // Issue #31
+ //   private int textX, textY;
     private int ilength = 10;
     private int lineLength1 = 2;
 	
diff --git a/src/main/java/ui/tmlad/TMLADExecIInterval.java b/src/main/java/ui/tmlad/TMLADExecIInterval.java
index 49c6b15468..28cabc15d9 100755
--- a/src/main/java/ui/tmlad/TMLADExecIInterval.java
+++ b/src/main/java/ui/tmlad/TMLADExecIInterval.java
@@ -55,7 +55,9 @@ import java.awt.geom.Line2D;
  */
 public class TMLADExecIInterval extends TADComponentWithSubcomponents /* Issue #69 TGCWithInternalComponent */ implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     private int lineLength = 5;
-    private int textX, textY;
+    
+    // Issue #31
+ //   private int textX, textY;
     private int ilength = 10;
     private int lineLength1 = 2;
 	
diff --git a/src/main/java/ui/tmlad/TMLADForLoop.java b/src/main/java/ui/tmlad/TMLADForLoop.java
index 75e89fcb6c..33a12dbe0c 100755
--- a/src/main/java/ui/tmlad/TMLADForLoop.java
+++ b/src/main/java/ui/tmlad/TMLADForLoop.java
@@ -143,7 +143,9 @@ public class TMLADForLoop extends TADForLoop /* Issue #69 TGCWithoutInternalComp
 		// Info on loops
 		g.drawString(IN_LOOP, x+width+2, y+height/2);
 		//int wTmp =  g.getFontMetrics().stringWidth(EXIT_LOOP);
-		g.drawString(EXIT_LOOP, x+width/2+2, y+height+10);
+		
+		// Issue #31
+		g.drawString(EXIT_LOOP, (int) (x+width/2+ 2 * oldScaleFactor), (int) (y+height+10 * oldScaleFactor) );
     }
 
     @Override
diff --git a/src/main/java/ui/tmlad/TMLADNotifiedEvent.java b/src/main/java/ui/tmlad/TMLADNotifiedEvent.java
index 174ae7f502..a8033423d2 100755
--- a/src/main/java/ui/tmlad/TMLADNotifiedEvent.java
+++ b/src/main/java/ui/tmlad/TMLADNotifiedEvent.java
@@ -60,10 +60,14 @@ import java.awt.geom.Line2D;
  */
 public class TMLADNotifiedEvent extends TADComponentWithoutSubcomponents/* Issue #69TGCWithoutInternalComponent */ implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     protected int lineLength = 5;
-    protected int textX =  5;
-    protected int textY =  15;
+    
+    // Issue #31
+//    protected int textX =  5;
+//    protected int textY =  15;
     protected int linebreak = 10;
-    protected int textX1 = 2;
+    private int textX1 = 2;
+    private double dtextX1;
+    
     
     protected String eventName = "evt";
     protected String result = "x";
@@ -77,6 +81,10 @@ public class TMLADNotifiedEvent extends TADComponentWithoutSubcomponents/* Issue
         height = 20;
         minWidth = 30;
         
+        // Issue #31
+        textX1 = 2;
+        dtextX1 = textX1 * oldScaleFactor;
+        
         nbConnectingPoint = 2;
         connectingPoint = new TGConnectingPoint[2];
         connectingPoint[0] = new TGConnectingPointTMLAD(this, 0, -lineLength, true, false, 0.5, 0.0);
@@ -266,4 +274,19 @@ public class TMLADNotifiedEvent extends TADComponentWithoutSubcomponents/* Issue
 	public void setStateAction(int _stateAction) {
 		stateOfError = _stateAction;
 	}
+	
+    /* Issue #31
+     * (non-Javadoc)
+     * @see ui.TGScalableComponent#rescale(double)
+     */
+    @Override
+    public void rescale( final double scaleFactor ) {
+    	super.rescale(scaleFactor);
+    	
+        final double factor = scaleFactor / oldScaleFactor;
+
+        dtextX1 = (textX1 + dtextX1) * factor;
+        textX1 = (int) (dtextX1);
+        dtextX1 = dtextX1 - textX1;
+    }
 }
diff --git a/src/main/java/ui/tmlad/TMLADRandom.java b/src/main/java/ui/tmlad/TMLADRandom.java
index e7cad443da..1d1df072e5 100755
--- a/src/main/java/ui/tmlad/TMLADRandom.java
+++ b/src/main/java/ui/tmlad/TMLADRandom.java
@@ -60,9 +60,11 @@ import java.awt.geom.Line2D;
  */
 public class TMLADRandom extends TADComponentWithoutSubcomponents/* Issue #69 TGCWithoutInternalComponent */implements EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     protected int lineLength = 5;
-    protected int textX =  5;
-    protected int textY =  15;
-    protected int arc = 5;
+    
+    // Issue #31
+//    protected int textX =  5;
+//    protected int textY =  15;
+//    protected int arc = 5;
 	protected String valueRandom = "";
 	protected String variable;
 	protected String minValue;
diff --git a/src/main/java/ui/tmlad/TMLADReadChannel.java b/src/main/java/ui/tmlad/TMLADReadChannel.java
index 0e4ec24024..50b53c212e 100755
--- a/src/main/java/ui/tmlad/TMLADReadChannel.java
+++ b/src/main/java/ui/tmlad/TMLADReadChannel.java
@@ -82,7 +82,9 @@ import ui.window.TabInfo;
 public class TMLADReadChannel extends TADComponentWithoutSubcomponents/* Issue #69 TGCWithoutInternalComponent*/ implements CheckableAccessibility, LinkedReference, CheckableLatency, EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     private Map<String, String> latencyVals;
     protected int lineLength = 5;
-    protected int textX = 5;
+    
+    // Issue #31
+//    protected int textX = 5;
     protected int textX0 = 2;
     protected int textY0 = 0;
     protected int textY1 = 15;
diff --git a/src/main/java/ui/tmlad/TMLADSendEvent.java b/src/main/java/ui/tmlad/TMLADSendEvent.java
index 9715bc1286..d8734e03ab 100755
--- a/src/main/java/ui/tmlad/TMLADSendEvent.java
+++ b/src/main/java/ui/tmlad/TMLADSendEvent.java
@@ -77,9 +77,11 @@ import ui.window.JDialogMultiString;
  */
 public class TMLADSendEvent extends TADComponentWithoutSubcomponents implements CheckableAccessibility, CheckableLatency, EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     protected int lineLength = 5;
-    protected int textX = 5;
-    protected int textY = 15;
-    protected int arc = 5;
+    
+    // Issue #31
+//    protected int textX = 5;
+//    protected int textY = 15;
+//    protected int arc = 5;
     protected int linebreak = 10;
 
     protected String eventName = "evt";
diff --git a/src/main/java/ui/tmlad/TMLADSendRequest.java b/src/main/java/ui/tmlad/TMLADSendRequest.java
index 8bb62a0d90..fa7d9e7d30 100755
--- a/src/main/java/ui/tmlad/TMLADSendRequest.java
+++ b/src/main/java/ui/tmlad/TMLADSendRequest.java
@@ -64,8 +64,10 @@ import java.util.List;
  */
 public class TMLADSendRequest extends TADComponentWithoutSubcomponents/* Issue #69TGCWithoutInternalComponent*/ implements CheckableAccessibility, CheckableLatency, EmbeddedComment, AllowedBreakpoint, BasicErrorHighlight {
     protected int lineLength = 5;
-    protected int textX =  5;
-    protected int textY =  15;
+    
+    // Issue #31
+//    protected int textX =  5;
+//    protected int textY =  15;
     protected int arc = 5;
     protected int linebreak = 10;
 
@@ -87,6 +89,9 @@ public class TMLADSendRequest extends TADComponentWithoutSubcomponents/* Issue #
         width = 30;
         height = 20;
         minWidth = 30;
+        
+        // Issue #31
+        textX = 5;
 
         nbConnectingPoint = 2;
         connectingPoint = new TGConnectingPoint[2];
diff --git a/src/main/java/ui/tmlcompd/TMLCPrimitiveComponent.java b/src/main/java/ui/tmlcompd/TMLCPrimitiveComponent.java
index c6ffa17757..1d024fb0e1 100755
--- a/src/main/java/ui/tmlcompd/TMLCPrimitiveComponent.java
+++ b/src/main/java/ui/tmlcompd/TMLCPrimitiveComponent.java
@@ -36,7 +36,6 @@
  * knowledge of the CeCILL license and that you accept its terms.
  */
 
-
 package ui.tmlcompd;
 
 import myutil.GraphicLib;
@@ -50,8 +49,8 @@ import ui.window.JDialogAttribute;
 import javax.swing.*;
 import java.awt.*;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Vector;
 
 /**
@@ -65,8 +64,10 @@ import java.util.Vector;
 public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent implements SwallowTGComponent, SwallowedTGComponent, WithAttributes {
     private int maxFontSize = 14;
     private int minFontSize = 4;
-    private int currentFontSize = -1;
-    private boolean displayText = true;
+    
+    // Issue #31
+    //private int currentFontSize = -1;
+    //private boolean displayText = true;
     //    private int spacePt = 3;
     private Color myColor;
 
@@ -79,9 +80,11 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
     //   private boolean attributesAreDrawn = false;
     //public HashMap<String, Integer> attrMap = new HashMap<String, Integer>();
     //public String mappingName;
-    protected LinkedList<TAttribute> myAttributes;
-    private int textX = 15; // border for ports
-    private double dtextX = 0.0;
+    protected List<TAttribute> myAttributes;
+    
+    // Issue #31
+//    private int textX = 15; // border for ports
+//    private double dtextX = 0.0;
 
     private String operation = "";
 
@@ -92,10 +95,11 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
 
         initScaling(200, 150);
 
-        oldScaleFactor = tdp.getZoom();
-        dtextX = textX * oldScaleFactor;
-        textX = (int) dtextX;
-        dtextX = dtextX - textX;
+        // Issue #31
+//        oldScaleFactor = tdp.getZoom();
+//        dtextX = textX * oldScaleFactor;
+//        textX = (int) dtextX;
+//        dtextX = dtextX - textX;
 
         minWidth = 1;
         minHeight = 1;
@@ -123,6 +127,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         actionOnAdd();
     }
 
+    @Override
     public void internalDrawing(Graphics g) {
         int w;
         Font f = g.getFont();
@@ -246,7 +251,6 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         }
 
         g.setFont(fold);
-
     }
 
     public void drawVerification(Graphics g, int x, int y, int checkConfStatus) {
@@ -267,18 +271,19 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         g.fillRect(x - 12, y - 5, 9, 7);
         g.setColor(c);
         g.drawRect(x - 12, y - 5, 9, 7);
-
-
     }
 
-    public void rescale(double scaleFactor) {
-        dtextX = (textX + dtextX) / oldScaleFactor * scaleFactor;
-        textX = (int) (dtextX);
-        dtextX = dtextX - textX;
-
-        super.rescale(scaleFactor);
-    }
+// Issue #31    
+//    @Override
+//    public void rescale(double scaleFactor) {
+//        dtextX = (textX + dtextX) / oldScaleFactor * scaleFactor;
+//        textX = (int) (dtextX);
+//        dtextX = dtextX - textX;
+//
+//        super.rescale(scaleFactor);
+//    }
 
+    @Override
     public TGComponent isOnOnlyMe(int _x, int _y) {
         if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
             return this;
@@ -286,11 +291,11 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         return null;
     }
 
-
     public boolean isAttacker() {
         return isAttacker;
     }
 
+    @Override
     public boolean editOndoubleClick(JFrame frame, int _x, int _y) {
         // On the icon?
         if (iconIsDrawn) {
@@ -383,6 +388,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         return ((TMLComponentTaskDiagramPanel) (tdp)).getRecordNamed(this, _nameOfRecord);
     }
 
+    @Override
     public int getType() {
         return TGComponentManager.TMLCTD_PCOMPONENT;
     }
@@ -396,12 +402,10 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         setFather(null);
         TDiagramPanel tdp = getTDiagramPanel();
         setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY());
-
     }
 
     public boolean acceptSwallowedTGComponent(TGComponent tgc) {
         return tgc instanceof TMLCPrimitivePort;
-
     }
 
     public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
@@ -428,7 +432,6 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         removeInternalComponent(tgc);
     }
 
-
     /*public Vector getArtifactList() {
       Vector v = new Vector();
       for(int i=0; i<nbInternalTGComponent; i++) {
@@ -439,6 +442,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
       return v;
       }*/
 
+    @Override
     public void hasBeenResized() {
         rescaled = true;
         for (int i = 0; i < nbInternalTGComponent; i++) {
@@ -452,8 +456,9 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         }
     }
 
+    @Override
     public void resizeWithFather() {
-        if ((father != null) && (father instanceof TMLCCompositeComponent)) {
+        if (/*(father != null) && (*/father instanceof TMLCCompositeComponent ) {
             // Too large to fit in the father? -> resize it!
             resizeToFatherSize();
 
@@ -462,6 +467,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         }
     }
 
+    @Override
     public int getChildCount() {
         return myAttributes.size() + nbInternalTGComponent + 1;
     }
@@ -496,6 +502,7 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         return -1;
     }
 
+    @Override
     protected String translateExtraParam() {
         TAttribute a;
         //TraceManager.addDev("Loading extra params of " + value);
@@ -594,36 +601,36 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         return currentFontSize;
     }
 
-    public java.util.List<TAttribute> getAttributeList() {
+    public List<TAttribute> getAttributeList() {
         return myAttributes;
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllChannelsOriginPorts() {
+    public List<TMLCPrimitivePort> getAllChannelsOriginPorts() {
         return getAllPorts(0, true);
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllChannelsDestinationPorts() {
+    public List<TMLCPrimitivePort> getAllChannelsDestinationPorts() {
         return getAllPorts(0, false);
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllEventsOriginPorts() {
+    public List<TMLCPrimitivePort> getAllEventsOriginPorts() {
         return getAllPorts(1, true);
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllEventsDestinationPorts() {
+    public List<TMLCPrimitivePort> getAllEventsDestinationPorts() {
         return getAllPorts(1, false);
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllRequestsDestinationPorts() {
+    public List<TMLCPrimitivePort> getAllRequestsDestinationPorts() {
         return getAllPorts(2, false);
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllRequestsOriginPorts() {
+    public List<TMLCPrimitivePort> getAllRequestsOriginPorts() {
         return getAllPorts(2, true);
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllPorts(int _type, boolean _isOrigin) {
-        java.util.List<TMLCPrimitivePort> ret = new LinkedList<TMLCPrimitivePort>();
+    public List<TMLCPrimitivePort> getAllPorts(int _type, boolean _isOrigin) {
+        List<TMLCPrimitivePort> ret = new LinkedList<TMLCPrimitivePort>();
         TMLCPrimitivePort port;
 
         //TraceManager.addDev("Type = " + _type + " isOrigin=" + _isOrigin);
@@ -642,8 +649,8 @@ public class TMLCPrimitiveComponent extends TGCScalableWithInternalComponent imp
         return ret;
     }
 
-    public java.util.List<TMLCPrimitivePort> getAllInternalPrimitivePorts() {
-        java.util.List<TMLCPrimitivePort> list = new ArrayList<TMLCPrimitivePort>();
+    public List<TMLCPrimitivePort> getAllInternalPrimitivePorts() {
+        List<TMLCPrimitivePort> list = new ArrayList<TMLCPrimitivePort>();
         for (int i = 0; i < nbInternalTGComponent; i++) {
             if (tgcomponent[i] instanceof TMLCPrimitivePort) {
                 list.add((TMLCPrimitivePort) (tgcomponent[i]));
-- 
GitLab