Browse Source

First Statistic Graph now has same size

dominik.rieder 7 years ago
parent
commit
45e1d33d03

+ 5 - 5
src/ui/view/DisplayedInformationPopUp.java

@@ -39,7 +39,7 @@ public class DisplayedInformationPopUp extends JDialog {
 	public DisplayedInformationPopUp(MyCanvas canvas, JPanel update, Control cont) {
 		super((java.awt.Frame) null, true);
 		setModalityType(java.awt.Dialog.ModalityType.APPLICATION_MODAL);
-		this.setTitle(Languages.getLanguage()[31]);
+		this.setTitle("Edit Displayed Informations");
 		setBounds(100, 100, 400, 276);
 		getContentPane().setLayout(new BorderLayout());
 		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
@@ -49,11 +49,11 @@ public class DisplayedInformationPopUp extends JDialog {
 		this.toUpdate = update;
 		controller = cont;
 
-		objectEnergyCheckbox = new JCheckBox(Languages.getLanguage()[32]);
+		objectEnergyCheckbox = new JCheckBox("Display Total Energy of Objects");
 		objectEnergyCheckbox.setBounds(19, 19, 300, 23);
 		contentPanel.add(objectEnergyCheckbox);
 
-		connectionCheckbox = new JCheckBox(Languages.getLanguage()[33]);
+		connectionCheckbox = new JCheckBox("Display Connection Properties");
 		connectionCheckbox.setBounds(19, 57, 300, 23);
 		contentPanel.add(connectionCheckbox);
 
@@ -80,12 +80,12 @@ public class DisplayedInformationPopUp extends JDialog {
 		btnCancel.setBounds(69, 193, 89, 23);
 		contentPanel.add(btnCancel);
 		
-		colorizedBorderCheckbox = new JCheckBox("Show colorized Border for Objects");
+		colorizedBorderCheckbox = new JCheckBox("Display colorized Border for Objects");
 		colorizedBorderCheckbox.setBounds(19, 96, 369, 23);
 		contentPanel.add(colorizedBorderCheckbox);
 		colorizedBorderCheckbox.setSelected(canvas.getShowedInformation()[3]);
 		
-		nodeOfnodeConnectionCheckbox = new JCheckBox("Show outside Connections in gouped Nodes");
+		nodeOfnodeConnectionCheckbox = new JCheckBox("Display outside Connections in gouped Nodes");
 		nodeOfnodeConnectionCheckbox.setBounds(19, 133, 369, 23);
 		contentPanel.add(nodeOfnodeConnectionCheckbox);
 		nodeOfnodeConnectionCheckbox.setSelected(canvas.getShowedInformation()[4]);

+ 7 - 5
src/ui/view/FlexSubData.java

@@ -79,14 +79,16 @@ public class FlexSubData extends JSplitPane {
 	}
 	
 	public void repaint(){
+		/*
 		if(btnShowObjects != null && listener != null && currentObj != null){
-			if(shown = true){
-				showAction();
-			}
-			if(shown = false){
-				hideAction();
+			if(shown){
+				btnShowObjects.setText(SHOW);
+			}else{
+				btnShowObjects.setText(HIDE);
 			}
+			btnShowObjects.doClick();
 		}
+		*/
 		super.repaint();
 	}
 	

+ 2 - 1
src/ui/view/StatisticGraph.java

@@ -19,6 +19,7 @@ import classes.SubNet;
 import classes.TrackedDataSet;
 import ui.controller.Control;
 import ui.model.Model;
+import java.awt.Dimension;
 
 public class StatisticGraph extends JPanel {
 
@@ -317,7 +318,7 @@ public class StatisticGraph extends JPanel {
 				maximum = val;
 			}
 		}
-		((StatisticGraphPanel) this.getParent()).setMaximumLabel(maximum);
+		((StatisticGraphPanel) this.getParent().getParent()).setMaximumLabel(maximum);
 	}
 
 	/**

+ 29 - 7
src/ui/view/StatisticGraphPanel.java

@@ -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();
 
 	// Variables
 	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);
+		//setLayout(new BorderLayout(0, 0));
 
 		// ******************** Component Propertys ***************//
 		// Graph
@@ -140,10 +157,11 @@ public class StatisticGraphPanel extends JPanel {
 		});
 
 		// ******************** add everything ********************//
-		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()) {