Parcourir la source

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

Teh-Hai Julian Zheng il y a 8 ans
Parent
commit
f7fb525f00

+ 2 - 1
.gitignore

@@ -1 +1,2 @@
-
+bin/
+build/

+ 7 - 0
src/interfaces/GraphListener.java

@@ -0,0 +1,7 @@
+package interfaces;
+
+public interface GraphListener {
+	
+	public void repaintGraph();
+
+}

+ 14 - 0
src/ui/model/Model.java

@@ -13,6 +13,7 @@ import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import interfaces.CategoryListener;
+import interfaces.GraphListener;
 import interfaces.ObjectListener;
 import ui.view.Console;
 
@@ -41,6 +42,7 @@ public class Model {
 	private ArrayList<AbstractCpsObject> clipboardObjects = new ArrayList<AbstractCpsObject>();
 	private Console console;
 
+	private ArrayList<GraphListener> graphListeners = new ArrayList<GraphListener>();
 	// Iteration Speed
 	private int timerSpeed = 1000;
 
@@ -353,6 +355,14 @@ public class Model {
 	 */
 	public void setCurIteration(int curIT) {
 		this.curIteration = curIT;
+		notifyGraphListeners();
+	}
+
+	private void notifyGraphListeners() {
+		for(GraphListener gl: graphListeners){
+			gl.repaintGraph();
+		}
+		
 	}
 
 	/**
@@ -620,5 +630,9 @@ public class Model {
 	public ArrayList<HolonObject> getTrackingObj() {
 		return trackingObj;
 	}
+	
+	public void addGraphListener(GraphListener gl){
+		graphListeners.add(gl);
+	}
 
 }

+ 148 - 0
src/ui/view/ButtonTabComponent.java

@@ -0,0 +1,148 @@
+package ui.view;
+
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle or the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ 
+import javax.swing.*;
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicButtonUI;
+import java.awt.*;
+import java.awt.event.*;
+ 
+/**
+ * Component to be used as tabComponent;
+ * Contains a JLabel to show the text and 
+ * a JButton to close the tab it belongs to 
+ */
+public class ButtonTabComponent extends JPanel {
+    private final JTabbedPane pane;
+ 
+    public ButtonTabComponent(final JTabbedPane pane) {
+        //unset default FlowLayout' gaps
+        super(new FlowLayout(FlowLayout.LEFT, 0, 0));
+        if (pane == null) {
+            throw new NullPointerException("TabbedPane is null");
+        }
+        this.pane = pane;
+        setOpaque(false);
+         
+        //make JLabel read titles from JTabbedPane
+        JLabel label = new JLabel() {
+            public String getText() {
+                int i = pane.indexOfTabComponent(ButtonTabComponent.this);
+                if (i != -1) {
+                    return pane.getTitleAt(i);
+                }
+                return null;
+            }
+        };
+         
+        add(label);
+        //add more space between the label and the button
+        label.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
+        //tab button
+        JButton button = new TabButton();
+        add(button);
+        //add more space to the top of the component
+        setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
+    }
+ 
+    private class TabButton extends JButton implements ActionListener {
+        public TabButton() {
+            int size = 17;
+            setPreferredSize(new Dimension(size, size));
+            setToolTipText("close this tab");
+            //Make the button looks the same for all Laf's
+            setUI(new BasicButtonUI());
+            //Make it transparent
+            setContentAreaFilled(false);
+            //No need to be focusable
+            setFocusable(false);
+            setBorder(BorderFactory.createEtchedBorder());
+            setBorderPainted(false);
+            //Making nice rollover effect
+            //we use the same listener for all buttons
+            addMouseListener(buttonMouseListener);
+            setRolloverEnabled(true);
+            //Close the proper tab by clicking the button
+            addActionListener(this);
+        }
+ 
+        public void actionPerformed(ActionEvent e) {
+            int i = pane.indexOfTabComponent(ButtonTabComponent.this);
+            if (i != -1) {
+                pane.remove(i);
+            }
+        }
+ 
+        //we don't want to update UI for this button
+        public void updateUI() {
+        }
+ 
+        //paint the cross
+        protected void paintComponent(Graphics g) {
+            super.paintComponent(g);
+            Graphics2D g2 = (Graphics2D) g.create();
+            //shift the image for pressed buttons
+            if (getModel().isPressed()) {
+                g2.translate(1, 1);
+            }
+            g2.setStroke(new BasicStroke(2));
+            g2.setColor(Color.BLACK);
+            if (getModel().isRollover()) {
+                g2.setColor(Color.MAGENTA);
+            }
+            int delta = 6;
+            g2.drawLine(delta, delta, getWidth() - delta - 1, getHeight() - delta - 1);
+            g2.drawLine(getWidth() - delta - 1, delta, delta, getHeight() - delta - 1);
+            g2.dispose();
+        }
+    }
+ 
+    private final static MouseListener buttonMouseListener = new MouseAdapter() {
+        public void mouseEntered(MouseEvent e) {
+            Component component = e.getComponent();
+            if (component instanceof AbstractButton) {
+                AbstractButton button = (AbstractButton) component;
+                button.setBorderPainted(true);
+            }
+        }
+ 
+        public void mouseExited(MouseEvent e) {
+            Component component = e.getComponent();
+            if (component instanceof AbstractButton) {
+                AbstractButton button = (AbstractButton) component;
+                button.setBorderPainted(false);
+            }
+        }
+    };
+}
+

+ 5 - 2
src/ui/view/GUI.java

@@ -272,6 +272,7 @@ public class GUI<E> implements CategoryListener {
 		this.controller = control;
 		this.model = control.getModel();
 		statPane = new StatisticPane(model, controller);
+		model.addGraphListener(statPane);
 		statScrollPane = new JScrollPane(statPane);
 		this.canvas = new MyCanvas(model, control);
 		this.unitGraph = new UnitGraph(model, control);
@@ -1604,8 +1605,10 @@ public class GUI<E> implements CategoryListener {
 		splitPane.setLeftComponent(scrollPane1);
 		splitPaneCanvasConsole.setLeftComponent(panelTapped_SimMenu);
 		tabbedPane.addTab("View", canvasSP);
-		tabbedPane.addTab("Statistics", statScrollPane);
-
+		tabbedPane.setTabComponentAt(0, new ButtonTabComponent(tabbedPane));
+		tabbedPane.addTab("Statistics", statScrollPane);
+		tabbedPane.setTabComponentAt(1, new ButtonTabComponent(tabbedPane));
+		
 		splitPaneCanvasConsole.setRightComponent(console);
 		splitPane1.setLeftComponent(splitPaneCanvasConsole);
 		splitPane1.setRightComponent(splitHolonElPro);

+ 8 - 4
src/ui/view/MyCanvas.java

@@ -123,7 +123,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		itemCollapse.addActionListener(new ActionListener() {
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				control.addUpperNode("NodeOfNode", null);
+				controller.addUpperNode("NodeOfNode", null);
 				repaint();
 			}
 		});
@@ -403,9 +403,13 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage();
 				}
 			}
-
-			g2.drawImage(img, cps.getPosition().x, cps.getPosition().y, controller.getScale(), controller.getScale(),
-					null);
+			if (cps instanceof CpsUpperNode) {
+				g2.drawImage(img, cps.getPosition().x, cps.getPosition().y, (int)(controller.getScale()*1.5),
+						(int)(controller.getScale()*1.5), null);
+			} else {
+				g2.drawImage(img, cps.getPosition().x, cps.getPosition().y, controller.getScale(),
+						controller.getScale(), null);
+			}
 		}
 
 		// Dragg Highlighting

