|
@@ -276,7 +276,8 @@ public class GUI implements CategoryListener {
|
|
|
toolBarHolonEl.add(btnAddHolEL);
|
|
|
btnAddHolEL.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent arg0) {
|
|
|
- if (tempCps != null && tempCps.getClass() == HolonObject.class) {
|
|
|
+ System.out.println(tempCps.getName() + " with ID: " + tempCps.getID());
|
|
|
+ if (tempCps != null && tempCps.getClass() == HolonObject.class && tempCps.getID() != 0) {
|
|
|
addElementPopUp = new AddElementPopUp();
|
|
|
addElementPopUp.setVisible(true);
|
|
|
controller.addElementCanvasObject(tempCps.getName(), addElementPopUp.getElement().getEleName(),
|
|
@@ -287,7 +288,7 @@ public class GUI implements CategoryListener {
|
|
|
toolBarHolonEl.add(btnDelHolEL);
|
|
|
btnDelHolEL.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent arg0) {
|
|
|
- if (tempElement != null && tempCps.getClass() == HolonObject.class) {
|
|
|
+ if (tempElement != null && tempCps.getClass() == HolonObject.class && tempCps.getID() != 0) {
|
|
|
System.out.println(tempCps.getID());
|
|
|
controller.deleteElementCanvas(tempCps.getID(), tempElement.getEleName());
|
|
|
}
|
|
@@ -296,11 +297,13 @@ public class GUI implements CategoryListener {
|
|
|
|
|
|
tableHolonElement.addMouseListener(new MouseAdapter() {
|
|
|
public void mousePressed(MouseEvent e) {
|
|
|
- int rowSelected = (int) Math.floor(e.getY() / 16);
|
|
|
- if (tableHolonElement.getRowCount() > rowSelected) {
|
|
|
- tempElement = ((HolonObject) tempCps).getElements().get(rowSelected);
|
|
|
- } else {
|
|
|
- tempElement = null;
|
|
|
+ if (tempCps != null) {
|
|
|
+ int rowSelected = (int) Math.floor(e.getY() / 16);
|
|
|
+ if (tableHolonElement.getRowCount() > rowSelected) {
|
|
|
+ tempElement = ((HolonObject) tempCps).getElements().get(rowSelected);
|
|
|
+ } else {
|
|
|
+ tempElement = null;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
});
|