Selaa lähdekoodia

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

Teh-Hai Julian Zheng 7 vuotta sitten
vanhempi
commit
384bfb35aa
3 muutettua tiedostoa jossa 28 lisäystä ja 0 poistoa
  1. 10 0
      src/ui/controller/Control.java
  2. 17 0
      src/ui/model/Model.java
  3. 1 0
      src/ui/view/StatPanel2.java

+ 10 - 0
src/ui/controller/Control.java

@@ -6,6 +6,7 @@ import java.awt.datatransfer.UnsupportedFlavorException;
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.zip.ZipException;
 
 import org.apache.commons.compress.archivers.ArchiveException;
@@ -24,6 +25,7 @@ import interfaces.CategoryListener;
 import ui.model.Model;
 import ui.view.FlexiblePane;
 import ui.view.MyCanvas;
+import ui.view.StatisticGraphPanel;
 
 /**
  * The Class represents the controller in the model, controller view Pattern.
@@ -929,5 +931,13 @@ public class Control {
 	public void setFlexiblePane(FlexiblePane fp){
 		simulationManager.setFlexiblePane(fp);
 	}
+	
+	public void setGraphTable(Hashtable<String, StatisticGraphPanel> gT){
+		model.setGraphTable(gT);
+	}
+	
+	public Hashtable<String, StatisticGraphPanel> getGraphTable(){
+		return model.getGraphTable();
+	}
 
 }

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

@@ -3,6 +3,7 @@ package ui.model;
 import java.awt.Color;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.LinkedList;
 import java.util.List;
 
@@ -20,6 +21,7 @@ import interfaces.ObjectListener;
 import ui.view.Console;
 import ui.view.DefaulTable;
 import ui.view.PropertyTable;
+import ui.view.StatisticGraphPanel;
 
 /**
  * The Class Model is the class where everything is saved. All changes made to
@@ -111,6 +113,7 @@ public class Model {
 	private Object algorithm = null;
 	private int selectedHolonBody;
 
+	private Hashtable<String, StatisticGraphPanel> statisticGraphTable = new Hashtable<String, StatisticGraphPanel>();
 	/**
 	 * Constructor for the model. It initializes the categories and
 	 * objectsOnCanvas by default values. Listeners are also initialized by
@@ -860,4 +863,18 @@ public class Model {
 	public void setCanvasImageHeight(int height) {
 		backgroundHeight = height;
 	}
+	
+	/**
+	 * Set the graphtable for Statistic Graphs
+	 */
+	public void setGraphTable(Hashtable<String, StatisticGraphPanel> gT){
+		statisticGraphTable = gT;
+	}
+	
+	/**
+	 * Returns the graphtable for Statistic Graphs
+	 */
+	public Hashtable<String, StatisticGraphPanel> getGraphTable(){
+		return statisticGraphTable;
+	}
 }

+ 1 - 0
src/ui/view/StatPanel2.java

@@ -110,6 +110,7 @@ public class StatPanel2 extends JSplitPane implements GraphListener {
 		this.controller = cont;
 		objectHashtable = new Hashtable<String, GraphDataSet>();
 		graphHashtable = new Hashtable<String, StatisticGraphPanel>();
+		controller.setGraphTable(graphHashtable);
 		
 		holonHashtable = new Hashtable<String, PropertyDataSet>();
 		holonHashtable.put(TOT_PROD_HOLON, new PropertyDataSet());