|
@@ -63,7 +63,7 @@ import javax.swing.tree.TreeCellRenderer;
|
|
|
import Interfaces.CategoryListener;
|
|
|
import classes.Category;
|
|
|
import classes.CpsEdge;
|
|
|
-import classes.CpsObject;
|
|
|
+import classes.AbstractCpsObject;
|
|
|
import classes.HolonElement;
|
|
|
import classes.HolonObject;
|
|
|
import classes.HolonSwitch;
|
|
@@ -193,7 +193,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
private boolean dragging = false;
|
|
|
private String actualObjectClicked;
|
|
|
private Image img = null;
|
|
|
- private CpsObject tempCps = null;
|
|
|
+ private AbstractCpsObject tempCps = null;
|
|
|
private int yValueElements = 0;
|
|
|
|
|
|
private Console console = new Console();
|
|
@@ -213,7 +213,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
// Coord for the Edit-Modus in the PropertieTable
|
|
|
private int yProThis;
|
|
|
private int xProThis;
|
|
|
- private CpsObject temp = null;
|
|
|
+ private AbstractCpsObject temp = null;
|
|
|
private final JButton btnTest = new JButton("test");
|
|
|
private final JMenuItem mntmUndo = new JMenuItem("Undo");
|
|
|
private final JMenuItem mntmRedo = new JMenuItem("Redo");
|
|
@@ -295,7 +295,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
controller.loadFile(controller.getUndoSave());
|
|
|
canvas.repaint();
|
|
|
ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
+ for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
if (cps instanceof HolonObject) {
|
|
|
for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
tempList.add(h);
|
|
@@ -332,7 +332,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
controller.loadFile(controller.getRedoSave());
|
|
|
canvas.repaint();
|
|
|
ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
+ for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
if (cps instanceof HolonObject) {
|
|
|
for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
tempList.add(h);
|
|
@@ -365,7 +365,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
model.getSelectedCpsObjects().clear();
|
|
|
- for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
+ for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
controller.addSelectedObject(cps);
|
|
|
}
|
|
|
canvas.repaint();
|
|
@@ -382,7 +382,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
|
- for (CpsObject cps : model.getSelectedCpsObjects()) {
|
|
|
+ for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
|
|
|
controller.delCanvasObject(cps);
|
|
|
}
|
|
|
model.getSelectedCpsObjects().clear();
|
|
@@ -648,7 +648,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
btnAddHolEL.addActionListener(new ActionListener() {
|
|
|
public void actionPerformed(ActionEvent arg0) {
|
|
|
if (model.getSelectedCpsObjects().size() == 1) {
|
|
|
- CpsObject tempCpsObject = getActualCps();
|
|
|
+ AbstractCpsObject tempCpsObject = getActualCps();
|
|
|
if (tempCpsObject != null && tempCpsObject.getClass() == HolonObject.class
|
|
|
&& tempCpsObject.getID() != 0) {
|
|
|
addElementPopUp = new AddElementPopUp();
|
|
@@ -948,7 +948,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
Image imgR = null;
|
|
|
if (leaf) {
|
|
|
for (Category cat : model.getCategories()) {
|
|
|
- for (CpsObject cps : cat.getObjects()) {
|
|
|
+ for (AbstractCpsObject cps : cat.getObjects()) {
|
|
|
if (value.toString().compareTo(cps.getObjName()) == 0) {
|
|
|
File checkPath = new File(cps.getImage());
|
|
|
if (checkPath.exists()) {
|
|
@@ -991,7 +991,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
if (dragging) {
|
|
|
int x = (int) canvas.getMousePosition().getX();
|
|
|
int y = (int) canvas.getMousePosition().getY();
|
|
|
- CpsObject h = null;
|
|
|
+ AbstractCpsObject h = null;
|
|
|
if (tempCps.getClass() == HolonObject.class) {
|
|
|
h = new HolonObject(tempCps);
|
|
|
}
|
|
@@ -1041,7 +1041,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
}
|
|
|
if (SwingUtilities.isRightMouseButton(e)) {
|
|
|
for (Category cat : model.getCategories()) {
|
|
|
- for (CpsObject cps : cat.getObjects()) {
|
|
|
+ for (AbstractCpsObject cps : cat.getObjects()) {
|
|
|
if (actualObjectClicked.compareTo(cps.getObjName()) == 0
|
|
|
&& !(cps instanceof HolonSwitch)) {
|
|
|
editItem.setEnabled(true);
|
|
@@ -1053,7 +1053,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
}
|
|
|
} else {
|
|
|
for (Category cat : model.getCategories()) {
|
|
|
- for (CpsObject cps : cat.getObjects()) {
|
|
|
+ for (AbstractCpsObject cps : cat.getObjects()) {
|
|
|
if (actualObjectClicked.compareTo(cps.getObjName()) == 0) {
|
|
|
File checkPath = new File(cps.getImage());
|
|
|
if (checkPath.exists()) {
|
|
@@ -1118,7 +1118,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
"Please select a Category first before adding " + selectedOption + ".");
|
|
|
}
|
|
|
if (selectedNode.getLevel() == 1) {
|
|
|
- CpsObject tmp = new HolonObject("");
|
|
|
+ AbstractCpsObject tmp = new HolonObject("");
|
|
|
addObjectPopUP = new AddObjectPopUp(false, tmp, null);
|
|
|
addObjectPopUP.setVisible(true);
|
|
|
addObjectPopUP.setController(controller);
|
|
@@ -1374,7 +1374,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
controller.loadFile(file.getAbsolutePath());
|
|
|
canvas.repaint();
|
|
|
ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
+ for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
if (cps instanceof HolonObject) {
|
|
|
for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
tempList.add(h);
|
|
@@ -1439,7 +1439,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
controller.loadFile(controller.getUndoSave());
|
|
|
canvas.repaint();
|
|
|
ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
+ for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
if (cps instanceof HolonObject) {
|
|
|
for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
tempList.add(h);
|
|
@@ -1475,7 +1475,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
controller.loadFile(controller.getRedoSave());
|
|
|
canvas.repaint();
|
|
|
ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (CpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
+ for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
if (cps instanceof HolonObject) {
|
|
|
for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
tempList.add(h);
|
|
@@ -1591,7 +1591,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
node_1 = new DefaultMutableTreeNode(c.getName());
|
|
|
|
|
|
// kann eventuell umgeändert werden
|
|
|
- for (CpsObject obj : c.getObjects()) {
|
|
|
+ for (AbstractCpsObject obj : c.getObjects()) {
|
|
|
node_1.add(new DefaultMutableTreeNode(obj.getObjName()));
|
|
|
}
|
|
|
add(node_1);
|
|
@@ -1623,9 +1623,9 @@ public class GUI<E> implements CategoryListener {
|
|
|
*
|
|
|
* @return selected CpsObject
|
|
|
*/
|
|
|
- private CpsObject getActualCps() {
|
|
|
+ private AbstractCpsObject getActualCps() {
|
|
|
int tempID = model.getSelectedObjectID();
|
|
|
- CpsObject tempCps = controller.searchByID(tempID);
|
|
|
+ AbstractCpsObject tempCps = controller.searchByID(tempID);
|
|
|
return tempCps;
|
|
|
}
|
|
|
|
|
@@ -1748,9 +1748,9 @@ public class GUI<E> implements CategoryListener {
|
|
|
* @param elements
|
|
|
* ArrayList to be displayed
|
|
|
*/
|
|
|
- private void fillElementTable(ArrayList<CpsObject> objects) {
|
|
|
+ private void fillElementTable(ArrayList<AbstractCpsObject> objects) {
|
|
|
if (objects.size() > 1) {
|
|
|
- for (CpsObject o : objects) {
|
|
|
+ for (AbstractCpsObject o : objects) {
|
|
|
if (o instanceof HolonObject) {
|
|
|
for (HolonElement he : ((HolonObject) o).getElements()) {
|
|
|
Object[] temp = { o.getName() + ", " + o.getID(), he.getId(), he.getEleName(), he.getEnergy(),
|
|
@@ -1760,7 +1760,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
}
|
|
|
}
|
|
|
} else if (objects.size() == 1) {
|
|
|
- CpsObject o = objects.get(0);
|
|
|
+ AbstractCpsObject o = objects.get(0);
|
|
|
if (o instanceof HolonObject) {
|
|
|
for (HolonElement he : ((HolonObject) o).getElements()) {
|
|
|
Object[] temp = { he.getId(), he.getEleName(), he.getEnergy(), he.getAmount(), he.getActive() };
|
|
@@ -1775,7 +1775,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
*/
|
|
|
private void refreshTableProperties() {
|
|
|
if (model.getSelectedCpsObjects().size() == 1) {
|
|
|
- CpsObject tempCps = getActualCps();
|
|
|
+ AbstractCpsObject tempCps = getActualCps();
|
|
|
if (tempCps != null && tempCps.getClass() == HolonObject.class) {
|
|
|
tableModelProperties.removeRow(2);
|
|
|
Object[] tempEnergy = { "Total Energy", ((HolonObject) tempCps).getCurrentEnergy() };
|