ConnectionSet cs1 = new ConnectionSet(edge1, portS, portDInt); ConnectionSet cs2 = new ConnectionSet(edge2, portDInt, portD);  Vector vecObj = new Vector(); vecObj.add(newProdCell); vecObj.add(edge1); vecObj.add(edge2);  this.getModel().insert(vecObj.toArray(), AllAttribute, null, null, null); this.getModel().insert(null, null, cs1, null, null); this.getModel().insert(null, null, cs2, null, null);  vecObj.clear(); vecObj.add(cellSrc); vecObj.add(cellDes);  this.getModel().remove(vecObj.toArray());   } else { System.out.println("SOURCE & DESTINATION identiques"); }
	public void mouseReleased( MouseEvent e ) 	{		        if(boutonLierActif == true){        	        	// verifier ke la ou l'on a relacher la souris , il y a un produit        	        	if (firstMouseEvent != null){        		        		Object cellSrc = this.getFirstCellForLocation(firstMouseEvent.getX(),firstMouseEvent.getY());    			Object cellDes = this.getFirstCellForLocation(e.getX(),e.getY());		    			Object cellEnt = null;    			Object cellSor = null;    			    			if (((cellSrc instanceof ProduitCellEntree) && (cellDes instanceof ProduitCellSortie)) || (cellSrc instanceof ProduitCellSortie) && (cellDes instanceof ProduitCellEntree) ) {    				// verif ke les 2 soit un produit de type differents	    			    				if(cellDes instanceof ProduitCellEntree){    					cellEnt = cellDes;    					cellSor = cellSrc;    				}else{    					cellEnt = cellSrc;    					cellSor = cellDes;    				}    				    					    				DefaultEdge edge1 = new DefaultEdge();    				DefaultEdge edge2 = new DefaultEdge();    				    				ProduitCell newProdCell = new ProduitCell(((ProduitCell)cellSrc).getMprod());    				newProdCell.setNomCompCell(((ProduitCell)cellSrc).getNomCompCell() + "(" + ((ProduitCell)cellDes).getNomCompCell() + ")");    				newProdCell.setImageComposant("produitLie.png");    				    				Map AllAttribute = GraphConstants.createMap();    				Map edge1Attribute = GraphConstants.createMap();    				Map edge2Attribute = GraphConstants.createMap();    				    				    				AllAttribute.put(edge1, edge1Attribute);    				AllAttribute.put(edge2, edge2Attribute);    				AllAttribute.put(newProdCell,newProdCell.getAttributs());    				GraphConstants.setLineEnd(edge1Attribute, GraphConstants.ARROW_CLASSIC);    				GraphConstants.setEndFill(edge1Attribute, true);    				GraphConstants.setDisconnectable(edge1Attribute,false);    				GraphConstants.setEditable(edge1Attribute,false);    				    				GraphConstants.setLineEnd(edge2Attribute, GraphConstants.ARROW_CLASSIC);    				GraphConstants.setEndFill(edge2Attribute, true);    				GraphConstants.setDisconnectable(edge2Attribute,false);    				GraphConstants.setEditable(edge2Attribute,false);    				    				   			           			        DefaultPort portS = ((ProduitCellSortie)cellSor).getCompParent().getPortComp();   			        DefaultPort portDInt = ((ProduitCell)newProdCell).getPortComp();   			        DefaultPort portD = ((ProduitCellEntree)cellEnt).getCompParent().getPortComp();    		        ConnectionSet cs1 = new ConnectionSet(edge1, portS, portDInt);    		        ConnectionSet cs2 = new ConnectionSet(edge2, portDInt, portD);       		        			        Vector vecObj = new Vector();   			        vecObj.add(newProdCell);   			        vecObj.add(edge1);   			        vecObj.add(edge2);   			           			        this.getModel().insert(vecObj.toArray(), AllAttribute, null, null, null);   			        this.getModel().insert(null, null, cs1, null, null);   			        this.getModel().insert(null, null, cs2, null, null);   			           			        vecObj.clear();   			        vecObj.add(cellSrc);   			        vecObj.add(cellDes);   			           			        this.getModel().remove(vecObj.toArray());   			           			                   	}    			else {	    				System.out.println("SOURCE & DESTINATION identiques");    			}        	}        }        firstMouseEvent = null;	}