Browse Source

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons

jess 7 years ago
parent
commit
b742d12ee7

+ 26 - 20
src/ui/controller/NodeController.java

@@ -261,32 +261,38 @@ public class NodeController {
 				// guck einfach in den Connections des Verlorenen nach Edges die
 				// auf der Canvas sind.
 				for (CpsEdge e : lost.getConnections()) {
-					if (( (found.contains(e.getA()) && !found.equals(lost))  || (found.contains(e.getB()) && !found.equals(lost)) ) && !node.getOldEdges().contains(e)) {
+					if (found.contains(e.getA()) && found.contains(e.getB()) && !node.getOldEdges().contains(e)) {
 						node.getOldEdges().add(e);
-						foundCps = true;	
+						foundCps = true;
 					}
-					
+
 				}
 
-			} if (!foundCps)
+			}
+			// wenn das verlorene Object nicht gefunden
+			if (!foundCps)
+				// für alle auf der Ebene liegende Objekte
 				outerLoop: for (AbstractCpsObject cps : found) {
-					if (!cps.equals(node) && !lostChildren.contains(cps))
-						if (backtrackLostChild(cps, toSearch, lost)) {
-
-							for (CpsEdge f : node.getOldEdges())
-								if ((f.getA().equals(cps) && f.getB().equals(toSearch))
-										|| (f.getB().equals(cps) && f.getA().equals(toSearch)))
-									continue outerLoop;
-
-							if (!lookforDuplicates(cps, lost, node.getOldEdges())) {
-
-								CpsEdge temp = new CpsEdge(cps, lost, edge.getCapacity());
-								node.getOldEdges().add(temp);
-//								if(cps instanceof CpsUpperNode)
-//									((CpsUpperNode)cps).getOldEdges().add(edge);
-							}
+				if (!cps.equals(node) && !lostChildren.contains(cps))
+					// such per Backtracking Algorithmus ob der enthalten ist
+					if (backtrackLostChild(cps, toSearch, lost)) {
+					// wenns stimmt dann überspringe den aktuellen Loop
+					for (CpsEdge f : node.getOldEdges())
+					if ((f.getA().equals(cps) && f.getB().equals(toSearch)) || (f.getB().equals(cps) && f.getA().equals(toSearch)))
+					continue outerLoop;
+					// guck nach duplikaten in den Old Edges
+					if (!lookforDuplicates(cps, lost, node.getOldEdges())) {
+					// wenn es keine gibt erzeuge eine neue Oldedge
+					CpsEdge temp = new CpsEdge(cps, lost, edge.getCapacity());
+					node.getOldEdges().add(temp);
+					}
+					// falls das Objekt ein CpsUpperNode gewesen ist verschiebe
+					// bitte die OldEdge dahin
+					if (cps instanceof CpsUpperNode) {
+					((CpsUpperNode) cps).getOldEdges().add(edge);
+					}
 
-						}
+					}
 				}
 
 		}

+ 34 - 0
src/ui/controller/SimulationManager.java

@@ -5,6 +5,7 @@ import java.util.HashMap;
 
 import classes.CpsEdge;
 import classes.CpsNode;
+import classes.CpsUpperNode;
 import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
@@ -448,6 +449,14 @@ public class SimulationManager {
 				if (!visited.contains(b.getID()) && legitState(cps)) {
 					sN = buildSubNet(b, visited, sN);
 				}
+				if(a instanceof CpsUpperNode && a.getID() != cps.getID()){
+					edge.setConnected(false);
+					checkForConnectedStates(b, (CpsUpperNode)a, edge);
+				}
+				if(b instanceof CpsUpperNode && b.getID() != cps.getID()){
+					edge.setConnected(false);
+					checkForConnectedStates(a, (CpsUpperNode)b, edge);
+				}
 			}
 		}
 		return sN;
@@ -556,5 +565,30 @@ public class SimulationManager {
 	public ArrayList<SubNet> getSubNets() {
 		return subNets;
 	}
+	
+	/**
+	 * checks wether a given object is connected to an object inside the upperNode.
+	 * if yes, the state for the edge is changed in "connected" or "not connected"
+	 * @param cps
+	 * @param cUNode
+	 */
+	public void checkForConnectedStates(AbstractCpsObject cps, CpsUpperNode cUNode, CpsEdge theEdge){
+		AbstractCpsObject tmp;
+		for(CpsEdge edge: cps.getConnections()){
+			if(edge.getA().getID() == cps.getID()){
+				tmp = edge.getB();
+			} else{
+				tmp = edge.getA();
+			}
+			if(cUNode.getNodes().contains(tmp)){
+				if(tmp instanceof CpsUpperNode){
+					checkForConnectedStates(cps, (CpsUpperNode)tmp, theEdge);
+				}else{
+					theEdge.setConnected(true);
+					break;
+				}
+			}
+		}
+	}
 
 }

