From 5a6cbe3a7d4eec4039b3c2f91f9fc6c16b8477b9 Mon Sep 17 00:00:00 2001
From: "Irina Lee [m1]" <irina.lee@etu.upmc.fr>
Date: Fri, 13 Jul 2018 17:29:47 +0200
Subject: [PATCH] up

---
 src/main/java/ui/ActionPerformer.java         |   2 +
 src/main/java/ui/TDiagramPanel.java           |   9 +
 src/main/java/ui/TGComponentManager.java      |   6 +
 src/main/java/ui/TGUIAction.java              |   4 +-
 src/main/java/ui/eln/ELNDiagramToolBar.java   |   4 +
 src/main/java/ui/eln/ELNModule.java           | 184 +++++++-----
 src/main/java/ui/eln/ELNModuleTerminal.java   | 284 ++++++++++++++++++
 src/main/java/ui/eln/ELNPortTerminal.java     | 247 +++++++--------
 .../ui/eln/sca_eln/ELNComponentResistor.java  |  13 +-
 .../ELNComponentCurrentSinkTDF.java           |   2 -
 src/main/java/ui/util/IconManager.java        |   4 +-
 .../ui/window/JDialogELNModuleTerminal.java   | 151 ++++++++++
 .../resources/ui/util/elnportterminal.gif     | Bin 0 -> 70 bytes
 13 files changed, 711 insertions(+), 199 deletions(-)
 create mode 100644 src/main/java/ui/eln/ELNModuleTerminal.java
 create mode 100644 src/main/java/ui/window/JDialogELNModuleTerminal.java
 create mode 100644 src/main/resources/ui/util/elnportterminal.gif

diff --git a/src/main/java/ui/ActionPerformer.java b/src/main/java/ui/ActionPerformer.java
index 0705e6e0cd..f2186871b9 100644
--- a/src/main/java/ui/ActionPerformer.java
+++ b/src/main/java/ui/ActionPerformer.java
@@ -963,6 +963,8 @@ public class ActionPerformer {
         	mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_TDF_CURRENT_SINK);
         } else if (command.equals(mgui.actions[TGUIAction.ELN_MODULE].getActionCommand())){
         	mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_MODULE);
+        } else if (command.equals(mgui.actions[TGUIAction.ELN_MODULE_TERMINAL].getActionCommand())){
+        	mgui.actionOnButton(TGComponentManager.COMPONENT, TGComponentManager.ELN_MODULE_TERMINAL);
 
             // Attack Tree Diagrams
         } else if (command.equals(mgui.actions[TGUIAction.ATD_BLOCK].getActionCommand())) {
diff --git a/src/main/java/ui/TDiagramPanel.java b/src/main/java/ui/TDiagramPanel.java
index 4f2845b243..12189348b1 100755
--- a/src/main/java/ui/TDiagramPanel.java
+++ b/src/main/java/ui/TDiagramPanel.java
@@ -52,6 +52,7 @@ import ui.avatarrd.AvatarRDRequirement;
 import ui.avatarsmd.AvatarSMDState;
 import ui.cd.*;
 import ui.ftd.FTDFault;
+import ui.eln.*;
 import ui.eln.sca_eln.*;
 import ui.syscams.*;
 import ui.ncdd.NCEqNode;
@@ -2603,6 +2604,7 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
                     || (o instanceof SysCAMSBlockTDF && this.checkSysCAMSBlockTDFComponent((SysCAMSBlockTDF) o, name))
                     || (o instanceof SysCAMSBlockDE && this.checkSysCAMSBlockDEComponent((SysCAMSBlockDE) o, name))
                     || (o instanceof SysCAMSCompositeComponent && this.checkSysCAMSCompositeComponent((SysCAMSCompositeComponent) o, name))
+                    || (o instanceof ELNModule && this.checkELNModule((ELNModule) o, name))
                     || (o instanceof ELNComponentNodeRef && this.checkELNComponentNodeRef((ELNComponentNodeRef) o, name))
                     || (o instanceof ELNComponentResistor && this.checkELNComponentResistor((ELNComponentResistor) o, name))
                     || (o instanceof ELNComponentCapacitor && this.checkELNComponentCapacitor((ELNComponentCapacitor) o, name))
@@ -2676,6 +2678,10 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
         	return false;
         }
 
+        public boolean checkELNModule(ELNModule o, String name) {
+        	return false;
+        }
+        
         public boolean checkELNComponentNodeRef(ELNComponentNodeRef o, String name) {
         	return false;
         }
