|
@@ -21,6 +21,7 @@ import java.beans.PropertyChangeListener;
|
|
|
import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
|
|
|
import javax.swing.AbstractAction;
|
|
|
import javax.swing.ActionMap;
|
|
@@ -118,7 +119,8 @@ public class GUI<E> implements CategoryListener {
|
|
|
// HolonObject with consumption/production, name and amount.
|
|
|
|
|
|
private JTable tableHolonElement = new JTable();
|
|
|
- private PropertyTable tableModelHolonElement = new PropertyTable();
|
|
|
+ private PropertyTable tableModelHolonElementMulti = new PropertyTable();
|
|
|
+ private PropertyTable tableModelHolonElementSingle = new PropertyTable();
|
|
|
private final JPanel scrollElements = new JPanel();
|
|
|
private JScrollPane tableHolonElementScrollPane = new JScrollPane();
|
|
|
|
|
@@ -239,8 +241,6 @@ public class GUI<E> implements CategoryListener {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-
|
|
|
-
|
|
|
JPanel contentPane = (JPanel) frmCyberPhysical.getContentPane();
|
|
|
|
|
|
int condition = JComponent.WHEN_IN_FOCUSED_WINDOW;
|
|
@@ -248,9 +248,9 @@ public class GUI<E> implements CategoryListener {
|
|
|
ActionMap actionMap = contentPane.getActionMap();
|
|
|
|
|
|
String cntrlZDown = "controlZ";
|
|
|
- inputMap.put(KeyStroke.getKeyStroke("control Z" ), cntrlZDown);
|
|
|
+ inputMap.put(KeyStroke.getKeyStroke("control Z"), cntrlZDown);
|
|
|
actionMap.put(cntrlZDown, new AbstractAction() {
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
try {
|
|
@@ -276,11 +276,11 @@ public class GUI<E> implements CategoryListener {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
String cntrlYDown = "controlY";
|
|
|
- inputMap.put(KeyStroke.getKeyStroke("control Y" ), cntrlYDown);
|
|
|
+ inputMap.put(KeyStroke.getKeyStroke("control Y"), cntrlYDown);
|
|
|
actionMap.put(cntrlYDown, new AbstractAction() {
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
try {
|
|
@@ -306,7 +306,6 @@ public class GUI<E> implements CategoryListener {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
|
|
|
frmCyberPhysical.setJMenuBar(menuBar);
|
|
|
|
|
@@ -408,10 +407,12 @@ public class GUI<E> implements CategoryListener {
|
|
|
* RIGHT CONTAINER (INFORMATION)
|
|
|
**********************/
|
|
|
// Set up of the HolonElements section
|
|
|
- Object[] columnNames = { "Object", "Device", "Energy", "Quantity", "Activated" };
|
|
|
- tableModelHolonElement.setColumnIdentifiers(columnNames);
|
|
|
+ Object[] columnNamesMulti = { "Object", "Device", "Energy", "Quantity", "Activated" };
|
|
|
+ tableModelHolonElementMulti.setColumnIdentifiers(columnNamesMulti);
|
|
|
+ Object[] columnNamesSingle = { "Device", "Energy", "Quantity", "Activated" };
|
|
|
+ tableModelHolonElementSingle.setColumnIdentifiers(columnNamesSingle);
|
|
|
tableHolonElement.setBorder(null);
|
|
|
- tableHolonElement.setModel(tableModelHolonElement);
|
|
|
+
|
|
|
tableHolonElement.setFillsViewportHeight(true);
|
|
|
tableHolonElement.setCellSelectionEnabled(true);
|
|
|
tableHolonElement.setColumnSelectionAllowed(true);
|
|
@@ -499,7 +500,6 @@ public class GUI<E> implements CategoryListener {
|
|
|
tableHolonElement.addMouseListener(new MouseAdapter() {
|
|
|
public void mousePressed(MouseEvent e) {
|
|
|
HolonObject obj = (HolonObject) getActualCps();
|
|
|
- ;
|
|
|
yValueElements = e.getY();
|
|
|
HolonElement ele = null;
|
|
|
if (model.getSelectedCpsObjects().size() == 1) {
|
|
@@ -507,8 +507,6 @@ public class GUI<E> implements CategoryListener {
|
|
|
} else {
|
|
|
ele = getActualHolonElement(null, yValueElements);
|
|
|
}
|
|
|
-
|
|
|
- // System.out.println(ele.getEleName());
|
|
|
if (e.isControlDown() && ele != null) {
|
|
|
if (!selectedElements.contains(ele)) {
|
|
|
selectedElements.add(ele);
|
|
@@ -538,13 +536,14 @@ public class GUI<E> implements CategoryListener {
|
|
|
selectedElements.clear();
|
|
|
holonEleNamesDisplayed = "None ";
|
|
|
}
|
|
|
- for (int i = 0; i < selectedElements.size(); i++) {
|
|
|
- if (i == 0) {
|
|
|
- System.out.println("Selected Items: " + selectedElements.get(i).getEleName());
|
|
|
- } else {
|
|
|
- System.out.println(selectedElements.get(i).getEleName());
|
|
|
- }
|
|
|
- }
|
|
|
+ // for (int i = 0; i < selectedElements.size(); i++) {
|
|
|
+ // if (i == 0) {
|
|
|
+ // System.out.println("Selected Items: " +
|
|
|
+ // selectedElements.get(i).getEleName());
|
|
|
+ // } else {
|
|
|
+ // System.out.println(selectedElements.get(i).getEleName());
|
|
|
+ // }
|
|
|
+ // }
|
|
|
elementGraph.setText(holonEleNamesDisplayed);
|
|
|
yBTHIS = e.getY();
|
|
|
xBTHIS = e.getX();
|
|
@@ -562,35 +561,73 @@ public class GUI<E> implements CategoryListener {
|
|
|
try {
|
|
|
int yMouse = yTHIS;
|
|
|
int yBMouse = yBTHIS;
|
|
|
- int selectedValueX = (int) Math.floor(xTHIS / (tableHolonElement.getWidth() / 5));
|
|
|
int selectedValueY = (int) Math.floor(yMouse / 16);
|
|
|
- int selectedValueBX = (int) Math.floor(xBTHIS / (tableHolonElement.getWidth() / 5));
|
|
|
int selectedValueBY = (int) Math.floor(yBMouse / 16);
|
|
|
- if (getActualCps() != null && getActualCps().getClass() == HolonObject.class) {
|
|
|
- if (selectedValueBX == 4) {
|
|
|
- HolonElement eleBTemp = getActualHolonElement((HolonObject) getActualCps(), yBMouse);
|
|
|
- String newBStuff = tableModelHolonElement.getValueAt(selectedValueBY, selectedValueBX)
|
|
|
- .toString();
|
|
|
- Boolean bTemp = Boolean.parseBoolean(newBStuff);
|
|
|
- eleBTemp.setActive(bTemp);
|
|
|
- } else {
|
|
|
- HolonElement eleTemp = getActualHolonElement((HolonObject) getActualCps(), yMouse);
|
|
|
- String newStuff = tableModelHolonElement.getValueAt(selectedValueY, selectedValueX)
|
|
|
- .toString();
|
|
|
- if (selectedValueX == 1) {
|
|
|
- eleTemp.setEleName(newStuff);
|
|
|
- } else if (selectedValueX == 2) {
|
|
|
- Float ftemp = Float.parseFloat(newStuff);
|
|
|
- eleTemp.setEnergy(ftemp);
|
|
|
- } else if (selectedValueX == 3) {
|
|
|
- Integer iTemp = Integer.parseInt(newStuff);
|
|
|
- eleTemp.setAmount(iTemp);
|
|
|
+ if (model.getSelectedCpsObjects().size() > 1) {
|
|
|
+ // Multiple Selection
|
|
|
+ int selectedValueX = (int) Math.floor(xTHIS / (tableHolonElement.getWidth() / 5));
|
|
|
+ int selectedValueBX = (int) Math.floor(xBTHIS / (tableHolonElement.getWidth() / 5));
|
|
|
+ if (getHolonObj(yMouse) != null) {
|
|
|
+ if (selectedValueBX == 4) {
|
|
|
+ HolonElement eleBTemp = getActualHolonElement(null, yBMouse);
|
|
|
+ String newBStuff = tableModelHolonElementMulti
|
|
|
+ .getValueAt(selectedValueBY, selectedValueBX).toString();
|
|
|
+ Boolean bTemp = Boolean.parseBoolean(newBStuff);
|
|
|
+ eleBTemp.setActive(bTemp);
|
|
|
+ } else {
|
|
|
+ HolonElement eleTemp = getActualHolonElement(null, yMouse);
|
|
|
+ String newStuff = tableModelHolonElementMulti.getValueAt(selectedValueY, selectedValueX)
|
|
|
+ .toString();
|
|
|
+ // Small bug, when it comes to edit the name of
|
|
|
+ // the HolonElement
|
|
|
+ if (selectedValueX == 1) {
|
|
|
+ eleTemp.setEleName(newStuff);
|
|
|
+ } else if (selectedValueX == 2) {
|
|
|
+ Float ftemp = Float.parseFloat(newStuff);
|
|
|
+ eleTemp.setEnergy(ftemp);
|
|
|
+ } else if (selectedValueX == 3) {
|
|
|
+ Integer iTemp = Integer.parseInt(newStuff);
|
|
|
+ eleTemp.setAmount(iTemp);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- refreshTableProperties();
|
|
|
- tableModelHolonElement.fireTableDataChanged();
|
|
|
- controller.calculateStateForTimeStep(model.getCurIteration());
|
|
|
- unitGraph.repaint();
|
|
|
+ } else if (model.getSelectedCpsObjects().size() == 1) {
|
|
|
+ // Single Selection
|
|
|
+ int selectedValueX = (int) Math.floor(xTHIS / (tableHolonElement.getWidth() / 4));
|
|
|
+ int selectedValueBX = (int) Math.floor(xBTHIS / (tableHolonElement.getWidth() / 4));
|
|
|
+ if (getActualCps() != null && getActualCps().getClass() == HolonObject.class) {
|
|
|
+ if (selectedValueBX == 3) {
|
|
|
+ HolonElement eleBTemp = getActualHolonElement((HolonObject) getActualCps(), yBMouse);
|
|
|
+ String newBStuff = tableModelHolonElementSingle
|
|
|
+ .getValueAt(selectedValueBY, selectedValueBX).toString();
|
|
|
+ Boolean bTemp = Boolean.parseBoolean(newBStuff);
|
|
|
+ eleBTemp.setActive(bTemp);
|
|
|
+ } else {
|
|
|
+ HolonElement eleTemp = getActualHolonElement((HolonObject) getActualCps(), yMouse);
|
|
|
+ String newStuff = tableModelHolonElementSingle
|
|
|
+ .getValueAt(selectedValueY, selectedValueX).toString();
|
|
|
+ // Small bug, when it comes to edit the name of
|
|
|
+ // the HolonElement
|
|
|
+ if (selectedValueX == 0) {
|
|
|
+ eleTemp.setEleName(newStuff);
|
|
|
+ } else if (selectedValueX == 1) {
|
|
|
+ Float ftemp = Float.parseFloat(newStuff);
|
|
|
+ eleTemp.setEnergy(ftemp);
|
|
|
+ } else if (selectedValueX == 2) {
|
|
|
+ Integer iTemp = Integer.parseInt(newStuff);
|
|
|
+ eleTemp.setAmount(iTemp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // for (HolonElement e : ((HolonObject)
|
|
|
+ // getActualCps()).getElements()) {
|
|
|
+ // System.out.println(e.getEleName() + ", " +
|
|
|
+ // e.getEnergy() + ", " + e.getAmount());
|
|
|
+ // }
|
|
|
+ refreshTableProperties();
|
|
|
+ tableModelHolonElementSingle.fireTableDataChanged();
|
|
|
+ controller.calculateStateForTimeStep(model.getCurIteration());
|
|
|
+ unitGraph.repaint();
|
|
|
+ }
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
|
|
@@ -606,6 +643,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
* to be edited is the name and for CpsEdge the Max.flow)
|
|
|
*/
|
|
|
tableProperties.addPropertyChangeListener(new PropertyChangeListener() {
|
|
|
+
|
|
|
@Override
|
|
|
public void propertyChange(PropertyChangeEvent evt) {
|
|
|
try {
|
|
@@ -739,7 +777,8 @@ public class GUI<E> implements CategoryListener {
|
|
|
if (selectedNode.getLevel() == 2) {
|
|
|
CpsObject selected = controller.searchCategoryObject(selectedNode.getParent().toString(),
|
|
|
selectedNode.toString());
|
|
|
- deleteRows();
|
|
|
+ deleteRows(tableModelHolonElementSingle);
|
|
|
+ deleteRows(tableModelHolonElementMulti);
|
|
|
// if (selected instanceof HolonObject && selected !=
|
|
|
// null) {
|
|
|
// selected = (HolonObject) selected;
|
|
@@ -864,6 +903,9 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
@Override
|
|
|
public void mousePressed(MouseEvent e) {
|
|
|
+ selectedElements.clear();
|
|
|
+ holonEleNamesDisplayed = "None ";
|
|
|
+
|
|
|
if (temp == null || temp.getID() != model.getSelectedObjectID()) {
|
|
|
unitGraph.empty();
|
|
|
elementGraph.setText("None ");
|
|
@@ -892,15 +934,16 @@ public class GUI<E> implements CategoryListener {
|
|
|
// null) {
|
|
|
// selectedObjects.add(model.getSelectedEdge());
|
|
|
// }
|
|
|
- boolean nothingImportant = true;
|
|
|
- for (CpsObject c : model.getSelectedCpsObjects()) {
|
|
|
- if (nothingImportant) {
|
|
|
- System.out.println("Elements: " + c.getName() + " and ID: " + c.getID());
|
|
|
- nothingImportant = false;
|
|
|
- } else {
|
|
|
- System.out.println(c.getName() + " and ID: " + c.getID());
|
|
|
- }
|
|
|
- }
|
|
|
+ // boolean nothingImportant = true;
|
|
|
+ // for (CpsObject c : model.getSelectedCpsObjects()) {
|
|
|
+ // if (nothingImportant) {
|
|
|
+ // System.out.println("Elements: " + c.getName() + " and ID: " +
|
|
|
+ // c.getID());
|
|
|
+ // nothingImportant = false;
|
|
|
+ // } else {
|
|
|
+ // System.out.println(c.getName() + " and ID: " + c.getID());
|
|
|
+ // }
|
|
|
+ // }
|
|
|
// Write new data
|
|
|
if (temp != null) {
|
|
|
Object[] tempName = { "Name", temp.getName() };
|
|
@@ -911,18 +954,20 @@ public class GUI<E> implements CategoryListener {
|
|
|
refreshTableHolonElement();
|
|
|
Object[] tempEnergy = { "Total Energy", ((HolonObject) temp).getCurrentEnergy() };
|
|
|
tableModelProperties.addRow(tempEnergy);
|
|
|
- } else if (temp instanceof HolonTransformer) {
|
|
|
- deleteRows();
|
|
|
- Object[] tempRatioPerc = { "Ratio Type", true };
|
|
|
- tableModelProperties.addRow(tempRatioPerc);
|
|
|
+ // } else if (temp instanceof HolonTransformer) {
|
|
|
+ // deleteRows();
|
|
|
+ // Object[] tempRatioPerc = { "Ratio Type", true };
|
|
|
+ // tableModelProperties.addRow(tempRatioPerc);
|
|
|
} else if (temp instanceof HolonSwitch) {
|
|
|
- deleteRows();
|
|
|
+ deleteRows(tableModelHolonElementSingle);
|
|
|
+ deleteRows(tableModelHolonElementMulti);
|
|
|
Object[] tempActive = { "Active", ((HolonSwitch) temp).getActiveAt()[model.getCurIteration()] };
|
|
|
tableModelProperties.addRow(tempActive);
|
|
|
unitGraph.repaintWithNewSwitch((HolonSwitch) temp);
|
|
|
elementGraph.setText(temp.getName());
|
|
|
} else {
|
|
|
- deleteRows();
|
|
|
+ deleteRows(tableModelHolonElementSingle);
|
|
|
+ deleteRows(tableModelHolonElementMulti);
|
|
|
}
|
|
|
tableModelProperties.setCellEditable(0, 1, true);
|
|
|
tableModelProperties.setCellEditable(2, 1, false);
|
|
@@ -965,7 +1010,13 @@ public class GUI<E> implements CategoryListener {
|
|
|
tableModelProperties.setCellEditable(0, 1, false);
|
|
|
tableModelProperties.setCellEditable(2, 1, true);
|
|
|
} else if (getActualCps() == null) {
|
|
|
- deleteRows();
|
|
|
+ deleteRows(tableModelHolonElementSingle);
|
|
|
+ deleteRows(tableModelHolonElementMulti);
|
|
|
+ }
|
|
|
+ if (model.getSelectedCpsObjects().size() > 1) {
|
|
|
+ tableHolonElement.setModel(tableModelHolonElementMulti);
|
|
|
+ } else if (model.getSelectedCpsObjects().size() == 1) {
|
|
|
+ tableHolonElement.setModel(tableModelHolonElementSingle);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -973,7 +1024,13 @@ public class GUI<E> implements CategoryListener {
|
|
|
public void mouseReleased(MouseEvent e) {
|
|
|
refreshTableHolonElement();
|
|
|
refreshTableProperties();
|
|
|
+ if (model.getSelectedCpsObjects().size() > 1) {
|
|
|
+ tableHolonElement.setModel(tableModelHolonElementMulti);
|
|
|
+ } else if (model.getSelectedCpsObjects().size() == 1) {
|
|
|
+ tableHolonElement.setModel(tableModelHolonElementSingle);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
});
|
|
|
|
|
|
toolBar.add(btnAdd);
|
|
@@ -1310,17 +1367,22 @@ public class GUI<E> implements CategoryListener {
|
|
|
*/
|
|
|
public HolonElement getActualHolonElement(HolonObject obj, int yValue) {
|
|
|
final int yTemp = (int) Math.floor(yValue / 16);
|
|
|
- int rowsTotal = tableModelHolonElement.getRowCount();
|
|
|
+ int rowsTotal = tableModelHolonElementSingle.getRowCount();
|
|
|
+ if (obj == null) {
|
|
|
+ rowsTotal = tableModelHolonElementMulti.getRowCount();
|
|
|
+ }
|
|
|
HolonObject obtTemp = null;
|
|
|
+ String eleTempName = "";
|
|
|
if (rowsTotal != 0 && rowsTotal > yTemp) {
|
|
|
if (obj == null) {
|
|
|
- String temp = tableModelHolonElement.getValueAt(yTemp, 0).toString();
|
|
|
+ String temp = tableModelHolonElementMulti.getValueAt(yTemp, 0).toString();
|
|
|
int idTemp = Integer.parseInt(temp.split(", ")[1]);
|
|
|
obtTemp = (HolonObject) controller.searchByID(idTemp);
|
|
|
+ eleTempName = tableModelHolonElementMulti.getValueAt(yTemp, 1).toString();
|
|
|
} else {
|
|
|
obtTemp = obj;
|
|
|
+ eleTempName = tableModelHolonElementSingle.getValueAt(yTemp, 0).toString();
|
|
|
}
|
|
|
- String eleTempName = tableModelHolonElement.getValueAt(yTemp, 1).toString();
|
|
|
model.setSelectedHolonElement(obtTemp.searchElement(eleTempName));
|
|
|
return obtTemp.searchElement(eleTempName);
|
|
|
} else {
|
|
@@ -1329,6 +1391,15 @@ public class GUI<E> implements CategoryListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public HolonObject getHolonObj(int yValue) {
|
|
|
+ final int yTemp = (int) Math.floor(yValue / 16);
|
|
|
+ HolonObject obtTemp = null;
|
|
|
+ String temp = tableModelHolonElementMulti.getValueAt(yTemp, 0).toString();
|
|
|
+ int idTemp = Integer.parseInt(temp.split(", ")[1]);
|
|
|
+ obtTemp = (HolonObject) controller.searchByID(idTemp);
|
|
|
+ return obtTemp;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Update the HolonElement Table, that means erase all rows and add the new
|
|
|
* rows with new data
|
|
@@ -1337,20 +1408,24 @@ public class GUI<E> implements CategoryListener {
|
|
|
// Update of the Information about the HolonElements - only for
|
|
|
// HolonObjects
|
|
|
|
|
|
- deleteRows();
|
|
|
- if (model.getSelectedCpsObjects() != null) {
|
|
|
+ if (model.getSelectedCpsObjects().size() > 1) {
|
|
|
+ deleteRows(tableModelHolonElementMulti);
|
|
|
fillElementTable(model.getSelectedCpsObjects());
|
|
|
+ tableModelHolonElementMulti.fireTableDataChanged();
|
|
|
+ } else if (model.getSelectedCpsObjects().size() == 1) {
|
|
|
+ deleteRows(tableModelHolonElementSingle);
|
|
|
+ fillElementTable(model.getSelectedCpsObjects());
|
|
|
+ tableModelHolonElementSingle.fireTableDataChanged();
|
|
|
}
|
|
|
- tableModelHolonElement.fireTableDataChanged();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Erase all information of the HolonElement Model
|
|
|
*/
|
|
|
- public void deleteRows() {
|
|
|
- if (tableModelHolonElement.getRowCount() > 0) {
|
|
|
- for (int i = tableModelHolonElement.getRowCount() - 1; i > -1; i--) {
|
|
|
- tableModelHolonElement.removeRow(i);
|
|
|
+ public void deleteRows(PropertyTable t) {
|
|
|
+ if (t.getRowCount() > 0) {
|
|
|
+ for (int i = t.getRowCount() - 1; i > -1; i--) {
|
|
|
+ t.removeRow(i);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1363,12 +1438,22 @@ public class GUI<E> implements CategoryListener {
|
|
|
* ArrayList to be displayed
|
|
|
*/
|
|
|
public void fillElementTable(ArrayList<CpsObject> objects) {
|
|
|
- for (CpsObject o : objects) {
|
|
|
+ if (objects.size() > 1) {
|
|
|
+ for (CpsObject o : objects) {
|
|
|
+ if (o instanceof HolonObject) {
|
|
|
+ for (HolonElement he : ((HolonObject) o).getElements()) {
|
|
|
+ Object[] temp = { o.getName() + ", " + o.getID(), he.getEleName(), he.getEnergy(),
|
|
|
+ he.getAmount(), he.getActive() };
|
|
|
+ tableModelHolonElementMulti.addRow(temp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (objects.size() == 1) {
|
|
|
+ CpsObject o = objects.get(0);
|
|
|
if (o instanceof HolonObject) {
|
|
|
for (HolonElement he : ((HolonObject) o).getElements()) {
|
|
|
- Object[] temp = { o.getName() + ", " + o.getID(), he.getEleName(), he.getEnergy(), he.getAmount(),
|
|
|
- he.getActive() };
|
|
|
- tableModelHolonElement.addRow(temp);
|
|
|
+ Object[] temp = { he.getEleName(), he.getEnergy(), he.getAmount(), he.getActive() };
|
|
|
+ tableModelHolonElementSingle.addRow(temp);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1378,13 +1463,13 @@ public class GUI<E> implements CategoryListener {
|
|
|
* Update the information concerning properties of the selected CpsObject
|
|
|
*/
|
|
|
public void refreshTableProperties() {
|
|
|
- CpsObject tempCps = getActualCps();
|
|
|
- if (tempCps != null && tempCps.getClass() == HolonObject.class) {
|
|
|
- tableModelProperties.removeRow(2);
|
|
|
- Object[] tempEnergy = { "Total Energy", ((HolonObject) tempCps).getCurrentEnergy() };
|
|
|
- tableModelProperties.insertRow(2, tempEnergy);
|
|
|
- } else if (tempCps instanceof HolonTransformer) {
|
|
|
- // Refresh Transformer Info
|
|
|
+ if (model.getSelectedCpsObjects().size() == 1) {
|
|
|
+ CpsObject tempCps = getActualCps();
|
|
|
+ if (tempCps != null && tempCps.getClass() == HolonObject.class) {
|
|
|
+ tableModelProperties.removeRow(2);
|
|
|
+ Object[] tempEnergy = { "Total Energy", ((HolonObject) tempCps).getCurrentEnergy() };
|
|
|
+ tableModelProperties.insertRow(2, tempEnergy);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|