Bläddra i källkod

graphPanel now accessible from Model

dominik.rieder 7 år sedan
förälder
incheckning
59712868c6
3 ändrade filer med 18 tillägg och 0 borttagningar
  1. 11 0
      src/ui/model/Model.java
  2. 1 0
      src/ui/view/GUI.java
  3. 6 0
      src/ui/view/StatisticPanel.java

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

@@ -31,6 +31,7 @@ import ui.view.Console;
 import ui.view.DefaulTable;
 import ui.view.PropertyTable;
 import ui.view.StatisticGraphPanel;
+import ui.view.StatisticPanel;
 
 /**
  * The Class Model is the class where everything is saved. All changes made to
@@ -131,6 +132,8 @@ public class Model {
 	private ArrayList<JsonObject> statisticData = new ArrayList<>();
 	
 	private Gson gson;
+	
+	private StatisticPanel statPanel;
 
 	/**
 	 * Constructor for the model. It initializes the categories and
@@ -978,4 +981,12 @@ public class Model {
 	public void setGson(Gson gson) {
 		this.gson = gson;
 	}
+	
+	public void setStatPanel(StatisticPanel sP){
+		statPanel = sP;
+	}
+	
+	public StatisticPanel getStatPanel(){
+		return statPanel;
+	}
 }

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

@@ -300,6 +300,7 @@ public class GUI<E> implements CategoryListener {
 		this.model = control.getModel();
 		statSplitPane = new StatisticPanel(controller);
 		model.addGraphListener(statSplitPane);
+		model.setStatPanel(statSplitPane);
 		statScrollPane = new JScrollPane(statSplitPane);
 		this.unitGraph = new UnitGraph(model, control);
 		this.canvas = new MyCanvas(model, control, unitGraph);

+ 6 - 0
src/ui/view/StatisticPanel.java

@@ -803,7 +803,13 @@ public class StatisticPanel extends JSplitPane implements GraphListener {
 			sg.repaint();
 		}
 	}
+	
+	public JPanel getGraphPanel(){
+		return graphPanel;
+	}
 
 	private static void addPopup(Component component, final JPopupMenu popup) {
 	}
+	
+	
 }