@@ -2867,6 +2873,9 @@ public abstract class TDiagramPanel extends JPanel implements GenericTree {
 
     public String findELNComponentName(String name) {
     	return this.findGoodName(name, new NameChecker() {
+    		public boolean checkELNModule(ELNModule o, String name) {
+    			return o.getValue().equals(name);
+    		}
     		public boolean checkELNComponentNodeRef(ELNComponentNodeRef o, String name) {
     			return o.getValue().equals(name);
     		}
diff --git a/src/main/java/ui/TGComponentManager.java b/src/main/java/ui/TGComponentManager.java
index d3152b2a23..7ae8ff9afc 100644
--- a/src/main/java/ui/TGComponentManager.java
+++ b/src/main/java/ui/TGComponentManager.java
@@ -362,6 +362,7 @@ public class TGComponentManager {
     public static final int ELN_TDF_VOLTAGE_SINK = 1622;
     public static final int ELN_TDF_CURRENT_SINK = 1623;
     public static final int ELN_MODULE = 1624;
+    public static final int ELN_MODULE_TERMINAL = 1625;
     
     // SMD diagram
     public static final int PROSMD_START_STATE = 2000;
@@ -1326,6 +1327,9 @@ public class TGComponentManager {
             case ELN_MODULE: 
             	tgc = new ELNModule(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
             	break;
+            case ELN_MODULE_TERMINAL: 
+            	tgc = new ELNModuleTerminal(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
+            	break;
             // Communication patterns + SD
             case TMLCP_CHOICE:
                 tgc = new TMLCPChoice(x, y, tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY(), false, null, tdp);
@@ -1756,6 +1760,8 @@ public class TGComponentManager {
         	return ELN_TDF_CURRENT_SINK;
         } else if (tgc instanceof ELNModule) {
         	return ELN_MODULE;
+        } else if (tgc instanceof ELNModuleTerminal) {
+        	return ELN_MODULE_TERMINAL;
         	
         	// Others
         } else if (tgc instanceof TADDeterministicDelay) {
diff --git a/src/main/java/ui/TGUIAction.java b/src/main/java/ui/TGUIAction.java
index 3a12f21a0b..8055d7a6f8 100644
--- a/src/main/java/ui/TGUIAction.java
+++ b/src/main/java/ui/TGUIAction.java
@@ -302,6 +302,7 @@ public class TGUIAction extends AbstractAction {
     public static final int ELN_TDF_VOLTAGE_SINK = 495; 
     public static final int ELN_TDF_CURRENT_SINK = 496; 
     public static final int ELN_MODULE = 498; 
+    public static final int ELN_MODULE_TERMINAL = 499;
     
     public static final int EBRDD_EDIT = 271;
     public static final int EBRDD_CONNECTOR = 272;
@@ -656,7 +657,7 @@ public class TGUIAction extends AbstractAction {
     public static final int MOVE_ENABLED = 463;
     public static final int FIRST_DIAGRAM = 464;
     
-    public static final int NB_ACTION = 499;
+    public static final int NB_ACTION = 500;
 
     private static final TAction [] actions = new TAction[NB_ACTION];
 
@@ -1177,6 +1178,7 @@ public class TGUIAction extends AbstractAction {
         actions[ELN_TDF_VOLTAGE_SINK] = new TAction("eln-tdf-vsink", "Add a conversion voltage to a TDF output signal", IconManager.imgic8030, IconManager.imgic8030, "Converts voltage to a TDF output signal", "Add a converts voltage to a TDF output signal to the currently opened ELN Diagram", 0);
         actions[ELN_TDF_CURRENT_SINK] = new TAction("eln-tdf-isink", "Add a conversion current to a TDF output signal", IconManager.imgic8031, IconManager.imgic8031, "Converts current to a TDF output signal", "Add a converts current to a TDF output signal to the currently opened ELN Diagram", 0);
         actions[ELN_MODULE] = new TAction("eln-module", "Add a SystemC module", IconManager.imgic8006, IconManager.imgic8006, "SystemC module", "Add a SystemC module to the currently opened ELN Diagram", 0);
+        actions[ELN_MODULE_TERMINAL] = new TAction("eln-module-terminal", "Add a module terminal", IconManager.imgic8032, IconManager.imgic8032, "Module terminal", "Add a module terminal to the currently opened ELN Diagram", 0);
 
         //ProActive State Machine Diagram
         actions[PROSMD_EDIT] = new TAction("edit-prosmd-diagram", "Edit ProActive state machine diagram", IconManager.imgic100, IconManager.imgic101, "Edit ProActive state machine diagram", "Make it possible to edit the currently opened ProActive state machine diagram", 0);
diff --git a/src/main/java/ui/eln/ELNDiagramToolBar.java b/src/main/java/ui/eln/ELNDiagramToolBar.java
index e4654add84..32fe0674bf 100644
--- a/src/main/java/ui/eln/ELNDiagramToolBar.java
+++ b/src/main/java/ui/eln/ELNDiagramToolBar.java
@@ -81,6 +81,7 @@ public class ELNDiagramToolBar extends TToolBar {
 		mgui.actions[TGUIAction.ELN_TDF_VOLTAGE_SINK].setEnabled(b);
 		mgui.actions[TGUIAction.ELN_TDF_CURRENT_SINK].setEnabled(b);
 		mgui.actions[TGUIAction.ELN_MODULE].setEnabled(b);
+		mgui.actions[TGUIAction.ELN_MODULE_TERMINAL].setEnabled(b);
 		
 		mgui.actions[TGUIAction.ACT_MODEL_CHECKING].setEnabled(b);
 		mgui.actions[TGUIAction.ACT_ONECLICK_LOTOS_RG].setEnabled(b);
@@ -103,6 +104,9 @@ public class ELNDiagramToolBar extends TToolBar {
 		
 		button = this.add(mgui.actions[TGUIAction.ELN_MODULE]);
 		button.addMouseListener(mgui.mouseHandler);
+	
+		button = this.add(mgui.actions[TGUIAction.ELN_MODULE_TERMINAL]);
+		button.addMouseListener(mgui.mouseHandler);
 		
 		this.addSeparator();
 		
diff --git a/src/main/java/ui/eln/ELNModule.java b/src/main/java/ui/eln/ELNModule.java
index 72d7cd971c..735b830a8b 100644
--- a/src/main/java/ui/eln/ELNModule.java
+++ b/src/main/java/ui/eln/ELNModule.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.
  */
@@ -40,44 +40,42 @@ package ui.eln;
 
 import myutil.GraphicLib;
 import ui.*;
-import ui.eln.sca_eln.ELNComponentNodeRef;
-import ui.syscams.SysCAMSComponentTaskDiagramPanel;
+import ui.eln.sca_eln.*;
 import ui.util.IconManager;
-import ui.window.JDialogELNComponentCapacitor;
-import ui.window.JDialogELNModule;
-
+import ui.window.*;
 import java.awt.*;
-
-import javax.swing.JFrame;
-import javax.swing.JOptionPane;
+import java.util.*;
+import javax.swing.*;
 
 /**
- * Class ELNModule 
+ * Class ELNModule
  * Module to be used in ELN diagrams 
- * Creation: 12/06/2018
- * @version 1.0 12/06/2018
+ * Creation: 12/07/2018
+ * @version 1.0 12/07/2018
  * @author Irina Kit Yan LEE
  */
 
-public class ELNModule extends TGCScalableWithInternalComponent	implements SwallowTGComponent {
-	protected Color myColor;
-	protected int orientation;
+public class ELNModule extends TGCScalableWithInternalComponent implements SwallowTGComponent {
 	private int maxFontSize = 14;
 	private int minFontSize = 4;
 	private int currentFontSize = -1;
+	protected int orientation;
+	private Color myColor;
 
 	private int textX = 15;
 	private double dtextX = 0.0;
 	protected int decPoint = 3;
-	
-	public ELNModule(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp) {
+
+	public String oldValue;
+
+	public ELNModule(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);
 
-		initScaling(250, 200);
-		
+		initScaling(200, 150);
+
 		oldScaleFactor = tdp.getZoom();
 		dtextX = textX * oldScaleFactor;
-		textX = (int) dtextX;
+		textX = (int)dtextX;
 		dtextX = dtextX - textX;
 
 		minWidth = 1;
@@ -90,73 +88,72 @@ public class ELNModule extends TGCScalableWithInternalComponent	implements Swall
 		editable = true;
 		removable = true;
 		userResizable = true;
-		value = tdp.findELNComponentName("Module_");
-	}
 
-	public Color getMyColor() {
-		return myColor;
+		value = tdp.findELNComponentName("Module_");
 	}
 
 	public void internalDrawing(Graphics g) {
 		int w;
 		Font f = g.getFont();
 		Font fold = f;
-		
+
 		if (myColor == null) {
 			myColor = Color.white;
 		}
-		
+
 		if (this.rescaled && !this.tdp.isScaled()) {
-            this.rescaled = false;
-            int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom())));
-            f = f.deriveFont((float) maxCurrentFontSize);
-
-            while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) {
-            	if (g.getFontMetrics().stringWidth(value) < (width - (2 * textX))) {
-            		break;
-            	}
-                maxCurrentFontSize--;
-                f = f.deriveFont((float) maxCurrentFontSize);
-            }
-
-            if (this.currentFontSize < this.minFontSize * this.tdp.getZoom()) {
-                maxCurrentFontSize++;
-                f = f.deriveFont((float) maxCurrentFontSize);
-            }
-            g.setFont(f);
-            this.currentFontSize = maxCurrentFontSize;
-        } else {
-            f = f.deriveFont(this.currentFontSize);
-    	}
-
-		Color col = g.getColor();
+			this.rescaled = false;
+			int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom())));
+			f = f.deriveFont((float) maxCurrentFontSize);
+
+			while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) {
+				if (g.getFontMetrics().stringWidth(value) < (width - (2 * textX))) {
+					break;
+				}
+				maxCurrentFontSize--;
+				f = f.deriveFont((float) maxCurrentFontSize);
+			}
+
+			if (this.currentFontSize < this.minFontSize * this.tdp.getZoom()) {
+				maxCurrentFontSize++;
+				f = f.deriveFont((float) maxCurrentFontSize);
+			}
+			g.setFont(f);
+			this.currentFontSize = maxCurrentFontSize;
+		} else {
+			f = f.deriveFont(this.currentFontSize);
+		}
+
+		Color c = g.getColor();
 		g.drawRect(x, y, width, height);
 		if ((width > 2) && (height > 2)) {
 			g.setColor(myColor);
 			g.fillRect(x+1, y+1, width-1, height-1);
-			g.setColor(col);
+			g.setColor(c);
 		}
-       
-        int attributeFontSize = this.currentFontSize * 5 / 6;
-        g.setFont(f.deriveFont((float) attributeFontSize));
-        g.setFont(f);
+
+		int attributeFontSize = this.currentFontSize * 5 / 6;
+		g.setFont(f.deriveFont((float) attributeFontSize));
+		g.setFont(f);
 		w = g.getFontMetrics().stringWidth(value);
-		if (!(w < (width - 2 * textX))) {
+		if (w > (width - 2 * textX)) {
+			g.setFont(f.deriveFont(Font.BOLD));
 			g.drawString(value, x + textX + 1, y + currentFontSize + textX);
 		} else {
+			g.setFont(f.deriveFont(Font.BOLD));
 			g.drawString(value, x + (width - w)/2, y + currentFontSize + textX);
 		}
-		
+
 		g.setFont(fold);
 	}
 
 	public void rescale(double scaleFactor){
 		dtextX = (textX + dtextX) / oldScaleFactor * scaleFactor;
 		textX = (int)(dtextX);
-		dtextX = dtextX - textX; 
+		dtextX = dtextX - textX;
 		super.rescale(scaleFactor);
 	}
-	
+
 	public TGComponent isOnOnlyMe(int _x, int _y) {
 		if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
 			return this;
@@ -164,19 +161,15 @@ public class ELNModule extends TGCScalableWithInternalComponent	implements Swall
 		return null;
 	}
 
-	public int getType() {
-		return TGComponentManager.ELN_MODULE;
-	}
-	
 	public boolean editOndoubleClick(JFrame frame, int _x, int _y) {
 		// On the name ?
 		if (_y <= (y + currentFontSize + textX)) {
+			oldValue = value;
 			String s = (String)JOptionPane.showInputDialog(frame, "Name:", "Setting component name",
 					JOptionPane.PLAIN_MESSAGE, IconManager.imgic100,
 					null,
 					getValue());
 			if ((s != null) && (s.length() > 0)) {
-
 				if (!TAttribute.isAValidId(s, false, false)) {
 					JOptionPane.showMessageDialog(frame,
 							"Could not change the name of the component: the new name is not a valid name",
@@ -193,15 +186,15 @@ public class ELNModule extends TGCScalableWithInternalComponent	implements Swall
 			}
 			return false;
 		}
-		
+
 		JDialogELNModule jde = new JDialogELNModule(this);
 		jde.setVisible(true);
 		rescaled = true;
 		return true;
 	}
 
-	public int getDefaultConnector() {
-		return TGComponentManager.ELN_CONNECTOR;
+	public int getType() {
+		return TGComponentManager.ELN_MODULE;
 	}
 
 	public boolean acceptSwallowedTGComponent(TGComponent tgc) {
@@ -210,7 +203,12 @@ public class ELNModule extends TGCScalableWithInternalComponent	implements Swall
 		} 
 		if (tgc instanceof ELNComponentNodeRef) {
 			return true;
-		} 
+		}
+		if (!(tgc.getFather() instanceof ELNModule)) {
+			if (tgc instanceof ELNPortTerminal) {
+				return true;
+			} 
+		}
 		return false;
 	}
 
@@ -229,6 +227,13 @@ public class ELNModule extends TGCScalableWithInternalComponent	implements Swall
 			addInternalComponent(tgc, 0);
 			return true;
 		}
+		if (tgc instanceof ELNModuleTerminal) {
+			tgc.setFather(this);
+			tgc.setDrawingZone(true);
+			tgc.resizeWithFather();
+			addInternalComponent(tgc, 0);
+			return true;
+		}
 		return false;
 	}
 
@@ -238,10 +243,43 @@ public class ELNModule extends TGCScalableWithInternalComponent	implements Swall
 
 	public void hasBeenResized() {
 		rescaled = true;
-		for (int i = 0; i < nbInternalTGComponent; i++) {
+		for(int i=0; i<nbInternalTGComponent; i++) {
 			if (tgcomponent[i] instanceof ELNComponent) {
 				tgcomponent[i].resizeWithFather();
 			}
+			if (tgcomponent[i] instanceof ELNComponentNodeRef) {
+				tgcomponent[i].resizeWithFather();
+			}
+			if (tgcomponent[i] instanceof ELNModuleTerminal) {
+				tgcomponent[i].resizeWithFather();
+			}
+		}
+	}
+
+	public int getCurrentFontSize() {
+		return currentFontSize;
+	}
+
+	public java.util.List<ELNModuleTerminal> getAllPorts() {
+		java.util.List<ELNModuleTerminal> ret = new LinkedList<ELNModuleTerminal>();
+		ELNModuleTerminal port;
+
+		for(int i=0; i<nbInternalTGComponent; i++) {
+			if (tgcomponent[i] instanceof ELNModuleTerminal) {
+				port = (ELNModuleTerminal)tgcomponent[i];
+					ret.add(port);
+			}
+		}
+		return ret;
+	}
+
+	public java.util.List<ELNModuleTerminal> getAllInternalPorts() {
+		java.util.List<ELNModuleTerminal> list = new ArrayList<ELNModuleTerminal>();
+		for(int i=0; i<nbInternalTGComponent; i++) {
+			if (tgcomponent[i] instanceof ELNModuleTerminal) {
+				list.add((ELNModuleTerminal)(tgcomponent[i]));
+			}
 		}
+		return list;
 	}
 }
\ No newline at end of file
diff --git a/src/main/java/ui/eln/ELNModuleTerminal.java b/src/main/java/ui/eln/ELNModuleTerminal.java
new file mode 100644
index 0000000000..ab4365c04e
--- /dev/null
+++ b/src/main/java/ui/eln/ELNModuleTerminal.java
@@ -0,0 +1,284 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ *
+ * ludovic.apvrille AT enst.fr
+ *
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ *
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ *
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ *
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ *
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package ui.eln;
+
+import myutil.GraphicLib;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import ui.*;
+import ui.window.*;
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * Class ELNModuleTerminal
+ * Primitive port. To be used in ELN diagrams
+ * Creation: 13/07/2018
+ * @version 1.0 13/07/2018
+ * @author Irina Kit Yan LEE
+ */
+
+public class ELNModuleTerminal extends TGCScalableWithInternalComponent implements SwallowedTGComponent, LinkedReference {
+    protected Color myColor;
+    protected int orientation;
+	private int maxFontSize = 14;
+    private int minFontSize = 4;
+    private int currentFontSize = -1;
+    protected int oldx, oldy;
+    protected int halfwidth = 5;
+    protected int currentOrientation = GraphicLib.NORTH;
+
+    private int isOrigin = -1;
+
+    private int textX = 15;
+    private double dtextX = 0.0;
+    protected int decPoint = 3;
+
+    public ELNModuleTerminal(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);
+
+        initScaling(2*halfwidth, 2*halfwidth);
+
+        dtextX = textX * oldScaleFactor;
+        textX = (int)dtextX;
+        dtextX = dtextX - textX;
+        
+        minWidth = 1;
+        minHeight = 1;
+
+        initConnectingPoint(true, true, 1);
+                
+        addTGConnectingPointsComment();
+
+        nbInternalTGComponent = 0;
+
+        moveable = true;
+        editable = true;
+        removable = true;
+        userResizable = false;
+       
+        value = "";
+    }
+
+    public void initConnectingPoint(boolean in, boolean out, int nb) {
+        nbConnectingPoint = nb;
+        connectingPoint = new TGConnectingPoint[nb];
+        int i;
+        for (i=0; i<nbConnectingPoint; i++) {
+            connectingPoint[i] = new ELNConnectingPoint(this, 0, 0, in, out, 0.5, 0.0);
+        }
+    }
+
+    public Color getMyColor() {
+        return myColor;
+    }
+
+    public void internalDrawing(Graphics g) {
+        Font f = g.getFont();
+        Font fold = f;
+        
+    	if ((x != oldx) | (oldy != y)) {
+            manageMove();
+            oldx = x;
+            oldy = y;
+        }
+
+    	if (this.rescaled && !this.tdp.isScaled()) {
+            this.rescaled = false;
+            int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom())));
+            f = f.deriveFont((float) maxCurrentFontSize);
+
+            while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) {
+            	if (g.getFontMetrics().stringWidth(value) < (width - (2 * textX))) {
+            		break;
+            	}
+                maxCurrentFontSize--;
+                f = f.deriveFont((float) maxCurrentFontSize);
+            }
+
+            if (this.currentFontSize < this.minFontSize * this.tdp.getZoom()) {
+                maxCurrentFontSize++;
+                f = f.deriveFont((float) maxCurrentFontSize);
+            }
+            g.setFont(f);
+            this.currentFontSize = maxCurrentFontSize;
+        } else {
+            f = f.deriveFont(this.currentFontSize);
+    	}
+
+    	Color c = g.getColor();
+    	g.setColor(c);
+    	g.drawRect(x, y, width, height);
+    	g.setColor(Color.black);
+    	g.fillRect(x, y, width, height);
+    	g.setFont(fold);
+    }
+
+    public void manageMove() {
+        if (father != null) {
+            Point p = GraphicLib.putPointOnRectangle(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight());
+
+            x = p.x - width/2;
+            y = p.y - height/2;
+
+            setMoveCd(x, y);
+
+            int orientation = GraphicLib.getCloserOrientation(x+(width/2), y+(height/2), father.getX(), father.getY(), father.getWidth(), father.getHeight());
+            if (orientation != currentOrientation) {
+                setOrientation(orientation);
+            }
+        }
+    }
+
+    public void setOrientation(int orientation) {
+        currentOrientation = orientation;
+        double w0, h0;
+
+        switch(orientation) {
+        case GraphicLib.NORTH:
+            w0 = 0.5;
+            h0 = 1.0;
+            break;
+        case GraphicLib.WEST:
+            w0 = 1.0;
+            h0 = 0.5;
+            break;
+        case GraphicLib.SOUTH:
+            w0 = 0.5;
+            h0 = 0.0;
+            break;
+        case GraphicLib.EAST:
+        default:
+            w0 = 0.0;
+            h0 = 0.5;
+        }
+
+        for (int i=0; i<1; i++) {
+            ((ELNConnectingPoint) connectingPoint[i]).setW(w0);
+            ((ELNConnectingPoint) connectingPoint[i]).setH(h0);
+        }
+    }
+
+    public TGComponent isOnOnlyMe(int _x, int _y) {
+        if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
+            return this;
+        }
+        return null;
+    }
+    
+	public int getType() {
+		return TGComponentManager.ELN_MODULE_TERMINAL;
+	}
+
+    public void wasSwallowed() {
+        myColor = null;
+    }
+
+    public void wasUnswallowed() {
+        myColor = null;
+        setFather(null);
+        TDiagramPanel tdp = getTDiagramPanel();
+        setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY());
+    }
+
+    public void resizeWithFather() {
+        if ((father != null) && (father instanceof ELNModule)) {
+        	setCdRectangle(0-getWidth()/2, father.getWidth() - (getWidth()/2), 0-getHeight()/2, father.getHeight() - (getHeight()/2));
+        	setMoveCd(x, y);
+        	oldx = -1;
+        	oldy = -1;
+        }
+    }
+
+    public boolean editOndoubleClick(JFrame frame) {
+		JDialogELNModuleTerminal jde = new JDialogELNModuleTerminal(this);
+		jde.setVisible(true);
+		return true;
+	}
+
+    protected String translateExtraParam() {
+		StringBuffer sb = new StringBuffer("<extraparam>\n");
+		sb.append("<attributes name=\"" + getValue() + "\"");
+		sb.append("/>\n");
+		sb.append("</extraparam>\n");
+		return new String(sb);
+	}
+
+	public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException {
+		try {
+			NodeList nli;
+			Node n1, n2;
+			Element elt;
+
+			String name;
+
+			for (int i = 0; i < nl.getLength(); i++) {
+				n1 = nl.item(i);
+				if (n1.getNodeType() == Node.ELEMENT_NODE) {
+					nli = n1.getChildNodes();
+					for (int j = 0; j < nli.getLength(); j++) {
+						n2 = nli.item(j);
+						if (n2.getNodeType() == Node.ELEMENT_NODE) {
+							elt = (Element) n2;
+							if (elt.getTagName().equals("attributes")) {
+								name = elt.getAttribute("name");
+								setValue(name);
+							}
+						}
+					}
+				}
+			}
+		} catch (Exception e) {
+			throw new MalformedModelingException();
+		}
+	}
+
+    public int getOrigin() {
+    	return isOrigin;
+    }
+    
+    public void setOrigin(int orig) {
+    	isOrigin = orig;
+    }
+    
+    public int getDefaultConnector() {
+        return TGComponentManager.ELN_CONNECTOR;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/ui/eln/ELNPortTerminal.java b/src/main/java/ui/eln/ELNPortTerminal.java
index 1b45a1ed8c..c8e8c14778 100644
--- a/src/main/java/ui/eln/ELNPortTerminal.java
+++ b/src/main/java/ui/eln/ELNPortTerminal.java
@@ -43,117 +43,149 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 import ui.*;
-import ui.eln.ELNConnectingPoint;
-import ui.window.JDialogELNPortTerminal;
+import ui.window.*;
 import javax.swing.*;
 import java.awt.*;
 
 /**
- * Class ELNPortTerminal 
- * Port terminal to be used in ELN diagrams 
- * Creation: 06/07/2018
- * @version 1.0 06/07/2018
+ * Class ELNPortTerminal
+ * Primitive port. To be used in ELN diagrams
+ * Creation: 13/07/2018
+ * @version 1.0 13/07/2018
  * @author Irina Kit Yan LEE
  */
 
-public class ELNPortTerminal extends TGCScalableWithInternalComponent implements SwallowedTGComponent {
-	protected Color myColor;
-	protected int orientation;
+public class ELNPortTerminal extends TGCScalableWithInternalComponent implements SwallowedTGComponent, LinkedReference {
+    protected Color myColor;
+    protected int orientation;
 	private int maxFontSize = 14;
-	private int minFontSize = 4;
-	private int currentFontSize = -1;
-	protected int oldx, oldy;
-
-	private int textX = 15;
-	private double dtextX = 0.0;
-	protected int decPoint = 3;
-
-	public ELNPortTerminal(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);
-
-		initScaling(10, 10);
-
-		dtextX = textX * oldScaleFactor;
-		textX = (int) dtextX;
-		dtextX = dtextX - textX;
-
-		minWidth = 1;
-		minHeight = 1;
-
-		initConnectingPoint(1);
-
-		addTGConnectingPointsComment();
-
-		moveable = false;
-		editable = true;
-		removable = false;
-		userResizable = false;
-
-		setValue("");
-	}
-
-	public void initConnectingPoint(int nb) {
-		nbConnectingPoint = nb;
-		connectingPoint = new TGConnectingPoint[nb];
-		connectingPoint[0] = new ELNConnectingPoint(this, 0, 0, true, true, 0.5, 0.5);
-	}
-
-	public Color getMyColor() {
-		return myColor;
-	}
-
-	public void internalDrawing(Graphics g) {
-		Font f = g.getFont();
-		Font fold = f;
-
-		if (this.rescaled && !this.tdp.isScaled()) {
-			this.rescaled = false;
-			int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom())));
-			f = f.deriveFont((float) maxCurrentFontSize);
-
-			while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) {
-				if (g.getFontMetrics().stringWidth(value) < (width - (2 * textX))) {
-					break;
-				}
-				maxCurrentFontSize--;
-				f = f.deriveFont((float) maxCurrentFontSize);
-			}
-
-			if (this.currentFontSize < this.minFontSize * this.tdp.getZoom()) {
-				maxCurrentFontSize++;
-				f = f.deriveFont((float) maxCurrentFontSize);
-			}
-			g.setFont(f);
-			this.currentFontSize = maxCurrentFontSize;
-		} else {
-			f = f.deriveFont(this.currentFontSize);
-		}
-
-		Color c = g.getColor();
-		g.drawRect(x, y, width, height);
-		g.fillRect(x, y, width, height);
-		g.setColor(c);
-		g.setFont(fold);
-	}
-
-	public TGComponent isOnOnlyMe(int _x, int _y) {
-		if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
-			return this;
-		}
-		return null;
-	}
-
+    private int minFontSize = 4;
+    private int currentFontSize = -1;
+    protected int oldx, oldy;
+    protected int halfwidth = 5;
+    protected int currentOrientation = GraphicLib.NORTH;
+
+    private int textX = 15;
+    private double dtextX = 0.0;
+    protected int decPoint = 3;
+
+    public ELNPortTerminal(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);
+
+        initScaling(2*halfwidth, 2*halfwidth);
+
+        dtextX = textX * oldScaleFactor;
+        textX = (int)dtextX;
+        dtextX = dtextX - textX;
+        
+        minWidth = 1;
+        minHeight = 1;
+
+        initConnectingPoint(true, true, 1);
+                
+        addTGConnectingPointsComment();
+
+        nbInternalTGComponent = 0;
+
+        moveable = false;
+        editable = true;
+        removable = true;
+        userResizable = false;
+       
+        value = "";
+    }
+
+    public void initConnectingPoint(boolean in, boolean out, int nb) {
+        nbConnectingPoint = nb;
+        connectingPoint = new TGConnectingPoint[nb];
+        int i;
+        for (i=0; i<nbConnectingPoint; i++) {
+            connectingPoint[i] = new ELNConnectingPoint(this, 0, 0, in, out, 0.5, 0.0);
+        }
+    }
+
+    public Color getMyColor() {
+        return myColor;
+    }
+
+    public void internalDrawing(Graphics g) {
+        Font f = g.getFont();
+        Font fold = f;
+        
+    	if ((x != oldx) | (oldy != y)) {
+            oldx = x;
+            oldy = y;
+        }
+
+    	if (this.rescaled && !this.tdp.isScaled()) {
+            this.rescaled = false;
+            int maxCurrentFontSize = Math.max(0, Math.min(this.height, (int) (this.maxFontSize * this.tdp.getZoom())));
+            f = f.deriveFont((float) maxCurrentFontSize);
+
+            while (maxCurrentFontSize > (this.minFontSize * this.tdp.getZoom() - 1)) {
+            	if (g.getFontMetrics().stringWidth(value) < (width - (2 * textX))) {
+            		break;
+            	}
+                maxCurrentFontSize--;
+                f = f.deriveFont((float) maxCurrentFontSize);
+            }
+
+            if (this.currentFontSize < this.minFontSize * this.tdp.getZoom()) {
+                maxCurrentFontSize++;
+                f = f.deriveFont((float) maxCurrentFontSize);
+            }
+            g.setFont(f);
+            this.currentFontSize = maxCurrentFontSize;
+        } else {
+            f = f.deriveFont(this.currentFontSize);
+    	}
+
+        Color c = g.getColor();
+        g.setColor(c);
+        g.drawRect(x, y, width, height);
+        g.setColor(Color.black);
+        g.fillRect(x, y, width, height);
+        g.setFont(fold);
+    }
+
+    public TGComponent isOnOnlyMe(int _x, int _y) {
+        if (GraphicLib.isInRectangle(_x, _y, x, y, width, height)) {
+            return this;
+        }
+        return null;
+    }
+    
 	public int getType() {
 		return TGComponentManager.ELN_PORT_TERMINAL;
 	}
 
