Browse Source

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

dominik.rieder 8 years ago
parent
commit
6e3092e53e
3 changed files with 20 additions and 15 deletions
  1. 1 6
      src/ui/model/Model.java
  2. 1 1
      src/ui/view/BackgroundPopUp.java
  3. 18 8
      src/ui/view/GUI.java

+ 1 - 6
src/ui/model/Model.java

@@ -1,7 +1,6 @@
 package ui.model;
 
 import java.awt.Color;
-import java.awt.RenderingHints;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -9,14 +8,11 @@ import java.util.List;
 
 import javax.swing.JTable;
 
-import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader.Array;
-
+import classes.AbstractCpsObject;
 import classes.Category;
 import classes.CpsEdge;
 import classes.CpsUpperNode;
-import classes.AbstractCpsObject;
 import classes.HolonElement;
-import classes.HolonObject;
 import classes.HolonSwitch;
 import interfaces.CategoryListener;
 import interfaces.GraphListener;
@@ -24,7 +20,6 @@ import interfaces.ObjectListener;
 import ui.view.Console;
 import ui.view.DefaulTable;
 import ui.view.PropertyTable;
-import ui.view.DefaulTable;
 
 /**
  * The Class Model is the class where everything is saved. All changes made to

+ 1 - 1
src/ui/view/BackgroundPopUp.java

@@ -202,7 +202,7 @@ public class BackgroundPopUp extends JDialog {
 
 			@Override
 			public void actionPerformed(ActionEvent e) {
-				// Bild ausgewählt?
+				// picture selected?
 				if (!path.isEmpty()) {
 					if (rdbtnImagePixel.isSelected()) {
 						mode = 0;

+ 18 - 8
src/ui/view/GUI.java

@@ -764,6 +764,8 @@ public class GUI<E> implements CategoryListener {
 			public void actionPerformed(ActionEvent e) {
 				if (panelTapped_SimMenu
 						.getComponent(panelTapped_SimMenu.getComponentCount() - 1) instanceof JSplitPane) {
+					Component tempC = tabbedPane2.getSelectedComponent();
+					tabbedPane.setComponentAt(tabbedPane2.getSelectedIndex(), tempC);
 					tabbedPane2.removeAll();
 					panelTapped_SimMenu
 							.remove(panelTapped_SimMenu.getComponent(panelTapped_SimMenu.getComponentCount() - 1));
@@ -772,11 +774,21 @@ public class GUI<E> implements CategoryListener {
 					for (int i = 0; i < tabbedPane.getTabCount(); i++) {
 						tabbedPane2.addTab(tabbedPane.getTitleAt(i), null);
 					}
+					if (tabbedPane.getSelectedComponent() == statScrollPane) {
+						tabbedPane.setComponentAt(0,null);
+						tabbedPane2.setComponentAt(0, canvasSP);
+						tabbedPane2.setSelectedIndex(0);
+					} else {
+						tabbedPane.setComponentAt(1,null);
+						tabbedPane2.setComponentAt(1, statScrollPane);
+						tabbedPane2.setSelectedIndex(1);
+					}
 					JSplitPane tempSplit = new JSplitPane();
 					tempSplit.setBorder(null);
 					tempSplit.setRightComponent(tabbedPane2);
 					tempSplit.setLeftComponent(tabbedPane);
 					tempSplit.setDividerLocation(tabbedPane.getWidth()/2);
+					tempSplit.setResizeWeight(0.9);
 					panelTapped_SimMenu.remove(tabbedPane);
 					panelTapped_SimMenu.add(tempSplit);
 				}
@@ -848,7 +860,6 @@ public class GUI<E> implements CategoryListener {
 			public void actionPerformed(ActionEvent arg0) {
 				if (model.getSelectedCpsObjects().size() == 1) {
 					AbstractCpsObject tempCpsObject = updCon.getActualCps();
-					System.out.println(tempCpsObject.getName());
 					if (tempCpsObject != null && tempCpsObject.getClass() == HolonObject.class
 							&& tempCpsObject.getId() != 0) {
 						addElementPopUp = new AddElementPopUp();
@@ -1094,7 +1105,6 @@ public class GUI<E> implements CategoryListener {
 					yProThis = e.getY();
 					xProThis = e.getX();
 				}
-
 			}
 		});
 
@@ -1110,14 +1120,14 @@ public class GUI<E> implements CategoryListener {
 					Point mousePos = tableProperties.getMousePosition();
 					int selValueY = (int) Math.floor(yProThis / 16);
 					int selValueX = (int) Math.floor(xProThis / (tableProperties.getWidth() / 2));
-					if (updCon.getActualCps() != null) {
+					if (updCon.getActualCps() != null && selValueX != 0) {
 						temp = model.getPropertyTable().getValueAt(selValueY, selValueX);
+						System.out.println(temp);
 						if (updCon.getActualCps() instanceof HolonSwitch) {
 							btemp = model.getPropertyTable().getValueAt(mousePos.y / tableProperties.getRowHeight(),
 									mousePos.x / (tableProperties.getWidth() / 2));
 							if (mousePos.y / tableProperties.getRowHeight() == 0) {
 								updCon.getActualCps().setName(btemp.toString());
-
 							} else if (mousePos.y / tableProperties.getRowHeight() == 2) {
 								Boolean bbTemp = Boolean.parseBoolean(btemp.toString());
 								((HolonSwitch) updCon.getActualCps()).setManualMode(bbTemp);
@@ -1133,9 +1143,8 @@ public class GUI<E> implements CategoryListener {
 									((HolonSwitch) updCon.getActualCps()).setManualState(bTemp);
 								}
 							}
-						}
-						updCon.getActualCps().setName(temp.toString());
-						if (updCon.getActualCps() instanceof CpsUpperNode) {
+						} else if (updCon.getActualCps() instanceof CpsUpperNode) {
+							updCon.getActualCps().setName(temp.toString());
 							for (int index = 4; index < tabbedPane.getTabCount(); index++) {
 								UpperNodeCanvas unc = ((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponent(index))
 										.getViewport().getComponent(0));
@@ -1144,8 +1153,9 @@ public class GUI<E> implements CategoryListener {
 									tabbedPane.updateUI();
 								}
 							}
+						} else if (updCon.getActualCps() instanceof HolonObject) {
+							updCon.getActualCps().setName(temp.toString());
 						}
-						// }
 					} else {
 						temp = model.getPropertyTable().getValueAt(selValueY, selValueX);
 						btemp = model.getPropertyTable().getValueAt(mousePos.y / tableProperties.getRowHeight(),