|
@@ -23,7 +23,9 @@ import javax.swing.JButton;
|
|
|
import javax.swing.JFileChooser;
|
|
|
import javax.swing.JFrame;
|
|
|
import javax.swing.JLabel;
|
|
|
+import javax.swing.JOptionPane;
|
|
|
import javax.swing.JPanel;
|
|
|
+import javax.swing.JSplitPane;
|
|
|
import javax.swing.SwingConstants;
|
|
|
import javax.swing.border.EmptyBorder;
|
|
|
|
|
@@ -33,7 +35,7 @@ import classes.TrackedDataSet;
|
|
|
import ui.controller.Control;
|
|
|
import ui.model.Model;
|
|
|
|
|
|
-public class StatisticGraphPanel extends JPanel {
|
|
|
+public class StatisticGraphPanel extends JSplitPane {
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
@@ -48,11 +50,13 @@ public class StatisticGraphPanel extends JPanel {
|
|
|
private JPanel topPanel = new JPanel();
|
|
|
private JButton closeButton = new JButton("X");
|
|
|
private JButton savImgButton = new JButton("Save as Image");
|
|
|
+ private JPanel topContainer = new JPanel();
|
|
|
+ private JPanel buttomContainer = new JPanel();
|
|
|
|
|
|
|
|
|
String graphName;
|
|
|
private final JPanel legendPanel = new JPanel();
|
|
|
- private JPanel that;
|
|
|
+ private JSplitPane that;
|
|
|
private Hashtable<String, StatisticGraphPanel> graphHashtable;
|
|
|
|
|
|
|
|
@@ -65,13 +69,26 @@ public class StatisticGraphPanel extends JPanel {
|
|
|
*/
|
|
|
public StatisticGraphPanel(Model mod, Control cont, String name, Hashtable<String, StatisticGraphPanel> gHt) {
|
|
|
super();
|
|
|
+ setDividerSize(0);
|
|
|
+ setPreferredSize(new Dimension(600, 300));
|
|
|
+ setContinuousLayout(true);
|
|
|
+ setMinimumSize(new Dimension(600, 300));
|
|
|
+ setOrientation(JSplitPane.VERTICAL_SPLIT);
|
|
|
setBorder(new EmptyBorder(0, 0, 0, 0));
|
|
|
this.model = mod;
|
|
|
this.controller = cont;
|
|
|
this.sGraph = new StatisticGraph(mod, cont);
|
|
|
this.graphName = name;
|
|
|
this.graphHashtable = gHt;
|
|
|
- setLayout(new BorderLayout(0, 0));
|
|
|
+ topContainer.setLayout(new BorderLayout(0,0));
|
|
|
+ buttomContainer.setPreferredSize(new Dimension(0, 0));
|
|
|
+ buttomContainer.setMinimumSize(new Dimension(0, 0));
|
|
|
+ buttomContainer.setAlignmentX(Component.LEFT_ALIGNMENT);
|
|
|
+ buttomContainer.setAlignmentY(Component.TOP_ALIGNMENT);
|
|
|
+ buttomContainer.setLayout(new BorderLayout(0,0));
|
|
|
+ this.setTopComponent(topContainer);
|
|
|
+ this.setBottomComponent(buttomContainer);
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -140,10 +157,11 @@ public class StatisticGraphPanel extends JPanel {
|
|
|
});
|
|
|
|
|
|
|
|
|
- this.add(sGraph);
|
|
|
- this.add(topPanel, BorderLayout.NORTH);
|
|
|
- this.add(maximumLabel, BorderLayout.WEST);
|
|
|
- this.add(legendPanel, BorderLayout.SOUTH);
|
|
|
+ topContainer.add(sGraph);
|
|
|
+ topContainer.add(topPanel, BorderLayout.NORTH);
|
|
|
+ topContainer.add(maximumLabel, BorderLayout.WEST);
|
|
|
+ buttomContainer.add(legendPanel, BorderLayout.NORTH);
|
|
|
+ this.setEnabled(false);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -153,6 +171,10 @@ public class StatisticGraphPanel extends JPanel {
|
|
|
* @param set
|
|
|
*/
|
|
|
public void addObject(TrackedDataSet set) {
|
|
|
+ if(legendPanel.getComponentCount() >= 20){
|
|
|
+ JOptionPane.showMessageDialog(null, "You can not add more than 20 Properties to a Graph");
|
|
|
+ return;
|
|
|
+ }
|
|
|
sGraph.addObject(set);
|
|
|
String property = "";
|
|
|
switch (set.getProperty()) {
|