Browse Source

fixes #34, renamed tabbedPane and tabbedPane1 to tabbedPaneOriginal and tabbedPane Split

I. Dix 8 years ago
parent
commit
466ca73009
2 changed files with 164 additions and 150 deletions
  1. 7 8
      src/classes/CpsUpperNode.java
  2. 157 142
      src/ui/view/GUI.java

+ 7 - 8
src/classes/CpsUpperNode.java

@@ -1,10 +1,10 @@
 package classes;
 
+import com.google.gson.annotations.Expose;
+
 import java.util.ArrayList;
 import java.util.HashMap;
 
-import com.google.gson.annotations.Expose;
-
 public class CpsUpperNode extends AbstractCpsObject {
 
 	private ArrayList<AbstractCpsObject> nodes;
@@ -25,15 +25,14 @@ public class CpsUpperNode extends AbstractCpsObject {
 
 	public CpsUpperNode(String nodeName) {
 		super(nodeName);
-		this.setConnections(new ArrayList<CpsEdge>());
+		this.setConnections(new ArrayList<>());
 		this.setImage("/Images/upper_node.png");
 		this.setSav("CVS");
 		this.setId(IdCounter.nextId());
-		this.setNodes(new ArrayList<AbstractCpsObject>());
-		this.setNodeEdges(new ArrayList<CpsEdge>());
-		this.setOldEdges(new ArrayList<CpsEdge>());
-		this.setNodesIdx(new HashMap<Integer, Integer>());
-		// TODO Auto-generated constructor stub
+		this.setNodes(new ArrayList<>());
+		this.setNodeEdges(new ArrayList<>());
+		this.setOldEdges(new ArrayList<>());
+		this.setNodesIdx(new HashMap<>());
 	}
 
 	/**

+ 157 - 142
src/ui/view/GUI.java

@@ -56,12 +56,17 @@ public class GUI<E> implements CategoryListener {
     private final JSplitPane splitPane = new JSplitPane();
     private final JSplitPane splitPane1 = new JSplitPane();
     private final JSplitPane splitPaneCanvasConsole = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
+    // the tabbed canvas containing the different sub-net tabs of the grid (Main Grid + Nodes of Nodes)
+    private final JTabbedPane tabbedPaneInnerOriginal = new JTabbedPane(JTabbedPane.TOP);
+    //    private final JTabbedPane tabbedPaneInnerSplit = new JTabbedPane(JTabbedPane.TOP);
+    // the main canvas where we can see the grid currently displayed
     private final JScrollPane canvasSP = new JScrollPane();
-    private final JTabbedPane canvasTP = new JTabbedPane(JTabbedPane.TOP);
     private final JScrollPane scrollPane1 = new JScrollPane();
     // private final JScrollPane holonSP = new JScrollPane();
-    private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
-    private final JTabbedPane tabbedPane2 = new JTabbedPane(JTabbedPane.TOP);
+    // the original tabbed Pane (containing tabs for view, statistics, holon, flexibility)
+    private final JTabbedPane tabbedPaneOriginal = new JTabbedPane(JTabbedPane.TOP);
+    // the same tabbed Pane that appears once the view is split
+    private final JTabbedPane tabbedPaneSplit = new JTabbedPane(JTabbedPane.TOP);
     private final JPopupMenu popmenuEdit = new JPopupMenu();
     private final JMenuItem editItem = new JMenuItem("Edit Object");
     private final StatisticPanel statSplitPane;
@@ -169,7 +174,7 @@ public class GUI<E> implements CategoryListener {
     // for doubleclick
     private boolean click = false;
     private JFrame frmCyberPhysical;
-    private JTabbedPane tabTemp; // tabbedPane or tabbedPane2
+    private JTabbedPane tabTemp; // tabbedPaneOriginal or tabbedPaneSplit
     private JSplitPane tempSplit;
     private boolean initSplit = true;
     private String catOfObjToBeEdited;
@@ -302,7 +307,6 @@ public class GUI<E> implements CategoryListener {
                     unitGraph.update(model.getObjectsOnCanvas());
                     updateUpperNodes();
                 } catch (IOException eex) {
-                    // TODO Auto-generated catch block
                     eex.printStackTrace();
                 }
             }
@@ -322,7 +326,6 @@ public class GUI<E> implements CategoryListener {
                     unitGraph.update(model.getObjectsOnCanvas());
                     updateUpperNodes();
                 } catch (IOException ex) {
-                    // TODO Auto-generated catch block
                     ex.printStackTrace();
                 }
             }
@@ -457,11 +460,11 @@ public class GUI<E> implements CategoryListener {
             public void actionPerformed(ActionEvent e) {
                 try {
                     tabTemp = null;
-                    if (tabbedPane.getMousePosition() != null) {
-                        tabTemp = tabbedPane;
+                    if (tabbedPaneOriginal.getMousePosition() != null) {
+                        tabTemp = tabbedPaneOriginal;
                     } else {
                         if (!initSplit) {
-                            tabTemp = tabbedPane2;
+                            tabTemp = tabbedPaneSplit;
                         }
                     }
 
@@ -481,7 +484,6 @@ public class GUI<E> implements CategoryListener {
                         canvas.repaint();
                     }
                 } catch (HeadlessException | JsonParseException | UnsupportedFlavorException | IOException e1) {
-                    // TODO Auto-generated catch block
                     JLabel message = new JLabel("The Clipboard information cannot be pasted into Application.");
                     JOptionPane.showMessageDialog(null, message, "", JOptionPane.ERROR_MESSAGE);
                 }
@@ -607,7 +609,7 @@ public class GUI<E> implements CategoryListener {
 
         mnNewMenuView.add(mntmCanvasSize);
         mntmCanvasSize.addActionListener(actionEvent -> {
-            CanvasResizePopUp popUp = new CanvasResizePopUp(model, controller, canvas, tabbedPane, tabbedPane2);
+            CanvasResizePopUp popUp = new CanvasResizePopUp(model, controller, canvas, tabbedPaneOriginal, tabbedPaneSplit);
             popUp.setVisible(true);
         });
 
@@ -640,33 +642,33 @@ public class GUI<E> implements CategoryListener {
         mntmSplitView.addActionListener(actionEvent -> {
             if (splitPaneCanvasConsole.getLeftComponent() instanceof JSplitPane) {
                 initSplit = true;
-                Component tempC = tabbedPane2.getSelectedComponent();
-                tabbedPane.setComponentAt(tabbedPane2.getSelectedIndex(), tempC);
-                tabbedPane2.removeAll();
-                splitPaneCanvasConsole.setLeftComponent(tabbedPane);
+                Component tempC = tabbedPaneSplit.getSelectedComponent();
+                tabbedPaneOriginal.setComponentAt(tabbedPaneSplit.getSelectedIndex(), tempC);
+                tabbedPaneSplit.removeAll();
+                splitPaneCanvasConsole.setLeftComponent(tabbedPaneOriginal);
             } else {
-                for (int i = 0; i < tabbedPane.getTabCount(); i++) {
-                    tabbedPane2.addTab(tabbedPane.getTitleAt(i), null);
+                for (int i = 0; i < tabbedPaneOriginal.getTabCount(); i++) {
+                    tabbedPaneSplit.addTab(tabbedPaneOriginal.getTitleAt(i), null);
                     if (i >= 4) {
-                        // tabbedPane2.setTabComponentAt(tabbedPane.getTabCount()
+                        // tabbedPaneSplit.setTabComponentAt(tabbedPaneOriginal.getTabCount()
                         // - 1,
-                        // new ButtonTabComponent(tabbedPane, tabbedPane2));
+                        // new ButtonTabComponent(tabbedPaneOriginal, tabbedPaneSplit));
                     }
                 }
-                if (tabbedPane.getSelectedComponent() == statScrollPane) {
-                    tabbedPane.setComponentAt(0, null);
-                    tabbedPane2.setComponentAt(0, canvasSP);
-                    tabbedPane2.setSelectedIndex(0);
+                if (tabbedPaneOriginal.getSelectedComponent() == statScrollPane) {
+                    tabbedPaneOriginal.setComponentAt(0, null);
+                    tabbedPaneSplit.setComponentAt(0, canvasSP);
+                    tabbedPaneSplit.setSelectedIndex(0);
                 } else {
-                    tabbedPane.setComponentAt(1, null);
-                    tabbedPane2.setComponentAt(1, statScrollPane);
-                    tabbedPane2.setSelectedIndex(1);
+                    tabbedPaneOriginal.setComponentAt(1, null);
+                    tabbedPaneSplit.setComponentAt(1, statScrollPane);
+                    tabbedPaneSplit.setSelectedIndex(1);
                 }
                 tempSplit = new JSplitPane();
                 tempSplit.setBorder(null);
-                tempSplit.setRightComponent(tabbedPane2);
-                tempSplit.setLeftComponent(tabbedPane);
-                tempSplit.setDividerLocation(tabbedPane.getWidth() / 2);
+                tempSplit.setRightComponent(tabbedPaneSplit);
+                tempSplit.setLeftComponent(tabbedPaneOriginal);
+                tempSplit.setDividerLocation(tabbedPaneOriginal.getWidth() / 2);
                 tempSplit.setResizeWeight(0.9);
                 splitPaneCanvasConsole.setLeftComponent(tempSplit);
                 initSplit = false;
@@ -676,7 +678,7 @@ public class GUI<E> implements CategoryListener {
         mnNewMenuView.add(mntmBackground);
 
         mntmBackground.addActionListener(actionEvent -> {
-            tabTemp = tabbedPane;
+            tabTemp = tabbedPaneOriginal;
             JScrollPane scrollPane = getScrollPaneFromTabbedPane();
 
             if (scrollPane.getViewport().getComponent(0) instanceof MyCanvas) {
@@ -717,34 +719,34 @@ public class GUI<E> implements CategoryListener {
 
         mnHelp.add(mntmAboutUs);
 
-        tabbedPane.addChangeListener(changeEvent -> {
-            if (tabbedPane.getSelectedComponent() == null) {
-                Component tempC = tabbedPane2.getSelectedComponent();
-                tabbedPane2.setComponentAt(tabbedPane.getSelectedIndex(), null);
-                tabbedPane.setComponentAt(tabbedPane.getSelectedIndex(), tempC);
-                tempC = tabbedPane.getComponentAt((tabbedPane.getSelectedIndex() + 1) % (tabbedPane.getTabCount()));
-                tabbedPane.setComponentAt((tabbedPane.getSelectedIndex() + 1) % (tabbedPane.getTabCount()), null);
-                tabbedPane2.setComponentAt((tabbedPane.getSelectedIndex() + 1) % (tabbedPane.getTabCount()), tempC);
-                tabbedPane2.setSelectedIndex((tabbedPane.getSelectedIndex() + 1) % (tabbedPane.getTabCount()));
+        tabbedPaneOriginal.addChangeListener(changeEvent -> {
+            if (tabbedPaneOriginal.getSelectedComponent() == null) {
+                Component tempC = tabbedPaneSplit.getSelectedComponent();
+                tabbedPaneSplit.setComponentAt(tabbedPaneOriginal.getSelectedIndex(), null);
+                tabbedPaneOriginal.setComponentAt(tabbedPaneOriginal.getSelectedIndex(), tempC);
+                tempC = tabbedPaneOriginal.getComponentAt((tabbedPaneOriginal.getSelectedIndex() + 1) % (tabbedPaneOriginal.getTabCount()));
+                tabbedPaneOriginal.setComponentAt((tabbedPaneOriginal.getSelectedIndex() + 1) % (tabbedPaneOriginal.getTabCount()), null);
+                tabbedPaneSplit.setComponentAt((tabbedPaneOriginal.getSelectedIndex() + 1) % (tabbedPaneOriginal.getTabCount()), tempC);
+                tabbedPaneSplit.setSelectedIndex((tabbedPaneOriginal.getSelectedIndex() + 1) % (tabbedPaneOriginal.getTabCount()));
                 contentPane.updateUI();
             }
         });
 
-        tabbedPane2.addChangeListener(changeEvent -> {
-            if (tabbedPane2.getSelectedComponent() == null && !initSplit) {
-                Component tempC = tabbedPane.getComponentAt(tabbedPane2.getSelectedIndex());
-                tabbedPane.setComponentAt(tabbedPane2.getSelectedIndex(), null);
-                tabbedPane2.setComponentAt(tabbedPane2.getSelectedIndex(), tempC);
-                for (int i = 0; i < tabbedPane.getTabCount(); i++) {
-                    if (tabbedPane2.getComponentAt(i) != null && tabbedPane2.getComponentAt(i) != tempC) {
-                        tempC = tabbedPane2.getComponentAt(i);
-                        tabbedPane2.setComponentAt(i, null);
-                        tabbedPane.setComponentAt(i, tempC);
+        tabbedPaneSplit.addChangeListener(changeEvent -> {
+            if (tabbedPaneSplit.getSelectedComponent() == null && !initSplit) {
+                Component tempC = tabbedPaneOriginal.getComponentAt(tabbedPaneSplit.getSelectedIndex());
+                tabbedPaneOriginal.setComponentAt(tabbedPaneSplit.getSelectedIndex(), null);
+                tabbedPaneSplit.setComponentAt(tabbedPaneSplit.getSelectedIndex(), tempC);
+                for (int i = 0; i < tabbedPaneOriginal.getTabCount(); i++) {
+                    if (tabbedPaneSplit.getComponentAt(i) != null && tabbedPaneSplit.getComponentAt(i) != tempC) {
+                        tempC = tabbedPaneSplit.getComponentAt(i);
+                        tabbedPaneSplit.setComponentAt(i, null);
+                        tabbedPaneOriginal.setComponentAt(i, tempC);
                         break;
                     }
                 }
-                if (tabbedPane.getSelectedIndex() == tabbedPane2.getSelectedIndex()) {
-                    tabbedPane.setSelectedIndex((tabbedPane2.getSelectedIndex() + 1) % tabbedPane.getTabCount());
+                if (tabbedPaneOriginal.getSelectedIndex() == tabbedPaneSplit.getSelectedIndex()) {
+                    tabbedPaneOriginal.setSelectedIndex((tabbedPaneSplit.getSelectedIndex() + 1) % tabbedPaneOriginal.getTabCount());
                 }
                 contentPane.updateUI();
             }
@@ -1108,18 +1110,18 @@ public class GUI<E> implements CategoryListener {
                         // Name edition through double click
                         updCon.getActualCps().setName(temp.toString());
                         // Update of name on the tab in the tab section
-                        for (int index = 4; index < tabbedPane.getTabCount(); index++) {
-                            tabTemp = tabbedPane;
+                        for (int index = 4; index < tabbedPaneOriginal.getTabCount(); index++) {
+                            tabTemp = tabbedPaneOriginal;
                             JScrollPane scrollPane = getScrollPaneFromTabbedPane();
 
                             UpperNodeCanvas unc = ((UpperNodeCanvas) scrollPane.getViewport().getComponent(0));
 
                             if (unc.upperNode.getId() == updCon.getActualCps().getId()) {
-                                tabbedPane.setTitleAt(index, unc.upperNode.getName());
-                                tabbedPane.updateUI();
+                                tabbedPaneOriginal.setTitleAt(index, unc.upperNode.getName());
+                                tabbedPaneOriginal.updateUI();
                                 if (!initSplit) {
-                                    tabbedPane2.setTitleAt(index, unc.upperNode.getName());
-                                    tabbedPane2.updateUI();
+                                    tabbedPaneSplit.setTitleAt(index, unc.upperNode.getName());
+                                    tabbedPaneSplit.updateUI();
                                 }
                             }
                         }
@@ -1468,7 +1470,6 @@ public class GUI<E> implements CategoryListener {
                     try {
                         controller.autoSave();
                     } catch (IOException e1) {
-                        // TODO Auto-generated catch block
                         e1.printStackTrace();
                     }
                 }
@@ -1719,7 +1720,6 @@ public class GUI<E> implements CategoryListener {
                     }
                     hideScrollGraph();
                 } catch (IOException e) {
-                    // TODO Auto-generated catch block
                     e.printStackTrace();
                 }
             }
@@ -1745,15 +1745,17 @@ public class GUI<E> implements CategoryListener {
         splitPaneCanvasConsole.setResizeWeight(0.9);
 
         splitPane.setLeftComponent(scrollPane1);
-        splitPaneCanvasConsole.setLeftComponent(tabbedPane);
-        tabbedPane.addTab("View", canvasTP);
-        canvasTP.addTab("Main Grid", canvasSP);
-        tabbedPane.addTab("Statistics", statScrollPane);
-        tabbedPane.addTab("Holon", holonCanvas);
+        splitPaneCanvasConsole.setLeftComponent(tabbedPaneOriginal);
+        tabbedPaneOriginal.addTab("View", tabbedPaneInnerOriginal);
+        tabbedPaneInnerOriginal.addTab("Main Grid", canvasSP);
+//        tabbedPaneSplit.addTab("View", tabbedPaneInnerSplit);
+//        tabbedPaneInnerSplit.addTab("Main Grid", null);
+        tabbedPaneOriginal.addTab("Statistics", statScrollPane);
+        tabbedPaneOriginal.addTab("Holon", holonCanvas);
         flexPane = new FlexiblePane(controller);
         controller.setFlexiblePane(flexPane);
         controller.getModel().getObjectListeners().add(flexPane);
-        tabbedPane.addTab("Flexibility", flexPane);
+        tabbedPaneOriginal.addTab("Flexibility", flexPane);
 
         splitPaneCanvasConsole.setRightComponent(console);
         splitPane1.setLeftComponent(splitPaneCanvasConsole);
@@ -1770,7 +1772,7 @@ public class GUI<E> implements CategoryListener {
         canvasSP.setViewportView(canvas);
         algorithmMenu.setBackground(new Color(240, 240, 240));
 
-        tabbedPane.setBorder(null);
+        tabbedPaneOriginal.setBorder(null);
         scrollProperties.setBorder(null);
         scrollGraph.setBorder(null);
         scrollElements.setBorder(null);
@@ -2014,8 +2016,6 @@ public class GUI<E> implements CategoryListener {
      * Open a new Tab with an UpperNodeCanvas
      */
     private void openNewUpperNodeTab() {
-        // is the uppernode on tabbedPane or tabbedPane2
-        // TODO: hier upper node
         chooseTabTemp();
 
         JScrollPane scrollPane = getScrollPaneFromTabbedPane();
@@ -2030,17 +2030,34 @@ public class GUI<E> implements CategoryListener {
 
         // check if tab already open for clicked NodeOfNode
         boolean dupl = false;
-        for (int i = 4; i < tabbedPane.getTabCount() && !dupl; i++) {
-            if (tabbedPane.getComponentAt(i) != null && ((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i))
-                    .getViewport().getComponent(0)).upperNode.getId() == temp.getId()) {
+
+        for (int i = 1; i < tabbedPaneInnerOriginal.getTabCount(); i++) {
+            JScrollPane paneOriginal = (JScrollPane) tabbedPaneInnerOriginal.getComponentAt(i);
+            if (paneOriginal != null &&
+                    ((UpperNodeCanvas) paneOriginal.getViewport().getComponent(0)).upperNode.getId() == temp.getId()) {
                 dupl = true;
-                tabbedPane.setSelectedComponent(tabbedPane.getComponentAt(i));
+                // set selected component to view
+                tabbedPaneOriginal.setSelectedComponent(tabbedPaneInnerOriginal);
+                // set selected tab in view to found upper-node-canvas
+                tabbedPaneInnerOriginal.setSelectedComponent(tabbedPaneInnerOriginal.getComponentAt(i));
             }
-            if (!initSplit && tabbedPane2.getComponentAt(i) != null
-                    && ((UpperNodeCanvas) ((JScrollPane) tabbedPane2.getComponentAt(i)).getViewport()
-                    .getComponent(0)).upperNode.getId() == temp.getId()) {
-                dupl = true;
-                tabbedPane2.setSelectedComponent(tabbedPane2.getComponentAt(i));
+
+            if (tabbedPaneSplit.getComponentCount() > 0) {
+                JTabbedPane tabbedPaneInnerSplit = (JTabbedPane) tabbedPaneSplit.getComponentAt(0);
+                JScrollPane paneSplit = (JScrollPane) tabbedPaneInnerSplit.getComponentAt(i);
+                if (!initSplit && paneSplit != null
+                        && ((UpperNodeCanvas) paneSplit.getViewport().getComponent(0)).upperNode.getId() == temp.getId()) {
+                    dupl = true;
+                    // set selected component to view
+                    tabbedPaneSplit.setSelectedComponent(tabbedPaneInnerSplit);
+                    // set selected tab in view to found upper-node-canvas
+                    tabbedPaneInnerSplit.setSelectedComponent(tabbedPaneInnerSplit.getComponentAt(i));
+                }
+            }
+
+            // if we found a duplicate, break
+            if (dupl) {
+                break;
             }
         }
         if (!dupl) {
@@ -2057,7 +2074,6 @@ public class GUI<E> implements CategoryListener {
 
                     chooseTabTemp();
 
-                    // TODO: look into: why MyCanvas?
                     JScrollPane scrollPane1 = getScrollPaneFromTabbedPane();
                     temp = ((UpperNodeCanvas) scrollPane1.getViewport().getComponent(0)).tempCps;
                     if (doubleClick() && MouseEvent.BUTTON3 != e.getButton() && temp instanceof CpsUpperNode) {
@@ -2073,65 +2089,38 @@ public class GUI<E> implements CategoryListener {
 
             JScrollPane sp = new JScrollPane(unc);
             sp.setBorder(null);
-            // Selected tabbed Pane = tabbedPane or tabbedPane2
-            if (tabTemp == tabbedPane) {
-                tabbedPane.add(temp.getName(), sp);
-                tabbedPane.setSelectedComponent(sp);
-                tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1,
-                        new ButtonTabComponent(tabbedPane, tabbedPane2));
-                if (!initSplit) {
-                    tabbedPane2.add(temp.getName(), null);
-                    // tabbedPane2.setTabComponentAt(tabbedPane2.getTabCount() -
-                    // 1,
-                    // new ButtonTabComponent(tabbedPane, tabbedPane2));
+
+            // Selected tabbed Pane = tabbedPaneOriginal or tabbedPaneSplit
+            if (tabTemp == tabbedPaneOriginal) {
+                this.tabbedPaneInnerOriginal.add(temp.getName(), sp);
+                this.tabbedPaneInnerOriginal.setSelectedComponent(sp);
+                this.tabbedPaneInnerOriginal.setTabComponentAt(this.tabbedPaneInnerOriginal.getTabCount() - 1,
+                        new ButtonTabComponent(this.tabbedPaneInnerOriginal, tabbedPaneSplit));
+
+                if (!initSplit && tabbedPaneSplit.getComponentCount() != 0) {
+                    JTabbedPane tabbedPaneInnerSplit = (JTabbedPane) tabbedPaneSplit.getComponentAt(0);
+                    tabbedPaneInnerSplit.add(temp.getName(), null);
                 }
             } else {
-                tabbedPane2.add(temp.getName(), sp);
-                Component tempC = tabbedPane2.getSelectedComponent();
-                tabbedPane2.setComponentAt(tabbedPane2.getSelectedIndex(), null);
-                tabbedPane.setComponentAt(tabbedPane2.getSelectedIndex(), tempC);
-                tabbedPane2.setSelectedComponent(sp);
-
-                // tabbedPane2.setTabComponentAt(tabbedPane2.getTabCount() - 1,
-                // new ButtonTabComponent(tabbedPane, tabbedPane2));
-
-                tabbedPane.add(temp.getName(), null);
-                tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1,
-                        new ButtonTabComponent(tabbedPane, tabbedPane2));
+                JTabbedPane tabbedPaneInnerSplit = (JTabbedPane) tabbedPaneSplit.getComponentAt(0);
+                tabbedPaneInnerSplit.add(temp.getName(), sp);
+                Component tempC = tabbedPaneInnerSplit.getSelectedComponent();
+                tabbedPaneInnerSplit.setComponentAt(tabbedPaneInnerSplit.getSelectedIndex(), null);
+                tabbedPaneOriginal.setComponentAt(tabbedPaneInnerSplit.getSelectedIndex(), tempC);
+                tabbedPaneInnerSplit.setSelectedComponent(sp);
+
+                tabbedPaneInnerOriginal.add(temp.getName(), null);
+                tabbedPaneInnerOriginal.setTabComponentAt(tabbedPaneInnerOriginal.getTabCount() - 1,
+                        new ButtonTabComponent(tabbedPaneInnerOriginal, tabbedPaneInnerSplit));
             }
 
             temp = null;
         }
     }
 
-    private void readStatistics(JsonObject json) {
-        List<String> keys = json.entrySet().stream().map(i -> i.getKey())
-                .collect(Collectors.toCollection(ArrayList::new));
-
-        // Saved Values
-        JsonObject obj;
-        AbstractCpsObject cps;
-        int prop;
-        Color color;
-
-        StatisticGraphPanel stat = new StatisticGraphPanel(model, controller, json.get("KEY").getAsString(),
-                model.getGraphTable());
-
-        for (String k : keys) {
-            if (!k.equals("KEY")) {
-                obj = json.get(k).getAsJsonObject();
-                cps = (obj.get("ID") == JsonNull.INSTANCE ? null : controller.searchTracked(obj.get("ID").getAsInt()));
-                prop = obj.get("PROPERTY").getAsInt();
-                color = model.getGson().fromJson(obj.get("COLOR"), Color.class);
-                stat.addObject(new TrackedDataSet(cps, prop, color));
-            }
-            model.getGraphTable().put(json.get("KEY").getAsString(), stat);
-            model.getStatPanel().getGraphPanel().add(stat);
-        }
-    }
-
     private void updateUpperNodes() {
-        for (Component comp : tabbedPane.getComponents()) {
+        System.out.println("updateUpperNodes");
+        for (Component comp : tabbedPaneOriginal.getComponents()) {
             if (!(comp instanceof JScrollPane))
                 continue;
             Component pane = ((JScrollPane) comp).getViewport().getComponent(0);
@@ -2149,42 +2138,68 @@ public class GUI<E> implements CategoryListener {
      * @param cps the CPS object that is currently selected
      */
     private void removeUpperNodeTab(AbstractCpsObject cps) {
-        // TODO: hier upper node
+        System.out.println("removeUpperNodeTab");
         if (cps instanceof CpsUpperNode) {
             boolean splitView = false;
-            for (int i = 4; i < tabbedPane.getTabCount(); i++) {
-                if (tabbedPane.getComponentAt(i) == null) {
+            for (int i = 4; i < tabbedPaneOriginal.getTabCount(); i++) {
+                if (tabbedPaneOriginal.getComponentAt(i) == null) {
                     splitView = true;
-                } else if (((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i))
+                } else if (((UpperNodeCanvas) ((JScrollPane) tabbedPaneOriginal.getComponentAt(i))
                         .getViewport().getComponent(0)).upperNode.getId() == cps.getId()) {
-                    ((ButtonTabComponent) tabbedPane.getTabComponentAt(i)).removeTabs();
+                    ((ButtonTabComponent) tabbedPaneOriginal.getTabComponentAt(i)).removeTabs();
                     break;
                 }
             }
             // If SplitView is on and the view on
-            // tabbedPane2 is the deleted upperNode
+            // tabbedPaneSplit is the deleted upperNode
             try {
                 if (splitView
-                        && ((UpperNodeCanvas) ((JScrollPane) tabbedPane2.getSelectedComponent())
+                        && ((UpperNodeCanvas) ((JScrollPane) tabbedPaneSplit.getSelectedComponent())
                         .getViewport().getComponent(0)).upperNode.getId() == cps.getId()) {
-                    ((ButtonTabComponent) tabbedPane
-                            .getTabComponentAt(tabbedPane2.getSelectedIndex())).removeTabs();
+                    ((ButtonTabComponent) tabbedPaneOriginal
+                            .getTabComponentAt(tabbedPaneSplit.getSelectedIndex())).removeTabs();
                 }
             } catch (Exception e2) {
             }
         }
     }
 
+    private void readStatistics(JsonObject json) {
+        List<String> keys = json.entrySet().stream().map(i -> i.getKey())
+                .collect(Collectors.toCollection(ArrayList::new));
+
+        // Saved Values
+        JsonObject obj;
+        AbstractCpsObject cps;
+        int prop;
+        Color color;
+
+        StatisticGraphPanel stat = new StatisticGraphPanel(model, controller, json.get("KEY").getAsString(),
+                model.getGraphTable());
+
+        for (String k : keys) {
+            if (!k.equals("KEY")) {
+                obj = json.get(k).getAsJsonObject();
+                cps = (obj.get("ID") == JsonNull.INSTANCE ? null : controller.searchTracked(obj.get("ID").getAsInt()));
+                prop = obj.get("PROPERTY").getAsInt();
+                color = model.getGson().fromJson(obj.get("COLOR"), Color.class);
+                stat.addObject(new TrackedDataSet(cps, prop, color));
+            }
+            model.getGraphTable().put(json.get("KEY").getAsString(), stat);
+            model.getStatPanel().getGraphPanel().add(stat);
+        }
+    }
+
 
     /**
-     * chooses whether to set the tabTemp to tabbedPane or tabbedPane2
+     * chooses whether to set the tabTemp to tabbedPaneOriginal or tabbedPaneSplit
      */
     private void chooseTabTemp() {
-        // is the uppernode on tabbedPane or tabbedPane2
-        if (tabbedPane.getMousePosition() != null) {
-            tabTemp = tabbedPane;
+        // is the uppernode on tabbedPaneOriginal or tabbedPaneSplit
+        if (tabbedPaneOriginal.getMousePosition() != null) {
+            tabTemp = tabbedPaneOriginal;
         } else {
-            tabTemp = tabbedPane2;
+            tabTemp = tabbedPaneSplit;
         }
     }