|
@@ -330,7 +330,7 @@ public class GUI<E> implements CategoryListener {
|
|
* RIGHT CONTAINER (INFORMATION)
|
|
* RIGHT CONTAINER (INFORMATION)
|
|
**********************/
|
|
**********************/
|
|
// Set up of the HolonElements section
|
|
// Set up of the HolonElements section
|
|
- Object[] columnNames = { "Device", "Energy", "Quantity", "Activated" };
|
|
|
|
|
|
+ Object[] columnNames = { "Object", "Device", "Energy", "Quantity", "Activated" };
|
|
tableModelHolonElement.setColumnIdentifiers(columnNames);
|
|
tableModelHolonElement.setColumnIdentifiers(columnNames);
|
|
tableHolonElement.setBorder(null);
|
|
tableHolonElement.setBorder(null);
|
|
tableHolonElement.setModel(tableModelHolonElement);
|
|
tableHolonElement.setModel(tableModelHolonElement);
|
|
@@ -775,6 +775,7 @@ public class GUI<E> implements CategoryListener {
|
|
* the clicked HolonObject
|
|
* the clicked HolonObject
|
|
*/
|
|
*/
|
|
canvas.addMouseListener(new MouseAdapter() {
|
|
canvas.addMouseListener(new MouseAdapter() {
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void mousePressed(MouseEvent e) {
|
|
public void mousePressed(MouseEvent e) {
|
|
if (temp == null || temp.getID() != model.getSelectedObjectID()) {
|
|
if (temp == null || temp.getID() != model.getSelectedObjectID()) {
|
|
@@ -789,6 +790,7 @@ public class GUI<E> implements CategoryListener {
|
|
// Update of the Information about the Properties - only for
|
|
// Update of the Information about the Properties - only for
|
|
// CpsObjects
|
|
// CpsObjects
|
|
// Erase old data
|
|
// Erase old data
|
|
|
|
+ System.out.println(model.getSelectedCpsObjects());
|
|
if (tableModelProperties.getRowCount() > 0) {
|
|
if (tableModelProperties.getRowCount() > 0) {
|
|
for (int i = tableModelProperties.getRowCount() - 1; i > -1; i--) {
|
|
for (int i = tableModelProperties.getRowCount() - 1; i > -1; i--) {
|
|
tableModelProperties.removeRow(i);
|
|
tableModelProperties.removeRow(i);
|
|
@@ -800,6 +802,9 @@ public class GUI<E> implements CategoryListener {
|
|
} else {
|
|
} else {
|
|
controller.addSelectedObject(temp);
|
|
controller.addSelectedObject(temp);
|
|
}
|
|
}
|
|
|
|
+ } else if (temp != null) {
|
|
|
|
+ model.getSelectedCpsObjects().clear();
|
|
|
|
+ controller.addSelectedObject(temp);
|
|
}
|
|
}
|
|
// } else if (e.isShiftDown() && model.getSelectedEdge() !=
|
|
// } else if (e.isShiftDown() && model.getSelectedEdge() !=
|
|
// null) {
|
|
// null) {
|
|
@@ -808,10 +813,10 @@ public class GUI<E> implements CategoryListener {
|
|
boolean nothingImportant = true;
|
|
boolean nothingImportant = true;
|
|
for (CpsObject c : model.getSelectedCpsObjects()) {
|
|
for (CpsObject c : model.getSelectedCpsObjects()) {
|
|
if (nothingImportant) {
|
|
if (nothingImportant) {
|
|
- System.out.println("Elements: " + c.getName());
|
|
|
|
|
|
+ System.out.println("Elements: " + c.getName() + " and ID: " + c.getID());
|
|
nothingImportant = false;
|
|
nothingImportant = false;
|
|
} else {
|
|
} else {
|
|
- System.out.println(c.getName());
|
|
|
|
|
|
+ System.out.println(c.getName() + " and ID: " + c.getID());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Write new data
|
|
// Write new data
|
|
@@ -881,6 +886,12 @@ public class GUI<E> implements CategoryListener {
|
|
deleteRows();
|
|
deleteRows();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void mouseReleased(MouseEvent e) {
|
|
|
|
+ refreshTableHolonElement();
|
|
|
|
+ refreshTableProperties();
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
toolBar.add(btnAdd);
|
|
toolBar.add(btnAdd);
|
|
@@ -1236,8 +1247,9 @@ public class GUI<E> implements CategoryListener {
|
|
// HolonObjects
|
|
// HolonObjects
|
|
|
|
|
|
deleteRows();
|
|
deleteRows();
|
|
- if (getActualCps() != null) {
|
|
|
|
- fillElementTable(((HolonObject) getActualCps()).getElements());
|
|
|
|
|
|
+ System.out.println(model.getSelectedCpsObjects());
|
|
|
|
+ if (model.getSelectedCpsObjects() != null) {
|
|
|
|
+ fillElementTable(model.getSelectedCpsObjects());
|
|
}
|
|
}
|
|
tableModelHolonElement.fireTableDataChanged();
|
|
tableModelHolonElement.fireTableDataChanged();
|
|
}
|
|
}
|
|
@@ -1260,10 +1272,14 @@ public class GUI<E> implements CategoryListener {
|
|
* @param elements
|
|
* @param elements
|
|
* ArrayList to be displayed
|
|
* ArrayList to be displayed
|
|
*/
|
|
*/
|
|
- public void fillElementTable(ArrayList<HolonElement> elements) {
|
|
|
|
- for (HolonElement he : elements) {
|
|
|
|
- Object[] temp = { he.getEleName(), he.getEnergy(), he.getAmount(), he.getActive() };
|
|
|
|
- tableModelHolonElement.addRow(temp);
|
|
|
|
|
|
+ public void fillElementTable(ArrayList<CpsObject> objects) {
|
|
|
|
+ for (CpsObject o : objects) {
|
|
|
|
+ if (o instanceof HolonObject) {
|
|
|
|
+ for (HolonElement he : ((HolonObject) o).getElements()) {
|
|
|
|
+ Object[] temp = { o.getName(), he.getEleName(), he.getEnergy(), he.getAmount(), he.getActive() };
|
|
|
|
+ tableModelHolonElement.addRow(temp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|