Browse Source

added new properties

dominik.rieder 7 years ago
parent
commit
c373a57747
1 changed files with 57 additions and 13 deletions
  1. 57 13
      src/ui/view/SplitPane.java

+ 57 - 13
src/ui/view/SplitPane.java

@@ -56,6 +56,8 @@ import java.awt.FlowLayout;
 import java.awt.BorderLayout;
 
 public class SplitPane extends JSplitPane implements GraphListener {
+	public static final String MAIN_GRID = "Main Grid";
+	public static final String HOLON = "Holons";
 	
 	// Property Strings
 	public static final String TOT_PROD_HOLON = "total Holon Production";
@@ -63,7 +65,15 @@ public class SplitPane extends JSplitPane implements GraphListener {
 	public static final String SUPPLIED_OBJ = "Percentage of supplied Objects";
 	public static final String NOT_SUPPLIED_OBJ = "Percentage of not supplied Objects";
 	public static final String PART_SUPPLIED_OBJ = "Percentage of partially supplied Objects";
-	public static final String NR_SUBNETS = "number of Subnets";
+	public static final String NR_SUBNETS = "Nr. of Subnets";
+	public static final String NR_CLOSED_SWITCHES = "Nr. of closed Switches";
+	public static final String AVG_OBJ_IN_HOLONS = "Average amount of Objects in Holons";
+	public static final String AVG_ELEM_IN_HOLONS = "Average amount of Elements in Holons";
+	public static final String AVG_PRODS_IN_HOLONS ="Average amount of Producers in Holons";
+	public static final String AVG_CONS_ENERGY_IN_HOLONS = "Average consumed Energy";
+	public static final String AVG_WASTED_ENERGY_HOLONS = "Average wasted Energy";
+	public static final String NR_BROKEN_EDGES = "Amount of broken Edges";
+	public static final String PROD_CONS_RATIO = "Producer/Consumer Ratio";
 	
 	public static final String TOT_PROD_OBJ = "total Production";
 	public static final String TOT_CONS_OBJ = "total Consumption";
@@ -85,8 +95,9 @@ public class SplitPane extends JSplitPane implements GraphListener {
 	private DefaultTreeModel treeModel;
 	private DefaultMutableTreeNode objectsNode;
 	private DefaultMutableTreeNode mainGrid;
+	private DefaultMutableTreeNode holonNode;
 	private DefaultMutableTreeNode switchesNode;
-	private DefaultMutableTreeNode gridsNode;
+	private DefaultMutableTreeNode groupNode;
 	
 	private Hashtable<String, GraphDataSet> objectHashtable;
 	private Hashtable<String, StatisticGraphPanel> graphHashtable;
@@ -104,6 +115,7 @@ public class SplitPane extends JSplitPane implements GraphListener {
 	JLabel showPropertylbl;
 
 	public SplitPane(Control cont) {
+		setContinuousLayout(true);
 		this.controller = cont;
 		objectHashtable = new Hashtable<String, GraphDataSet>();
 		graphHashtable = new Hashtable<String, StatisticGraphPanel>();
@@ -115,6 +127,14 @@ public class SplitPane extends JSplitPane implements GraphListener {
 		holonHashtable.put(NOT_SUPPLIED_OBJ, new PropertyDataSet());
 		holonHashtable.put(PART_SUPPLIED_OBJ, new PropertyDataSet());
 		holonHashtable.put(NR_SUBNETS, new PropertyDataSet());
+		holonHashtable.put(NR_CLOSED_SWITCHES, new PropertyDataSet());
+		holonHashtable.put(AVG_OBJ_IN_HOLONS, new PropertyDataSet());
+		holonHashtable.put(AVG_ELEM_IN_HOLONS, new PropertyDataSet());
+		holonHashtable.put(AVG_PRODS_IN_HOLONS, new PropertyDataSet());
+		holonHashtable.put(AVG_CONS_ENERGY_IN_HOLONS, new PropertyDataSet());
+		holonHashtable.put(AVG_WASTED_ENERGY_HOLONS, new PropertyDataSet());
+		holonHashtable.put(NR_BROKEN_EDGES, new PropertyDataSet());
+		holonHashtable.put(PROD_CONS_RATIO, new PropertyDataSet());
 		
 		//propValTable associates the Strings to the numbers
 		propValTable = new Hashtable<String, Integer>();
@@ -130,6 +150,16 @@ public class SplitPane extends JSplitPane implements GraphListener {
 		propValTable.put(TOT_PROD_GRID, TrackedDataSet.GROUP_PRODUCTION);
 		propValTable.put(TOT_CONS_GRID, TrackedDataSet.GROUP_CONSUMPTION);
 		propValTable.put(NR_SUBNETS, TrackedDataSet.AMOUNT_HOLONS);
+		propValTable.put(NR_CLOSED_SWITCHES, TrackedDataSet.AMOUNT_CLOSED_SWITCHES);
+		propValTable.put(AVG_OBJ_IN_HOLONS, TrackedDataSet.AVG_AMOUNT_OBJECTS_IN_HOLONS);
+		propValTable.put(AVG_ELEM_IN_HOLONS, TrackedDataSet.AVG_AMOUNT_ELEMENTS_IN_HOLONS);
+		propValTable.put(AVG_PRODS_IN_HOLONS, TrackedDataSet.AVG_AMOUNT_PRODUCERS_IN_HOLONS);
+		propValTable.put(AVG_CONS_ENERGY_IN_HOLONS, TrackedDataSet.AVG_CONSUMED_ENERGY_IN_HOLONS);
+		propValTable.put(AVG_WASTED_ENERGY_HOLONS, TrackedDataSet.AVG_WASTED_ENERGY_IN_HOLONS);
+		propValTable.put(NR_BROKEN_EDGES, TrackedDataSet.AMOUNT_BROKEN_EDGES);
+		propValTable.put(PROD_CONS_RATIO, TrackedDataSet.RATIO_PRODUCERS_CONSUMERS);
+
+
 
 		JScrollPane dataPane = new JScrollPane();
 		setLeftComponent(dataPane);
@@ -429,7 +459,8 @@ public class SplitPane extends JSplitPane implements GraphListener {
 				if (selectedNode == null) {
 					return;
 				} else {
-					if (selectedNode.getLevel() == 3 || (selectedNode.getLevel() == 2 && selectedNode.getParent().toString().equals("Main Grid") )) {
+					if (selectedNode.getLevel() == 3 || (selectedNode.getLevel() == 2 && 
+							(selectedNode.getParent().toString().equals(HOLON) || selectedNode.getParent().toString().equals(MAIN_GRID) ))) {
 						StatisticGraphPanel tmp = null;
 						if (graphNrTxtField.getText().length() > 0) {
 							if (!graphHashtable.containsKey(graphNrTxtField.getText())
@@ -449,7 +480,7 @@ public class SplitPane extends JSplitPane implements GraphListener {
 							String object = ((DefaultMutableTreeNode) selectedNode.getParent()).toString();
 							String property = selectedNode.toString();
 							AbstractCpsObject absCps = null;
-							if(!object.equals("Main Grid")){
+							if(!object.equals(MAIN_GRID) && !object.equals(HOLON)){
 							GraphDataSet dataSet = objectHashtable.get(object);
 							absCps = dataSet.getObject();
 							}
@@ -551,13 +582,24 @@ public class SplitPane extends JSplitPane implements GraphListener {
 		objectTree = new JTree();
 		treeModel = (DefaultTreeModel) objectTree.getModel();
 		DefaultMutableTreeNode root = new DefaultMutableTreeNode("Statistics");
-		mainGrid = new DefaultMutableTreeNode("Main Grid");
+		mainGrid = new DefaultMutableTreeNode(MAIN_GRID);
 		mainGrid.add(new DefaultMutableTreeNode(TOT_PROD_HOLON));
 		mainGrid.add(new DefaultMutableTreeNode(TOT_CONS_HOLON));
 		mainGrid.add(new DefaultMutableTreeNode(SUPPLIED_OBJ));
 		mainGrid.add(new DefaultMutableTreeNode(NOT_SUPPLIED_OBJ));
 		mainGrid.add(new DefaultMutableTreeNode(PART_SUPPLIED_OBJ));
 		mainGrid.add(new DefaultMutableTreeNode(NR_SUBNETS));
+		mainGrid.add(new DefaultMutableTreeNode(NR_CLOSED_SWITCHES));
+		mainGrid.add(new DefaultMutableTreeNode(PROD_CONS_RATIO));
+		mainGrid.add(new DefaultMutableTreeNode(NR_BROKEN_EDGES));
+		mainGrid.add(new DefaultMutableTreeNode(NR_CLOSED_SWITCHES));
+		
+		holonNode = new DefaultMutableTreeNode(HOLON);
+		holonNode.add(new DefaultMutableTreeNode(AVG_OBJ_IN_HOLONS));
+		holonNode.add(new DefaultMutableTreeNode(AVG_ELEM_IN_HOLONS));
+		holonNode.add(new DefaultMutableTreeNode(AVG_WASTED_ENERGY_HOLONS));
+		holonNode.add(new DefaultMutableTreeNode(AVG_CONS_ENERGY_IN_HOLONS));
+		holonNode.add(new DefaultMutableTreeNode(AVG_PRODS_IN_HOLONS));
 
 		objectsNode = new DefaultMutableTreeNode("Objects");
 		objectsNode.add(new DefaultMutableTreeNode("empty"));
@@ -565,14 +607,15 @@ public class SplitPane extends JSplitPane implements GraphListener {
 		switchesNode = new DefaultMutableTreeNode("Switches");
 		switchesNode.add(new DefaultMutableTreeNode("empty"));
 		
-		gridsNode = new DefaultMutableTreeNode("Groups");
-		gridsNode.add(new DefaultMutableTreeNode("empty"));
+		groupNode = new DefaultMutableTreeNode("Groups");
+		groupNode.add(new DefaultMutableTreeNode("empty"));
 		
 		treeModel.setRoot(root);
 		root.add(mainGrid);
+		root.add(holonNode);
 		root.add(objectsNode);
 		root.add(switchesNode);
-		root.add(gridsNode);
+		root.add(groupNode);
 		objectTree.setModel(treeModel);
 
 		treeScrollPane.setViewportView(objectTree);
@@ -615,7 +658,8 @@ public class SplitPane extends JSplitPane implements GraphListener {
 						showObjectlbl.setText(selectedNode.toString());
 					}
 					if (selectedNode.getLevel() == 2) {
-						if (((DefaultMutableTreeNode) selectedNode.getParent()).toString().equals("Main Grid")) {
+						if (((DefaultMutableTreeNode) selectedNode.getParent()).toString().equals(MAIN_GRID)
+								|| ((DefaultMutableTreeNode) selectedNode.getParent()).toString().equals(HOLON)) {
 							enableFields();
 							String object = selectedNode.getParent().toString();
 							String property = selectedNode.toString();
@@ -686,7 +730,7 @@ public class SplitPane extends JSplitPane implements GraphListener {
 	public void addTrackedObject(ArrayList<AbstractCpsObject> hlList) {
 		objectsNode.removeAllChildren();
 		switchesNode.removeAllChildren();
-		gridsNode.removeAllChildren();
+		groupNode.removeAllChildren();
 		objectHashtable.clear();
 		if (hlList.size() > 0 && hlList != null) {
 			for (AbstractCpsObject abs : hlList) {
@@ -718,7 +762,7 @@ public class SplitPane extends JSplitPane implements GraphListener {
 					tmp.add(new DefaultMutableTreeNode(TOT_CONS_GRID));
 					tmpHash.put(TOT_PROD_GRID, new PropertyDataSet());
 					tmpHash.put(TOT_CONS_GRID, new PropertyDataSet());
-					gridsNode.add(tmp);
+					groupNode.add(tmp);
 				}
 				
 				GraphDataSet gS = new GraphDataSet(abs, tmpHash);
@@ -731,8 +775,8 @@ public class SplitPane extends JSplitPane implements GraphListener {
 		if(switchesNode.getChildCount() == 0){
 			switchesNode.add(new DefaultMutableTreeNode("empty"));
 		}
-		if(gridsNode.getChildCount() == 0){
-			gridsNode.add(new DefaultMutableTreeNode("empty"));
+		if(groupNode.getChildCount() == 0){
+			groupNode.add(new DefaultMutableTreeNode("empty"));
 		}
 
 	}