|
@@ -852,9 +852,8 @@ public class GUI implements CategoryListener {
|
|
controller.addElementCanvasObject(tempCpsObject.getId(), ele.getEleName(), ele.getAmount(),
|
|
controller.addElementCanvasObject(tempCpsObject.getId(), ele.getEleName(), ele.getAmount(),
|
|
ele.getEnergyPerElement(), ele.getId());
|
|
ele.getEnergyPerElement(), ele.getId());
|
|
}
|
|
}
|
|
- updCon.refreshTableHolonElement(model.getMultiTable(), model.getSingleTable());
|
|
|
|
- updCon.refreshTableProperties(model.getPropertyTable());
|
|
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
|
|
+ triggerUpdateController(null);
|
|
contentPane.updateUI();
|
|
contentPane.updateUI();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -870,9 +869,8 @@ public class GUI implements CategoryListener {
|
|
HolonObject obj = (HolonObject) updCon.getActualCps();
|
|
HolonObject obj = (HolonObject) updCon.getActualCps();
|
|
for (HolonElement e : selectedElements) {
|
|
for (HolonElement e : selectedElements) {
|
|
controller.deleteElementCanvas(obj.getId(), e.getId());
|
|
controller.deleteElementCanvas(obj.getId(), e.getId());
|
|
- updCon.refreshTableHolonElement(model.getMultiTable(), model.getSingleTable());
|
|
|
|
- updCon.refreshTableProperties(model.getPropertyTable());
|
|
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
|
|
+ triggerUpdateController(null);
|
|
contentPane.updateUI();
|
|
contentPane.updateUI();
|
|
// Names displayed in graph are not updated
|
|
// Names displayed in graph are not updated
|
|
}
|
|
}
|
|
@@ -886,12 +884,11 @@ public class GUI implements CategoryListener {
|
|
controller.deleteElementCanvas(i, e.getId());
|
|
controller.deleteElementCanvas(i, e.getId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- updCon.refreshTableHolonElement(model.getMultiTable(), model.getSingleTable());
|
|
|
|
- updCon.refreshTableProperties(model.getPropertyTable());
|
|
|
|
|
|
+ triggerUpdateController(null);
|
|
model.getEleToDelete().clear();
|
|
model.getEleToDelete().clear();
|
|
selectedElements.clear();
|
|
selectedElements.clear();
|
|
}
|
|
}
|
|
- updCon.refreshTableProperties(model.getPropertyTable());
|
|
|
|
|
|
+ triggerUpdateController(null);
|
|
elementGraph.setText(Languages.getLanguage()[25]);
|
|
elementGraph.setText(Languages.getLanguage()[25]);
|
|
holonEleNamesDisplayed = Languages.getLanguage()[25];
|
|
holonEleNamesDisplayed = Languages.getLanguage()[25];
|
|
});
|
|
});
|
|
@@ -1060,9 +1057,10 @@ public class GUI implements CategoryListener {
|
|
Float ftemp = Float.parseFloat(newStuff);
|
|
Float ftemp = Float.parseFloat(newStuff);
|
|
eleTemp.setFlexibleEnergyAvailable(ftemp);
|
|
eleTemp.setFlexibleEnergyAvailable(ftemp);
|
|
|
|
|
|
|
|
+ // if this is a flexible device and the flexibly available energy was changed,
|
|
|
|
+ // set used energy to 0, so that it can be computed anew
|
|
if (eleTemp.isFlexible()) {
|
|
if (eleTemp.isFlexible()) {
|
|
eleTemp.setEnergyPerElement(0);
|
|
eleTemp.setEnergyPerElement(0);
|
|
- // TODO: recalculate energy
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Amount of Elements update
|
|
// Amount of Elements update
|
|
@@ -1076,11 +1074,12 @@ public class GUI implements CategoryListener {
|
|
updateElementTableAfterChange(eleTemp, selectedValueBY);
|
|
updateElementTableAfterChange(eleTemp, selectedValueBY);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- updCon.refreshTableProperties(model.getPropertyTable());
|
|
|
|
- model.getSingleTable().fireTableDataChanged();
|
|
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
|
|
+ model.getSingleTable().fireTableDataChanged();
|
|
|
|
+ triggerUpdateController(null);
|
|
contentPane.updateUI();
|
|
contentPane.updateUI();
|
|
unitGraph.repaint();
|
|
unitGraph.repaint();
|
|
|
|
+ triggerUpdateController(null);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -1492,8 +1491,7 @@ public class GUI implements CategoryListener {
|
|
unitGraph.fillArrayofBooleans();
|
|
unitGraph.fillArrayofBooleans();
|
|
}
|
|
}
|
|
// Write new data in the PropertyTable
|
|
// Write new data in the PropertyTable
|
|
- updCon.paintProperties(temp);
|
|
|
|
- updCon.refreshTableHolonElement(model.getMultiTable(), model.getSingleTable());
|
|
|
|
|
|
+ triggerUpdateController(temp);
|
|
|
|
|
|
// New Tab with NodeOfNode
|
|
// New Tab with NodeOfNode
|
|
if (doubleClick() && MouseEvent.BUTTON3 != e.getButton() && temp instanceof CpsUpperNode) {
|
|
if (doubleClick() && MouseEvent.BUTTON3 != e.getButton() && temp instanceof CpsUpperNode) {
|
|
@@ -2242,7 +2240,7 @@ public class GUI implements CategoryListener {
|
|
/**
|
|
/**
|
|
* if flexibility was turned on, then active needs to be turned off, the energy currently produced/consumed
|
|
* if flexibility was turned on, then active needs to be turned off, the energy currently produced/consumed
|
|
*
|
|
*
|
|
- * @param eleBTemp element that needs to be updated
|
|
|
|
|
|
+ * @param eleBTemp element that needs to be updated
|
|
* @param selectedValueBY the y value in the table
|
|
* @param selectedValueBY the y value in the table
|
|
*/
|
|
*/
|
|
private void updateElementTableAfterChange(HolonElement eleBTemp, int selectedValueBY) {
|
|
private void updateElementTableAfterChange(HolonElement eleBTemp, int selectedValueBY) {
|
|
@@ -2253,6 +2251,14 @@ public class GUI implements CategoryListener {
|
|
model.getSingleTable().setValueAt(eleBTemp.getEnergyPerElement(), selectedValueBY, 2);
|
|
model.getSingleTable().setValueAt(eleBTemp.getEnergyPerElement(), selectedValueBY, 2);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void triggerUpdateController(AbstractCpsObject temp) {
|
|
|
|
+ if (temp != null) {
|
|
|
|
+ updCon.paintProperties(temp);
|
|
|
|
+ }
|
|
|
|
+ updCon.refreshTableHolonElement(model.getMultiTable(), model.getSingleTable());
|
|
|
|
+ updCon.refreshTableProperties(model.getPropertyTable());
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Custom Mouse adapter makes contentPane gain focus once mouse leaves this component
|
|
* Custom Mouse adapter makes contentPane gain focus once mouse leaves this component
|
|
* so copy/paste/cut and "select all" works
|
|
* so copy/paste/cut and "select all" works
|