+ 121 - 80
src/ui/view/StatisticPane.java

@@ -14,23 +14,34 @@ import javax.swing.JCheckBox;
 import javax.swing.LayoutStyle.ComponentPlacement;
 import java.awt.Color;
 import javax.swing.SwingConstants;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
 
+import classes.HolonObject;
+import interfaces.GraphListener;
 import ui.controller.Control;
 import ui.model.Model;
 
 import javax.swing.JComboBox;
 import javax.swing.JButton;
 import java.awt.event.ActionListener;
+import java.util.HashMap;
 import java.awt.event.ActionEvent;
 
-public class StatisticPane extends JPanel{
+public class StatisticPane extends JPanel implements GraphListener{
 	private JScrollPane listScrollPane = new JScrollPane();
     private JList objectList;
     private DefaultListModel listModel =  new DefaultListModel();
     private Model model;
     private Control controller;
-    //private StatisticGraph statGraph;
-    private JPanel statGraph;
+    //private StatisticGraph statGraph1;
+    private JPanel statGraph1;
+    //private StatisticGraph statGraph2;
+    private JPanel statGraph2;
+    private HashMap<String, HolonObject> objectHashMap = new HashMap<String, HolonObject>();
+    private JLabel nameThreshHolder;
+    private GroupLayout groupLayout;
+    
     
     public StatisticPane(Model m, Control c){
     	model = m;
@@ -52,8 +63,8 @@ public class StatisticPane extends JPanel{
     	
     	JLabel lblName = new JLabel("Name:");
     	
-    	JLabel lblNewLabel = new JLabel("...");
-    	lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
+    	nameThreshHolder = new JLabel("...");
+    	nameThreshHolder.setHorizontalAlignment(SwingConstants.LEFT);
     	
     	JCheckBox checkBox = new JCheckBox("total consumption");
     	checkBox.setForeground(Color.RED);
@@ -61,26 +72,36 @@ public class StatisticPane extends JPanel{
     	JCheckBox checkBox_1 = new JCheckBox("total production");
     	checkBox_1.setForeground(Color.BLUE);
     	
-    	JLabel lblGraph = new JLabel("  Graph:");
-    	
-    	JComboBox comboBox = new JComboBox();
-    	
-    	//statGraph = new StatisticGraph(model, controller);
-    	statGraph = new JPanel();
+    	//statGraph1 = new StatisticGraph(model, controller);
+    	statGraph1 = new JPanel();
     	
     	JButton btnRefresh = new JButton("Refresh Tracked Objects");
     	btnRefresh.addActionListener(new ActionListener() {
     		public void actionPerformed(ActionEvent e) {
-    			listModel.removeAllElements();
-    			for(int i = 0; i < controller.getTrackingObj().size(); i++){
-    				listModel.addElement(controller.getTrackingObj().get(i).getName() +
-    						controller.getTrackingObj().get(i).getID());
-    			}
+    			refreshTrackedList();
+    		}
+    	});
+    	
+    	//statGraph2 = new StatisticGraph(model, controller);
+    	statGraph2 = new JPanel();
+    	
+    	JButton btnUntrack = new JButton("Untrack");
+    	btnUntrack.addActionListener(new ActionListener() {
+    		public void actionPerformed(ActionEvent e) {
+    			controller.getTrackingObj().remove(objectHashMap.get(nameThreshHolder.getText()));
+    			refreshTrackedList();
+    			nameThreshHolder.setText("...");
     		}
     	});
     	
-    	JPanel panel = new JPanel();
-    	GroupLayout groupLayout = new GroupLayout(this);
+    	JButton btnAddGraph = new JButton("add Graph");
+    	btnAddGraph.addActionListener(new ActionListener() {
+    		public void actionPerformed(ActionEvent e) {
+    			JPanel tmp = new JPanel();
+    			//groupLayout.
+    		}
+    	});
+    	groupLayout = new GroupLayout(this);
     	groupLayout.setHorizontalGroup(
     		groupLayout.createParallelGroup(Alignment.LEADING)
     			.addGroup(groupLayout.createSequentialGroup()
@@ -88,89 +109,109 @@ public class StatisticPane extends JPanel{
     				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
     					.addGroup(groupLayout.createSequentialGroup()
     						.addComponent(listScrollPane, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
-    						.addGap(263))
-    					.addGroup(groupLayout.createSequentialGroup()
-    						.addComponent(lblObject, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)
-    						.addContainerGap(384, Short.MAX_VALUE))
-    					.addGroup(groupLayout.createSequentialGroup()
-    						.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
-    							.addGroup(groupLayout.createSequentialGroup()
-    								.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
-    									.addGroup(groupLayout.createSequentialGroup()
-    										.addGap(10)
-    										.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
-    											.addGroup(groupLayout.createSequentialGroup()
-    												.addComponent(lblGraph, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)
-    												.addPreferredGap(ComponentPlacement.RELATED)
-    												.addComponent(comboBox, 0, 127, Short.MAX_VALUE))
-    											.addComponent(checkBox_1, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE)
-    											.addComponent(checkBox, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
-    											.addGroup(groupLayout.createSequentialGroup()
-    												.addComponent(lblName)
-    												.addPreferredGap(ComponentPlacement.RELATED)
-    												.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))))
-    									.addGroup(groupLayout.createSequentialGroup()
-    										.addGap(10)
-    										.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
-    											.addComponent(chckbxNewCheckBox)
-    											.addComponent(chckbxNewCheckBox_1))
-    										.addGap(35)))
-    								.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
-    							.addGroup(groupLayout.createSequentialGroup()
+    						.addGap(323))
+    					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    						.addGroup(groupLayout.createSequentialGroup()
+    							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    								.addGroup(groupLayout.createSequentialGroup()
+    									.addGap(10)
+    									.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    										.addGroup(groupLayout.createSequentialGroup()
+    											.addComponent(lblName)
+    											.addPreferredGap(ComponentPlacement.RELATED)
+    											.addComponent(nameThreshHolder, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
+    										.addComponent(checkBox, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE)
+    										.addComponent(checkBox_1, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE)))
     								.addComponent(lblOverallStatistics, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE)
-    								.addPreferredGap(ComponentPlacement.RELATED))
-    							.addGroup(groupLayout.createSequentialGroup()
-    								.addComponent(btnRefresh)
-    								.addGap(63)))
-    						.addPreferredGap(ComponentPlacement.RELATED)
-    						.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
-    							.addComponent(panel, GroupLayout.DEFAULT_SIZE, 226, Short.MAX_VALUE)
-    							.addComponent(statGraph, GroupLayout.PREFERRED_SIZE, 226, GroupLayout.PREFERRED_SIZE)))))
+    								.addGroup(groupLayout.createSequentialGroup()
+    									.addGap(10)
+    									.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    										.addComponent(chckbxNewCheckBox_1)
+    										.addComponent(chckbxNewCheckBox)))
+    								.addComponent(lblObject, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)
+    								.addGroup(groupLayout.createSequentialGroup()
+    									.addComponent(btnUntrack)
+    									.addGap(18)
+    									.addComponent(btnAddGraph)))
+    							.addGap(125)
+    							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    								.addComponent(statGraph2, GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)
+    								.addComponent(statGraph1, GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE)))
+    						.addGroup(groupLayout.createSequentialGroup()
+    							.addComponent(btnRefresh)
+    							.addContainerGap(349, Short.MAX_VALUE)))))
     	);
     	groupLayout.setVerticalGroup(
     		groupLayout.createParallelGroup(Alignment.LEADING)
     			.addGroup(groupLayout.createSequentialGroup()
+    				.addGap(17)
     				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
     					.addGroup(groupLayout.createSequentialGroup()
-    						.addGap(63)
     						.addComponent(lblOverallStatistics)
     						.addPreferredGap(ComponentPlacement.UNRELATED)
     						.addComponent(chckbxNewCheckBox)
-    						.addPreferredGap(ComponentPlacement.UNRELATED)
-    						.addComponent(chckbxNewCheckBox_1)
-    						.addGap(48)
+    						.addPreferredGap(ComponentPlacement.RELATED)
+    						.addComponent(chckbxNewCheckBox_1))
+    					.addComponent(statGraph1, GroupLayout.PREFERRED_SIZE, 125, GroupLayout.PREFERRED_SIZE))
+    				.addGap(41)
+    				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    					.addGroup(groupLayout.createSequentialGroup()
     						.addComponent(lblObject)
     						.addPreferredGap(ComponentPlacement.UNRELATED)
     						.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
     							.addComponent(lblName)
-    							.addComponent(lblNewLabel)))
-    					.addGroup(groupLayout.createSequentialGroup()
-    						.addGap(17)
-    						.addComponent(statGraph, GroupLayout.PREFERRED_SIZE, 140, GroupLayout.PREFERRED_SIZE)))
-    				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
-    					.addGroup(groupLayout.createSequentialGroup()
-    						.addGap(80)
+    							.addComponent(nameThreshHolder))
+    						.addPreferredGap(ComponentPlacement.RELATED)
     						.addComponent(checkBox)
