|
@@ -105,7 +105,7 @@ public class GUI<E> implements CategoryListener {
|
|
private final JLabel elementGraph = new JLabel("None ");
|
|
private final JLabel elementGraph = new JLabel("None ");
|
|
private final ArrayList<HolonElement> selectedElements = new ArrayList<HolonElement>();
|
|
private final ArrayList<HolonElement> selectedElements = new ArrayList<HolonElement>();
|
|
private String holonEleNamesDisplayed = "None ";
|
|
private String holonEleNamesDisplayed = "None ";
|
|
- HashMap<Integer, ArrayList<HolonElement>> eleToDelete = new HashMap<Integer, ArrayList<HolonElement>>();
|
|
|
|
|
|
+ private HashMap<Integer, ArrayList<HolonElement>> eleToDelete = new HashMap<Integer, ArrayList<HolonElement>>();
|
|
private final JTree tree = new JTree();
|
|
private final JTree tree = new JTree();
|
|
/******************************************
|
|
/******************************************
|
|
************* Right Container*************
|
|
************* Right Container*************
|
|
@@ -655,8 +655,10 @@ public class GUI<E> implements CategoryListener {
|
|
addElementPopUp.setActualCps(getActualCps());
|
|
addElementPopUp.setActualCps(getActualCps());
|
|
addElementPopUp.setVisible(true);
|
|
addElementPopUp.setVisible(true);
|
|
HolonElement ele = addElementPopUp.getElement();
|
|
HolonElement ele = addElementPopUp.getElement();
|
|
- controller.addElementCanvasObject(tempCpsObject.getID(), ele.getEleName(), ele.getAmount(),
|
|
|
|
- ele.getEnergy());
|
|
|
|
|
|
+ if (ele != null) {
|
|
|
|
+ controller.addElementCanvasObject(tempCpsObject.getID(), ele.getEleName(), ele.getAmount(),
|
|
|
|
+ ele.getEnergy());
|
|
|
|
+ }
|
|
refreshTableHolonElement();
|
|
refreshTableHolonElement();
|
|
refreshTableProperties();
|
|
refreshTableProperties();
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
controller.calculateStateForTimeStep(model.getCurIteration());
|
|
@@ -848,7 +850,7 @@ public class GUI<E> implements CategoryListener {
|
|
**********************/
|
|
**********************/
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Update of the mouse coord
|
|
|
|
|
|
+ * Update of the mouse coord for Edit-Mode
|
|
*/
|
|
*/
|
|
tableProperties.addMouseListener(new MouseAdapter() {
|
|
tableProperties.addMouseListener(new MouseAdapter() {
|
|
public void mousePressed(MouseEvent e) {
|
|
public void mousePressed(MouseEvent e) {
|
|
@@ -1621,7 +1623,7 @@ public class GUI<E> implements CategoryListener {
|
|
*
|
|
*
|
|
* @return selected CpsObject
|
|
* @return selected CpsObject
|
|
*/
|
|
*/
|
|
- public CpsObject getActualCps() {
|
|
|
|
|
|
+ private CpsObject getActualCps() {
|
|
int tempID = model.getSelectedObjectID();
|
|
int tempID = model.getSelectedObjectID();
|
|
CpsObject tempCps = controller.searchByID(tempID);
|
|
CpsObject tempCps = controller.searchByID(tempID);
|
|
return tempCps;
|
|
return tempCps;
|
|
@@ -1640,7 +1642,7 @@ public class GUI<E> implements CategoryListener {
|
|
* Control, 2 means MultiSelection with Control
|
|
* Control, 2 means MultiSelection with Control
|
|
* @return the selected HolonElement
|
|
* @return the selected HolonElement
|
|
*/
|
|
*/
|
|
- public HolonElement getActualHolonElement(HolonObject obj, int yValue, int toMultiHash) {
|
|
|
|
|
|
+ private HolonElement getActualHolonElement(HolonObject obj, int yValue, int toMultiHash) {
|
|
final int yTemp = (int) Math.floor(yValue / 16);
|
|
final int yTemp = (int) Math.floor(yValue / 16);
|
|
int rowsTotal = 0;
|
|
int rowsTotal = 0;
|
|
// Filter for search --> single and multi selection
|
|
// Filter for search --> single and multi selection
|
|
@@ -1700,7 +1702,7 @@ public class GUI<E> implements CategoryListener {
|
|
* @param yValue
|
|
* @param yValue
|
|
* @return clicked HolonObject
|
|
* @return clicked HolonObject
|
|
*/
|
|
*/
|
|
- public HolonObject getHolonObj(int yValue) {
|
|
|
|
|
|
+ private HolonObject getHolonObj(int yValue) {
|
|
final int yTemp = (int) Math.floor(yValue / 16);
|
|
final int yTemp = (int) Math.floor(yValue / 16);
|
|
HolonObject obtTemp = null;
|
|
HolonObject obtTemp = null;
|
|
String temp = tableModelHolonElementMulti.getValueAt(yTemp, 0).toString();
|
|
String temp = tableModelHolonElementMulti.getValueAt(yTemp, 0).toString();
|
|
@@ -1713,7 +1715,7 @@ public class GUI<E> implements CategoryListener {
|
|
* Update the HolonElement Table, that means erase all rows and add the new
|
|
* Update the HolonElement Table, that means erase all rows and add the new
|
|
* rows with new data
|
|
* rows with new data
|
|
*/
|
|
*/
|
|
- public void refreshTableHolonElement() {
|
|
|
|
|
|
+ private void refreshTableHolonElement() {
|
|
// Update of the Information about the HolonElements - only for
|
|
// Update of the Information about the HolonElements - only for
|
|
// HolonObjects
|
|
// HolonObjects
|
|
|
|
|
|
@@ -1731,7 +1733,7 @@ public class GUI<E> implements CategoryListener {
|
|
/**
|
|
/**
|
|
* Erase all information of the HolonElement Model
|
|
* Erase all information of the HolonElement Model
|
|
*/
|
|
*/
|
|
- public void deleteRows(PropertyTable t) {
|
|
|
|
|
|
+ private void deleteRows(PropertyTable t) {
|
|
if (t.getRowCount() > 0) {
|
|
if (t.getRowCount() > 0) {
|
|
for (int i = t.getRowCount() - 1; i > -1; i--) {
|
|
for (int i = t.getRowCount() - 1; i > -1; i--) {
|
|
t.removeRow(i);
|
|
t.removeRow(i);
|
|
@@ -1746,7 +1748,7 @@ public class GUI<E> implements CategoryListener {
|
|
* @param elements
|
|
* @param elements
|
|
* ArrayList to be displayed
|
|
* ArrayList to be displayed
|
|
*/
|
|
*/
|
|
- public void fillElementTable(ArrayList<CpsObject> objects) {
|
|
|
|
|
|
+ private void fillElementTable(ArrayList<CpsObject> objects) {
|
|
if (objects.size() > 1) {
|
|
if (objects.size() > 1) {
|
|
for (CpsObject o : objects) {
|
|
for (CpsObject o : objects) {
|
|
if (o instanceof HolonObject) {
|
|
if (o instanceof HolonObject) {
|
|
@@ -1771,7 +1773,7 @@ public class GUI<E> implements CategoryListener {
|
|
/**
|
|
/**
|
|
* Update the information concerning properties of the selected CpsObject
|
|
* Update the information concerning properties of the selected CpsObject
|
|
*/
|
|
*/
|
|
- public void refreshTableProperties() {
|
|
|
|
|
|
+ private void refreshTableProperties() {
|
|
if (model.getSelectedCpsObjects().size() == 1) {
|
|
if (model.getSelectedCpsObjects().size() == 1) {
|
|
CpsObject tempCps = getActualCps();
|
|
CpsObject tempCps = getActualCps();
|
|
if (tempCps != null && tempCps.getClass() == HolonObject.class) {
|
|
if (tempCps != null && tempCps.getClass() == HolonObject.class) {
|