-	public boolean editOndoubleClick(JFrame frame) {
+    public void wasSwallowed() {
+        myColor = null;
+    }
+
+    public void wasUnswallowed() {
+        myColor = null;
+        setFather(null);
+        TDiagramPanel tdp = getTDiagramPanel();
+        setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY());
+    }
+
+    public void resizeWithFather() {
+        if ((father != null) && (father instanceof ELNComponent)) {
+            setCdRectangle(0-getWidth()/2, father.getWidth() - (getWidth()/2), 0-getHeight()/2, father.getHeight() - (getHeight()/2));
+            setMoveCd(x, y);
+            oldx = -1;
+            oldy = -1;
+        }
+    }
+
+    public boolean editOndoubleClick(JFrame frame) {
 		JDialogELNPortTerminal jde = new JDialogELNPortTerminal(this);
 		jde.setVisible(true);
 		return true;
 	}
 
-	protected String translateExtraParam() {
+    protected String translateExtraParam() {
 		StringBuffer sb = new StringBuffer("<extraparam>\n");
 		sb.append("<attributes name=\"" + getValue() + "\"");
 		sb.append("/>\n");
@@ -190,28 +222,7 @@ public class ELNPortTerminal extends TGCScalableWithInternalComponent implements
 		}
 	}
 
