|
@@ -45,6 +45,7 @@ public class GUI implements CategoryListener {
|
|
|
private final JMenu mnNewMenuView = new JMenu("View");
|
|
|
private final JMenu mnHelp = new JMenu("Help");
|
|
|
private final JCheckBox consoleLogCheckBox = new JCheckBox("Show program console log");
|
|
|
+ private final JCheckBox useFlexibleDevicesCheckBox = new JCheckBox("Automatically use flexible devices");
|
|
|
private final JMenuItem mntmOpen = new JMenuItem("Open");
|
|
|
private final JMenuItem mntmNew = new JMenuItem("New");
|
|
|
private final JMenuItem mntmSave = new JMenuItem("Save");
|
|
@@ -158,10 +159,10 @@ public class GUI implements CategoryListener {
|
|
|
private final JMenuItem mntmEditShowedInformation = new JMenuItem("Edit showed Information");
|
|
|
private final JMenuItem mntmResetCategory = new JMenuItem("Reset Categories");
|
|
|
private final JMenu mnLanguage = new JMenu("Language");
|
|
|
- private final String[] columnNamesMulti = {"Object", "Nr.", "Device", "Energy", "Flexibility", "Quantity", "Activated",
|
|
|
- "Flex. activated"};
|
|
|
- private final String[] columnNamesSingle = {"Nr.", "Device", "Energy", "Flexibility", "Quantity", "Activated",
|
|
|
- "Flex. activated"};
|
|
|
+ private final String[] columnNamesMulti = {"Object", "Nr.", "Device", "Energy", "Flexible Energy Available",
|
|
|
+ "Quantity", "Activated", "Flexible"};
|
|
|
+ private final String[] columnNamesSingle = {"Nr.", "Device", "Energy", "Flexible Energy Available", "Quantity",
|
|
|
+ "Activated", "Flexible"};
|
|
|
private final ArrayList<PropertyTable> tables = new ArrayList<>();
|
|
|
private final String[] comboBoxCat = {"Category", "Object", "Switch"};
|
|
|
private final UpdateController updCon;
|
|
@@ -624,6 +625,11 @@ public class GUI implements CategoryListener {
|
|
|
consoleLogCheckBox.setSelected(true);
|
|
|
consoleLogCheckBox.addActionListener(arg0 -> controller.setShowConsoleLog(consoleLogCheckBox.isSelected()));
|
|
|
|
|
|
+ mnNewMenuOptions.add(useFlexibleDevicesCheckBox);
|
|
|
+ useFlexibleDevicesCheckBox.setSelected(true);
|
|
|
+ useFlexibleDevicesCheckBox.addActionListener(
|
|
|
+ actionEvent -> model.setUseFlexibleDevices(useFlexibleDevicesCheckBox.isSelected()));
|
|
|
+
|
|
|
menuBar.add(mnNewMenuView);
|
|
|
|
|
|
mnNewMenuView.add(mntmCanvasSize);
|
|
@@ -1018,29 +1024,29 @@ public class GUI implements CategoryListener {
|
|
|
int selectedValueX = (int) Math.floor(xThis / (model.getTableHolonElement().getWidth() / 7));
|
|
|
int selectedValueBX = (int) Math.floor(xBThis / (model.getTableHolonElement().getWidth() / 7));
|
|
|
if (updCon.getActualCps() != null && updCon.getActualCps().getClass() == HolonObject.class) {
|
|
|
+ HolonElement eleTemp;
|
|
|
+
|
|
|
|
|
|
if (selectedValueBX == 5) {
|
|
|
- HolonElement eleBTemp = updCon
|
|
|
+ eleTemp = updCon
|
|
|
.getActualHolonElement((HolonObject) updCon.getActualCps(), yBMouse, 0, tables);
|
|
|
String newBStuff = model.getSingleTable().getValueAt(selectedValueBY, selectedValueBX)
|
|
|
.toString();
|
|
|
Boolean bTemp = Boolean.parseBoolean(newBStuff);
|
|
|
- eleBTemp.setActive(bTemp);
|
|
|
+ eleTemp.setActive(bTemp);
|
|
|
+
|
|
|
}
|
|
|
else if (selectedValueBX == 6) {
|
|
|
- HolonElement eleBTemp = updCon
|
|
|
+ eleTemp = updCon
|
|
|
.getActualHolonElement((HolonObject) updCon.getActualCps(), yBMouse, 0, tables);
|
|
|
String newBStuff = model.getSingleTable().getValueAt(selectedValueBY, selectedValueBX)
|
|
|
.toString();
|
|
|
Boolean bTemp = Boolean.parseBoolean(newBStuff);
|
|
|
- eleBTemp.setFlexible(bTemp);
|
|
|
-
|
|
|
-
|
|
|
- setTableNewCellsAfterFlexibilityClick(bTemp, eleBTemp, selectedValueBY);
|
|
|
+ eleTemp.setFlexible(bTemp);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- HolonElement eleTemp = updCon.getActualHolonElement((HolonObject) updCon.getActualCps(),
|
|
|
+ eleTemp = updCon.getActualHolonElement((HolonObject) updCon.getActualCps(),
|
|
|
yMouse, 0, tables);
|
|
|
String newStuff = model.getSingleTable().getValueAt(selectedValueY, selectedValueX)
|
|
|
.toString();
|
|
@@ -1062,6 +1068,9 @@ public class GUI implements CategoryListener {
|
|
|
eleTemp.setAmount(iTemp);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ updateElementTableAfterChange(eleTemp, selectedValueBY);
|
|
|
}
|
|
|
}
|
|
|
updCon.refreshTableProperties(model.getPropertyTable());
|
|
@@ -2237,10 +2246,10 @@ public class GUI implements CategoryListener {
|
|
|
* @param eleBTemp
|
|
|
* @param selectedValueBY
|
|
|
*/
|
|
|
- private void setTableNewCellsAfterFlexibilityClick(boolean bTemp, HolonElement eleBTemp, int selectedValueBY) {
|
|
|
- if (bTemp) {
|
|
|
- model.getSingleTable().setValueAt(Boolean.FALSE, selectedValueBY, 5);
|
|
|
- }
|
|
|
+ private void updateElementTableAfterChange(HolonElement eleBTemp, int selectedValueBY) {
|
|
|
+ model.getSingleTable().setValueAt(eleBTemp.isFlexible(), selectedValueBY, 6);
|
|
|
+ model.getSingleTable().setValueAt(eleBTemp.isActive(), selectedValueBY, 5);
|
|
|
+ model.getSingleTable().setValueAt(eleBTemp.getAmount(), selectedValueBY, 4);
|
|
|
model.getSingleTable().setValueAt(eleBTemp.getFlexibleEnergyAvailable(), selectedValueBY, 3);
|
|
|
model.getSingleTable().setValueAt(eleBTemp.getEnergy(), selectedValueBY, 2);
|
|
|
}
|