Browse Source

arrays auffüllen beim laden

Kevin Trometer 7 years ago
parent
commit
038a969545
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/ui/view/GUI.java

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

@@ -896,6 +896,17 @@ public class GUI<E> implements CategoryListener {
 					try {
 						controller.loadFile(file.getAbsolutePath());
 						canvas.repaint();
+						ArrayList<HolonElement> tempList = new ArrayList<>();
+						for (CpsObject cps : model.getObjectsOnCanvas()) {
+							if (cps instanceof HolonObject) {
+								for (HolonElement h : ((HolonObject)cps).getElements()) {
+									tempList.add(h);
+									unitGraph.repaintWithNewElement(tempList);
+									tempList.remove(0);
+								}
+							}
+						}
+						unitGraph.empty();
 						tree.repaint();
 					} catch (IOException e) {
 						// TODO Auto-generated catch block
@@ -941,7 +952,6 @@ public class GUI<E> implements CategoryListener {
 			public void stateChanged(ChangeEvent e) {
 				int i = model.getCurIteration();
 				controller.calculateStateForTimeStep(i);
-				canvas.repaint();
 				unitGraph.repaint();
 			}
 		});