-	public int getDefaultConnector() {
-		return TGComponentManager.ELN_CONNECTOR;
-	}
-
-	public void wasSwallowed() {
-		myColor = null;
-	}
-
-	public void wasUnswallowed() {
-		myColor = null;
-		setFather(null);
-		TDiagramPanel tdp = getTDiagramPanel();
-		setCdRectangle(tdp.getMinX(), tdp.getMaxX(), tdp.getMinY(), tdp.getMaxY());
-	}
-
-	public void resizeWithFather() {
-		if ((father != null) && (father instanceof ELNComponent)) {
-			setCdRectangle(0 - getWidth() / 2, father.getWidth() - (getWidth() / 2), 0 - getHeight() / 2,
-					father.getHeight() - (getHeight() / 2));
-			setMoveCd(x, y);
-			oldx = -1;
-			oldy = -1;
-		}
-	}
+    public int getDefaultConnector() {
+        return TGComponentManager.ELN_CONNECTOR;
+    }
 }
\ No newline at end of file
diff --git a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java
index 31e9712b3e..757867f637 100644
--- a/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java
+++ b/src/main/java/ui/eln/sca_eln/ELNComponentResistor.java
@@ -509,8 +509,8 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent imple
 		sb.append("\" unit=\"");
 		sb.append(encode(unit));
 		sb.append("\" position=\"" + position);
