Browse Source

The bug concerning the Name of the HolonObjs. fixed

Edgardo Palza 7 years ago
parent
commit
4d159ad815
1 changed files with 6 additions and 8 deletions
  1. 6 8
      src/ui/view/GUI.java

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

@@ -817,7 +817,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();
@@ -1063,7 +1062,6 @@ public class GUI<E> implements CategoryListener {
 					yProThis = e.getY();
 					xProThis = e.getX();
 				}
-
 			}
 		});
 
@@ -1079,14 +1077,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);
@@ -1102,9 +1100,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));
@@ -1113,8 +1110,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(),