Browse Source

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

Conflicts:
src/ui/view/GUI.java

Kevin Trometer 8 years ago
parent
commit
19e14cc38a
3 changed files with 131 additions and 0 deletions
  1. 4 0
      src/ui/view/GUI.java
  2. 1 0
      src/ui/view/SimulationMenu.java
  3. 126 0
      src/ui/view/StatisticPane.java

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

@@ -110,6 +110,10 @@ public class GUI<E> implements CategoryListener {
 	private JMenuItem editItem = new JMenuItem("Edit Object");
 	private String catOfObjToBeEdited;
 	private final JScrollPane statTab = new JScrollPane();
+	
+	private StatisticPane statPane = new StatisticPane();
+	private JScrollPane statScrollPane = new JScrollPane(statPane);
+
 
 	private final JLabel maxGraph = new JLabel("100%");
 	private final JLabel medGraph = new JLabel("50%");

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

@@ -148,6 +148,7 @@ public class SimulationMenu extends JMenuBar {
 
 		// timerSpeed
 		simSpeedText.setMaximumSize(new Dimension(300, 300));
+		//simSpeedText.setMinimumSize(new Dimension(300, 300));
 		simSpeedText.addCaretListener(new CaretListener() {
 			@Override
 			public void caretUpdate(CaretEvent e) {

+ 126 - 0
src/ui/view/StatisticPane.java

@@ -0,0 +1,126 @@
+package ui.view;
+
+import javax.swing.DefaultListModel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+import javax.swing.GroupLayout;
+import javax.swing.GroupLayout.Alignment;
+import javax.swing.JLabel;
+import java.awt.Font;
+import javax.swing.JCheckBox;
+import javax.swing.LayoutStyle.ComponentPlacement;
+import java.awt.Color;
+import javax.swing.SwingConstants;
+import javax.swing.JComboBox;
+
+public class StatisticPane extends JPanel{
+	private JScrollPane myScrollPane = new JScrollPane();
+    private JList objectList;
+    private DefaultListModel model =  new DefaultListModel();
+    
+    public StatisticPane(){
+    	objectList = new JList(model);
+    	myScrollPane.setViewportView(objectList);
+    	
+    	JLabel lblOverallStatistics = new JLabel("Overall Statistics:");
+    	lblOverallStatistics.setFont(new Font("Tahoma", Font.PLAIN, 13));
+    	
+    	JCheckBox chckbxNewCheckBox = new JCheckBox("total consumption");
+    	chckbxNewCheckBox.setForeground(Color.RED);
+    	
+    	JCheckBox chckbxNewCheckBox_1 = new JCheckBox("total production");
+    	chckbxNewCheckBox_1.setForeground(Color.BLUE);
+    	
+    	JLabel lblObject = new JLabel("Object:");
+    	lblObject.setFont(new Font("Tahoma", Font.PLAIN, 13));
+    	
+    	JLabel lblName = new JLabel("Name:");
+    	
+    	JLabel lblNewLabel = new JLabel("...");
+    	lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
+    	
+    	JCheckBox checkBox = new JCheckBox("total consumption");
+    	checkBox.setForeground(Color.RED);
+    	
+    	JCheckBox checkBox_1 = new JCheckBox("total production");
+    	checkBox_1.setForeground(Color.BLUE);
+    	
+    	JLabel lblGraph = new JLabel("  Graph:");
+    	
+    	JComboBox comboBox = new JComboBox();
+    	GroupLayout groupLayout = new GroupLayout(this);
+    	groupLayout.setHorizontalGroup(
+    		groupLayout.createParallelGroup(Alignment.LEADING)
+    			.addGroup(groupLayout.createSequentialGroup()
+    				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    					.addGroup(groupLayout.createSequentialGroup()
+    						.addContainerGap()
+    						.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    							.addComponent(lblOverallStatistics, GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE)
+    							.addGroup(groupLayout.createSequentialGroup()
+    								.addGap(10)
+    								.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    									.addComponent(chckbxNewCheckBox_1)
+    									.addComponent(chckbxNewCheckBox)))))
+    					.addGroup(groupLayout.createSequentialGroup()
+    						.addContainerGap()
+    						.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    							.addComponent(lblObject, GroupLayout.PREFERRED_SIZE, 56, GroupLayout.PREFERRED_SIZE)
+    							.addGroup(groupLayout.createSequentialGroup()
+    								.addGap(10)
+    								.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
+    									.addGroup(groupLayout.createSequentialGroup()
+    										.addGap(4)
+    										.addComponent(lblName)
+    										.addPreferredGap(ComponentPlacement.RELATED)
+    										.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE))
+    									.addComponent(checkBox_1, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE)
+    									.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false)
+    										.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
+    											.addComponent(lblGraph, GroupLayout.PREFERRED_SIZE, 54, GroupLayout.PREFERRED_SIZE)
+    											.addPreferredGap(ComponentPlacement.RELATED)
+    											.addComponent(comboBox, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+    										.addComponent(checkBox, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 111, GroupLayout.PREFERRED_SIZE))))))
+    					.addGroup(groupLayout.createSequentialGroup()
+    						.addContainerGap()
+    						.addComponent(myScrollPane, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)))
+    				.addContainerGap(263, Short.MAX_VALUE))
+    	);
+    	groupLayout.setVerticalGroup(
+    		groupLayout.createParallelGroup(Alignment.LEADING)
+    			.addGroup(groupLayout.createSequentialGroup()
+    				.addContainerGap()
+    				.addComponent(lblOverallStatistics)
+    				.addPreferredGap(ComponentPlacement.UNRELATED)
+    				.addComponent(chckbxNewCheckBox)
+    				.addPreferredGap(ComponentPlacement.UNRELATED)
+    				.addComponent(chckbxNewCheckBox_1)
+    				.addGap(18)
+    				.addComponent(lblObject)
+    				.addPreferredGap(ComponentPlacement.UNRELATED)
+    				.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
+    					.addComponent(lblNewLabel)
+    					.addComponent(lblName))
+    				.addPreferredGap(ComponentPlacement.UNRELATED)
+    				.addComponent(checkBox)
+    				.addPreferredGap(ComponentPlacement.UNRELATED)
+    				.addComponent(checkBox_1)
+    				.addPreferredGap(ComponentPlacement.UNRELATED)
+    				.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
+    					.addComponent(lblGraph)
+    					.addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+    				.addGap(57)
+    				.addComponent(myScrollPane, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
+    				.addGap(1))
+    	);
+    	setLayout(groupLayout);
+    	
+    	for(int i = 0; i < 20; i++){
+    		model.addElement(i*2000000000);
+    	}
+
+    }
+}