-		sb.append("\" width=\"" + width);
-		sb.append("\" height=\"" + height);
+		sb.append("\" width=\"" + Math.max(width, height));
+		sb.append("\" height=\"" + Math.min(width, height));
 		sb.append("\" fv_0_2=\"" + fv_0_2);
 		sb.append("\" fv_1_3=\"" + fv_1_3);
 		sb.append("\" fh_0_2=\"" + fh_0_2);
@@ -554,8 +554,13 @@ public class ELNComponentResistor extends TGCScalableWithInternalComponent imple
 								setVal(value);
 								setUnit(unit);
 								setPosition(position);
-								this.width = width;
-								this.height = height;
+								if (position == 0 || position == 2) {
+									this.height = width;
+									this.width = height;
+								} else if (position == 1 || position == 3) {
+									this.width = width;
+									this.height = height;
+								}
 								setFv_0_2(fv_0_2);
 								setFv_1_3(fv_1_3);
 								setFh_0_2(fh_0_2);
diff --git a/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java b/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java
index 31dc1ef2ae..51c4325473 100644
--- a/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java
+++ b/src/main/java/ui/eln/sca_eln_sca_tdf/ELNComponentCurrentSinkTDF.java
@@ -46,8 +46,6 @@ import org.w3c.dom.NodeList;
 import ui.*;
 import ui.eln.ELNConnectingPoint;
 import ui.window.JDialogELNComponentCurrentSinkTDF;
