Browse Source

Title of the Tabs - live update ;)

Edgardo Palza 7 years ago
parent
commit
03967fb4f2
1 changed files with 13 additions and 2 deletions
  1. 13 2
      src/ui/view/GUI.java

+ 13 - 2
src/ui/view/GUI.java

@@ -995,6 +995,7 @@ public class GUI<E> implements CategoryListener {
 									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);
@@ -1010,9 +1011,18 @@ public class GUI<E> implements CategoryListener {
 									((HolonSwitch) updCon.getActualCps()).setManualState(bTemp);
 								}
 							}
-						} // else if (getActualCps() instanceof
-							// AbstractCpsObject) {
+						}
 						updCon.getActualCps().setName(temp.toString());
+						if (updCon.getActualCps() instanceof CpsUpperNode) {
+							for (int index = 3; index < tabbedPane.getTabCount(); index++) {
+								UpperNodeCanvas unc = ((UpperNodeCanvas) ((JScrollPane) tabbedPane.getComponent(index))
+										.getViewport().getComponent(0));
+								if (unc.upperNode.getID() == updCon.getActualCps().getID()) {
+									tabbedPane.setTitleAt(index, unc.upperNode.getName());
+									tabbedPane.updateUI();
+								}
+							}
+						}
 						// }
 					} else {
 						temp = model.getPropertyTable().getValueAt(selValueY, selValueX);
@@ -1045,6 +1055,7 @@ public class GUI<E> implements CategoryListener {
 		 */
 		resetGraphBtn.setBorder(new LineBorder(Color.BLACK));
 		resetGraphBtn.addActionListener(new ActionListener() {
+
 			public void actionPerformed(ActionEvent arg0) {
 				unitGraph.reset();
 			}