From 35f71da1fbcdee99d182dd44ed50c1d146b6f807 Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Tue, 2 Dec 2008 08:30:11 +0000
Subject: [PATCH] NC update

---
 src/ui/GNCModeling.java                    |  85 ++-
 src/ui/GTURTLEModeling.java                |   5 +
 src/ui/IconManager.java                    |  17 +-
 src/ui/JToolBarMainTurtle.java             |   7 +
 src/ui/MainGUI.java                        |  24 +-
 src/ui/MalformedModelingException.java     |   2 +-
 src/ui/TGUIAction.java                     |   5 +-
 src/ui/ncdd/NCConnectorNode.java           |  69 +-
 src/ui/ncdd/NCSwitchNode.java              |  33 +-
 src/ui/ncdd/NCTrafficArtifact.java         |  37 +-
 src/ui/tree/DiagramTreeRenderer.java       |   8 +
 src/ui/window/EquipmentsNCTableModel.java  | 135 ++++
 src/ui/window/GeneralInfoNCTableModel.java | 101 +++
 src/ui/window/JDialogLinkNCNode.java       |  42 +-
 src/ui/window/JDialogNCRoute.java          |  36 +-
 src/ui/window/JDialogNCSwitchNode.java     |  34 +-
 src/ui/window/JDialogNCTraffic.java        |  50 +-
 src/ui/window/JFrameNC.java                | 750 +++++++++++++++++++++
 src/ui/window/LinksNCTableModel.java       |  96 +++
 src/ui/window/SwitchesNCTableModel.java    |  93 +++
 20 files changed, 1562 insertions(+), 67 deletions(-)
 create mode 100755 src/ui/window/EquipmentsNCTableModel.java
 create mode 100755 src/ui/window/GeneralInfoNCTableModel.java
 create mode 100755 src/ui/window/JFrameNC.java
 create mode 100755 src/ui/window/LinksNCTableModel.java
 create mode 100755 src/ui/window/SwitchesNCTableModel.java