-import ui.window.JDialogELNComponentVoltageSinkTDF;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.ActionEvent;
diff --git a/src/main/java/ui/util/IconManager.java b/src/main/java/ui/util/IconManager.java
index bfa8e5c111..ffd5b37dde 100755
--- a/src/main/java/ui/util/IconManager.java
+++ b/src/main/java/ui/util/IconManager.java
@@ -187,7 +187,7 @@ public class IconManager {
 
     // ELN
     public static ImageIcon imgic8020, imgic8021, imgic8022, imgic8023, imgic8024, imgic8025, imgic8026, imgic8027, imgic8028, imgic8029, 
-    						imgic8030, imgic8031;
+    						imgic8030, imgic8031, imgic8032;
     
     //private static String icon7 = "turtle_large.gif";
     private static String ttoolStringIcon = "starting_logo.gif";
@@ -689,6 +689,7 @@ public class IconManager {
     private static String icon8029 = "elnground.gif";
     private static String icon8030 = "elntdfvsink.gif";
     private static String icon8031 = "elntdfisink.gif";
+    private static String icon8032 = "elnportterminal.gif";
     
     public IconManager() {
 
@@ -1200,6 +1201,7 @@ public class IconManager {
         imgic8029 = getIcon(icon8029);
         imgic8030 = getIcon(icon8030);
         imgic8031 = getIcon(icon8031);
+        imgic8032 = getIcon(icon8032);
     }
 
 } // Class
diff --git a/src/main/java/ui/window/JDialogELNModuleTerminal.java b/src/main/java/ui/window/JDialogELNModuleTerminal.java
new file mode 100644
index 0000000000..d25cd2971f
--- /dev/null
+++ b/src/main/java/ui/window/JDialogELNModuleTerminal.java
@@ -0,0 +1,151 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * 
+ * ludovic.apvrille AT enst.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+package ui.window;
+
+import ui.eln.ELNModuleTerminal;
+import ui.util.*;
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+/**
+ * Class JDialogELNModuleTerminal 
+ * Dialog for managing of ELN module terminal
+ * Creation: 13/07/2018
+ * @version 1.0 13/07/2018
+ * @author Irina Kit Yan LEE
+ */
+
+@SuppressWarnings("serial")
+
+public class JDialogELNModuleTerminal extends JDialog implements ActionListener {
+
+	private JTextField nameTextField;
+
+	private ELNModuleTerminal term;
+
+	public JDialogELNModuleTerminal(ELNModuleTerminal term) {
+		this.setTitle("Setting Module Terminal Attributes");
+		this.setLocationRelativeTo(null);
+		this.setVisible(true);
+		this.setAlwaysOnTop(true);
+		this.setResizable(false);
+
+		this.term = term;
+
+		getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "close");
+		getRootPane().getActionMap().put("close", new AbstractAction() {
+			public void actionPerformed(ActionEvent e) {
+				dispose();
+			}
+		});
+
+		dialog();
+	}
+
+	public void dialog() {
+		JPanel mainPanel = new JPanel(new BorderLayout());
+		this.add(mainPanel);
+
+		JPanel attributesMainPanel = new JPanel();
+		mainPanel.add(attributesMainPanel, BorderLayout.NORTH); 
+
+		attributesMainPanel.setLayout(new BorderLayout());
+
+		Box attributesBox = Box.createVerticalBox();
+		attributesBox.setBorder(BorderFactory.createTitledBorder("Setting module terminal attributes"));
+
+		GridBagLayout gridBag = new GridBagLayout();
+		GridBagConstraints constraints = new GridBagConstraints();
+		JPanel attributesBoxPanel = new JPanel();
+		attributesBoxPanel.setFont(new Font("Helvetica", Font.PLAIN, 14));
+		attributesBoxPanel.setLayout(gridBag);
+
+		JLabel labelName = new JLabel("Name : ");
+		constraints = new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
+				new Insets(15, 10, 5, 10), 0, 0);
+		gridBag.setConstraints(labelName, constraints);
+		attributesBoxPanel.add(labelName);
+
+		if (term.getValue().toString().equals("")) {
+			nameTextField = new JTextField(10);
+		} else {
+			nameTextField = new JTextField(term.getValue().toString(), 10); 
+		}
+		constraints = new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
+				new Insets(15, 10, 5, 10), 0, 0);
+		gridBag.setConstraints(nameTextField, constraints);
+		attributesBoxPanel.add(nameTextField);
+
+		attributesBox.add(attributesBoxPanel);
+
+		attributesMainPanel.add(attributesBox, BorderLayout.NORTH); 
+
+		JPanel downPanel = new JPanel(new FlowLayout());
+
+		JButton saveCloseButton = new JButton("Save and close");
+		saveCloseButton.setIcon(IconManager.imgic25);
+		saveCloseButton.setActionCommand("Save_Close");
+		saveCloseButton.addActionListener(this);
+		saveCloseButton.setPreferredSize(new Dimension(200, 30));
+		downPanel.add(saveCloseButton);
+
+		JButton cancelButton = new JButton("Cancel");
+		cancelButton.setIcon(IconManager.imgic27);
+		cancelButton.setActionCommand("Cancel");
+		cancelButton.addActionListener(this);
+		cancelButton.setPreferredSize(new Dimension(200, 30));
+		downPanel.add(cancelButton);
+
+		mainPanel.add(downPanel, BorderLayout.CENTER);
+		pack();
+		this.getRootPane().setDefaultButton(saveCloseButton);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		if ("Save_Close".equals(e.getActionCommand())) {
+			term.setValue(new String(nameTextField.getText()));
+			this.dispose();
+		}
+
+		if ("Cancel".equals(e.getActionCommand())) {
+			this.dispose();
+		}
+	}
+}
\ No newline at end of file
diff --git a/src/main/resources/ui/util/elnportterminal.gif b/src/main/resources/ui/util/elnportterminal.gif
new file mode 100644
index 0000000000000000000000000000000000000000..49aa980d135e12794880392ff6e055e6dabbadb1
GIT binary patch
literal 70
zcmZ?wbhEHb<Yy3ISjf!K(9poZz_4l4rvLx{EB<6*<YHiE&;g1tfaDpN#OL&{JpEQ)
Ysb|u~?sfNOM!yL-?=kIJBm;vr0OMa5xc~qF

literal 0
HcmV?d00001

-- 
GitLab