-    						.addPreferredGap(ComponentPlacement.UNRELATED)
-    						.addComponent(checkBox_1))
-    					.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
     						.addPreferredGap(ComponentPlacement.RELATED)
-    						.addComponent(panel, GroupLayout.PREFERRED_SIZE, 123, GroupLayout.PREFERRED_SIZE)))
-    				.addPreferredGap(ComponentPlacement.UNRELATED)
-    				.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
-    					.addComponent(lblGraph)
-    					.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
-    				.addGap(27)
-    				.addComponent(btnRefresh)
-    				.addPreferredGap(ComponentPlacement.RELATED)
-    				.addComponent(listScrollPane, GroupLayout.PREFERRED_SIZE, 206, GroupLayout.PREFERRED_SIZE)
-    				.addContainerGap(91, Short.MAX_VALUE))
+    						.addComponent(checkBox_1)
+    						.addPreferredGap(ComponentPlacement.UNRELATED)
+    						.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
+    							.addComponent(btnUntrack)
+    							.addComponent(btnAddGraph))
+    						.addGap(30)
+    						.addComponent(btnRefresh)
+    						.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+    						.addComponent(listScrollPane, GroupLayout.PREFERRED_SIZE, 160, GroupLayout.PREFERRED_SIZE)
+    						.addPreferredGap(ComponentPlacement.RELATED))
+    					.addComponent(statGraph2, GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE))
+    				.addContainerGap(89, GroupLayout.PREFERRED_SIZE))
     	);
     	setLayout(groupLayout);