diff --git a/src/ui/GNCModeling.java b/src/ui/GNCModeling.java
index 10ce6991bd..bc10ebaa55 100755
--- a/src/ui/GNCModeling.java
+++ b/src/ui/GNCModeling.java
@@ -124,6 +124,7 @@ public class GNCModeling  {
 		ListIterator iterator = ncdp.getListOfSwitchNode().listIterator();
 		NCSwitchNode node;
 		NCSwitch sw;
+		NCCapacityUnit unit = new NCCapacityUnit();
 		
 		while(iterator.hasNext()) {
 			node = (NCSwitchNode)(iterator.next());
@@ -131,6 +132,9 @@ public class GNCModeling  {
 			sw= new NCSwitch();
 			sw.setName(node.getNodeName());
 			sw.setSchedulingPolicy(node.getSchedulingPolicy());
+			sw.setCapacity(node.getCapacity());
+			unit.setUnit(node.getCapacityUnit());
+			sw.setCapacityUnit(unit);
 			ncs.switches.add(sw);
 		}
 	}
@@ -139,6 +143,7 @@ public class GNCModeling  {
 		ListIterator iterator = ncdp.getTrafficArtifacts().listIterator();
 		NCTrafficArtifact arti;
 		NCTraffic tr;
+		NCTimeUnit unit;
 		
 		while(iterator.hasNext()) {
 			arti = (NCTrafficArtifact)(iterator.next());
@@ -146,6 +151,10 @@ public class GNCModeling  {
 			tr.setName(arti.getValue());
 			tr.setPeriodicType(arti.getPeriodicType());
 			tr.setDeadline(arti.getDeadline());
+			unit = new NCTimeUnit();
+			unit.setUnit(arti.getDeadlineUnit());
+			tr.setDeadlineUnit(unit);
+			tr.setMinPacketSize(arti.getMinPacketSize());
 			tr.setMaxPacketSize(arti.getMaxPacketSize());
 			tr.setPriority(arti.getPriority());
 			ncs.traffics.add(tr);
@@ -161,6 +170,8 @@ public class GNCModeling  {
 		NCLinkedElement ncle;
 		String name;
 		CheckingError ce;
+		NCCapacityUnit nccu;
+		NCSwitchNode switch1, switch2;
 		
 		while(iterator.hasNext()) {
 			nccn = (NCConnectorNode)(iterator.next());
@@ -172,10 +183,11 @@ public class GNCModeling  {
 				checkingErrors.add(ce);
 				
 			} else {
+				switch1 = null;
+				switch2 = null;
 				
 				lk = new NCLink();
 				lk.setName(nccn.getInterfaceName());
-				lk.setCapacity(nccn.getCapacity());
 				
 				tp = nccn.getTGConnectingPointP1();
 				tgc = ncdp.getComponentToWhichBelongs(tp);
@@ -187,7 +199,8 @@ public class GNCModeling  {
 						if (tgc instanceof NCEqNode) {
 							name =  tgc.getName();
 						} else {
-							name = ((NCSwitchNode)tgc).getNodeName();
+							switch1 = ((NCSwitchNode)tgc);
+							name = switch1.getNodeName();
 						}
 						ncle = ncs.getNCLinkedElementByName(name);
 						if (ncle == null) {
@@ -210,7 +223,8 @@ public class GNCModeling  {
 						if (tgc instanceof NCEqNode) {
 							name =  tgc.getName();
 						} else {
-							name = ((NCSwitchNode)tgc).getNodeName();
+							switch2 = ((NCSwitchNode)tgc);
+							name = switch2.getNodeName();
 						}
 						ncle = ncs.getNCLinkedElementByName(name);
 						if (ncle == null) {
@@ -232,6 +246,47 @@ public class GNCModeling  {
 				} else {
 					ncs.links.add(lk);
 				}
+				
+				if (!nccn.hasCapacity()) {
+					// In that case, must set the capacity of switches
+					if ((switch1 == null) && (switch2 == null)) {
+						lk.setCapacity(nccn.getCapacity());
+						nccu = new NCCapacityUnit();
+						nccu.setUnit(nccn.getCapacityUnit());
+						lk.setCapacityUnit(nccu);
+					} else {
+						if (switch1 == null) {
+							lk.setCapacity(switch2.getCapacity());
+							nccu = new NCCapacityUnit();
+							nccu.setUnit(switch2.getCapacityUnit());
+							lk.setCapacityUnit(nccu);
+						}
+						if (switch2 == null) {
+							lk.setCapacity(switch1.getCapacity());
+							nccu = new NCCapacityUnit();
+							nccu.setUnit(switch2.getCapacityUnit());
+							lk.setCapacityUnit(nccu);
+						}
+						if ((switch1 != null) && (switch2 != null)) {
+							if (switch1.getCapacity() != switch2.getCapacity()) {
+								ce = new CheckingError(CheckingError.STRUCTURE_ERROR, "Link with no capacity between two switches of different capacity: " + nccn.getInterfaceName());
+								ce.setTDiagramPanel(ncdp);
+								ce.setTGComponent(nccn);
+								checkingErrors.add(ce);
+							} else {
+								lk.setCapacity(switch1.getCapacity());
+								nccu = new NCCapacityUnit();
+								nccu.setUnit(switch2.getCapacityUnit());
+								lk.setCapacityUnit(nccu);
+							}
+						}
+					}
+				} else {
+					lk.setCapacity(nccn.getCapacity());
+					nccu = new NCCapacityUnit();
+					nccu.setUnit(nccn.getCapacityUnit());
+					lk.setCapacityUnit(nccu);
+				}
 			}
 		}
 	}
@@ -298,7 +353,7 @@ public class GNCModeling  {
 		CheckingError ce;
 		
 		if (tree.isLeaf()) {
-			System.out.println("Found path");
+			//System.out.println("Found path");
 			NCPath path = new NCPath();
 			path.traffic = traffic;
 			path.origin = origin;
@@ -324,7 +379,7 @@ public class GNCModeling  {
 					return;
 				}
 			}
-			System.out.println("Adding path");
+			//System.out.println("Adding path");
 			path.setName("path" + PATH_INDEX);
 			PATH_INDEX++;
 			ncs.paths.add(path);
@@ -333,13 +388,13 @@ public class GNCModeling  {
 		} else {
 			sw = (NCSwitchNode)(tree.getElement());
 			TreeCell next = new TreeCell();
-			System.out.println("Adding to path: " + sw.getName());
+			//System.out.println("Adding to path: " + sw.getName());
 			list.add(sw.getName());
 			for(int i=0; i<tree.getNbOfChildren(); i++) {
 				next = tree.getChildrenByIndex(i);
 				exploreTree(next, list, origin, traffic);
 			}
-			System.out.println("Removing from path: " + sw.getName());
+			//System.out.println("Removing from path: " + sw.getName());
 			list.remove(list.size()-1);
 		}
 	}
@@ -430,7 +485,7 @@ public class GNCModeling  {
 		// Get all routes concerning that traffic on that switch
 		ArrayList<NCRoute> routes = ncdp.getAllRoutesFor(sw, arti);
 		
-		System.out.println("toto0");
+		//System.out.println("toto0");
 		
 		// Get all next swithes, according to routes, and fill the tree
 		// Verify that there is at least one possibile route
@@ -471,7 +526,7 @@ public class GNCModeling  {
 			System.out.println("Considering route:" + route.toString()+  " vs input route=" + lkname);
 			if (route.inputInterface.equals(lkname)) {
 				// Must check that two routes don't have the same output interface
-				System.out.println("toto1");
+				//System.out.println("toto1");
 				error = false;
 				for(NCRoute route1: computed) {
 					if ((route1 != route) && (route1.outputInterface.equals(route.outputInterface))) {
@@ -484,7 +539,7 @@ public class GNCModeling  {
 				}
 				computed.add(route);
 				
-				System.out.println("toto2");
+				//System.out.println("toto2");
 				// Is it an existing output interface?
 				if (error == false) {
 					link = ncs.hasLinkWith(sw.getNodeName(), route.outputInterface);
@@ -494,7 +549,7 @@ public class GNCModeling  {
 						ce.setTGComponent(sw);
 						warnings.add(ce);	
 					} else {
-						System.out.println("toto3");
+						//System.out.println("toto3");
 						// Is the destination equipment a switch that is in the tree already?
 						// If so, there is a cycle -> ignoring route
 						if (link.getLinkedElement1().getName().equals(sw.getNodeName())) {
@@ -503,7 +558,7 @@ public class GNCModeling  {
 							ncle = link.getLinkedElement1();
 						}
 						
-						System.out.println("toto4");
+						//System.out.println("toto4");
 						// Is the next of the route an equipment?
 						if (ncle instanceof NCEquipment) {
 							ncen = ncdp.getEquipmentByName(ncle.getName());
@@ -514,7 +569,7 @@ public class GNCModeling  {
 								checkingErrors.add(ce);	
 							} else {
 								// Adding an equipment -> leaf of the tree
-								System.out.println("Adding a leaf: " + ncle.getName());
+								//System.out.println("Adding a leaf: " + ncle.getName());
 								cell = new TreeCell();
 								cell.setElement(ncen);
 								tree.addChildren(cell);
@@ -542,9 +597,9 @@ public class GNCModeling  {
 									checkingErrors.add(ce);	
 								} else {
 									// Recursive call
-									System.out.println("Adding a switch: " + ncsn.getNodeName());
+									//System.out.println("Adding a switch: " + ncsn.getNodeName());
 									buildTreeFromSwitch(root, cell, ncsn, nextArriving, arti);
-									System.out.println("Ending adding a switch: " + ncsn.getNodeName());
+									//System.out.println("Ending adding a switch: " + ncsn.getNodeName());
 								}
 							//}
 						}
diff --git a/src/ui/GTURTLEModeling.java b/src/ui/GTURTLEModeling.java
index 294c10a699..dbfeabacfa 100755
--- a/src/ui/GTURTLEModeling.java
+++ b/src/ui/GTURTLEModeling.java
@@ -237,6 +237,10 @@ public class GTURTLEModeling {
 			tm.mergeChoices(nonDeterministic);
 		}
 	}
+	
+	public NCStructure getNCS() {
+		return ncs;
+	}
 
 	public void generateRTLOTOS(File f) {
 		TURTLETranslator tt = new TURTLETranslator(tm);
@@ -4824,6 +4828,7 @@ public class GTURTLEModeling {
 			} catch (FileException fe) {
 				System.out.println("Could not save in file:" + fe.getMessage());
 			}
+			mgui.setMode(MainGUI.NC_OK);
 			return true;
 		}
 		
diff --git a/src/ui/IconManager.java b/src/ui/IconManager.java
index 67ecb18bbb..2c14e50e14 100755
--- a/src/ui/IconManager.java
+++ b/src/ui/IconManager.java
@@ -118,6 +118,10 @@ public class IconManager {
     // CSD diagram
     public static ImageIcon imgic2100, imgic2104, imgic2106,imgic2108,imgic2110;
       
+ 
+	// NC
+	public static ImageIcon imgic3000;
+	
        // Delegate ports image removed, by Solange
     //public static ImageIcon imgic2102;
     
@@ -397,10 +401,12 @@ public class IconManager {
     private static String icon2100 = "images/procsdcomponent.gif";
       //Delegate ports image removed, by Solange
     //private static String icon2102 = "images/adport.gif";
-    private static String icon2104 ="images/cdtclass.gif";
-    private static String icon2106 ="images/proCSDInPort.gif";
-    private static String icon2108 ="images/proCSDOutPort.gif";
-    private static String icon2110 ="images/ProCSDConector.gif";
+    private static String icon2104 = "images/cdtclass.gif";
+    private static String icon2106 = "images/proCSDInPort.gif";
+    private static String icon2108 = "images/proCSDOutPort.gif";
+    private static String icon2110 = "images/ProCSDConector.gif";
+	
+	private static String icon3000= "images/nc.gif";
 	
     public IconManager() {
         
@@ -659,6 +665,9 @@ public class IconManager {
         imgic2108 = getIcon(icon2108);
         imgic2110 = getIcon(icon2110);
         imgic2111 = getIcon(icon2111); //Icon created by Solange
+		
+		// NC
+		imgic3000 = getIcon(icon3000);
     }
     
 } // Class
diff --git a/src/ui/JToolBarMainTurtle.java b/src/ui/JToolBarMainTurtle.java
index c296a9accc..0dcefd7b92 100755
--- a/src/ui/JToolBarMainTurtle.java
+++ b/src/ui/JToolBarMainTurtle.java
@@ -177,6 +177,13 @@ public	class JToolBarMainTurtle extends JToolBar	{
         button.addMouseListener(mgui.mouseHandler);
 		//button = add(mgui.actions[TGUIAction.ACT_SIMU_JAVA]);
         //button.addMouseListener(mgui.mouseHandler);
+		
+		addSeparator();
+		
+		if (MainGUI.ncOn) {
+			button = add(mgui.actions[TGUIAction.ACT_NC]);
+			button.addMouseListener(mgui.mouseHandler);
+		}
         
         addSeparator();
 		
diff --git a/src/ui/MainGUI.java b/src/ui/MainGUI.java
index 8a64c4ce24..c6565f680b 100755
--- a/src/ui/MainGUI.java
+++ b/src/ui/MainGUI.java
@@ -175,6 +175,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
     public final static byte VIEW_WAVE_OK = 40;
     public final static byte REQ_OK = 41;
 	public final static byte UPPAAL_OK = 42;
+	public final static byte NC_OK = 43;
     
     public final static int INCREMENT = 10;
     
@@ -701,6 +702,9 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 		case VIEW_SUGG_DESIGN_KO:
 			actions[TGUIAction.ACT_VIEW_SUGGESTED_DESIGN].setEnabled(false);
 			break;
+		case NC_OK:
+			actions[TGUIAction.ACT_NC].setEnabled(true);
+			break;
 		default:
 			System.out.println("DEFAULT");
 			activeActions(false);
@@ -898,7 +902,7 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
         mainTabbedPane.add(ncp.tabbedPane, index);
         mainTabbedPane.setToolTipTextAt(index, "Open network calculus diagrams");
         mainTabbedPane.setTitleAt(index, name);
-        mainTabbedPane.setIconAt(index, IconManager.imgic14);
+        mainTabbedPane.setIconAt(index, IconManager.imgic60);
         //mainTabbedPane.addTab(name, IconManager.imgic14, dp.tabbedPane, "Opens design diagrams");
         ncp.init();
         //System.out.println("TURTLE OS Design added index=" + index);
@@ -3039,6 +3043,22 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
     	ThreadGUIElement t = new ThreadGUIElement(frame, 0, title, data, "Analyzing graph... Please wait");
     	t.go();
     }
+	
+	public void NC() {
+		System.out.println("NC");
+		JFrameNC jfnc = new JFrameNC("Network calculus", gtm.getNCS());
+        jfnc.setIconImage(IconManager.img8);
+        jfnc.setSize(600, 600);
+        GraphicLib.centerOnParent(jfnc);
+        jfnc.setVisible(true);
+		System.out.println("Done");
+		
+		/*JFrameStatistics jfs = new JFrameStatistics(title, data);
+        jfs.setIconImage(IconManager.img8);
+        jfs.setSize(600, 600);
+        GraphicLib.centerOnParent(jfs);
+        jfs.setVisible(true);*/
+	}
     
     public void statAUT() {
         showAUT("Analysis on the last RG (AUT format)", gtm.getLastTextualRGAUT());
@@ -5024,6 +5044,8 @@ public	class MainGUI implements ActionListener, WindowListener, KeyListener {
 			toggleAttr();
         } else if (command.equals(actions[TGUIAction.ACT_ENHANCE].getActionCommand())) {
             enhanceDiagram();
+        } else if (command.equals(actions[TGUIAction.ACT_NC].getActionCommand())) {
+            NC();
         } else if (command.equals(actions[TGUIAction.EXTERNAL_ACTION_1].getActionCommand())) {
             executeUserCommand(ConfigurationTTool.ExternalCommand1Host, ConfigurationTTool.ExternalCommand1);
         } else if (command.equals(actions[TGUIAction.EXTERNAL_ACTION_2].getActionCommand())) {
diff --git a/src/ui/MalformedModelingException.java b/src/ui/MalformedModelingException.java
index 566525b033..fb43bb12f9 100755
--- a/src/ui/MalformedModelingException.java
+++ b/src/ui/MalformedModelingException.java
@@ -49,7 +49,7 @@ package ui;
 public	class MalformedModelingException extends Exception {
 	
 	public MalformedModelingException() {
-		super("Modeling does not follows the TTOOL format");
+		super("Modeling does not follows the TTool format");
 	}
     
 } // Class 
diff --git a/src/ui/TGUIAction.java b/src/ui/TGUIAction.java
index 3108ee8761..0ff636450a 100755
--- a/src/ui/TGUIAction.java
+++ b/src/ui/TGUIAction.java
@@ -258,6 +258,7 @@ public class TGUIAction extends AbstractAction {
 	public static final int NCDD_SWITCHNODE = 254;
     public static final int NCDD_TRAFFIC_ARTIFACT = 253;
 	public static final int NCDD_ROUTE_ARTIFACT = 256;
+	public static final int ACT_NC = 257;
 	
 	// SysML Requirements
     
@@ -365,7 +366,7 @@ public class TGUIAction extends AbstractAction {
     public static final int PRUEBA_1 = 205;
 
     
-    public static final int NB_ACTION = 257;
+    public static final int NB_ACTION = 258;
 
 
     private  static final TAction [] actions = new TAction[NB_ACTION];
@@ -597,6 +598,8 @@ public class TGUIAction extends AbstractAction {
         actions[NCDD_SWITCHNODE] = new TAction("add-ncdd-switchnode", "Add a switch node", IconManager.imgic700, IconManager.imgic700, "Add a switch node", "Add a switch node to the currently opened network calculus diagram", 0);
         actions[NCDD_TRAFFIC_ARTIFACT] = new TAction("add-ncdd-traffic", "Add a traffic", IconManager.imgic702, IconManager.imgic702, "Traffic", "Add a traffic to the currently opened network calculus diagram", 0);
 		actions[NCDD_ROUTE_ARTIFACT] = new TAction("add-ncdd-route", "Add a route", IconManager.imgic702, IconManager.imgic702, "Route", "Add a route to the currently opened network calculus diagram", 0);
+		actions[ACT_NC] = new TAction("gen_nc-command", "Network calculus", IconManager.imgic3000, IconManager.imgic3000, "Network calculus",  "Perform network calculus from  UML diagrams", '0');
+     
    
 		
         actions[TMLTD_EDIT] = new TAction("edit-tmlcd-diagram", "Edit TML Task diagram", IconManager.imgic100, IconManager.imgic101, "Edit TML task diagram", "Make it possible to edit the currently opened TML task diagram", 0);
diff --git a/src/ui/ncdd/NCConnectorNode.java b/src/ui/ncdd/NCConnectorNode.java
index 68c7348f72..6b1dacfefe 100755
--- a/src/ui/ncdd/NCConnectorNode.java
+++ b/src/ui/ncdd/NCConnectorNode.java
@@ -63,7 +63,9 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
     protected int arrowLength = 10;
     protected int widthValue, heightValue, maxWidthValue, h;
 	
+	protected boolean hasCapacity = false;
 	protected int capacity = 10;
+	protected String capacityUnit = "Mbs";
 	protected String interfaceName;
 	
     
@@ -77,7 +79,11 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
     }
 	
 	public void makeValue() {
-		value = "{" + interfaceName + ", capacity = " + capacity + "}";
+		if (hasCapacity) {
+			value = "{" + interfaceName + ", capacity = " + capacity +  " " + capacityUnit + "}";
+		} else {
+			value = "{" + interfaceName + "}";
+		}
 	}
 	
 	public String getInterfaceName() {
@@ -113,7 +119,7 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
 		String tmp;
 		String interfaceNameTmp;
         
-        JDialogLinkNCNode jdlncn = new JDialogLinkNCNode(frame, "Setting link parameters", capacity, interfaceName);
+        JDialogLinkNCNode jdlncn = new JDialogLinkNCNode(frame, "Setting link parameters", hasCapacity, capacity, capacityUnit, interfaceName);
         jdlncn.setSize(250, 200);
         GraphicLib.centerOnParent(jdlncn);
         jdlncn.show(); // Blocked until dialog has been closed
@@ -155,9 +161,11 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
         
         if (!jdlncn.hasBeenCancelled()) {
 			interfaceName = interfaceNameTmp;
+			capacityUnit = jdlncn.getCapacityUnit();
+			hasCapacity = jdlncn.hasCapacity();
             makeValue();
         }
-        
+		
         return !jdlncn.hasBeenCancelled();
     }
     
@@ -178,7 +186,11 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
         StringBuffer sb = new StringBuffer("<extraparam>\n");
         sb.append("<info capacity=\"");
 		sb.append(capacity);
-        sb.append("\" interfaceName=\"");
+        sb.append("\" capacityUnit=\"");
+		sb.append(capacityUnit);
+		sb.append("\" hasCapacity=\"");
+		sb.append(hasCapacity);
+		sb.append("\" interfaceName=\"");
 		sb.append(interfaceName);
 		sb.append("\"/>\n");
         sb.append("</extraparam>\n");
@@ -194,6 +206,8 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
             Element elt;
             int t1id;
 			String prio;
+			String unit;
+			String has;
             
             for(int i=0; i<nl.getLength(); i++) {
                 n1 = nl.item(i);
@@ -214,6 +228,21 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
 								if (elt != null) {
 									interfaceName = prio;
 								}
+								
+								unit = elt.getAttribute("capacityUnit");
+								if ((unit != null) && (unit.length() > 0)){
+									capacityUnit = unit;
+								}
+								
+								has =  elt.getAttribute("hasCapacity");
+								if ((has != null) && (has.length() > 0)){
+										if (has.equals("true")) {
+											hasCapacity = true;
+										} else {
+											hasCapacity = false;
+										}
+								}
+								
                             }
                         }
                     }
@@ -225,31 +254,25 @@ public  class NCConnectorNode extends TGConnector implements WithAttributes {
         }
     }
 	
-    
-    /*public TMLArchiCPUNode getOriginNode() {
-        TGComponent tgc = tdp.getComponentToWhichBelongs(getTGConnectingPointP1());
-        if (tgc instanceof TMLArchiCPUNode) {
-            return (TMLArchiCPUNode)tgc;
-        } else {
-            return null;
-        }
-    }
-    
-    public TMLArchiCPUNode getDestinationNode() {
-        TGComponent tgc = tdp.getComponentToWhichBelongs(getTGConnectingPointP2());
-        if (tgc instanceof TMLArchiCPUNode) {
-            return (TMLArchiCPUNode)tgc;
-        } else {
-            return null;
-        }
-    }*/
 	
 	public int getCapacity() {
 		return capacity;
 	}
+	
+	public boolean hasCapacity() {
+		return hasCapacity;
+	}
+	
+	public String getCapacityUnit() {
+		return capacityUnit;
+	}
     
 	public String getAttributes() {
-		return "Capacity = " + capacity;
+		if (hasCapacity) {
+			return "Capacity = " + capacity + " " + capacityUnit;
+		} else {
+			return "No capacity";
+		}
 	}
   
  
diff --git a/src/ui/ncdd/NCSwitchNode.java b/src/ui/ncdd/NCSwitchNode.java
index c4060a8471..fd67fd83f9 100755
--- a/src/ui/ncdd/NCSwitchNode.java
+++ b/src/ui/ncdd/NCSwitchNode.java
@@ -65,6 +65,8 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC
     private String stereotype = "Switch";
 	
 	protected int schedulingPolicy = 0; // 0: FCFS ; 1: SP
+	protected int capacity = 10;
+	protected String capacityUnit = "Mbs";
     
     public NCSwitchNode(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);
@@ -171,13 +173,21 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC
 	public int getSchedulingPolicy() {
 		return schedulingPolicy;
 	}
+	
+	public int getCapacity() {
+		return capacity;
+	}
+	
+	public String getCapacityUnit() {
+		return capacityUnit;
+	}
     
    	public boolean editOndoubleClick(JFrame frame) {
         //System.out.println("Double click");
         String oldName = name;
 		String tmp;
         
-        JDialogNCSwitchNode jdncsn = new JDialogNCSwitchNode(frame, "Setting switch parameters", name, schedulingPolicy);
+        JDialogNCSwitchNode jdncsn = new JDialogNCSwitchNode(frame, "Setting switch parameters", name, schedulingPolicy, capacity, capacityUnit);
         jdncsn.setSize(350, 250);
         GraphicLib.centerOnParent(jdncsn);
         jdncsn.show(); // Blocked until dialog has been closed
@@ -213,7 +223,17 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC
 		
 		name = tmp;
 		schedulingPolicy = jdncsn.getSchedulingPolicy();
-        
+		
+		try {
+			capacity = Integer.decode(jdncsn.getCapacity()).intValue();
+		} catch (Exception e) {
+			 JOptionPane.showMessageDialog(frame,
+					"Wrong capacity value",
+					"Error",
+					JOptionPane.INFORMATION_MESSAGE);
+		}
+        capacityUnit = jdncsn.getCapacityUnit();
+		
         return true;
     }
     
@@ -288,6 +308,8 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC
     protected String translateExtraParam() {
         StringBuffer sb = new StringBuffer("<extraparam>\n");
         sb.append("<info schedulingPolicy=\"" + schedulingPolicy);
+		sb.append("\" capacity=\"" + capacity);
+		sb.append("\" capacityUnit=\"" + capacityUnit);
         sb.append("\" />\n");
         sb.append("</extraparam>\n");
         return new String(sb);
@@ -313,6 +335,10 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC
                             elt = (Element) n2;
                             if (elt.getTagName().equals("info")) {
                                 schedulingPolicy = Integer.decode(elt.getAttribute("schedulingPolicy")).intValue();
+								if (elt.getAttribute("capacity").length() > 0) {
+									capacityUnit = elt.getAttribute("capacityUnit");
+									capacity = Integer.decode(elt.getAttribute("capacity")).intValue();
+								}
 							}
                         }
                     }
@@ -336,7 +362,8 @@ public class NCSwitchNode extends TGCWithInternalComponent implements SwallowTGC
 		} else {
 			pol = "SP";
 		}
-		String attr = "Scheduling policy = " + pol;
+		String attr = "Scheduling policy = " + pol + "\n";
+		attr += "Capacity = " + capacity + " " + capacityUnit;
 		return attr;
 		
 	}
diff --git a/src/ui/ncdd/NCTrafficArtifact.java b/src/ui/ncdd/NCTrafficArtifact.java
index b86536505b..1e288eea59 100755
--- a/src/ui/ncdd/NCTrafficArtifact.java
+++ b/src/ui/ncdd/NCTrafficArtifact.java
@@ -70,7 +70,9 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
 	
 	protected int periodicType = 0; // 0: periodic ; 1: aperiodic
 	protected int deadline = 10;
-	protected int maxPacketSize = 20;
+	protected String deadlineUnit = "ms"; // "us", "ms", "s";
+	protected int minPacketSize = 20;
+	protected int maxPacketSize = 40;
 	protected int priority = 0; // 0 to 3
     
     public NCTrafficArtifact(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp)  {
@@ -147,7 +149,7 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
 		boolean error = false;
 		String oldValue = value;
 		
-		JDialogNCTraffic dialog = new JDialogNCTraffic(frame, "Setting traffic attributes", value, periodicType, deadline, maxPacketSize, priority);
+		JDialogNCTraffic dialog = new JDialogNCTraffic(frame, "Setting traffic attributes", value, periodicType, deadline, deadlineUnit, minPacketSize, maxPacketSize, priority);
 		dialog.setSize(300, 350);
         GraphicLib.centerOnParent(dialog);
         dialog.show(); // blocked until dialog has been closed
@@ -187,7 +189,9 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
 		periodicType = dialog.getPeriodicType();
 		priority = dialog.getPriority();
 		deadline = dialog.getDeadline();
+		deadlineUnit = dialog.getDeadlineUnit();
 		maxPacketSize = dialog.getMaxPacketSize();
+		minPacketSize = dialog.getMinPacketSize();
 			
 		return !error;
       
@@ -210,6 +214,10 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
         sb.append(periodicType);
 		sb.append("\" deadline=\"");
 		sb.append(deadline);
+		sb.append("\" deadlineUnit=\"");
+		sb.append(deadlineUnit);
+		sb.append("\" minPacketSize=\"");
+		sb.append(minPacketSize);
 		sb.append("\" maxPacketSize=\"");
 		sb.append(maxPacketSize);
 		sb.append("\" priority=\"");
@@ -227,7 +235,7 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
             Node n1, n2;
             Element elt;
             int t1id;
-            String svalue = null, s0 = null, s1 = null, s2 = null, s3 = null;
+            String svalue = null, s0 = null, s1 = null, s2 = null, s3 = null, s4 = null, s5 = null;
             
             for(int i=0; i<nl.getLength(); i++) {
                 n1 = nl.item(i);
@@ -243,6 +251,8 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
                                 svalue = elt.getAttribute("value");
                                 s0 = elt.getAttribute("periodicType");
                                 s1 = elt.getAttribute("deadline");
+								s4 = elt.getAttribute("deadlineUnit");
+								s5 = elt.getAttribute("minPacketSize");
 								s2 = elt.getAttribute("maxPacketSize");
 								s3 = elt.getAttribute("priority");
                             }
@@ -262,6 +272,14 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
                             }
 							//System.out.println("Decoding traffic s0=" + s0 + " s1=" + s1 + " s2=" + s2 + " s3=" + s3);
                            
+							if ((s4 != null) && (s4.length() > 0)) {
+								deadlineUnit = s4;
+							}
+							
+							if ((s5 != null) && (s5.length() > 0)) {
+								minPacketSize = Integer.decode(s5).intValue();
+                            }
+							
 							if (s2 != null){
 								maxPacketSize = Integer.decode(s2).intValue();
                             }
@@ -292,8 +310,16 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
         return deadline;
     }
 	
+	public String getDeadlineUnit() {
+        return deadlineUnit;
+    }
+	
 	public int getMaxPacketSize() {
         return maxPacketSize;
+    }     
+	
+	public int getMinPacketSize() {
+        return minPacketSize;
     }
 	
 	public int getPriority() {
@@ -307,8 +333,9 @@ public class NCTrafficArtifact extends TGCWithoutInternalComponent implements Sw
 		} else {
 			ret += "Aperioridic\n";
 		}
-		ret += "Deadline = " + deadline + "\n";
-		ret += "Max packet size = " + maxPacketSize + "\n";
+		ret += "Deadline = " + deadline + " " + deadlineUnit + "\n";
+		ret += "Min packet size = " + minPacketSize + " B\n";
+		ret += "Max packet size = " + maxPacketSize + " B\n";
 		ret += "Priority = " + priority; 
 		
 		return ret;
diff --git a/src/ui/tree/DiagramTreeRenderer.java b/src/ui/tree/DiagramTreeRenderer.java
index ff5c81971e..c7841171cb 100755
--- a/src/ui/tree/DiagramTreeRenderer.java
+++ b/src/ui/tree/DiagramTreeRenderer.java
@@ -64,6 +64,8 @@ import ui.tmlcd.*;
 import ui.tmldd.*;
 import ui.tmlcompd.*;
 
+import ui.ncdd.*;
+
 import ui.oscd.*;
 import ui.osad.*;
 
@@ -102,6 +104,9 @@ public class DiagramTreeRenderer extends DefaultTreeCellRenderer  {
         } else if (value instanceof DeploymentPanel) {
             setIcon(IconManager.imgic60);
             setToolTipText("TURTLE Deployment");
+        } else if (value instanceof NCPanel) {
+            setIcon(IconManager.imgic60);
+            setToolTipText("Network Calculus");
         } else if (value instanceof RequirementPanel) {
             setIcon(IconManager.imgic1000);
             setToolTipText("TURTLE Requirement");
@@ -123,6 +128,9 @@ public class DiagramTreeRenderer extends DefaultTreeCellRenderer  {
         } else if (value instanceof TDeploymentDiagramPanel) {
             setIcon(IconManager.imgic60);
             setToolTipText("TURTLE Deployment Diagram");          
+        } else if (value instanceof NCDiagramPanel) {
+            setIcon(IconManager.imgic60);
+            setToolTipText("NC Diagram");          
         } else if (value instanceof RequirementDiagramPanel) {
             setIcon(IconManager.imgic1000);
             setToolTipText("TURTLE Requirement Diagram");          
diff --git a/src/ui/window/EquipmentsNCTableModel.java b/src/ui/window/EquipmentsNCTableModel.java
new file mode 100755
index 0000000000..e961d9bb40
--- /dev/null
+++ b/src/ui/window/EquipmentsNCTableModel.java
@@ -0,0 +1,135 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class EquipmentsNCTableModel
+ * Main data of equipments in NC structures
+ * Creation: 25/11/2008
+ * @version 1.0 25/11/2008
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.window;
+
+import java.util.*;
+import javax.swing.table.*;
+
+import myutil.*;
+import nc.*;
+
+public class EquipmentsNCTableModel extends AbstractTableModel {
+	private NCStructure ncs;
+	
+	//private String [] names;
+	private String [] outputs;
+	private String [] inputs;
+
+	public EquipmentsNCTableModel(NCStructure _ncs) {
+		ncs = _ncs;
+		outputs = new String[ncs.equipments.size()];
+		inputs = new String[ncs.equipments.size()];
+		computeData(_ncs);
+	}
+
+	// From AbstractTableModel
+	public int getRowCount() {
+		return ncs.equipments.size();
+	}
+
+	public int getColumnCount() {
+		return 3;
+	}
+
+	public Object getValueAt(int row, int column) {
+		if (column == 0) {
+			return ncs.equipments.get(row).getName();
+		} else if (column == 1) {
+			return outputs[row];
+		}
+		return inputs[row];
+	}
+
+	public String getColumnName(int columnIndex) {
+		switch(columnIndex) {
+		case 0:
+			return "Equipment";
+		case 1:
+			return "Ouput traffic";
+		}
+		return "Input traffic";
+	}
+
+
+	private void computeData(NCStructure _ncs) {
+		String out = "", in = "";
+		String tmpout= "", tmpin = "";
+		int cpt=0;
+		for(NCEquipment eq: ncs.equipments) {
+			for(NCPath path: ncs.paths) {
+				
+				if (path.destination == eq) {
+					if (tmpin.indexOf(path.traffic.getName()) == -1) {
+						tmpin += path.traffic.getName() + " ";
+						if (in.length() > 0) {
+							in += ", " + path.traffic.getName();
+						} else {
+							in = path.traffic.getName();
+						}
+					}
+				}
+				
+				if (path.origin == eq) {
+					if (tmpout.indexOf(path.traffic.getName()) == -1) {
+						tmpout += path.traffic.getName() + " ";
+						if (out.length() > 0) {
+							out += ", " + path.traffic.getName();
+						} else {
+							out = path.traffic.getName();
+						}
+					}
+				}
+			}
+			
+		outputs[cpt] = out;
+		inputs[cpt] = in;
+		out = "";
+		in = "";
+		cpt ++;
+		}
+	}
+}
\ No newline at end of file
diff --git a/src/ui/window/GeneralInfoNCTableModel.java b/src/ui/window/GeneralInfoNCTableModel.java
new file mode 100755
index 0000000000..d22dda1fb1
--- /dev/null
+++ b/src/ui/window/GeneralInfoNCTableModel.java
@@ -0,0 +1,101 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class GeneralInfoNCTableModel
+ * Main data of NC structures
+ * Creation: 25/11/2008
+ * @version 1.0 25/11/2008
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.window;
+
+import java.util.*;
+import javax.swing.table.*;
+
+import myutil.*;
+import nc.*;
+
+public class GeneralInfoNCTableModel extends AbstractTableModel {
+	
+	private String [] names = {"Equipments", "Switches", "Traffics", "Links", "Paths"};
+	private String [] sizes;
+
+	public GeneralInfoNCTableModel(NCStructure _ncs) {
+		//ncs = _ncs;
+		sizes = new String[5];
+		computeData(_ncs);
+	}
+
+	// From AbstractTableModel
+	public int getRowCount() {
+		return 5;
+	}
+
+	public int getColumnCount() {
+		return 2;
+	}
+
+	public Object getValueAt(int row, int column) {
+		if (column == 0) {
+			return names[row];
+		} else {
+			return sizes[row];
+		}
+	}
+
+	public String getColumnName(int columnIndex) {
+		switch(columnIndex) {
+		case 0:
+			return "Element";
+		case 1:
+			return "#";
+		}
+		return "none";
+	}
+
+
+	private void computeData(NCStructure _ncs) {
+		sizes[0] = "" + _ncs.equipments.size();
+		sizes[1] = "" + _ncs.switches.size();
+		sizes[2] = "" + _ncs.traffics.size();
+		sizes[3] = "" + _ncs.links.size();
+		sizes[4] = "" + _ncs.paths.size();
+	}
+}
\ No newline at end of file
diff --git a/src/ui/window/JDialogLinkNCNode.java b/src/ui/window/JDialogLinkNCNode.java
index fde323dda8..2646766f6c 100755
--- a/src/ui/window/JDialogLinkNCNode.java
+++ b/src/ui/window/JDialogLinkNCNode.java
@@ -61,6 +61,8 @@ public class JDialogLinkNCNode extends javax.swing.JDialog implements ActionList
     
     private String interfaceName;
     private int capacity;
+	private String capacityUnit;
+	private boolean hasCapacity;
 	
 	private boolean data;
     
@@ -68,22 +70,27 @@ public class JDialogLinkNCNode extends javax.swing.JDialog implements ActionList
     
     // Panel1
     private JTextField interfaceNameText, capacityText;
+	private JCheckBox hasCapacityBox;
+	private JComboBox capacityUnitBox;
     
     // Main Panel
     private JButton closeButton;
     private JButton cancelButton;
     
     /** Creates new form  */
-    public JDialogLinkNCNode(Frame _f, String _title, int _capacity, String _interfaceName) {
+    public JDialogLinkNCNode(Frame _f, String _title, boolean _hasCapacity, int _capacity, String _capacityUnit, String _interfaceName) {
         super(_f, _title, true);
         frame = _f;
         
         interfaceName = _interfaceName;
+		hasCapacity = _hasCapacity;
         capacity = _capacity;
+		capacityUnit = _capacityUnit;
         
         myInitComponents();
         initComponents();
         pack();
+		updateComponents();
     }
     
     private void myInitComponents() {
@@ -126,14 +133,27 @@ public class JDialogLinkNCNode extends javax.swing.JDialog implements ActionList
         c1.gridwidth = GridBagConstraints.REMAINDER; //end row
         interfaceNameText = new JTextField(interfaceName);
         panel1.add(interfaceNameText, c1);
+		
+		hasCapacityBox = new JCheckBox("has its own caapcity", hasCapacity);
+		hasCapacityBox.addActionListener(this);
+		panel1.add(hasCapacityBox, c1);
         
         c1.gridwidth = 1;
         c1.anchor = GridBagConstraints.CENTER;
         panel1.add(new JLabel("Capacity:"), c1);
-        c1.gridwidth = GridBagConstraints.REMAINDER; //end row
+        //c1.gridwidth = GridBagConstraints.REMAINDER; //end row
         capacityText = new JTextField(""+capacity);
         panel1.add(capacityText, c1);
-        
+        c1.gridwidth = GridBagConstraints.REMAINDER; //end row
+		capacityUnitBox = new JComboBox();
+		capacityUnitBox.addItem("Mbs");
+		capacityUnitBox.addItem("kbs");
+		if (capacityUnit.equals("Mbs")) {
+			capacityUnitBox.setSelectedItem(0);
+		} else {
+			capacityUnitBox.setSelectedItem(1);
+		}
+		panel1.add(capacityUnitBox, c1);
         
         // main panel;
         c0.gridwidth = 1;
@@ -163,8 +183,16 @@ public class JDialogLinkNCNode extends javax.swing.JDialog implements ActionList
             closeDialog();
 		} else if (command.equals("Cancel")) {
             cancelDialog();
+		} if (evt.getSource() == hasCapacityBox) {
+			updateComponents();
 		}
     }
+	
+	public void updateComponents() {
+		boolean b = hasCapacityBox.isSelected();
+		capacityText.setEnabled(b);
+		capacityUnitBox.setEnabled(b);
+	}
     
     
     public void closeDialog() {
@@ -191,6 +219,14 @@ public class JDialogLinkNCNode extends javax.swing.JDialog implements ActionList
     public String getCapacity() {
         return capacityText.getText();
     }
+	
+	public String getCapacityUnit() {
+		return capacityUnitBox.getSelectedItem().toString();
+	}
+	
+	public boolean hasCapacity() {
+		return hasCapacityBox.isSelected();
+	}
     
   
 }
diff --git a/src/ui/window/JDialogNCRoute.java b/src/ui/window/JDialogNCRoute.java
index ebe2f927b6..33b82baa64 100755
--- a/src/ui/window/JDialogNCRoute.java
+++ b/src/ui/window/JDialogNCRoute.java
@@ -181,6 +181,10 @@ public class JDialogNCRoute extends javax.swing.JDialog implements ActionListene
 		for(String s0: inputInterfaces) {
 			inputInterfaceBox.addItem(s0);
 		}
+		if (inputInterfaces.size() < 2) {
+			inputInterfaceBox.setEnabled(false);
+		}
+		inputInterfaceBox.addActionListener(this);
         panel1.add(inputInterfaceBox, c1);
 		
 		panel1.add(new JLabel(" / "), c1);
@@ -199,6 +203,12 @@ public class JDialogNCRoute extends javax.swing.JDialog implements ActionListene
 		for(String s2: outputInterfaces) {
 			outputInterfaceBox.addItem(s2);
 		}
+		if (outputInterfaces.size() < 2) {
+			outputInterfaceBox.setEnabled(false);
+		} else {
+			outputInterfaceBox.setSelectedIndex(1);
+		}
+		outputInterfaceBox.addActionListener(this);
         panel1.add(outputInterfaceBox, c1);
         
         // third line panel1
@@ -294,8 +304,32 @@ public class JDialogNCRoute extends javax.swing.JDialog implements ActionListene
             downRoute();
         } else if (command.equals("Up")) {
             upRoute();
-        }
+        } else if (evt.getSource() == inputInterfaceBox) {
+			manageInputBox();
+		} else if (evt.getSource() == outputInterfaceBox) {
+			manageOutputBox();
+		}
     }
+	
+	public void manageInputBox() {
+		int index = inputInterfaceBox.getSelectedIndex();
+		int indexOther = outputInterfaceBox.getSelectedIndex();
+		
+		if (indexOther == index) {
+			indexOther = (indexOther + 1) % outputInterfaceBox.getItemCount();
+			outputInterfaceBox.setSelectedIndex(indexOther);
+		}
+	}
+	
+	public void manageOutputBox() {
+		int index = inputInterfaceBox.getSelectedIndex();
+		int indexOther = outputInterfaceBox.getSelectedIndex();
+		
+		if (indexOther == index) {
+			index = (index + 1) % inputInterfaceBox.getItemCount();
+			inputInterfaceBox.setSelectedIndex(index);
+		}
+	}
     
     
     public void addRoute() {
diff --git a/src/ui/window/JDialogNCSwitchNode.java b/src/ui/window/JDialogNCSwitchNode.java
index c94e3a708f..98a086d199 100755
--- a/src/ui/window/JDialogNCSwitchNode.java
+++ b/src/ui/window/JDialogNCSwitchNode.java
@@ -61,6 +61,8 @@ public class JDialogNCSwitchNode extends javax.swing.JDialog implements ActionLi
     
     private String switchName;
     private int schedulingPolicy;
+	private int capacity;
+	private String capacityUnit;
 	
 	private boolean data;
     
@@ -68,18 +70,22 @@ public class JDialogNCSwitchNode extends javax.swing.JDialog implements ActionLi
     // Panel1
     private JTextField switchNameText;
 	private JComboBox schedulingPolicyBox;
+	private JTextField capacityText;
+	private JComboBox capacityUnitBox;
     
     // Main Panel
     private JButton closeButton;
     private JButton cancelButton;
     
     /** Creates new form  */
-    public JDialogNCSwitchNode(Frame _f, String _title, String _switchName, int _schedulingPolicy) {
+    public JDialogNCSwitchNode(Frame _f, String _title, String _switchName, int _schedulingPolicy, int _capacity, String _capacityUnit) {
         super(_f, _title, true);
         frame = _f;
         
         switchName = _switchName;
         schedulingPolicy = _schedulingPolicy;
+		capacity = _capacity;
+		capacityUnit = _capacityUnit;
         
         myInitComponents();
         initComponents();
@@ -128,7 +134,6 @@ public class JDialogNCSwitchNode extends javax.swing.JDialog implements ActionLi
         panel1.add(switchNameText, c1);
         
         c1.gridwidth = 1;
-        c1.anchor = GridBagConstraints.CENTER;
         panel1.add(new JLabel("Scheduling policy:"), c1);
         c1.gridwidth = GridBagConstraints.REMAINDER; //end row
         schedulingPolicyBox = new JComboBox();
@@ -136,6 +141,23 @@ public class JDialogNCSwitchNode extends javax.swing.JDialog implements ActionLi
 		schedulingPolicyBox.addItem("Static Priority");
 		schedulingPolicyBox.setSelectedIndex(schedulingPolicy);
         panel1.add(schedulingPolicyBox, c1);
+		
+		c1.gridwidth = 1;
+        panel1.add(new JLabel("Capacity:"), c1);
+        //c1.gridwidth = GridBagConstraints.REMAINDER; //end row
+        capacityText = new JTextField(""+capacity);
+        panel1.add(capacityText, c1);
+		c1.gridwidth = GridBagConstraints.REMAINDER; 
+		capacityUnitBox = new JComboBox();
+		capacityUnitBox.addItem("Mbs");
+		capacityUnitBox.addItem("Kbs");
+		if (capacityUnit.equals("Mbs")) {
+			capacityUnitBox.setSelectedItem(0);
+		} else {
+			capacityUnitBox.setSelectedItem(1);
+		}
+		panel1.add(capacityUnitBox, c1);
+		
         
         // main panel;
         c0.gridwidth = 1;
@@ -193,6 +215,14 @@ public class JDialogNCSwitchNode extends javax.swing.JDialog implements ActionLi
     public int getSchedulingPolicy() {
         return schedulingPolicyBox.getSelectedIndex();
     }
+	
+	public String getCapacity() {
+		return capacityText.getText();
+	}
+	
+	public String getCapacityUnit() {
+		return capacityUnitBox.getSelectedItem().toString();
+	}
     
   
 }
diff --git a/src/ui/window/JDialogNCTraffic.java b/src/ui/window/JDialogNCTraffic.java
index 38503ee258..1623c426ff 100755
--- a/src/ui/window/JDialogNCTraffic.java
+++ b/src/ui/window/JDialogNCTraffic.java
@@ -59,27 +59,29 @@ public class JDialogNCTraffic extends javax.swing.JDialog implements ActionListe
     private JPanel panel1;
     private Frame frame;
     
-	protected String value;
-    protected int periodicType, deadline, maxPacketSize, priority;
+	protected String value, deadlineUnit;
+    protected int periodicType, deadline, minPacketSize, maxPacketSize, priority;
 	
 	private boolean data;
     
     // Panel1
-    private JTextField valueText, deadlineText, maxPacketSizeText;
-	private JComboBox periodicTypeBox, priorityBox;
+    private JTextField valueText, deadlineText, minPacketSizeText, maxPacketSizeText;
+	private JComboBox periodicTypeBox, priorityBox, deadlineUnitBox;
     
     // Main Panel
     private JButton closeButton;
     private JButton cancelButton;
     
     /** Creates new form  */
-    public JDialogNCTraffic(Frame _f, String _title, String _value, int _periodicType, int _deadline, int _maxPacketSize, int _priority) {
+    public JDialogNCTraffic(Frame _f, String _title, String _value, int _periodicType, int _deadline, String _deadlineUnit, int _minPacketSize, int _maxPacketSize, int _priority) {
         super(_f, _title, true);
         frame = _f;
         
 		value = _value;
         periodicType = _periodicType;
 		deadline = _deadline;
+		deadlineUnit = _deadlineUnit;
+		minPacketSize = _minPacketSize;
 		maxPacketSize = _maxPacketSize;
 		priority = _priority;
         
@@ -107,7 +109,7 @@ public class JDialogNCTraffic extends javax.swing.JDialog implements ActionListe
         panel1 = new JPanel();
         panel1.setLayout(gridbag1);
         panel1.setBorder(new javax.swing.border.TitledBorder("Setting idenfier and capacity "));
-        panel1.setPreferredSize(new Dimension(350, 400));
+        panel1.setPreferredSize(new Dimension(400, 400));
         
         // first line panel1
         c1.gridwidth = 1;
@@ -143,9 +145,29 @@ public class JDialogNCTraffic extends javax.swing.JDialog implements ActionListe
         
 		c1.gridwidth = 1;
         panel1.add(new JLabel("Deadline:"), c1);
-        c1.gridwidth = GridBagConstraints.REMAINDER; //end row
-        deadlineText = new JTextField(""+deadline);
+        deadlineText = new JTextField(""+deadline, 10);
         panel1.add(deadlineText, c1);
+		c1.gridwidth = GridBagConstraints.REMAINDER; //end row
+		deadlineUnitBox = new JComboBox();
+		deadlineUnitBox.addItem("s");
+		deadlineUnitBox.addItem("ms");
+		deadlineUnitBox.addItem("us");
+		int cpt;
+		if (deadlineUnit.equals("s")) {
+			cpt = 0; 
+		}  else if (deadlineUnit.equals("ms")) {
+			cpt = 1;
+		} else {
+			cpt = 2;
+		}
+		deadlineUnitBox.setSelectedIndex(cpt);
+        panel1.add(deadlineUnitBox, c1);
+		
+		c1.gridwidth = 1;
+        panel1.add(new JLabel("Min packet size:"), c1);
+        c1.gridwidth = GridBagConstraints.REMAINDER; //end row
+        minPacketSizeText = new JTextField(""+minPacketSize);
+        panel1.add(minPacketSizeText, c1);
 		
 		c1.gridwidth = 1;
         panel1.add(new JLabel("Max packet size:"), c1);
@@ -229,6 +251,18 @@ public class JDialogNCTraffic extends javax.swing.JDialog implements ActionListe
 		}
     }
 	
+	public String getDeadlineUnit() {
+		return deadlineUnitBox.getSelectedItem().toString();
+	}
+	
+	public int getMinPacketSize() {
+		try {
+			return Integer.decode(minPacketSizeText.getText()).intValue();
+		} catch (Exception e) {
+			return minPacketSize;
+		}
+    }
+	
 	public int getMaxPacketSize() {
 		try {
 			return Integer.decode(maxPacketSizeText.getText()).intValue();
diff --git a/src/ui/window/JFrameNC.java b/src/ui/window/JFrameNC.java
new file mode 100755
index 0000000000..6561fcd456
--- /dev/null
+++ b/src/ui/window/JFrameNC.java
@@ -0,0 +1,750 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+* Class JFrameNC
+* Creation: 25/11/2008
+* version 1.0 25/11/2008
+* @author Ludovic APVRILLE
+* @see
+*/
+
+package ui.window;
+
+//import java.io.*;
+import javax.swing.*;
+//import javax.swing.event.*;
+import javax.swing.table.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.io.*;
+
+
+import myutil.*;
+import ui.*;
+import ui.file.*;
+
+import nc.*;
+
+
+public	class JFrameNC extends JFrame implements ActionListener /*, StoppableGUIElement, SteppedAlgorithm, ExternalCall*/ {
+	
+	private NCStructure ncs;
+	
+	
+	//private StatisticsTableModel tm;
+	
+	//private JStatisticsPanel jstat;
+	
+	private JScrollPane jspGeneralInfo;
+	private JScrollPane jspEquipmentInfo;
+	private JScrollPane jspSwitchInfo;
+	private JScrollPane jspTrafficInfo;
+	private JScrollPane jspLinkInfo;
+	private JScrollPane jspPathInfo;
+	
+	//private JTextField eq, sw, tr, li, pa;
+	
+	// tab pane
+	JTabbedPane mainTabbedPane;
+	
+	//shortest paths
+	//JComboBox combo1, combo2, combo3, combo4;
+	//JTextField combo1, combo2, combo3, combo4;
+	//JTextField text1, text2;
+	//JButton goPath, goPathL, savePath, savePathL;
+	
+	/*public synchronized void stopElement() {
+		if (computingPath) {
+			GraphAlgorithms.go = false;
+			return;
+		}
+		if (!hasFinished()) {
+			if (!graphDone) {
+				if (graph != null) {
+					graph.stopBuildGraph();
+				}
+			} else  {
+				if (tm != null) {
+					tm.stopBuildElement();
+				} 
+			}
+			stopped = true;
+		}
+		stopAsSoonAsPossible = true;
+	}
+	
+	public synchronized void setFinished() {
+		finished = true;
+	}
+	
+	public synchronized boolean hasFinished() {
+		return finished;
+	}
+	
+	public synchronized boolean hasBeenStopped() {
+		return stopped;
+	}
+	
+	public int getPercentage() {
+		if (computingPath) {
+			return -1;
+		}
+		if (graph == null) {
+			return 0;
+		} else {
+			if (!graphDone) {
+				return graph.getPercentage();
+			} else {
+				if (!statisticsDone) {
+					if (tm != null) {
+						return tm.getPercentage();
+					} else {
+						return 0;
+					}
+				}
+				return -1;
+			}
+		}
+	}
+	
+	public String getCurrentActivity() {
+		if (computingPath) {
+			return "Path is being calculated";
+		}
+		if (graph == null) {
+			return "All done";
+		} else {
+			if (!graphDone) {
+				return "Analyzing graph";
+			} else {
+				if (statisticsDone) {
+					if (cycleDone) {
+						return "Computing cycles";
+					} else {
+						return "Building deadlock information";
+					}
+				} else {
+					return "Building statistical information";
+				}
+			}
+		}	
+	}
+	
+	public void goElement() {
+		graph = new AUTGraph();
+		//System.out.println("Building graph : " + data);
+		graph.buildGraph(data);
+		graph.computeStates();
+		//System.out.println("Build is done");
+		if (stopped) {
+			return;
+		}
+		graphDone = true;
+		//System.out.println("making components");
+		makeComponents();
+		//System.out.println("setting finished");
+		setFinished();
+		//System.out.println("Done");
+	}*/
+	
+	public JFrameNC(String title, NCStructure _ncs) {
+		super(title);
+		ncs = _ncs;
+		makeComponents();
+	}
+	
+	public void makeComponents() {
+		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+		Container framePanel = getContentPane();
+		framePanel.setLayout(new BorderLayout());
+		
+		
+		//jstat = new JStatisticsPanel(this, data);
+		//System.out.println("Building statistical elements");
+		//tm = new StatisticsTableModel(data);
+		/*tm = new StatisticsTableModel();
+		tm.analyzeData(graph);
+		
+		
+		TableSorter sorter = new TableSorter(tm);
+		
+	
+		
+		
+		JTable jtable = new JTable(sorter);
+	
+		sorter.setTableHeader(jtable.getTableHeader());
+		
+	
+		
+		/*try {
+			sorter.setColumnComparator(Class.forName("Integer"), sorter.INTEGER_COMPARATOR);
+        } catch (ClassNotFoundException e) {
+			
+        }
+		((jtable.getColumnModel()).getColumn(0)).setPreferredWidth(Math.max(maxLengthColumn(framePanel, tm, 0) + 20, 100));
+		((jtable.getColumnModel()).getColumn(1)).setPreferredWidth(Math.max(maxLengthColumn(framePanel, tm, 1) + 15, 60));
+		((jtable.getColumnModel()).getColumn(2)).setPreferredWidth(Math.max(maxLengthColumn(framePanel, tm, 2) + 15, 400));
+		jtable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);*/
+		
+		
+		//jsp = new JScrollPane(jtable);
+		
+		
+		//jsp.setWheelScrollingEnabled(true);
+		//jsp.getVerticalScrollBar().setUnitIncrement(10);
+		//statisticsDone = true;
+		//jsp.setMaximumSize(new Dimension(250, 50));
+		
+		//framePanel.add(jsp, BorderLayout.CENTER);
+		
+		// Buttons
+		
+		JButton button1 = new JButton("Close", IconManager.imgic27);
+		button1.addActionListener(this);
+		JPanel jp = new JPanel();
+		jp.add(button1);
+		
+		framePanel.add(jp, BorderLayout.SOUTH);
+		
+		// upper information
+		//Point p = FormatManager.nbStateTransitionRGAldebaran(data);
+		//Container c = getContentPane();
+		//GridBagLayout gridbag0 = new GridBagLayout();
+		//GridBagConstraints c0 = new GridBagConstraints();
+		
+		//jp = new JPanel();
+		//jp.setLayout(gridbag0);
+		
+		/*c0.gridwidth = 1;
+        c0.gridheight = 1;
+        c0.weighty = 1.0;
+        c0.weightx = 1.0;
+		jp.add(new JLabel("Equipments:"), c0);
+		c0.gridwidth = GridBagConstraints.REMAINDER;
+		eq = new JTextField(5);
+		eq.setEditable(false);
+		eq.setText(""+nc.equipments.size());
+		jp.add(eq, c0);
+		
+		c0.gridwidth = 1;
+		jp.add(new JLabel("Switches:"), c0);
+		c0.gridwidth = GridBagConstraints.REMAINDER;
+		sw = new JTextField(5);
+		sw.setEditable(false);
+		sw.setText(""+nc.switches.size());
+		jp.add(sw, c0);*/
+		
+		// Information
+		GeneralInfoNCTableModel tmgi = new GeneralInfoNCTableModel(ncs);
+		TableSorter sorterGI = new TableSorter(tmgi);
+		JTable jtableGI = new JTable(sorterGI);
+		sorterGI.setTableHeader(jtableGI.getTableHeader());
+			
+
+		((jtableGI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtableGI.getColumnModel()).getColumn(1)).setPreferredWidth(25);
+		jtableGI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspGeneralInfo = new JScrollPane(jtableGI);
+		jspGeneralInfo.setWheelScrollingEnabled(true);
+		jspGeneralInfo.getVerticalScrollBar().setUnitIncrement(10);
+		
+		// Equipments
+		EquipmentsNCTableModel enctm = new EquipmentsNCTableModel(ncs);
+		TableSorter sorterEI = new TableSorter(enctm);
+		JTable jtableEI = new JTable(sorterEI);
+		sorterEI.setTableHeader(jtableEI.getTableHeader());
+			
+
+		((jtableEI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtableEI.getColumnModel()).getColumn(1)).setPreferredWidth(150);
+		((jtableEI.getColumnModel()).getColumn(2)).setPreferredWidth(150);
+		jtableEI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspEquipmentInfo = new JScrollPane(jtableEI);
+		jspEquipmentInfo.setWheelScrollingEnabled(true);
+		jspEquipmentInfo.getVerticalScrollBar().setUnitIncrement(10);
+		
+		// Switchs
+		SwitchesNCTableModel snctm = new SwitchesNCTableModel(ncs);
+		TableSorter sorterSI = new TableSorter(snctm);
+		JTable jtableSI = new JTable(sorterSI);
+		sorterSI.setTableHeader(jtableSI.getTableHeader());
+			
+
+		((jtableSI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtableSI.getColumnModel()).getColumn(1)).setPreferredWidth(150);
+		((jtableSI.getColumnModel()).getColumn(2)).setPreferredWidth(100);
+		jtableSI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspSwitchInfo = new JScrollPane(jtableSI);
+		jspSwitchInfo.setWheelScrollingEnabled(true);
+		jspSwitchInfo.getVerticalScrollBar().setUnitIncrement(10);
+		
+		// Traffics
+		TrafficsNCTableModel tnctm = new TrafficsNCTableModel(ncs);
+		TableSorter sorterTI = new TableSorter(tnctm);
+		JTable jtableTI = new JTable(sorterTI);
+		sorterTI.setTableHeader(jtableTI.getTableHeader());
+			
+
+		((jtableTI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtableTI.getColumnModel()).getColumn(1)).setPreferredWidth(100);
+		((jtableTI.getColumnModel()).getColumn(2)).setPreferredWidth(100);
+		((jtableTI.getColumnModel()).getColumn(3)).setPreferredWidth(100);
+		((jtableTI.getColumnModel()).getColumn(4)).setPreferredWidth(100);
+		jtableTI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspTrafficInfo = new JScrollPane(jtableTI);
+		jspTrafficInfo.setWheelScrollingEnabled(true);
+		jspTrafficInfo.getVerticalScrollBar().setUnitIncrement(10);
+		
+		// Links
+		LinksNCTableModel lnctm = new LinksNCTableModel(ncs);
+		TableSorter sorterLI = new TableSorter(lnctm);
+		JTable jtableLI = new JTable(sorterLI);
+		sorterLI.setTableHeader(jtableLI.getTableHeader());
+			
+
+		((jtableLI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtableLI.getColumnModel()).getColumn(1)).setPreferredWidth(100);
+		((jtableLI.getColumnModel()).getColumn(2)).setPreferredWidth(150);
+		jtableLI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspLinkInfo = new JScrollPane(jtableLI);
+		jspLinkInfo.setWheelScrollingEnabled(true);
+		jspLinkInfo.getVerticalScrollBar().setUnitIncrement(10);
+		
+		// Paths
+		PathsNCTableModel pnctm = new PathsNCTableModel(ncs);
+		TableSorter sorterPI = new TableSorter(pnctm);
+		JTable jtablePI = new JTable(sorterPI);
+		sorterPI.setTableHeader(jtablePI.getTableHeader());
+			
+
+		((jtablePI.getColumnModel()).getColumn(0)).setPreferredWidth(100);
+		((jtablePI.getColumnModel()).getColumn(1)).setPreferredWidth(100);
+		((jtablePI.getColumnModel()).getColumn(2)).setPreferredWidth(300);
+		jtablePI.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+		jspPathInfo = new JScrollPane(jtablePI);
+		jspPathInfo.setWheelScrollingEnabled(true);
+		jspPathInfo.getVerticalScrollBar().setUnitIncrement(10);
+		
+		/*
+		// Table
+		//System.out.println("Building deadlock elements");
+		JPanel jp1 = new JPanel();
+		JPanel jp2 = new JPanel();
+		JPanel jp3 = new JPanel();
+		JPanel jp4 = new JPanel();
+		//if (graph.getNbTransition() < MAX_TRANSITIONS) { 
+			DeadlockTableModel tmDeadlock = new DeadlockTableModel(graph, MAX_TRANSITIONS);
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			TableSorter sorterDeadlock = new TableSorter(tmDeadlock);
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			JTable jtableDeadlock = new JTable(sorterDeadlock);
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			sorterDeadlock.setTableHeader(jtableDeadlock.getTableHeader());
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			//System.out.println("Deadlock table");
+			
+			((jtableDeadlock.getColumnModel()).getColumn(0)).setPreferredWidth(Math.max(maxLengthColumn(framePanel, tmDeadlock, 0) + 20, 50));
+			((jtableDeadlock.getColumnModel()).getColumn(1)).setPreferredWidth(Math.max(maxLengthColumn(framePanel, tmDeadlock, 1) + 15, 100));
+			((jtableDeadlock.getColumnModel()).getColumn(2)).setPreferredWidth(Math.max(maxLengthColumn(framePanel, tmDeadlock, 2) + 15, 400));
+			jtableDeadlock.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+			jspDeadlock = new JScrollPane(jtableDeadlock);
+			jspDeadlock.setWheelScrollingEnabled(true);
+			jspDeadlock.getVerticalScrollBar().setUnitIncrement(10);
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			//System.out.println("End Deadlock table");
+			
+			// shortest paths
+			GridBagLayout gridbag1 = new GridBagLayout();
+			GridBagConstraints c1 = new GridBagConstraints();
+			jp1.setLayout(gridbag1);
+			jp2.setLayout(new BorderLayout());
+			
+			//jp1.setBorder(new javax.swing.border.TitledBorder("Simulation options"));
+			
+			// first line panel1
+			//c1.gridwidth = 3;
+			c1.gridheight = 1;
+			c1.weighty = 1.0;
+			c1.weightx = 1.0;
+			c1.gridwidth = 1; //GridBagConstraints.REMAINDER; //end row
+			c1.fill = GridBagConstraints.HORIZONTAL;
+			c1.gridheight = 1;
+			
+			JLabel label1 = new JLabel("Shortest path from ");
+			jp1.add(label1, c1);
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			//System.out.println("Graphical");
+			
+			Integer[] tab1 = new Integer[graph.getNbState()];
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			Integer[] tab2 = new Integer[graph.getNbState()];
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			for(int i=0; i<graph.getNbState(); i++) {
+				tab1[i] = new Integer(i);
+				tab2[i] = new Integer(i);
+			}
+			
+			//combo1 = new JComboBox(tab1);
+			combo1 = new JTextField("0", 10);
+			jp1.add(combo1, c1);
+			
+			JLabel label2 = new JLabel("   to ");
+			jp1.add(label2, c1);
+			
+			c1.gridwidth = GridBagConstraints.REMAINDER; //end row
+			//combo2 = new JComboBox(tab2);
+			combo2 = new JTextField("" + (graph.getNbState() - 1), 10);
+			jp1.add(combo2, c1);
+			//jp2.add(jp1, BorderLayout.NORTH);
+			
+			goPath = new JButton("Compute", IconManager.imgic16);
+			goPath.addActionListener(this);
+			jp1.add(goPath, c1);
+			
+			savePath = new JButton("Save last path as a graph", IconManager.imgic24);
+			savePath.addActionListener(this);
+			jp1.add(savePath, c1);
+			savePath.setEnabled(false);
+			
+			jp2.add(jp1, BorderLayout.NORTH);
+			
+			text1 = new JTextField(300);
+			JScrollPane jspText = new JScrollPane(text1);
+			jspText.setWheelScrollingEnabled(true);
+			jspText.getVerticalScrollBar().setUnitIncrement(10);
+			jp2.add(jspText, BorderLayout.CENTER);
+			
+			// Longest path
+			GridBagLayout gridbag2 = new GridBagLayout();
+			GridBagConstraints c2 = new GridBagConstraints();
+			jp3.setLayout(gridbag2);
+			jp4.setLayout(new BorderLayout());
+			
+			//jp1.setBorder(new javax.swing.border.TitledBorder("Simulation options"));
+			
+			// first line panel1
+			//c1.gridwidth = 3;
+			c2.gridheight = 1;
+			c2.weighty = 1.0;
+			c2.weightx = 1.0;
+			c2.gridwidth = 1; //GridBagConstraints.REMAINDER; //end row
+			c2.fill = GridBagConstraints.HORIZONTAL;
+			c2.gridheight = 1;
+			
+			cycleDone = true;
+			//System.out.println("Searching for cycles");
+			if (graph.getNbTransition() < MAX_TRANSITIONS) {
+				hasCycle = GraphAlgorithms.hasCycle(graph);
+				cycleComputed = true;
+			} else {
+				cycleComputed = false;
+			}
+			//System.out.println("End searching for cycles");
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			//System.out.println("G comp");
+			
+			label2 = new JLabel("Longest path from ");
+			jp3.add(label2, c2);
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			tab1 = new Integer[graph.getNbState()];
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			tab2 = new Integer[graph.getNbState()];
+			
+			if (shouldIStop()) {
+				return;
+			}
+			
+			for(int i=0; i<graph.getNbState(); i++) {
+				tab1[i] = new Integer(i);
+				tab2[i] = new Integer(i);
+			}
+			
+			//combo3 = new JComboBox(tab1);
+			combo3 = new JTextField("0", 10);
+			//graph.getNbState()
+			jp3.add(combo3, c2);
+			
+			label2 = new JLabel("   to ");
+			jp3.add(label2, c2);
+			
+			c2.gridwidth = GridBagConstraints.REMAINDER; //end row
+			//combo4 = new JComboBox(tab2);
+			combo4 = new JTextField("" + (graph.getNbState() - 1), 10);
+			jp3.add(combo4, c2);
+			//jp2.add(jp1, BorderLayout.NORTH);
+			
+			goPathL = new JButton("Compute", IconManager.imgic16);
+			goPathL.addActionListener(this);
+			jp3.add(goPathL, c2);
+			
+			savePathL = new JButton("Save last path as a graph", IconManager.imgic24);
+			savePathL.addActionListener(this);
+			jp3.add(savePathL, c2);
+			savePathL.setEnabled(false);
+			
+			jp4.add(jp3, BorderLayout.NORTH);
+			
+			text2 = new JTextField(300);
+			jspText = new JScrollPane(text2);
+			jspText.setWheelScrollingEnabled(true);
+			jspText.getVerticalScrollBar().setUnitIncrement(10);
+			jp4.add(jspText, BorderLayout.CENTER);
+			
+			if (cycleComputed) {
+				if (hasCycle) {
+					text2.setText("The graph contains cycle -> longest path is infinite");
+					goPathL.setEnabled(false);
+				}
+			} else {
+				text2.setText("Graph may contain cycles -> in that case, the longest path cannot be computed");
+			}
+		//}
+		
+		
+		//System.out.println("Making last elements");
+		
+		mainTabbedPane = new JTabbedPane();
+		mainTabbedPane.addTab("General info.", IconManager.imgic13, jp, "# states, #transitions");
+		mainTabbedPane.addTab("Statistics", IconManager.imgic13, jsp, "Statistics on states & transitions");
+		//if (graph.getNbTransition() < MAX_TRANSITIONS) { 
+			mainTabbedPane.addTab("Deadlocks", IconManager.imgic13, jspDeadlock, "Potential deadlocks");
+			mainTabbedPane.addTab("Shortest Paths", IconManager.imgic13, jp2, "Shortest paths");
+			mainTabbedPane.addTab("Longest Paths", IconManager.imgic13, jp4, "Longest paths");
+		//}
+		//}
+		
+		
+		
+		*/
+		
+		mainTabbedPane = new JTabbedPane();
+		mainTabbedPane.addTab("General info.", IconManager.imgic13, jspGeneralInfo, "Information on diagram");
+		mainTabbedPane.addTab("Equipments", IconManager.imgic13, jspEquipmentInfo, "Information on equipments");
+		mainTabbedPane.addTab("Switches", IconManager.imgic13, jspSwitchInfo, "Information on switches");
+		mainTabbedPane.addTab("Traffics", IconManager.imgic13, jspTrafficInfo, "Information on traffics");
+		mainTabbedPane.addTab("Links", IconManager.imgic13, jspLinkInfo, "Information on links");
+		mainTabbedPane.addTab("Paths", IconManager.imgic13, jspPathInfo, "Information on paths");
+		
+		framePanel.add(mainTabbedPane, BorderLayout.CENTER);
+		
+		
+		pack();
+		
+		System.out.println("GG comp done");
+	}
+	
+	public void	actionPerformed(ActionEvent evt)  {
+		String command = evt.getActionCommand();
+		//System.out.println("Command:" + command);
+		
+		if (command.equals("Close")) {
+			dispose();
+			return;
+		} /*else if (evt.getSource() == goPath) {
+			compute(1);
+		} else if (evt.getSource() == goPathL) {
+			compute(2);
+		}*/
+	}
+	
+
+	
+	private void compute(int idFunc) {
+		/*computingPath = true;
+		GraphAlgorithms.go = true;
+		String info;
+		if (idFunc == 1) {
+			info = "Calculating shortest path...";
+		} else {
+			info = "Calculating longest path...";
+		}
+		
+		int from;
+		int to;
+		JTextField text;
+		
+		if (idFunc == 1) {
+			text = text1;
+			try {
+				from = Integer.decode(combo1.getText()).intValue(); 
+			} catch (Exception e) {
+				text1.setText("Invalid value:" + combo1.getText());
+				return;
+			}
+			try {
+				to = Integer.decode(combo2.getText()).intValue(); 
+			} catch (Exception e) {
+				text1.setText("Invalid value:" + combo2.getText());
+				return;
+			}
+			
+			if(from<0) {
+				text.setText("Invalid value:" + combo1.getText() + ". Minimun value is 0");
+				return;
+			}
+			
+			if(to<0) {
+				text.setText("Invalid value:" + combo2.getText() + ". Minimun value is 0");
+				return;
+			}
+			
+			if(from>=graph.getNbState()) {
+				text1.setText("Invalid value:" + combo1.getText() + ". Maximum value is: " + (graph.getNbState()-1));
+				return;
+			}
+			
+			if(to>=graph.getNbState()) {
+				text1.setText("Invalid value:" + combo2.getText() + ". Maximum value is: " + (graph.getNbState()-1));
+				return;
+			}
+			
+		} else {
+			text = text2;
+			
+			try {
+				from = Integer.decode(combo3.getText()).intValue(); 
+			} catch (Exception e) {
+				text2.setText("Invalid value:" + combo3.getText());
+				return;
+			}
+			try {
+				to = Integer.decode(combo4.getText()).intValue(); 
+			} catch (Exception e) {
+				text2.setText("Invalid value:" + combo4.getText());
+				return;
+			}
+			
+			if(from<0) {
+				text2.setText("Invalid value:" + combo3.getText() + ". Minimun value is 0");
+				return;
+			}
+			
+			if(to<0) {
+				text2.setText("Invalid value:" + combo4.getText() + ". Minimun value is 0");
+				return;
+			}
+			
+			if(from>=graph.getNbState()) {
+				text1.setText("Invalid value:" + combo3.getText() + ". Maximum value is: " + (graph.getNbState()-1));
+				return;
+			}
+			
+			if(to>=graph.getNbState()) {
+				text2.setText("Invalid value:" + combo4.getText() + ". Maximum value is: " + (graph.getNbState()-1));
+				return;
+			}
+			
+			if (!cycleComputed) {
+				hasCycle = GraphAlgorithms.hasCycle(graph);
+				cycleComputed = true;
+			}
+		}
+		
+		ThreadGUIElement t = new ThreadGUIElement(this, idFunc, info, "Please wait", "");
+		t.setExternalCall((ExternalCall)this);
+		t.setStoppableGUIElement((StoppableGUIElement)this);
+		t.go();*/
+	}
+	
+	
+
+	
+	private int maxLengthColumn(Component c, AbstractTableModel tm, int index) {
+		int w = 0, wtmp;
+		FontMetrics fm = c.getFontMetrics(c.getFont());
+		if (fm == null) {
+			return 0;
+		}
+		
+		String s;
+		
+		for(int i=0; i<tm.getRowCount(); i++) {
+			s = tm.getValueAt(i, index).toString();
+			wtmp = fm.stringWidth(s);
+			w = Math.max(w, wtmp);
+		}
+		return w;
+	}
+	
+	
+} // Class
\ No newline at end of file
diff --git a/src/ui/window/LinksNCTableModel.java b/src/ui/window/LinksNCTableModel.java
new file mode 100755
index 0000000000..86d315afe1
--- /dev/null
+++ b/src/ui/window/LinksNCTableModel.java
@@ -0,0 +1,96 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class TrafficsNCTableModel
+ * Main data of links in NC structures
+ * Creation: 27/11/2008
+ * @version 1.0 27/11/2008
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.window;
+
+import java.util.*;
+import javax.swing.table.*;
+
+import myutil.*;
+import nc.*;
+
+public class LinksNCTableModel extends AbstractTableModel {
+	private NCStructure ncs;
+	
+	//private String [] names;
+	public LinksNCTableModel(NCStructure _ncs) {
+		ncs = _ncs;
+		//computeData(_ncs);
+	}
+
+	// From AbstractTableModel
+	public int getRowCount() {
+		return ncs.links.size();
+	}
+
+	public int getColumnCount() {
+		return 3;
+	}
+
+	public Object getValueAt(int row, int column) {
+		if (column == 0) {
+			return ncs.links.get(row).getName();
+		} else if (column == 1) {
+			return ncs.links.get(row).getCapacity() + " " + ncs.links.get(row).getCapacityUnit().getStringUnit();
+		} 
+		
+		return ncs.links.get(row).getLinkedElement1().getName() + " <-> " + ncs.links.get(row).getLinkedElement2().getName();
+		
+	}
+
+	public String getColumnName(int columnIndex) {
+		switch(columnIndex) {
+		case 0:
+			return "Link";
+		case 1:
+			return "Capacity";
+		case 2:
+			return "Link between...";
+		}
+		return "none";
+	}
+
+}
\ No newline at end of file
diff --git a/src/ui/window/SwitchesNCTableModel.java b/src/ui/window/SwitchesNCTableModel.java
new file mode 100755
index 0000000000..7e7a6f756d
--- /dev/null
+++ b/src/ui/window/SwitchesNCTableModel.java
@@ -0,0 +1,93 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+
+ludovic.apvrille AT enst.fr
+
+This software is a computer program whose purpose is to allow the 
+edition of TURTLE analysis, design and deployment diagrams, to 
+allow the generation of RT-LOTOS or Java code from this diagram, 
+and at last to allow the analysis of formal validation traces 
+obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+from INRIA Rhone-Alpes.
+
+This software is governed by the CeCILL  license under French law and
+abiding by the rules of distribution of free software.  You can  use, 
+modify and/ or redistribute the software under the terms of the CeCILL
+license as circulated by CEA, CNRS and INRIA at the following URL
+"http://www.cecill.info". 
+
+As a counterpart to the access to the source code and  rights to copy,
+modify and redistribute granted by the license, users are provided only
+with a limited warranty  and the software's author,  the holder of the
+economic rights,  and the successive licensors  have only  limited
+liability. 
+
+In this respect, the user's attention is drawn to the risks associated
+with loading,  using,  modifying and/or developing or reproducing the
+software by the user in light of its specific status of free software,
+that may mean  that it is complicated to manipulate,  and  that  also
+therefore means  that it is reserved for developers  and  experienced
+professionals having in-depth computer knowledge. Users are therefore
+encouraged to load and test the software's suitability as regards their
+requirements in conditions enabling the security of their systems and/or 
+data to be ensured and,  more generally, to use and operate it in the 
+same conditions as regards security. 
+
+The fact that you are presently reading this means that you have had
+knowledge of the CeCILL license and that you accept its terms.
+
+/**
+ * Class SwitchesNCTableModel
+ * Main data of switches in NC structures
+ * Creation: 26/11/2008
+ * @version 1.0 26/11/2008
+ * @author Ludovic APVRILLE
+ * @see
+ */
+
+package ui.window;
+
+import java.util.*;
+import javax.swing.table.*;
+
+import myutil.*;
+import nc.*;
+
+public class SwitchesNCTableModel extends AbstractTableModel {
+	private NCStructure ncs;
+	
+	//private String [] names;
+	public SwitchesNCTableModel(NCStructure _ncs) {
+		ncs = _ncs;
+		//computeData(_ncs);
+	}
+
+	// From AbstractTableModel
+	public int getRowCount() {
+		return ncs.switches.size();
+	}
+
+	public int getColumnCount() {
+		return 3;
+	}
+
+	public Object getValueAt(int row, int column) {
+		if (column == 0) {
+			return ncs.switches.get(row).getName();
+		} else if (column == 1) {
+			return NCSwitch.getStringSchedulingPolicy(ncs.switches.get(row).getSchedulingPolicy());
+		} else {
+			return ncs.switches.get(row).getCapacity() + " " + ncs.switches.get(row).getCapacityUnit().getStringUnit();
+		}
+	}
+
+	public String getColumnName(int columnIndex) {
+		switch(columnIndex) {
+		case 0:
+			return "Switch";
+		case 1:
+			return "Scheduling policy";
+		}
+		return "Capacity";
+	}
+
+}
\ No newline at end of file
-- 
GitLab