Browse Source

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

Teh-Hai Julian Zheng 7 years ago
parent
commit
7d842e001d

+ 6 - 0
src/interfaces/GraphListener.java

@@ -1,7 +1,13 @@
 package interfaces;
 
+import java.util.ArrayList;
+
+import classes.HolonObject;
+
 public interface GraphListener {
 	
 	public void repaintGraph();
+	
+	public void addTrackedObject(ArrayList<HolonObject> hlList);
 
 }

+ 1 - 0
src/ui/controller/StatsController.java

@@ -25,6 +25,7 @@ public class StatsController {
 
 	public void addTrackingObj(HolonObject obj) {
 		model.getTrackingObj().add(obj);
+		model.addObjectsToGraphListeners();
 		/*
 		for(int i = 0; i < model.getTrackingObj().size(); i++){
 			System.out.println(model.getTrackingObj().get(i).getName() + " " + model.getTrackingObj().get(i).getID());

+ 7 - 1
src/ui/model/Model.java

@@ -24,7 +24,7 @@ import ui.view.Console;
  * @author Gruppe14
  *
  */
-public class Model {
+public class Model{
 
 	// Global Variables
 	private int canvasX = 1000;
@@ -660,4 +660,10 @@ public class Model {
 		graphListeners.add(gl);
 	}
 
+	public void addObjectsToGraphListeners(){
+		for(GraphListener gl : graphListeners){
+			gl.addTrackedObject(trackingObj);
+		}
+	}
+
 }

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

@@ -124,8 +124,9 @@ public class GUI<E> implements CategoryListener {
 	private String catOfObjToBeEdited;
 	private final JScrollPane statTab = new JScrollPane();
 
-	private StatisticPane statPane;
+	private splitPane statSplitPane;
 	private JScrollPane statScrollPane;
+	private UpperNodeCanvas unc;;
 
 	private final JLabel maxGraph = new JLabel("100%");
 	private final JLabel medGraph = new JLabel("50%");
@@ -235,7 +236,6 @@ public class GUI<E> implements CategoryListener {
 	private Console console = new Console();
 	private MyCanvas canvas;
 	private UnitGraph unitGraph;
-	private StatisticGraph statGraph;
 	private final JSplitPane splitPane3 = new JSplitPane();
 	private final JSlider sizeSlider = new JSlider();
 	private final JLabel lblImageSize = new JLabel(Languages.getLanguage()[94]);
@@ -279,12 +279,11 @@ public class GUI<E> implements CategoryListener {
 	public GUI(Control control) {
 		this.controller = control;
 		this.model = control.getModel();
-		statPane = new StatisticPane(model, controller);
-		model.addGraphListener(statPane);
-		statScrollPane = new JScrollPane(statPane);
+		statSplitPane = new splitPane();
+		model.addGraphListener(statSplitPane);
+		statScrollPane = new JScrollPane(statSplitPane);
 		this.canvas = new MyCanvas(model, control);
 		this.unitGraph = new UnitGraph(model, control);
-		this.statGraph = new StatisticGraph(model, controller);
 		control.initListener(this);
 		controller.setCanvas(canvas);
 		model.setConsole(console);
@@ -1971,7 +1970,6 @@ public class GUI<E> implements CategoryListener {
 	 */
 	private void openNewUpperNodeTab() {
 
-		UpperNodeCanvas unc;
 		if (((JScrollPane) tabbedPane.getSelectedComponent()).getViewport().getComponent(0) instanceof MyCanvas) {
 			unc = new UpperNodeCanvas(model, controller, (CpsUpperNode) temp, "");
 		} else {
@@ -1990,7 +1988,6 @@ public class GUI<E> implements CategoryListener {
 			}
 		}
 		if (!dupl) {
-
 			unc.setBorder(null);
 			unc.setBackground(Color.WHITE);
 			unc.setPreferredSize(new Dimension(model.getCanvasX(), model.getCanvasY()));

+ 13 - 0
src/ui/view/MyCanvas.java

@@ -23,6 +23,8 @@ import javax.swing.ImageIcon;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
 import javax.swing.JToolTip;
 
 import classes.CpsEdge;
@@ -196,6 +198,17 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				// Remove the selected Object objects
 				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
 					controller.delCanvasObject(cps);
+					// Remove UpperNodeTab if UpperNode deleted
+					if(cps instanceof CpsUpperNode){
+						JTabbedPane tabbedPane = (JTabbedPane) getParent().getParent().getParent();
+						for (int i = 2; i < tabbedPane.getTabCount(); i++) {
+							if (((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i)).getViewport().getComponent(0)).upperNode
+									.getID() == cps.getID()) {
+								tabbedPane.remove(i);
+								i = tabbedPane.getTabCount();				
+							}
+						}
+					}	
 				}
 				model.getSelectedCpsObjects().clear();
 				tempCps = null;

+ 15 - 1
src/ui/view/StatisticPane.java

@@ -8,6 +8,7 @@ import java.awt.BorderLayout;
 import java.awt.FlowLayout;
 import javax.swing.GroupLayout;
 import javax.swing.GroupLayout.Alignment;
+import javax.swing.GroupLayout.Group;
 import javax.swing.JLabel;
 import java.awt.Font;
 import javax.swing.JCheckBox;
@@ -25,6 +26,7 @@ import ui.model.Model;
 import javax.swing.JComboBox;
 import javax.swing.JButton;
 import java.awt.event.ActionListener;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.awt.event.ActionEvent;
 
@@ -98,9 +100,15 @@ public class StatisticPane extends JPanel implements GraphListener{
     	btnAddGraph.addActionListener(new ActionListener() {
     		public void actionPerformed(ActionEvent e) {
     			JPanel tmp = new JPanel();
-    			//groupLayout.
     		}
     	});
+    	
+    	/*
+		Group gr = groupLayout.createParallelGroup();
+		for(int i = 0; i < 4; i++){
+			gr.addComponent(statGraph2, GroupLayout.DEFAULT_SIZE, 199, Short.MAX_VALUE);
+		}
+		*/
     	groupLayout = new GroupLayout(this);
     	groupLayout.setHorizontalGroup(
     		groupLayout.createParallelGroup(Alignment.LEADING)
@@ -214,4 +222,10 @@ public class StatisticPane extends JPanel implements GraphListener{
 		// TODO Auto-generated method stub
 		statGraph1.repaint();
 	}
+
+	@Override
+	public void addTrackedObject(ArrayList<HolonObject> hl) {
+		// TODO Auto-generated method stub
+		
+	}
 }

+ 195 - 84
src/ui/view/UpperNodeCanvas.java

@@ -25,6 +25,7 @@ import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
 import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
 import javax.swing.JToolTip;
 
 import classes.CpsEdge;
@@ -34,6 +35,7 @@ import classes.AbstractCpsObject;
 import classes.HolonElement;
 import classes.HolonObject;
 import classes.HolonSwitch;
+import classes.Position;
 import classes.SubNet;
 import ui.controller.Control;
 import ui.model.Model;
@@ -56,6 +58,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 	private int cx, cy;
 	private int sx, sy; // Mark Coords
 	private float scalediv20;
+	private int borderPos = 0; // Border Position
 
 	// Path
 	public String path;
@@ -86,7 +89,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 	public JMenuItem itemUngroup = new JMenuItem("Ungroup");
 	public JMenuItem itemTrack = new JMenuItem("Track");
 	public JMenuItem itemUntrack = new JMenuItem("Untrack");
-	private JToolTip objectTT = new JToolTip();
+	// private JToolTip objectTT = new JToolTip();
 
 	private Point mousePosition = new Point(); // Mouse Position when
 												// rightclicked
@@ -102,7 +105,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;
@@ -111,6 +114,12 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		// this.add(breadCrumb);
 		scalediv20 = model.getScale() / 20;
 
+		for (AbstractCpsObject cps : upperNode.getNodes()) {
+			if (cps.getPosition().x < model.getScaleDiv2() + borderPos + 5) {
+				cps.setPosition(new Position(borderPos + 5, cps.getPosition().y));
+			}
+		}
+
 		showedInformation[0] = true;
 		showedInformation[1] = true;
 		control.setMaxCapacity(10000);
@@ -137,15 +146,15 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		itemGroup.addActionListener(new ActionListener() {
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				controller.addUpperNode("NodeOfNode", UpperNode);
+				controller.addUpperNode("NodeOfNode", upperNode);
 				repaint();
 			}
 		});
-		
+
 		itemUngroup.addActionListener(new ActionListener() {
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				controller.delUpperNode((CpsUpperNode) tempCps, UpperNode);
+				controller.delUpperNode((CpsUpperNode) tempCps, upperNode);
 				repaint();
 			}
 		});
@@ -205,8 +214,19 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 			@Override
 			public void actionPerformed(ActionEvent e) {
 				// Remove the selected Object objects
-				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
+				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
 					controller.delObjUpperNode(cps, UpperNode);
+					// Remove UpperNodeTab if UpperNode deleted
+					if(cps instanceof CpsUpperNode){
+						JTabbedPane tabbedPane = (JTabbedPane) getParent().getParent().getParent();
+						for (int i = 2; i < tabbedPane.getTabCount(); i++) {
+							if (((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponentAt(i)).getViewport().getComponent(0)).upperNode
+									.getID() == cps.getID()) {
+								tabbedPane.remove(i);
+								i = tabbedPane.getTabCount();				
+							}
+						}
+					}
 				}
 				model.getSelectedCpsObjects().clear();
 				tempCps = null;
@@ -259,6 +279,14 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
 		g2.setRenderingHints(rh);
 
+		// Left Border
+		borderPos = (int) (model.getScale()+scalediv20+scalediv20+10);
+		g2.setColor(new Color(230, 230, 230));
+		g2.fillRect(0, 0, borderPos, this.getHeight());
+		g2.setColor(Color.BLACK);
+		g2.drawLine(0, 0, this.getWidth(), 0);
+		
+
 		// Test SubNet Coloring
 		int i = 0;
 		for (SubNet s : controller.getSimManager().getSubNets()) {
@@ -371,7 +399,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 			}
 		}
 
-		// Objects
+		// Objects in upper node
 		for (AbstractCpsObject cps : upperNode.getNodes()) {
 			// Border Highlighting
 			g2.setColor(cps.getBorderColor());
@@ -430,6 +458,68 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 					null);
 		}
 
+		// Objects connected to upperNode
+		int count = 0;
+		for (CpsEdge e : upperNode.getConnections()) {
+
+			AbstractCpsObject cps;
+			if (e.getA().equals(this.upperNode)) {
+				cps = e.getB();
+			} else {
+				cps = e.getA();
+			}
+
+			// 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)));
+			}
+
+			// node image
+			if (cps instanceof CpsNode && (cps == tempCps || model.getSelectedCpsObject() == cps
+					|| model.getSelectedCpsObjects().contains(cps) || tempSelected.contains(cps))) {
+				img = new ImageIcon(this.getClass().getResource("/Images/node_selected.png")).getImage();
+			} else {
+				if (cps instanceof HolonSwitch) {
+					if (((HolonSwitch) cps).getActiveAt()[model.getCurIteration()]) {
+						((HolonSwitch) cps).setAutoState(true);
+					} else {
+						((HolonSwitch) cps).setAutoState(false);
+					}
+				}
+				// Highlighting
+				if ((cps == tempCps && model.getSelectedCpsObjects().size() == 0 && tempSelected.size() == 0)
+						|| model.getSelectedCpsObjects().contains(cps) || tempSelected.contains(cps)) {
+					g2.setColor(Color.BLUE);
+					g2.fillRect((int) ((borderPos >> 1) - model.getScaleDiv2() - scalediv20),
+							(int) (scalediv20 + 5 + (model.getScale() + scalediv20 + 10) * count - scalediv20),
+							(int) (controller.getScale() + (scalediv20 * 2)),
+							(int) (controller.getScale() + (scalediv20 * 2)));
+				} else if (cps instanceof HolonObject) {
+					g2.setColor(((HolonObject) cps).getColor());
+
+					g2.fillRect((int) ((borderPos >> 1) - model.getScaleDiv2() - scalediv20),
+							(int) (scalediv20 + 5 + (model.getScale() + scalediv20 + 10) * count - scalediv20),
+							(int) (controller.getScale() + (scalediv20 * 2)),
+							(int) (controller.getScale() + (scalediv20 * 2)));
+				}
+				// draw image
+				File checkPath = new File(cps.getImage());
+				if (checkPath.exists()) {
+					img = new ImageIcon(cps.getImage()).getImage();
+				} else {
+					img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage();
+				}
+			}
+			g2.drawImage(img, (borderPos >> 1) - model.getScaleDiv2(),
+					(int) (scalediv20 + 5 + (model.getScale() + scalediv20 + 10) * count), controller.getScale(),
+					controller.getScale(), null);
+			count++;
+		}
+		
 		// Dragg Highlighting
 		if (doMark) {
 			g2.setColor(Color.BLACK);
@@ -444,6 +534,10 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 				g2.drawRect(sx, y, x - sx, sy - y);
 			}
 		}
+		
+		//Border Line
+		g2.setColor(Color.BLACK);
+		g2.drawLine(borderPos, 0, borderPos, this.getHeight());
 	}
 
 	@Override
@@ -466,31 +560,44 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		edgeHighlight = null;
 		controller.setSelecteEdge(null);
 		// Object Selection
-		for (AbstractCpsObject cps : upperNode.getNodes()) {
-			cx = cps.getPosition().x;
-			cy = cps.getPosition().y;
-			if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
-				tempCps = cps;
-				controller.addTextToConsole("Selected: ", Color.BLACK, 12, false, false, false);
-				controller.addTextToConsole("" + cps.getName(), Color.BLUE, 12, true, false, false);
-				controller.addTextToConsole(", ID:", Color.BLACK, 12, false, false, false);
-				controller.addTextToConsole("" + cps.getID(), Color.RED, 12, true, false, true);
-				dragging = true;
-				controller.setSelectedObjectID(tempCps.getID());
-				// If drawing an Edge (CTRL down)
-				if (tempCps.getClass() == HolonObject.class) {
-					HolonObject tempObj = ((HolonObject) tempCps);
-					dataSelected = tempObj.getElements();
+		if (e.getX() > borderPos) {
+			for (AbstractCpsObject cps : upperNode.getNodes()) {
+				cx = cps.getPosition().x;
+				cy = cps.getPosition().y;
+				if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
+					tempCps = cps;
+					controller.addTextToConsole("Selected: ", Color.BLACK, 12, false, false, false);
+					controller.addTextToConsole("" + cps.getName(), Color.BLUE, 12, true, false, false);
+					controller.addTextToConsole(", ID:", Color.BLACK, 12, false, false, false);
+					controller.addTextToConsole("" + cps.getID(), Color.RED, 12, true, false, true);
+					dragging = true;
+					controller.setSelectedObjectID(tempCps.getID());
+					// If drawing an Edge (CTRL down)
+					if (tempCps.getClass() == HolonObject.class) {
+						HolonObject tempObj = ((HolonObject) tempCps);
+						dataSelected = tempObj.getElements();
+					}
+					if (e.isShiftDown()) {
+						drawEdge = true;
+						dragging = false;
+					}
 				}
-				if (e.isShiftDown()) {
-					drawEdge = true;
-					dragging = false;
+			}
+		} else {
+			for (CpsEdge ed : upperNode.getConnections()) {
+				AbstractCpsObject cps;
+				if (ed.getA().equals(this.upperNode)) {
+					cps = ed.getB();
+				} else {
+					cps = ed.getA();
 				}
+
 			}
 		}
+
 		// Selection of CpsObject
 		model.setSelectedCpsObject(tempCps);
-		
+
 		// Edge Selection
 		if (tempCps == null) {
 			edgeHighlight = mousePositionOnEdge(x, y);
@@ -603,48 +710,55 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		}
 		if (dragging) {
 			try {
-				dragged = true;
-				float xDist, yDist; // Distance
-
-				x = e.getX() - controller.getScaleDiv2();
-				y = e.getY() - controller.getScaleDiv2();
-
-				// Make sure its in bounds
-				if (e.getX() < controller.getScaleDiv2())
-					x = 0;
-				else if (e.getX() > this.getWidth() - controller.getScaleDiv2())
-					x = this.getWidth() - controller.getScale();
-				if (e.getY() < controller.getScaleDiv2())
-					y = 0;
-				else if (e.getY() > this.getHeight() - controller.getScaleDiv2())
-					y = this.getHeight() - controller.getScale();
-
-				// Distance
-				xDist = x - tempCps.getPosition().x;
-				yDist = y - tempCps.getPosition().y;
-
-				tempCps.setPosition(x, y); // Drag Position
-				// TipText Position and name
-				objectTT.setTipText(tempCps.getName() + ", " + tempCps.getID());
-				objectTT.setLocation(x, y + controller.getScale());
-
-				// All Selected Objects
-				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
-					if (cps != tempCps) {
-						x = (int) (cps.getPosition().x + xDist);
-						y = (int) (cps.getPosition().y + yDist);
-
-						// Make sure its in bounds
-						if (x <= 0)
-							x = 0;
-						else if (x > this.getWidth() - controller.getScale())
-							x = this.getWidth() - controller.getScale();
-						if (y <= 0)
-							y = 0;
-						else if (y > this.getHeight() - controller.getScale())
-							y = this.getHeight() - controller.getScale();
-
-						cps.setPosition(x, y);
+				if (upperNode.getNodes().contains(tempCps)) {
+					dragged = true;
+					float xDist, yDist; // Distance
+
+					x = e.getX() - controller.getScaleDiv2();
+					y = e.getY() - controller.getScaleDiv2();
+
+					// tempCps in the upperNode? if not its a connected Object
+					// from
+					// outside
+
+					// Make sure its in bounds
+					if (e.getX() < controller.getScaleDiv2() + borderPos + 5)
+						x = borderPos + 5;
+					else if (e.getX() > this.getWidth() - controller.getScaleDiv2())
+						x = this.getWidth() - controller.getScale();
+					if (e.getY() < controller.getScaleDiv2())
+						y = 0;
+					else if (e.getY() > this.getHeight() - controller.getScaleDiv2())
+						y = this.getHeight() - controller.getScale();
+
+					// Distance
+					xDist = x - tempCps.getPosition().x;
+					yDist = y - tempCps.getPosition().y;
+
+					tempCps.setPosition(x, y); // Drag Position
+					// TipText Position and name
+					// objectTT.setTipText(tempCps.getName() + ", " +
+					// tempCps.getID());
+					// objectTT.setLocation(x, y + controller.getScale());
+
+					// All Selected Objects
+					for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
+						if (cps != tempCps) {
+							x = (int) (cps.getPosition().x + xDist);
+							y = (int) (cps.getPosition().y + yDist);
+
+							// Make sure its in bounds
+							if (x <= 0)
+								x = 0;
+							else if (x > this.getWidth() - controller.getScale())
+								x = this.getWidth() - controller.getScale();
+							if (y <= 0)
+								y = 0;
+							else if (y > this.getHeight() - controller.getScale())
+								y = this.getHeight() - controller.getScale();
+
+							cps.setPosition(x, y);
+						}
 					}
 				}
 				repaint();
@@ -685,22 +799,19 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		x = e.getX();
 		y = e.getY();
 		// Everytghing for the tooltip :)
-		boolean on = false;
-		for (AbstractCpsObject cps : upperNode.getNodes()) {
-
-			cx = cps.getPosition().x;
-			cy = cps.getPosition().y;
-			if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
-
-				objectTT.setTipText(cps.getName() + ", " + cps.getID());
-				objectTT.setLocation(cx, cy + controller.getScale());
-				on = true;
-			}
-		}
-		if (!on) {
-			objectTT.setLocation(-200, -200);
-			objectTT.setTipText("");
-		}
+		/*
+		 * boolean on = false; for (AbstractCpsObject cps :
+		 * upperNode.getNodes()) {
+		 * 
+		 * cx = cps.getPosition().x; cy = cps.getPosition().y; if (x -
+		 * controller.getScale() <= cx && y - controller.getScale() <= cy && x
+		 * >= cx && y >= cy) {
+		 * 
+		 * objectTT.setTipText(cps.getName() + ", " + cps.getID());
+		 * objectTT.setLocation(cx, cy + controller.getScale()); on = true; } }
+		 * if (!on) { objectTT.setLocation(-200, -200); objectTT.setTipText("");
+		 * }
+		 */
 	}
 
 	/**

+ 225 - 0
src/ui/view/splitPane.java

@@ -0,0 +1,225 @@
+package ui.view;
+
+import javax.swing.JSplitPane;
+import javax.swing.JScrollPane;
+import javax.swing.JPanel;
+
+import java.util.ArrayList;
+
+import javax.swing.GroupLayout;
+import javax.swing.GroupLayout.Alignment;
+import javax.swing.JLabel;
+import javax.swing.LayoutStyle.ComponentPlacement;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.MutableTreeNode;
+import javax.swing.tree.TreeNode;
+
+import classes.HolonObject;
+import interfaces.GraphListener;
+
+import javax.swing.JTextField;
+import javax.swing.JComboBox;
+import javax.swing.JButton;
+import javax.swing.JTree;
+
+public class splitPane extends JSplitPane implements GraphListener {
+	private JTextField graphNrTxtField;
+	private JTextField redField;
+	private JTextField blueField;
+	private JTextField greenField;
+	private JTree objectTree;
+	private DefaultTreeModel treeModel;
+	DefaultMutableTreeNode objectsNode;
+	DefaultMutableTreeNode wholeHolon;
+	JLabel showObjectlbl;
+	JLabel showPropertylbl;
+	public splitPane() {
+		
+		JPanel panel = new JPanel();
+		setLeftComponent(panel);
+		
+		JScrollPane treeScrollPane = new JScrollPane();
+		
+		JLabel lblObject = new JLabel("Object(s):");
+		
+		showObjectlbl = new JLabel("...");
+		
+		JLabel lblProperty = new JLabel("Property:");
+		
+		showPropertylbl = new JLabel("...");
+		
+		JLabel lblGraph = new JLabel("Graph:");
+		
+		graphNrTxtField = new JTextField();
+		graphNrTxtField.setColumns(10);
+		
+		JLabel lblColor = new JLabel("Color:");
+		
+		JComboBox colorComboBox = new JComboBox();
+		
+		redField = new JTextField();
+		redField.setColumns(10);
+		
+		blueField = new JTextField();
+		blueField.setColumns(10);
+		
+		greenField = new JTextField();
+		greenField.setColumns(10);
+		
+		JLabel lblR = new JLabel("R:");
+		
+		JLabel lblB = new JLabel("B:");
+		
+		JLabel lblG = new JLabel("G:");
+		
+		JButton btnAdd = new JButton("Add");
+		GroupLayout gl_panel = new GroupLayout(panel);
+		gl_panel.setHorizontalGroup(
+			gl_panel.createParallelGroup(Alignment.LEADING)
+				.addGroup(gl_panel.createSequentialGroup()
+					.addContainerGap()
+					.addGroup(gl_panel.createParallelGroup(Alignment.TRAILING, false)
+						.addComponent(treeScrollPane, Alignment.LEADING)
+						.addGroup(Alignment.LEADING, gl_panel.createSequentialGroup()
+							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
+								.addComponent(lblGraph)
+								.addComponent(lblObject)
+								.addComponent(lblProperty)
+								.addComponent(lblColor)
+								.addGroup(gl_panel.createSequentialGroup()
+									.addComponent(lblR)
+									.addPreferredGap(ComponentPlacement.RELATED)
+									.addComponent(redField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)))
+							.addPreferredGap(ComponentPlacement.RELATED)
+							.addGroup(gl_panel.createParallelGroup(Alignment.LEADING, false)
+								.addComponent(showObjectlbl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+								.addComponent(showPropertylbl, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+								.addComponent(graphNrTxtField)
+								.addGroup(gl_panel.createParallelGroup(Alignment.TRAILING, false)
+									.addComponent(colorComboBox, Alignment.LEADING, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+									.addGroup(Alignment.LEADING, gl_panel.createSequentialGroup()
+										.addComponent(lblB)
+										.addPreferredGap(ComponentPlacement.RELATED)
+										.addComponent(blueField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE)
+										.addPreferredGap(ComponentPlacement.RELATED)
+										.addComponent(lblG)
+										.addPreferredGap(ComponentPlacement.RELATED)
+										.addComponent(greenField, GroupLayout.PREFERRED_SIZE, 37, GroupLayout.PREFERRED_SIZE))
+									.addComponent(btnAdd, Alignment.LEADING)))))
+					.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+		);
+		gl_panel.setVerticalGroup(
+			gl_panel.createParallelGroup(Alignment.LEADING)
+				.addGroup(gl_panel.createSequentialGroup()
+					.addContainerGap()
+					.addComponent(treeScrollPane, GroupLayout.PREFERRED_SIZE, 153, GroupLayout.PREFERRED_SIZE)
+					.addGap(27)
+					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
+						.addComponent(lblObject, GroupLayout.PREFERRED_SIZE, 14, GroupLayout.PREFERRED_SIZE)
+						.addComponent(showObjectlbl))
+					.addPreferredGap(ComponentPlacement.RELATED)
+					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
+						.addComponent(lblProperty)
+						.addComponent(showPropertylbl))
+					.addPreferredGap(ComponentPlacement.RELATED)
+					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
+						.addComponent(lblGraph)
+						.addComponent(graphNrTxtField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+					.addPreferredGap(ComponentPlacement.RELATED)
+					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
+						.addComponent(lblColor)
+						.addComponent(colorComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+					.addGap(18)
+					.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
+						.addComponent(lblR)
+						.addComponent(redField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+						.addComponent(lblB)
+						.addComponent(blueField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+						.addComponent(lblG)
+						.addComponent(greenField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+					.addPreferredGap(ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
+					.addComponent(btnAdd)
+					.addContainerGap())
+		);
+		
+		objectTree = new JTree();
+		treeModel = new DefaultTreeModel(null);
+		DefaultMutableTreeNode root = new DefaultMutableTreeNode("Statistics");
+		wholeHolon = new DefaultMutableTreeNode("whole Holon");
+		wholeHolon.add(new DefaultMutableTreeNode("total Production"));
+		wholeHolon.add(new DefaultMutableTreeNode("total Consumption"));
+		wholeHolon.add(new DefaultMutableTreeNode("Percentage of Supplied Objects"));
+		wholeHolon.add(new DefaultMutableTreeNode("Percentage of not Supplied Objects"));
+		wholeHolon.add(new DefaultMutableTreeNode("Percentage of partially Supplied Objects"));
+
+		objectsNode = new DefaultMutableTreeNode("Objects");
+		DefaultMutableTreeNode defaultNode = new DefaultMutableTreeNode("empty");
+	
+		objectsNode.add(defaultNode);
+		treeModel.setRoot(root);
+		root.add(wholeHolon);
+		root.add(objectsNode);
+		objectTree.setModel(treeModel);
+		
+		treeScrollPane.setViewportView(objectTree);
+		
+		objectTree.addTreeSelectionListener(new TreeSelectionListener(){
+
+			@Override
+			public void valueChanged(TreeSelectionEvent e) {
+				showObjectlbl.setText("...");
+				showPropertylbl.setText("...");
+				 DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)objectTree.getLastSelectedPathComponent();
+				 if(selectedNode == null){
+					 return;
+				 }else{
+					 if(selectedNode.getLevel() == 1){
+						 showObjectlbl.setText(selectedNode.toString());
+					 }
+					 if(selectedNode.getLevel() == 2){
+						 if(((DefaultMutableTreeNode)selectedNode.getParent()).toString().equals("whole Holon")){
+							 showPropertylbl.setText(selectedNode.toString());
+							 showObjectlbl.setText(selectedNode.getParent().toString());
+						 }else{
+							 showObjectlbl.setText(selectedNode.toString());
+						 }
+					 }
+					 if(selectedNode.getLevel() == 3){
+						 showObjectlbl.setText(((DefaultMutableTreeNode)selectedNode.getParent()).toString());
+						 showPropertylbl.setText(selectedNode.toString());
+					 }
+				 }
+			}
+			
+		});
+		panel.setLayout(gl_panel);
+		
+		JScrollPane graphScrollPane = new JScrollPane();
+		setRightComponent(graphScrollPane);
+	}
+	@Override
+	public void repaintGraph() {
+		// TODO Auto-generated method stub
+		
+	}
+	@Override
+	public void addTrackedObject(ArrayList<HolonObject> hlList) {
+		if(hlList.size() > 0 && hlList != null){
+			objectsNode.removeAllChildren();
+			for(HolonObject hO : hlList){
+				DefaultMutableTreeNode tmp = new DefaultMutableTreeNode(hO.getName() + " " + hO.getID());
+				tmp.add(new DefaultMutableTreeNode("total Production"));
+				tmp.add(new DefaultMutableTreeNode("total Consumption"));
+				tmp.add(new DefaultMutableTreeNode("number of activated Elements"));
+				objectsNode.add(tmp);
+			}
+		}else{
+			objectsNode.add(new DefaultMutableTreeNode("empty"));
+		}
+		objectTree.repaint();
+		
+	}
+}