+    	
+    	objectList.addListSelectionListener(new ListSelectionListener(){
+    		
+    		@Override
+    		public void valueChanged(ListSelectionEvent arg0){
+    			if(objectList.getSelectedValue() != null){
+    			nameThreshHolder.setText(objectList.getSelectedValue().toString());
+    			}
+    		}
+    	});
 
     }
     
+    public void refreshTrackedList(){
+		listModel.removeAllElements();
+		objectHashMap.clear();
+		for(int i = 0; i < controller.getTrackingObj().size(); i++){
+			String name = controller.getTrackingObj().get(i).getName() + " " +
+			controller.getTrackingObj().get(i).getID();
+			
+			listModel.addElement(name);
+			objectHashMap.put(name, controller.getTrackingObj().get(i));
+			if(i < 8){
+				//statGraph1.addObject(controller.getTrackingObj().get(i));
+			}
+		}
+    }
     public void updateGraphs(){
-    	statGraph.repaint();
+    	statGraph1.repaint();
     }
+
+	@Override
+	public void repaintGraph() {
+		// TODO Auto-generated method stub
+		statGraph1.repaint();
+	}
 }

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

@@ -130,7 +130,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		itemCollapse.addActionListener(new ActionListener() {
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				control.addUpperNode("NodeOfNode");
+				controller.addUpperNode("NodeOfNode", null);
 				repaint();
 			}
 		});