+ 1 - 0
src/ui/view/GUI.java

@@ -1901,6 +1901,7 @@ public class GUI<E> implements CategoryListener {
 					((UpperNodeCanvas) ((JScrollPane) tabbedPane.getSelectedComponent()).getViewport()
 							.getComponent(0)).path + " -> ");
 		}
+		unc.setShowedInformation(canvas.getShowedInformation());
 
 		// check if tab already open for clicked NodeOfNode
 		boolean dupl = false;

+ 43 - 24
src/ui/view/MyCanvas.java

@@ -118,7 +118,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 
 		showedInformation[0] = true;
 		showedInformation[1] = true;
-		showedInformation[2] = false;
+		showedInformation[3] = false;
 		control.setMaxCapacity(10000);
 
 		popmenu.add(itemCut);
@@ -396,7 +396,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				controller.addSubNetColor(new Color((int) (Math.random() * 255), (int) (Math.random() * 255),
 						(int) (Math.random() * 255)));
 			}
-			if(showedInformation[2]){
+			if(showedInformation[3]){
 			for (HolonObject cps : s.getObjects()) {
 				cps.setBorderColor(model.getSubNetColors().get(i));
 			}
@@ -415,13 +415,18 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		for (CpsEdge con : model.getEdgesOnCanvas()) {
 			if (con.getA().getID() != model.getSelectedObjectID() && con.getB().getID() != model.getSelectedObjectID()
 					&& con != edgeHighlight) {
-				if (con.getState()) {
-					g2.setColor(Color.GREEN);
-					if (con.getCapacity() != -1) {
-						g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+				if(con.getConnected()){
+					if (con.getState()) {
+						g2.setColor(Color.GREEN);
+						if (con.getCapacity() != -1) {
+							g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+						}
+					} else {
+						g2.setColor(Color.RED);
+						g2.setStroke(new BasicStroke(2));
 					}
-				} else {
-					g2.setColor(Color.RED);
+				}else{
+					g2.setColor(Color.DARK_GRAY);
 					g2.setStroke(new BasicStroke(2));
 				}
 				g2.drawLine(con.getA().getPosition().x + controller.getScaleDiv2(),
@@ -435,9 +440,15 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					maxCap = String.valueOf(con.getCapacity());
 				}
 				if (showedInformation[0]) {
-					g2.drawString(con.getFlow() + "/" + maxCap,
-							(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
-							(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					if(con.getConnected()){
+						g2.drawString(con.getFlow() + "/" + maxCap,
+								(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
+								(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					}else{
+						g2.drawString("not connected", 
+								(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
+								(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					}
 				}
 			}
 		}
@@ -467,11 +478,19 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 						maxCap = String.valueOf(con.getCapacity());
 					}
 					if (showedInformation[0]) {
-						g2.drawString(con.getFlow() + "/" + maxCap,
-								(con.getA().getPosition().x + con.getB().getPosition().x) / 2
-										+ controller.getScaleDiv2(),
-								(con.getA().getPosition().y + con.getB().getPosition().y) / 2
-										+ controller.getScaleDiv2());
+						if(con.getConnected()){
+							g2.drawString(con.getFlow() + "/" + maxCap,
+									(con.getA().getPosition().x + con.getB().getPosition().x) / 2
+											+ controller.getScaleDiv2(),
+											(con.getA().getPosition().y + con.getB().getPosition().y) / 2
+											+ controller.getScaleDiv2());
+						}else{
+							g2.drawString("not connected",
+									(con.getA().getPosition().x + con.getB().getPosition().x) / 2
+											+ controller.getScaleDiv2(),
+											(con.getA().getPosition().y + con.getB().getPosition().y) / 2
+											+ controller.getScaleDiv2());
+						}
 					}
 				}
 			}
@@ -504,13 +523,13 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		// Objects
 		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 			// Border Highlighting
-			if(showedInformation[2]){
-			g2.setColor(cps.getBorderColor());
-			if (g2.getColor() != Color.WHITE) {
-				g2.fillRect((int) (cps.getPosition().x - scalediv20 - 3), (int) (cps.getPosition().y - scalediv20 - 3),
-						(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
-						(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
-			}
+			if(showedInformation[3]){
+				g2.setColor(cps.getBorderColor());
+				if (g2.getColor() != Color.WHITE) {
+					g2.fillRect((int) (cps.getPosition().x - scalediv20 - 3), (int) (cps.getPosition().y - scalediv20 - 3),
+							(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
+							(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
+				}
 			}
 			// node image
 			if (cps instanceof CpsNode && (cps == tempCps || model.getSelectedCpsObject() == cps
@@ -1004,7 +1023,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	public void setShowedInformation(boolean connection, boolean object, boolean border) {
 		showedInformation[0] = connection;
 		showedInformation[1] = object;
-		showedInformation[2] = border;
+		showedInformation[3] = border;
 	}
 
 	/**

+ 1 - 1
src/ui/view/ShowedInformationPopUp.java

@@ -78,7 +78,7 @@ public class ShowedInformationPopUp extends JDialog {
 		colorizedBorderCheckbox = new JCheckBox("Show colorized Border for Objects");
 		colorizedBorderCheckbox.setBounds(19, 96, 195, 23);
 		contentPanel.add(colorizedBorderCheckbox);
-		colorizedBorderCheckbox.setSelected(canvas.getShowedInformation()[2]);
+		colorizedBorderCheckbox.setSelected(canvas.getShowedInformation()[3]);
 	}
 
 	/**

+ 183 - 31
src/ui/view/UpperNodeCanvas.java

@@ -99,6 +99,19 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 
 	private UpdateController updCon;
 
+	javax.swing.Timer animT; // animation Timer
+	private final int ANIMTIME = 500; // animation Time
+
+	private ArrayList<AbstractCpsObject> animCps = null;
+	private int animFPS = 60;
+	private int animDuration = ANIMTIME; // animation Duration
+	private int animDelay = 1000 / animFPS; // animation Delay
+	private int animSteps = animDuration / animDelay; // animation Steps;
+	private long start = 0; // for time
+	private long elapsedTime = 0; // outprint
+	private Position unPos;
+	private ArrayList<Position> savePos;
+
 	/**
 	 * Constructor.
 	 * 
@@ -108,7 +121,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 	 *            the Controller
 	 */
 	public UpperNodeCanvas(Model mod, Control control, CpsUpperNode UpperNode, String parentPath) {
-		this.add(objectTT);
+		//this.add(objectTT);
 		this.controller = control;
 		this.model = mod;
 		this.upperNode = UpperNode;
@@ -147,20 +160,125 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		itemTrack.setEnabled(false);
 		itemUntrack.setEnabled(false);
 		updCon = new UpdateController(model, controller);
-
+		
 		itemGroup.addActionListener(new ActionListener() {
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				controller.addUpperNode("NodeOfNode", upperNode, model.getSelectedCpsObjects());
-				repaint();
+				// calculate uppernode pos (taken from the controller)
+				unPos = new Position(0, 0);
+				animCps = new ArrayList<>();
+				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
+					animCps.add(cps); // add to animation Cps ArrayList
+					unPos.x += cps.getPosition().x;
+					unPos.y += cps.getPosition().y;
+				}
+				unPos.x /= animCps.size();
+				unPos.y /= animCps.size();
+
+				// save old Position
+				savePos = new ArrayList<>();
+				for (int i = 0; i < animCps.size(); i++) {
+					savePos.add(new Position(0, 0));
+					savePos.get(i).x = animCps.get(i).getPosition().x;
+					savePos.get(i).y = animCps.get(i).getPosition().y;
+				}
+
+				animT = new javax.swing.Timer(animDelay, new ActionListener() {
+
+					@Override
+					public void actionPerformed(ActionEvent e) {
+						if (animDuration - animDelay > 0 && animCps.size() > 1) {
+							for (int i = 0; i < animCps.size(); i++) {
+								double x1 = animCps.get(i).getPosition().x - unPos.x;
+								double y1 = animCps.get(i).getPosition().y - unPos.y;
+								animCps.get(i).getPosition().x -= x1 / animSteps;
+								animCps.get(i).getPosition().y -= y1 / animSteps;
+							}
+							repaint();
+							animDuration -= animDelay;
+							animSteps--;
+						} else {
+							animDuration = ANIMTIME;
+							animSteps = animDuration / animDelay;
+							animT.stop();
+							for (int i = 0; i < animCps.size(); i++) {
+								animCps.get(i).getPosition().x = savePos.get(i).x;
+								animCps.get(i).getPosition().y = savePos.get(i).y;
+							}
+							controller.addUpperNode("NodeOfNode", upperNode, model.getSelectedCpsObjects());
+							controller.calculateStateForCurrentTimeStep();
+							repaint();
+							elapsedTime = System.currentTimeMillis() - start;
+							controller.addTextToConsole(elapsedTime + "");
+						}
+					}
+				});
+				start = System.currentTimeMillis();
+				animT.start();
 			}
 		});
 
 		itemUngroup.addActionListener(new ActionListener() {
 			@Override
 			public void actionPerformed(ActionEvent e) {
+				// save old Position
+				JTabbedPane tabbedPane = (JTabbedPane) getParent().getParent().getParent();
+				for (int i = 3; i < tabbedPane.getTabCount(); i++) {
+					if (((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i)).getViewport()
+							.getComponent(0)).upperNode.getID() == ((CpsUpperNode) tempCps).getID()) {
+						tabbedPane.remove(i);
+						break;
+					}
+				}
+				
+				savePos = new ArrayList<>();
+				animCps = ((CpsUpperNode) tempCps).getNodes();
 				controller.delUpperNode((CpsUpperNode) tempCps, upperNode);
-				repaint();
+
+				for (int i = 0; i < animCps.size(); i++) {
+					savePos.add(new Position(0, 0));
+					savePos.get(i).x = animCps.get(i).getPosition().x;
+					savePos.get(i).y = animCps.get(i).getPosition().y;
+				}
+				for (AbstractCpsObject cps : animCps) {
+					int x = ((CpsUpperNode) tempCps).getPosition().x;
+					int y = ((CpsUpperNode) tempCps).getPosition().y;
+
+					cps.setPosition(new Position(x, y));
+				}
+
+				animT = new javax.swing.Timer(animDelay, new ActionListener() {
+
+					@Override
+					public void actionPerformed(ActionEvent e) {
+						if (animDuration - animDelay >= 0) {
+							for (int i = 0; i < animCps.size(); i++) {
+								double x1 = animCps.get(i).getPosition().x - savePos.get(i).x;
+								double y1 = animCps.get(i).getPosition().y - savePos.get(i).y;
+								animCps.get(i).getPosition().x -= x1 / animSteps;
+								animCps.get(i).getPosition().y -= y1 / animSteps;
+							}
+							repaint();
+							animDuration -= animDelay;
+							animSteps--;
+						} else {
+							animDuration = ANIMTIME;
+							animSteps = animDuration / animDelay;
+							animT.stop();
+							for (int i = 0; i < animCps.size(); i++) {
+								animCps.get(i).getPosition().x = savePos.get(i).x;
+								animCps.get(i).getPosition().y = savePos.get(i).y;
+							}
+
+							controller.calculateStateForCurrentTimeStep();
+							repaint();
+							elapsedTime = System.currentTimeMillis() - start;
+							controller.addTextToConsole(elapsedTime + "");
+						}
+					}
+				});
+				start = System.currentTimeMillis();
+				animT.start();
 			}
 		});
 
@@ -172,10 +290,10 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 						boolean found = false;
 						if (controller.getTrackingObj() != null) {
 							for (AbstractCpsObject obj : controller.getTrackingObj()) {
-								if(obj instanceof HolonObject){
+								if (obj instanceof HolonObject) {
 									if (obj.getID() == o.getID()) {
 										found = true;
-									}	
+									}
 								}
 							}
 						}
@@ -201,7 +319,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 						boolean found = false;
 						if (controller.getTrackingObj() != null) {
 							for (AbstractCpsObject obj : controller.getTrackingObj()) {
-								if(obj instanceof HolonObject){
+								if (obj instanceof HolonObject) {
 									if (obj.getID() == o.getID()) {
 										found = true;
 									}
@@ -229,6 +347,8 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
 					if (upperNode.getNodes().contains(cps)) {
 						controller.delObjUpperNode(cps, upperNode);
+						// Removes the object from the tracked objects, in case it was tracked
+						controller.removeTrackingObj(cps);
 						// Remove UpperNodeTab if UpperNode deleted
 						if (cps instanceof CpsUpperNode) {
 							JTabbedPane tabbedPane = (JTabbedPane) getParent().getParent().getParent();
@@ -342,13 +462,18 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		for (CpsEdge con : upperNode.getNodeEdges()) {
 			if (con.getA().getID() != model.getSelectedObjectID() && con.getB().getID() != model.getSelectedObjectID()
 					&& con != edgeHighlight) {
-				if (con.getState()) {
-					g2.setColor(Color.GREEN);
-					if (con.getCapacity() != -1) {
-						g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+				if(con.getConnected()){
+					if (con.getState()) {
+						g2.setColor(Color.GREEN);
+						if (con.getCapacity() != -1) {
+							g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+						}
+					} else {
+						g2.setColor(Color.RED);
+						g2.setStroke(new BasicStroke(2));
 					}
-				} else {
-					g2.setColor(Color.RED);
+				}else{
+					g2.setColor(Color.DARK_GRAY);
 					g2.setStroke(new BasicStroke(2));
 				}
 				g2.drawLine(con.getA().getPosition().x + controller.getScaleDiv2(),
@@ -362,9 +487,15 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 					maxCap = String.valueOf(con.getCapacity());
 				}
 				if (showedInformation[0]) {
-					g2.drawString(con.getFlow() + "/" + maxCap,
-							(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
-							(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					if(con.getConnected()){
+						g2.drawString(con.getFlow() + "/" + maxCap,
+								(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
+								(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					}else{
+						g2.drawString("not connected", 
+								(con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
+								(con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
+					}
 				}
 			}
 		}
@@ -394,11 +525,19 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 						maxCap = String.valueOf(con.getCapacity());
 					}
 					if (showedInformation[0]) {
-						g2.drawString(con.getFlow() + "/" + maxCap,
-								(con.getA().getPosition().x + con.getB().getPosition().x) / 2
+						if(con.getConnected()){
+							g2.drawString(con.getFlow() + "/" + maxCap,
+									(con.getA().getPosition().x + con.getB().getPosition().x) / 2
 										+ controller.getScaleDiv2(),
-								(con.getA().getPosition().y + con.getB().getPosition().y) / 2
+									(con.getA().getPosition().y + con.getB().getPosition().y) / 2
 										+ controller.getScaleDiv2());
+						}else{
+							g2.drawString("not connected",
+									(con.getA().getPosition().x + con.getB().getPosition().x) / 2
+										+ controller.getScaleDiv2(),
+									(con.getA().getPosition().y + con.getB().getPosition().y) / 2
+										+ controller.getScaleDiv2());
+						}
 					}
 				}
 			}
@@ -431,11 +570,13 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		// Objects in upper node
 		for (AbstractCpsObject cps : upperNode.getNodes()) {
 			// Border Highlighting
-			g2.setColor(cps.getBorderColor());
-			if (g2.getColor() != Color.WHITE) {
-				g2.fillRect((int) (cps.getPosition().x - scalediv20 - 3), (int) (cps.getPosition().y - scalediv20 - 3),
-						(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
-						(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
+			if(showedInformation[3]){
+				g2.setColor(cps.getBorderColor());
+				if (g2.getColor() != Color.WHITE) {
+					g2.fillRect((int) (cps.getPosition().x - scalediv20 - 3), (int) (cps.getPosition().y - scalediv20 - 3),
+							(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
+							(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
+				}
 			}
 
 			// node image
@@ -516,12 +657,15 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 			}
 
 			// Border Highlighting
-			g2.setColor(cps.getBorderColor());
-			if (g2.getColor() != Color.WHITE) {
-				g2.fillRect((int) ((borderPos >> 1) - model.getScaleDiv2() - scalediv20) - 3,
-						(int) (scalediv20 + 5 + (model.getScale() + scalediv20 + 10) * count - scalediv20) - 3,
-						(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
-						(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
+			if(showedInformation[3]){
+				System.out.println("here");
+				g2.setColor(cps.getBorderColor());
+				if (g2.getColor() != Color.WHITE) {
+					g2.fillRect((int) ((borderPos >> 1) - model.getScaleDiv2() - scalediv20) - 3,
+							(int) (scalediv20 + 5 + (model.getScale() + scalediv20 + 10) * count - scalediv20) - 3,
+							(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
+							(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
+				}
 			}
 
 			// node image
@@ -1222,6 +1366,14 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		showedInformation[0] = connection;
 		showedInformation[1] = object;
 	}
+	
+	/**
+	 * copies a set of given informations
+	 * @param informations
+	 */
+	public void setShowedInformation(boolean[] informations){
+		showedInformation = informations;
+	}
 
 	/**
 	 * Returns if Information should be shown.