Ver código fonte

Adds Dummy InformationPanel

TomTroppmann 3 anos atrás
pai
commit
1515e777dd
41 arquivos alterados com 410 adições e 262 exclusões
  1. BIN
      jars/xchart-3.8.0/xchart-3.8.0.jar
  2. BIN
      jars/xchart-3.8.0/xchart-3.8.1.jar
  3. BIN
      jars/xchart-3.8.0/xchart-demo-3.8.0.jar
  4. 2 2
      src/addOns/Randomizer.java
  5. 1 1
      src/addOns/Utility/EmailNotification.java
  6. 1 1
      src/addOns/Utility/HolonElementSketch.java
  7. 1 1
      src/algorithm/binary/AcoAlgorithm.java
  8. 1 1
      src/algorithm/objectiveFunction/TopologieObjectiveFunction.java
  9. 1 1
      src/algorithm/topologie/AcoAlgorithm.java
  10. 1 1
      src/algorithm/topologie/GaAlgorithm.java
  11. 1 1
      src/algorithm/topologie/PsoAlgorithm.java
  12. 2 2
      src/api/AlgorithmFrameworkFlex.java
  13. 1 1
      src/classes/HolonElement.java
  14. 43 0
      src/preferences/ColorPreference.java
  15. 19 6
      src/ui/controller/Control.java
  16. 15 3
      src/ui/controller/ObjectController.java
  17. 0 19
      src/ui/model/Model.java
  18. 1 1
      src/ui/view/AboutUsPopUp.java
  19. 0 11
      src/ui/view/AbstractCanvas.java
  20. 1 1
      src/ui/view/AddElementPopUp.java
  21. 1 1
      src/ui/view/AddObjectPopUp.java
  22. 1 1
      src/ui/view/AddOnWindow.java
  23. 1 1
      src/ui/view/BackgroundPopUp.java
  24. 1 1
      src/ui/view/CanvasResizePopUp.java
  25. 1 1
      src/ui/view/Console.java
  26. 1 1
      src/ui/view/CreateTemplatePopUp.java
  27. 1 1
      src/ui/view/FlexWindow.java
  28. 18 162
      src/ui/view/GUI.java
  29. 6 6
      src/ui/view/GroupNodeCanvas.java
  30. 256 0
      src/ui/view/HolonInformationPanel.java
  31. 16 16
      src/ui/view/MyCanvas.java
  32. 1 1
      src/ui/view/Outliner.java
  33. 1 1
      src/ui/view/TimePanel.java
  34. 0 8
      src/ui/view/XChartTest.java
  35. 4 1
      src/util/Action.java
  36. 4 1
      src/util/Event.java
  37. 1 1
      src/util/FloatLog.java
  38. 1 1
      src/util/ImageImport.java
  39. 1 1
      src/util/Random.java
  40. 1 1
      src/util/StringFormat.java
  41. 2 2
      tests/tests/PraktikumHolonsTestObjectController.java

BIN
jars/xchart-3.8.0/xchart-3.8.0.jar


BIN
jars/xchart-3.8.0/xchart-3.8.1.jar


BIN
jars/xchart-3.8.0/xchart-demo-3.8.0.jar


+ 2 - 2
src/addOns/Randomizer.java

@@ -45,8 +45,8 @@ import classes.GroupNode;
 import classes.HolonElement;
 import classes.HolonObject;
 import ui.controller.Control;
-import utility.Random;
-import utility.ImageImport;
+import util.ImageImport;
+import util.Random;
 
 public class Randomizer implements AddOn {
 	private Control  control;

+ 1 - 1
src/addOns/Utility/EmailNotification.java

@@ -16,7 +16,7 @@ import javax.swing.JTextField;
 
 import org.apache.commons.mail.*;
 
-import utility.ImageImport;
+import util.ImageImport;
 
 
 public class EmailNotification {

+ 1 - 1
src/addOns/Utility/HolonElementSketch.java

@@ -4,8 +4,8 @@ import classes.Constrain;
 import classes.Flexibility;
 import classes.HolonElement;
 import classes.HolonElement.Priority;
+import util.Random;
 import classes.HolonObject;
-import utility.Random;
 
 public class HolonElementSketch {
 	//HolonElement

+ 1 - 1
src/algorithm/binary/AcoAlgorithm.java

@@ -6,7 +6,7 @@ import java.util.ListIterator;
 
 import javax.swing.JFrame;
 import api.AlgorithmFrameworkFlex;
-import utility.StringFormat;
+import util.StringFormat;
 
 public class AcoAlgorithm extends AlgorithmFrameworkFlex{
 	

+ 1 - 1
src/algorithm/objectiveFunction/TopologieObjectiveFunction.java

@@ -4,7 +4,7 @@ package algorithm.objectiveFunction;
 import ui.model.DecoratedHolonObject;
 import ui.model.DecoratedNetwork;
 import ui.model.DecoratedState;
-import utility.FloatLog;
+import util.FloatLog;
 
 import java.util.Locale;
 import algorithm.objectiveFunction.GraphMetrics.Graph;

+ 1 - 1
src/algorithm/topologie/AcoAlgorithm.java

@@ -8,7 +8,7 @@ import java.util.ListIterator;
 import algorithm.objectiveFunction.TopologieObjectiveFunction;
 import api.TopologieAlgorithmFramework;
 import ui.model.DecoratedState;
-import utility.Random;
+import util.Random;
 
 public class AcoAlgorithm extends TopologieAlgorithmFramework {
 

+ 1 - 1
src/algorithm/topologie/GaAlgorithm.java

@@ -9,7 +9,7 @@ import java.util.TreeSet;
 import algorithm.objectiveFunction.TopologieObjectiveFunction;
 import api.TopologieAlgorithmFramework;
 import ui.model.DecoratedState;
-import utility.Random;
+import util.Random;
 
 public class GaAlgorithm extends TopologieAlgorithmFramework {
 

+ 1 - 1
src/algorithm/topologie/PsoAlgorithm.java

@@ -9,7 +9,7 @@ import java.util.stream.Collectors;
 import algorithm.objectiveFunction.TopologieObjectiveFunction;
 import api.TopologieAlgorithmFramework;
 import ui.model.DecoratedState;
-import utility.Random;
+import util.Random;
 
 public class PsoAlgorithm extends TopologieAlgorithmFramework {
 

+ 2 - 2
src/api/AlgorithmFrameworkFlex.java

@@ -61,8 +61,8 @@ import ui.model.DecoratedHolonObject.HolonObjectState;
 import ui.model.DecoratedSwitch.SwitchState;
 import ui.model.DecoratedNetwork;
 import ui.view.Console;
-import utility.ImageImport;
-import utility.StringFormat;
+import util.ImageImport;
+import util.StringFormat;
 
 public abstract class AlgorithmFrameworkFlex implements AddOn{
 	//Algo

+ 1 - 1
src/classes/HolonElement.java

@@ -53,7 +53,7 @@ public class HolonElement implements LocalMode, GraphEditable{
     @Expose
     private Priority priority;
 
-	public enum Priority {
+	public static enum Priority {
     	Essential, High, Medium , Low
     }
 

+ 43 - 0
src/preferences/ColorPreference.java

@@ -0,0 +1,43 @@
+package preferences;
+
+import java.awt.Color;
+
+/**
+ * A Class to save all colors in Holeg;
+ * @author Tom
+ *
+ */
+public class ColorPreference {
+	
+	public static class Priority{
+		public static final Color Essential = new Color(181, 24, 54);
+		public static final Color High = new Color(248, 72, 6);
+		public static final Color Medium = new Color(250, 196, 37);
+		public static final Color Low = new Color(255, 255, 175);
+	}
+	public static class HolonObject{
+		public static final Color Producer = Color.lightGray;
+		public static final Color OverSupplied = new Color(166, 78, 229);
+		public static final Color Supplied = new Color(13, 175, 28);
+		public static final Color PartiallySupplied = Color.yellow;
+		public static final Color NotSupplied = new Color(230, 120, 100);
+		public static final Color NoEnergy = Color.white;
+	}
+	public static class Energy{
+		public static final Color Production = new Color(21, 93, 203);
+		public static final Color Consumption = new Color(239, 27, 20);
+	}
+	public static class Flexibility{
+		public static final Color InUse = new Color(96, 180, 85);
+		public static final Color OnCooldown = new Color(239, 215, 128);
+		public static final Color Offered = new Color(55, 150, 52);
+		public static final Color NotOffered = new Color(237, 106, 90);
+		public static final Color Unavailable = new Color(193, 193, 193);
+	}
+	
+	public static class Panel {
+		public static final Color Transparent = new Color(0,0,0,0);
+		public static final Color Background = new Color(250, 250, 250);
+		public static final Color Title = new Color(54, 73, 78);
+	}
+}

+ 19 - 6
src/ui/controller/Control.java

@@ -23,6 +23,7 @@ import ui.model.Model;
 import ui.model.Model.FairnessModel;
 import ui.view.CreateTemplatePopUp;
 import ui.view.GUI;
+import util.Event;
 
 /**
  * The Class represents the controller in the model, controller view Pattern.
@@ -50,6 +51,11 @@ public class Control {
     private String otherDir = "";
     private String dimensionsFileName = "dimensions";
     private int rand;
+    
+    
+    
+    
+    public Event OnSelectionUpdate = new Event();
 
     /**
      * Constructor.
@@ -254,21 +260,28 @@ public class Control {
     }
 
     /**
-     * deletes a selectedObject.
-     *
+     * remove a selectedObject.
+     * 
      * @param obj Cpsobject
      */
-    public void deleteSelectedObject(AbstractCanvasObject obj) {
-        objectController.deleteSelectedObject(obj);
+    public void removeSelectedObjectFromSelection(AbstractCanvasObject obj) {
+        objectController.removeSelectedObjectFromSelection(obj);
+        this.OnSelectionUpdate.broadcast();
     }
-
+    
+    public void clearSelection() {
+    	objectController.clearSelection();
+    	this.OnSelectionUpdate.broadcast();
+    }
+    
     /**
      * add an Object to selectedObject.
      *
      * @param obj AbstractCpsobject
      */
     public void addSelectedObject(AbstractCanvasObject obj) {
-        objectController.addSelectedObject(obj);
+        objectController.addSelectedObjectToSelection(obj);
+        this.OnSelectionUpdate.broadcast();
     }
 
 	/* Operations for Canvas */

+ 15 - 3
src/ui/controller/ObjectController.java

@@ -120,20 +120,32 @@ public class ObjectController {
     }
 
     /**
-     * deletes a selectedObject.
+     * removes a selectedObject.
      *
      * @param obj Cpsobject
      */
-    public void deleteSelectedObject(AbstractCanvasObject obj) {
+    public void removeSelectedObjectFromSelection(AbstractCanvasObject obj) {
         model.getSelectedCpsObjects().remove(obj);
     }
 
+    
+    
+    /**
+     * removes a selectedObject.
+     *
+     * @param obj Cpsobject
+     */
+    public void clearSelection() {
+        model.getSelectedCpsObjects().clear();
+    }
+    
+    
     /**
      * add an Object to selectedObject.
      *
      * @param obj AbstractCpsobject
      */
-    public void addSelectedObject(AbstractCanvasObject obj) {
+    public void addSelectedObjectToSelection(AbstractCanvasObject obj) {
         model.getSelectedCpsObjects().add(obj);
     }
 

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

@@ -53,8 +53,6 @@ public class Model {
     private int canvasX = 3000;
     private int canvasY = 3000;
     private int curIteration = 0;
-    // ID of the Selected Object
-    private AbstractCanvasObject selectedCpsObject = null;
     private HolonElement selectedHolonElement;
     private Edge selectedEdge;
     private ArrayList<AbstractCanvasObject> selectedObjects = new ArrayList<>();
@@ -281,23 +279,6 @@ public class Model {
         this.selectedID = id;
     }
 
-    /**
-     * Returns the Selected Cps Object.
-     *
-     * @return selected Cps Object
-     */
-    public AbstractCanvasObject getSelectedCpsObject() {
-        return selectedCpsObject;
-    }
-
-    /**
-     * Set the Selected Objecs.
-     *
-     * @param selectedCpsObject Objects that are selected
-     */
-    public void setSelectedCpsObject(AbstractCanvasObject selectedCpsObject) {
-        this.selectedCpsObject = selectedCpsObject;
-    }
 
     /**
      * Returns all selected Objects on the Canvas.

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

@@ -2,7 +2,7 @@ package ui.view;
 
 import javax.swing.*;
 
-import utility.ImageImport;
+import util.ImageImport;
 
 import java.awt.*;
 

+ 0 - 11
src/ui/view/AbstractCanvas.java

@@ -419,17 +419,6 @@ public abstract class AbstractCanvas extends JPanel {
 		        cellEditor.cancelCellEditing();
 		    }
 		}
-		
-		JTable propertys = model.getTableProperties();
-		cellEditor = propertys.getCellEditor();
-		if (cellEditor != null) {
-		    if (cellEditor.getCellEditorValue() != null) {
-		    	/** TODO: Maybe try to save current Data */
-		        cellEditor.stopCellEditing();
-		    } else {
-		        cellEditor.cancelCellEditing();
-		    }
-		}
 	}
 
 	/**

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

@@ -3,7 +3,7 @@ package ui.view;
 import classes.AbstractCanvasObject;
 import classes.HolonElement;
 import classes.HolonObject;
-import utility.ImageImport;
+import util.ImageImport;
 
 import javax.swing.*;
 import javax.swing.border.EmptyBorder;

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

@@ -36,7 +36,7 @@ import classes.HolonElement;
 import classes.HolonObject;
 import classes.Pair;
 import ui.controller.Control;
-import utility.ImageImport;
+import util.ImageImport;
 
 /**
  * Popup for adding a Holon Object to a Category.

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

@@ -27,7 +27,7 @@ import javax.tools.ToolProvider;
 
 import api.AddOn;
 import ui.controller.Control;
-import utility.ImageImport;
+import util.ImageImport;
 
 public class AddOnWindow extends JFrame{
 	private AddOn actual;

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

@@ -3,7 +3,7 @@ package ui.view;
 import classes.GroupNode;
 import ui.controller.Control;
 import ui.model.Model;
-import utility.ImageImport;
+import util.ImageImport;
 
 import javax.swing.*;
 import javax.swing.filechooser.FileNameExtensionFilter;

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

@@ -2,7 +2,7 @@ package ui.view;
 
 import ui.controller.Control;
 import ui.model.Model;
-import utility.ImageImport;
+import util.ImageImport;
 
 import javax.swing.*;
 import java.awt.*;

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

@@ -11,7 +11,7 @@ import javax.swing.JTextArea;
 import javax.swing.JToolBar;
 import javax.swing.text.DefaultCaret;
 
-import utility.ImageImport;
+import util.ImageImport;
 /**
  * Little new swing object to print data to a console.
  * @author tom

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

@@ -25,7 +25,7 @@ import classes.HolonObject;
 import classes.Pair;
 import ui.controller.Control;
 import ui.model.Model;
-import utility.ImageImport;
+import util.ImageImport;
 
 /**
  * PopUp for creating Holon Object Template.

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

@@ -61,7 +61,7 @@ import ui.controller.FlexManager;
 import ui.controller.FlexManager.FlexState;
 import ui.controller.FlexManager.FlexWrapper;
 import ui.model.Model;
-import utility.ImageImport;
+import util.ImageImport;
 
 
 public class FlexWindow extends JFrame {

+ 18 - 162
src/ui/view/GUI.java

@@ -92,7 +92,8 @@ import ui.model.DecoratedState;
 import ui.model.Model;
 import ui.model.Model.FairnessModel;
 import ui.view.CreateNewDialog.Option;
-import utility.ImageImport;
+import util.Event;
+import util.ImageImport;
 
 /**
  * Graphical User Interface.
@@ -103,6 +104,10 @@ public class GUI{
 	
 	static final Color PALE_RED=new Color(255, 192, 192);
 	
+	
+	
+	
+	
 	/**
 	 * Menu on the Top containing File, Edit View Help etc
 	 */
@@ -113,6 +118,9 @@ public class GUI{
 	private final JMenu mnNewMenuView = new JMenu("View");
 	private final JMenu menuWindow = new JMenu("Window");
 	
+	
+	private final HolonInformationPanel informationPanel;
+	
 	/** Help Menu containing helpful Informations and the AboutUs Popup */
 	private final JMenu mnHelp = new JMenu("Help");
 	
@@ -192,31 +200,7 @@ public class GUI{
 	// Model for single or multi selection
 	private final JPanel scrollElements = new JPanel();
 	private final JScrollPane tableHolonElementScrollPane = new JScrollPane();
-	// In this section are all the properties that correspond to the clicked
-	// HolonObject, such as connections, name, Type, etc.
-	// Table for Properties --> Cell with (0,1) is editable by CpsObjt and
-	// Cell(3,1) is editable by Edges
-	private final JTable tableProperties = new JTable() {
-
-		@Override
-		public TableCellRenderer getCellRenderer(int row, int column) {
-			if (getValueAt(row, column) instanceof Boolean) {
-				return super.getDefaultRenderer(Boolean.class);
-			} else {
-				return super.getCellRenderer(row, column);
-			}
-		}
-
-		@Override
-		public TableCellEditor getCellEditor(int row, int column) {
-			if (getValueAt(row, column) instanceof Boolean) {
-				return super.getDefaultEditor(Boolean.class);
-			} else {
-				return super.getCellEditor(row, column);
-			}
-		}
 
-	};
 	//Prechoosed local Periods
 	private String[] comboContext = {
 	         "", "5", "10", "20" ,"100", "1000"
@@ -229,7 +213,6 @@ public class GUI{
 	private final JScrollPane scrollProperties = new JScrollPane();
 	// In this section is the graph for the selected HolonElement of the clicked
 	// HolonObject
-	private final JTable tableGraph = new JTable();
 	private final DefaultTableModel tableModelGraph = new DefaultTableModel();
 	private final JScrollPane scrollGraph = new JScrollPane();
 	private final Model model;
@@ -304,10 +287,6 @@ public class GUI{
 	private int yBTis;
 	private int xBThis;
 	// Coord for the Edit-Modus in the PropertieTable
-	private int yProThis;
-	private int xProThis;
-	private int yProThisOneClick;
-	private int xProThisOneClick;
 	private AbstractCanvasObject temp = null;
 	private String warningText = "Warning";
 	private String saveBeforeNew = "Do you want to save your current data?";
@@ -329,11 +308,11 @@ public class GUI{
 	 */
 	GUI(Control control) {
 		this.controller = control;
+		this.informationPanel = new HolonInformationPanel(control);
 		this.model = control.getModel();
 		control.setGui(this);
 		this.unitGraph = new UnitGraph(model, control);
 		this.canvas = new MyCanvas(model, control, unitGraph);
-		model.setTableProperties(tableProperties);
 		initialize();
 		updateCategories(model.getCategories());
 		updCon = new UpdateController(model, controller);
@@ -451,7 +430,7 @@ public class GUI{
 			public void actionPerformed(ActionEvent e) {
 				chooseTabTemp();
 
-				model.getSelectedCpsObjects().clear();
+				controller.clearSelection();
 
 				// Uppernode Canvas?
 				JScrollPane scrollPane = getScrollPaneFromTabbedPane();
@@ -539,7 +518,7 @@ public class GUI{
 					controller.calculateStateAndVisualForCurrentTimeStep();
 				}
 
-				model.getSelectedCpsObjects().clear();
+				controller.clearSelection();
 				hideScrollGraph();
 			}
 		});
@@ -973,17 +952,11 @@ public class GUI{
 		panelHolonEl.add(toolBarHolonEl);
 
 		// Set up of the Properties section
-		tableProperties.setModel(model.getPropertyTable());
-		tableProperties.setFillsViewportHeight(true);
-		tableProperties.setCellSelectionEnabled(true);
-		tableProperties.setColumnSelectionAllowed(true);
-		scrollProperties.setViewportView(tableProperties);
-
+		scrollProperties.setViewportView(this.informationPanel);
+		scrollProperties.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+		scrollProperties.getVerticalScrollBar().setUnitIncrement(16);
+		
 		// Set up of the Graph section
-		tableGraph.setModel(tableModelGraph);
-		tableGraph.setFillsViewportHeight(true);
-		tableGraph.setCellSelectionEnabled(true);
-		tableGraph.setColumnSelectionAllowed(true);
 		scrollGraph.setViewportView(unitGraph);
 		graphLabel.setLayout(new BorderLayout(0, 10));
 		graphLabel.add(maxGraph, BorderLayout.NORTH);
@@ -1386,124 +1359,7 @@ public class GUI{
 					} catch (Exception e) {
 					}
 				});
-		/***********************
-		 * HolonElement Properties Actions
-		 **********************/
-
-		/*
-		 * Update of the mouse coord for Edit-Mode
-		 */
-		tableProperties.addMouseListener(new MouseAdapter() {
-			public void mousePressed(MouseEvent e) {
-				if (e.getClickCount() == 2) {
-					yProThis = e.getY();
-					xProThis = e.getX();
-				}
-				yProThisOneClick = e.getY();
-				xProThisOneClick = e.getX();
-			}
-		});
-
-		/*
-		 * Update any change in the Property table
-		 */
-		tableProperties.addPropertyChangeListener(propertyChangeEvent -> {
-			try {
-				Object temp;
-				Object btemp;
-				int selValueY = (int) Math.floor(yProThis / 16);
-				int selValueX = (int) Math.floor(xProThis
-						/ (tableProperties.getWidth() / 2));
-				int selValueYBool = (int) Math.floor(yProThisOneClick / 16);
-				int selValueXBool = (int) Math.floor(xProThisOneClick
-						/ (tableProperties.getWidth() / 2));
-				if (updCon.getActualCps() != null) {
-					temp = model.getPropertyTable().getValueAt(selValueY,
-							selValueX);
-					btemp = model.getPropertyTable().getValueAt(selValueYBool,
-							selValueXBool);
-					// Case: Switch selected
-
-				if (updCon.getActualCps() instanceof HolonSwitch) {
-					if (selValueY == 0 && selValueX != 0) {
-						updCon.getActualCps().setName(temp.toString());
-					}
-					if (selValueYBool == 2) {
-						Boolean bbTemp = Boolean.parseBoolean(btemp.toString());
-						((HolonSwitch) updCon.getActualCps())
-								.setManualMode(bbTemp);
-						if (bbTemp) {
-							model.getPropertyTable()
-									.setCellEditable(3, 1, true);
-						} else {
-							model.getPropertyTable().setCellEditable(3, 1,
-									false);
-						}
-					} else if (selValueYBool == 3) {
-						if (((HolonSwitch) updCon.getActualCps())
-								.getManualMode()) {
-							model.getPropertyTable()
-									.setCellEditable(3, 1, true);
-							Boolean bTemp = Boolean.parseBoolean(btemp
-									.toString());
-							((HolonSwitch) updCon.getActualCps())
-									.setManualState(bTemp);
-						}
-					}
-				} // Case: UpperNode selected
-				else if (updCon.getActualCps() instanceof GroupNode
-						&& selValueX != 0) {
-					// 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 < tabbedPaneOriginal
-							.getTabCount(); index++) {
-						tabTemp = tabbedPaneOriginal;
-						JScrollPane scrollPane = getScrollPaneFromTabbedPane();
-
-						GroupNodeCanvas unc = ((GroupNodeCanvas) scrollPane
-								.getViewport().getComponent(0));
-
-						if (unc.upperNode.getId() == updCon.getActualCps()
-								.getId()) {
-							tabbedPaneOriginal.setTitleAt(index,
-									unc.upperNode.getName());
-							tabbedPaneOriginal.updateUI();
-							if (!initSplit) {
-								tabbedPaneSplit.setTitleAt(index,
-										unc.upperNode.getName());
-								tabbedPaneSplit.updateUI();
-							}
-						}
-					}
-				} // Case: HolonObject is selected
-				else if (updCon.getActualCps() instanceof HolonObject
-						&& selValueX != 0) {
-					// Name edition through double click
-					updCon.getActualCps().setName(temp.toString());
-				}
-			} // Case: Edge is selected
-			else {
-				temp = model.getPropertyTable()
-						.getValueAt(selValueY, selValueX);
-				btemp = model.getPropertyTable().getValueAt(selValueYBool,
-						selValueXBool);
-				// Edit modus for capacity by double clicking
-				if (selValueY == 2) {
-					Float ftemp;
-					if (Float.parseFloat(temp.toString()) >= 0.0) {
-						ftemp = Float.parseFloat(temp.toString());
-					} else {
-						ftemp = model.getSelectedEdge().getCapacity();
-					}
-					model.getSelectedEdge().setCapacity(ftemp);
-				}
-			}
-			canvas.repaint();
-		} catch (Exception e) {
-		}
-	})	;
-
+	
 		/***********************
 		 * HolonElement Graph Actions
 		 **********************/
@@ -1955,7 +1811,7 @@ public class GUI{
 				}
 				if (e.isControlDown() && temp != null) {
 					if (model.getSelectedCpsObjects().contains(temp)) {
-						controller.deleteSelectedObject(temp);
+						controller.removeSelectedObjectFromSelection(temp);
 					} else {
 						controller.addSelectedObject(temp);
 					}

+ 6 - 6
src/ui/view/GroupNodeCanvas.java

@@ -45,10 +45,10 @@ import ui.model.DecoratedHolonObject.HolonObjectState;
 import ui.model.DecoratedSwitch;
 import ui.model.ExitCable;
 import ui.model.DecoratedSwitch.SwitchState;
+import util.ImageImport;
 import ui.model.Model;
 import ui.model.Passiv;
 import ui.model.Supplier;
-import utility.ImageImport;
 
 /**
  * This Class is the Canvas. All Objects will be visualized here
@@ -239,7 +239,7 @@ public class GroupNodeCanvas extends AbstractCanvas implements MouseListener, Mo
                 }
             }
             toolTip = false;
-            model.getSelectedCpsObjects().clear();
+            controller.clearSelection();
             tempCps = null;
             repaint();
         });
@@ -643,7 +643,7 @@ public class GroupNodeCanvas extends AbstractCanvas implements MouseListener, Mo
                     dragging = true;
                     if (e.isControlDown() && tempCps != null) {
                         if (model.getSelectedCpsObjects().contains(tempCps)) {
-                            controller.deleteSelectedObject(tempCps);
+                            controller.removeSelectedObjectFromSelection(tempCps);
                         } else {
                             controller.addSelectedObject(tempCps);
                             if(tempCps instanceof GroupNode)
@@ -701,7 +701,7 @@ public class GroupNodeCanvas extends AbstractCanvas implements MouseListener, Mo
                 controller.setSelecteEdge(edgeHighlight);
                 controller.setSelectedObjectID(0);
                 if (!e.isControlDown() && e.getButton() != MouseEvent.BUTTON3) {
-                    model.getSelectedCpsObjects().clear();
+                    controller.clearSelection();
                 }
                 updCon.deleteRows(model.getMultiTable());
                 updCon.deleteRows(model.getSingleTable());
@@ -766,7 +766,7 @@ public class GroupNodeCanvas extends AbstractCanvas implements MouseListener, Mo
         }
 
         if (!e.isControlDown() && !dragged && tempCps != null && MouseEvent.BUTTON3 != e.getButton()) {
-            model.getSelectedCpsObjects().clear();
+            controller.clearSelection();
             controller.addSelectedObject(tempCps);
             if(tempCps instanceof GroupNode)
 				controller.getObjectsInDepth();
@@ -796,7 +796,7 @@ public class GroupNodeCanvas extends AbstractCanvas implements MouseListener, Mo
         x = e.getX();
         y = e.getY();
         if (!model.getSelectedCpsObjects().contains(tempCps) && !doMark) {
-            model.getSelectedCpsObjects().clear();
+            controller.clearSelection();
             if (tempCps != null) {
                 controller.addSelectedObject(tempCps);
             }

+ 256 - 0
src/ui/view/HolonInformationPanel.java

@@ -0,0 +1,256 @@
+package ui.view;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.swing.BorderFactory;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.SwingUtilities;
+import javax.swing.border.EmptyBorder;
+
+import org.knowm.xchart.CategoryChart;
+import org.knowm.xchart.CategoryChartBuilder;
+import org.knowm.xchart.PieChart;
+import org.knowm.xchart.PieChartBuilder;
+import org.knowm.xchart.PieSeries.PieSeriesRenderStyle;
+import org.knowm.xchart.XChartPanel;
+import org.knowm.xchart.style.CategoryStyler;
+import org.knowm.xchart.style.PieStyler;
+import org.knowm.xchart.style.PieStyler.LabelType;
+
+import classes.AbstractCanvasObject;
+import classes.GroupNode;
+import classes.HolonObject;
+import preferences.ColorPreference;
+import ui.controller.Control;
+import ui.model.DecoratedGroupNode;
+import ui.model.DecoratedHolonObject.HolonObjectState;
+import ui.model.Model;
+
+public class HolonInformationPanel extends JPanel {
+
+	private final int defaultWidth = 50;
+	private final int defaultHeight = 150;
+
+	private PieChart supplyChart = createSupplyStateChart();
+	private PieChart priorityChart = createPriorityChart();
+	private PieChart flexibilityChart = createFlexibilityChart();
+	private CategoryChart energyChart = createProductionChart();
+
+	private XChartPanel<PieChart> panelHolonObject;
+	private XChartPanel<PieChart> panelPriority;
+	private XChartPanel<PieChart> panelFlexibility;
+	private XChartPanel<CategoryChart> panelEnergy;
+	
+	
+	
+	private JPanel graphPanel = new JPanel(new GridLayout(0, 2));
+	private JPanel titlePanel = new JPanel(new BorderLayout(0, 0));
+
+	private Control control;
+
+	public static void main(String[] args) {
+		HolonInformationPanel exampleChart = new HolonInformationPanel(new Control(new Model()));
+		JFrame frame = new JFrame();
+		frame.setContentPane(exampleChart);
+
+		frame.pack();
+		frame.setBounds(0, 0, 540, 600);
+		frame.setLocationRelativeTo(null);
+		frame.setVisible(true);
+	}
+
+	public void updateCharts() {
+		// TODO check for a method without instanceof and cast
+		List<GroupNode> list = control.getModel().getSelectedCpsObjects().stream()
+				.filter(object -> object instanceof GroupNode).map(object -> (GroupNode) object)
+				.collect(Collectors.toList());
+		System.out.println("UPDATE CHART" + list.size());
+		if(list.size() != 1) {
+			return;
+		}
+		GroupNode groupNode = list.get(0);
+		DecoratedGroupNode decoratedGroupNode = control.getSimManager().getActualVisualRepresentationalState().getCreatedGroupNodes().get(groupNode);
+		
+		//UPDATE SUPPLY STATE
+		int producerAmount = decoratedGroupNode.getAmountOfSupplier();
+		int overSuppliedAmount = decoratedGroupNode.getAmountOfConsumerWithState(HolonObjectState.OVER_SUPPLIED);
+		int suppliedAmount = decoratedGroupNode.getAmountOfConsumerWithState(HolonObjectState.SUPPLIED);
+		int partiallySuppliedAmount = decoratedGroupNode.getAmountOfConsumerWithState(HolonObjectState.PARTIALLY_SUPPLIED);
+		int notSuppliedAmount = decoratedGroupNode.getAmountOfConsumerWithState(HolonObjectState.NOT_SUPPLIED);
+		int noEnergyAmount = decoratedGroupNode.getAmountOfPassiv();
+		
+		supplyChart.updatePieSeries("Producer", producerAmount);
+		supplyChart.updatePieSeries("Over supplied", overSuppliedAmount);
+		supplyChart.updatePieSeries("Supplied", suppliedAmount);
+		supplyChart.updatePieSeries("Partial supplied", partiallySuppliedAmount);
+		supplyChart.updatePieSeries("Not supplied", notSuppliedAmount);
+		supplyChart.updatePieSeries("No energy", noEnergyAmount);
+		panelHolonObject.updateToolTips();
+		
+		//UPDATE PRIORITYS
+		//decoratedGroupNode.
+		
+		
+		this.revalidate();
+		this.repaint();
+	}
+
+	public HolonInformationPanel(Control control) {
+		control.OnSelectionUpdate.addListener(() -> updateCharts());
+		this.control = control;
+		this.setLayout(new BorderLayout());
+		initGraphPanel();
+		initTitlePanel();
+		this.setBackground(ColorPreference.Panel.Background);
+		this.add(titlePanel, BorderLayout.PAGE_START);
+		this.add(graphPanel, BorderLayout.CENTER);
+	}
+
+	public void initGraphPanel() {
+		graphPanel.setBackground(ColorPreference.Panel.Background);
+		panelHolonObject = new XChartPanel<PieChart>(supplyChart);
+		panelHolonObject.setBackground(ColorPreference.Panel.Background);
+		graphPanel.add(panelHolonObject);
+		panelPriority = new XChartPanel<PieChart>(priorityChart);
+		panelPriority.setBackground(ColorPreference.Panel.Background);
+		graphPanel.add(panelPriority);
+		panelFlexibility = new XChartPanel<PieChart>(flexibilityChart);
+		panelFlexibility.setBackground(ColorPreference.Panel.Background);
+		graphPanel.add(panelFlexibility);
+		panelEnergy = new XChartPanel<CategoryChart>(energyChart);
+		panelEnergy.setBackground(ColorPreference.Panel.Background);
+		graphPanel.add(panelEnergy);
+		graphPanel.setBorder(BorderFactory.createLineBorder(Color.lightGray));
+	}
+
+	public void initTitlePanel() {
+		JTextField textField = new JTextField("WindPanel");
+		textField.setFont(new Font("Arial", Font.BOLD, 24));
+		textField.setForeground(ColorPreference.Panel.Title);
+		textField.setBackground(ColorPreference.Panel.Background);
+		textField.setBackground(null);
+		textField.setBorder(null);
+		titlePanel.setBackground(ColorPreference.Panel.Background);
+		titlePanel.setBorder(new EmptyBorder(5, 5, 2, 0));
+		titlePanel.add(textField, BorderLayout.CENTER);
+	}
+
+	public void setDefaultPieChartSettings(PieChart chart) {
+		PieStyler styler = chart.getStyler();
+		styler.setChartTitleVisible(true);
+		styler.setDefaultSeriesRenderStyle(PieSeriesRenderStyle.Donut);
+		styler.setLabelsFont(new java.awt.Font("Arial", java.awt.Font.PLAIN, 14));
+		styler.setLabelType(LabelType.Percentage);
+		styler.setLabelsFontColor(Color.black);
+		styler.setLabelsFontColorAutomaticEnabled(false);
+		styler.setLabelsDistance(0.8);
+		styler.setChartFontColor(ColorPreference.Panel.Title);
+		styler.setToolTipsEnabled(true);
+		styler.setPlotContentSize(0.9);
+		styler.setPlotBackgroundColor(ColorPreference.Panel.Background);
+		styler.setPlotBorderColor(ColorPreference.Panel.Background);
+		styler.setLegendVisible(false);
+		styler.setChartBackgroundColor(ColorPreference.Panel.Background);
+	}
+
+	public PieChart createSupplyStateChart() {
+		PieChart chart = new PieChartBuilder().width(defaultWidth).height(defaultHeight).title("Holon Objects").build();
+		setDefaultPieChartSettings(chart);
+		Color[] sliceColors = new Color[] { ColorPreference.HolonObject.Producer,
+				ColorPreference.HolonObject.OverSupplied, ColorPreference.HolonObject.Supplied,
+				ColorPreference.HolonObject.PartiallySupplied, ColorPreference.HolonObject.NotSupplied,
+				ColorPreference.HolonObject.NoEnergy };
+		chart.getStyler().setSeriesColors(sliceColors);
+
+		// TODO: get data
+		// Series
+		chart.addSeries("Producer", 40);
+		chart.addSeries("Over supplied", 21);
+		chart.addSeries("Supplied", 24);
+		chart.addSeries("Partial supplied", 39);
+		chart.addSeries("Not supplied", 17);
+		chart.addSeries("No energy", 0);
+		chart.updatePieSeries("Producer", 100);
+		
+		return chart;
+	}
+
+	public PieChart createPriorityChart() {
+		// Create Chart
+		PieChart chart = new PieChartBuilder().width(defaultWidth).height(defaultHeight).title("Priotities").build();
+		setDefaultPieChartSettings(chart);
+		// Customize Chart
+		Color[] sliceColors = new Color[] { ColorPreference.Priority.Essential, ColorPreference.Priority.High,
+				ColorPreference.Priority.Medium, ColorPreference.Priority.Low, };
+		chart.getStyler().setSeriesColors(sliceColors);
+		// TODO: get data
+		// Series
+		chart.addSeries("Essential", 20);
+		chart.addSeries("High", 28);
+		chart.addSeries("Medium", 29);
+		chart.addSeries("Low", 70);
+		return chart;
+	}
+
+	public PieChart createFlexibilityChart() {
+		// IN_USE, ON_COOLDOWN, OFFERED, NOT_OFFERED, UNAVAILABLE
+		// Create Chart
+		PieChart chart = new PieChartBuilder().width(defaultWidth).height(defaultHeight).title("Flexibilities").build();
+		setDefaultPieChartSettings(chart);
+		// Customize Chart
+		Color[] sliceColors = new Color[] { ColorPreference.Flexibility.Offered, ColorPreference.Flexibility.InUse,
+				ColorPreference.Flexibility.OnCooldown, ColorPreference.Flexibility.NotOffered,
+				ColorPreference.Flexibility.Unavailable, };
+		chart.getStyler().setSeriesColors(sliceColors);
+		// TODO: get data
+		// Series
+		chart.addSeries("Offered", 124);
+		chart.addSeries("In use", 45);
+		chart.addSeries("On cooldown", 30);
+		chart.addSeries("Not offered", 15);
+		chart.addSeries("Unavailable", 2);
+		return chart;
+	}
+
+	public CategoryChart createProductionChart() {
+		// Create Chart
+		CategoryChart chart = new CategoryChartBuilder().width(defaultWidth).height(defaultHeight)
+				.title("Production vs. Consumption").yAxisTitle("Energy Units").build();
+
+		// Customize Chart
+		CategoryStyler styler = chart.getStyler();
+		Color[] barColors = new Color[] { ColorPreference.Energy.Production, ColorPreference.Energy.Consumption };
+		chart.getStyler().setSeriesColors(barColors);
+
+		styler.setLegendVisible(false);
+		styler.setXAxisTitleVisible(false);
+		styler.setLabelsVisible(false);
+		styler.setXAxisTicksVisible(false);
+		styler.setChartFontColor(ColorPreference.Panel.Title);
+		styler.setChartBackgroundColor(ColorPreference.Panel.Background);
+		styler.setPlotBackgroundColor(ColorPreference.Panel.Background);
+		styler.setPlotBorderColor(ColorPreference.Panel.Background);
+		styler.setToolTipsEnabled(true);
+		// TODO: get data
+		// Series
+		chart.addSeries("Production", new ArrayList<String>(Arrays.asList(new String[] { "Production" })),
+				new ArrayList<Number>(Arrays.asList(new Number[] { 50.0 })));
+
+		chart.addSeries("Consumption", new ArrayList<String>(Arrays.asList(new String[] { "Consumption" })),
+				new ArrayList<Number>(Arrays.asList(new Number[] { 55.0 })));
+
+		return chart;
+	}
+}

+ 16 - 16
src/ui/view/MyCanvas.java

@@ -33,6 +33,7 @@ import classes.HolonObject;
 import classes.HolonSwitch;
 import classes.Node;
 import classes.Position;
+import preferences.ColorPreference;
 import ui.controller.Control;
 import ui.controller.UpdateController;
 import ui.model.Consumer;
@@ -43,11 +44,11 @@ import ui.model.DecoratedHolonObject.HolonObjectState;
 import ui.model.DecoratedSwitch;
 import ui.model.ExitCable;
 import ui.model.DecoratedSwitch.SwitchState;
+import util.ImageImport;
 import ui.model.Model;
 import ui.model.Passiv;
 import ui.model.Supplier;
 import ui.model.VisualRepresentationalState;
-import utility.ImageImport;
 
 /**
  * This Class is the Canvas. All Objects will be visualized here
@@ -144,7 +145,7 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 						controller.addUpperNode("GroupNode", null, animCps);
 						controller.calculateStateAndVisualForCurrentTimeStep();
 						triggerUpdateController();
-						model.getSelectedCpsObjects().clear();
+						controller.clearSelection();
 						repaint();
 					}
 				});
@@ -177,7 +178,7 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 					animT = new javax.swing.Timer(
 							animDelay,
 							actionEvent1 -> {
-								model.getSelectedCpsObjects().clear();
+								controller.clearSelection();
 								if (animDuration - animDelay >= 0) {
 									for (int i = 0; i < animCps.size(); i++) {
 										Position pos = animCps.get(i).getPosition();
@@ -249,7 +250,7 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 				}
 				toolTip = false;
 			}
-			model.getSelectedCpsObjects().clear();
+			controller.clearSelection();
 			tempCps = null;
 			repaint();
 		});
@@ -307,20 +308,20 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 	 *            Graphics
 	 */
 	
-	private Color getStateColor(HolonObjectState state) {
+	public static Color getStateColor(HolonObjectState state) {
 		switch(state) {
 		case NOT_SUPPLIED:
-			return new Color(230, 120, 100);
+			return ColorPreference.HolonObject.NotSupplied;
 		case NO_ENERGY:
-			return Color.white;
+			return ColorPreference.HolonObject.NoEnergy;
 		case OVER_SUPPLIED:
-			return new Color(166, 78, 229);
+			return ColorPreference.HolonObject.OverSupplied;
 		case PARTIALLY_SUPPLIED:
-			return Color.yellow;
+			return ColorPreference.HolonObject.PartiallySupplied;
 		case PRODUCER:
-			return Color.lightGray;
+			return ColorPreference.HolonObject.Producer;
 		case SUPPLIED:
-			return new Color(13, 175, 28);
+			return ColorPreference.HolonObject.Supplied;
 		default:
 			return Color.BLACK;
 		}
@@ -640,7 +641,7 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 
 				if (e.isControlDown() && tempCps != null) {
 					if (model.getSelectedCpsObjects().contains(tempCps)) {
-						controller.deleteSelectedObject(tempCps);
+						controller.removeSelectedObjectFromSelection(tempCps);
 							//TODO: RemoveDepth
 					} else {
 						controller.addSelectedObject(tempCps);
@@ -668,7 +669,7 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 			controller.setSelecteEdge(edgeHighlight);
 			controller.setSelectedObjectID(0);
 			if (!e.isControlDown() && e.getButton() != MouseEvent.BUTTON3) {
-				model.getSelectedCpsObjects().clear();
+				controller.clearSelection();
 			}
 		}
 
@@ -727,9 +728,8 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 
 		if (!e.isControlDown() && !dragged && tempCps != null
 				&& MouseEvent.BUTTON3 != e.getButton()) {
-			model.getSelectedCpsObjects().clear();
+			controller.clearSelection();
 			controller.addSelectedObject(tempCps);
-			model.setSelectedCpsObject(tempCps);
 			if(tempCps instanceof GroupNode)
 				controller.getObjectsInDepth();
 		}
@@ -762,7 +762,7 @@ public class MyCanvas extends AbstractCanvas implements MouseListener,
 		y = e.getY();
 		
 		if (!model.getSelectedCpsObjects().contains(tempCps) && !doMark) {
-			model.getSelectedCpsObjects().clear();
+			controller.clearSelection();
 			if (tempCps != null) {
 				controller.addSelectedObject(tempCps);
 			}

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

@@ -20,6 +20,7 @@ import ui.controller.Control;
 import ui.model.Consumer;
 import ui.model.DecoratedCable;
 import ui.model.DecoratedHolonObject.HolonObjectState;
+import util.ImageImport;
 import ui.model.DecoratedNetwork;
 import ui.model.DecoratedState;
 import ui.model.DecoratedSwitch;
@@ -27,7 +28,6 @@ import ui.model.MinimumNetwork;
 import ui.model.Model;
 import ui.model.Passiv;
 import ui.model.Supplier;
-import utility.ImageImport;
 
 
 

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

@@ -34,7 +34,7 @@ import javax.swing.event.ChangeListener;
 import javax.swing.plaf.basic.BasicSliderUI;
 
 import ui.controller.Control;
-import utility.ImageImport;
+import util.ImageImport;
 /**
  * This Class represents a Panel where the User can start and stop the
  * Simulation. He Can also reset the Simulation and click through every

+ 0 - 8
src/ui/view/XChartTest.java

@@ -1,8 +0,0 @@
-package ui.view;
-
-import javax.swing.JPanel;
-
-public class XChartTest extends JPanel {
-	
-	//XYChart chart = QuickChart.getChart("Sample Chart", "X", "Y", "y(x)", xData, yData);
-}

+ 4 - 1
src/utility/Action.java → src/util/Action.java

@@ -1,4 +1,4 @@
-package utility;
+package util;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -10,6 +10,9 @@ public class Action<T> {
     public void addListener(Consumer<T> listener) {
         listeners.add(listener);
     }
+    public void removeListener(Consumer<T> listener) {
+        listeners.remove(listener);
+    }
 
     public void broadcast(T argument) {
         listeners.forEach(x -> x.accept(argument));

+ 4 - 1
src/utility/Event.java → src/util/Event.java

@@ -1,4 +1,4 @@
-package utility;
+package util;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -7,6 +7,9 @@ public class Event {
     public void addListener(Runnable listener) {
         listeners.add(listener);
     }
+    public void removeListener(Runnable listener) {
+        listeners.remove(listener);
+    }
 
     public void broadcast() {
         listeners.forEach(x -> x.run());

+ 1 - 1
src/utility/FloatLog.java → src/util/FloatLog.java

@@ -1,4 +1,4 @@
-package utility;
+package util;
 
 import java.util.HashMap;
 import java.util.stream.Collectors;

+ 1 - 1
src/utility/ImageImport.java → src/util/ImageImport.java

@@ -1,4 +1,4 @@
-package utility;
+package util;
 
 import java.awt.Image;
 import java.awt.image.BufferedImage;

+ 1 - 1
src/utility/Random.java → src/util/Random.java

@@ -1,4 +1,4 @@
-package utility;
+package util;
 
 
 

+ 1 - 1
src/utility/StringFormat.java → src/util/StringFormat.java

@@ -1,4 +1,4 @@
-package utility;
+package util;
 
 import java.math.RoundingMode;
 import java.text.DecimalFormat;

+ 2 - 2
tests/tests/PraktikumHolonsTestObjectController.java

@@ -124,13 +124,13 @@ public class PraktikumHolonsTestObjectController {
 
 		for (AbstractCanvasObject cps : model.getObjectsOnCanvas()) {
 			int size = model.getSelectedCpsObjects().size();
-			controller.addSelectedObject(cps);
+			controller.addSelectedObjectToSelection(cps);
 			assertTrue("Size does not Match", model.getSelectedCpsObjects().size() == size + 1);
 		}
 		for (AbstractCanvasObject cps : model.getObjectsOnCanvas()) {
 			System.out.println(model.getSelectedCpsObjects().size());
 			int size = model.getSelectedCpsObjects().size();
-			controller.deleteSelectedObject(cps);
+			controller.removeSelectedObjectFromSelection(cps);
 			assertTrue("Size does not Match", model.getSelectedCpsObjects().size() == size - 1);
 			assertTrue("Object was not unselected", !model.getSelectedCpsObjects().contains(cps));