|
@@ -341,21 +341,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
try {
|
|
|
controller.loadAutoSave(controller.getUndoSave());
|
|
|
canvas.repaint();
|
|
|
- ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
- if (cps instanceof HolonObject) {
|
|
|
- for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
- tempList.add(h);
|
|
|
- unitGraph.repaintWithNewElement(tempList);
|
|
|
- unitGraph.fillArrayofValue();
|
|
|
- tempList.remove(0);
|
|
|
- }
|
|
|
- } else if (cps instanceof HolonSwitch) {
|
|
|
- unitGraph.repaintWithNewSwitch((HolonSwitch) cps);
|
|
|
- unitGraph.fillArrayofBooleans();
|
|
|
- }
|
|
|
- }
|
|
|
- unitGraph.empty();
|
|
|
+ unitGraph.update(model.getObjectsOnCanvas());
|
|
|
} catch (IOException eex) {
|
|
|
// TODO Auto-generated catch block
|
|
|
eex.printStackTrace();
|
|
@@ -374,21 +360,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
try {
|
|
|
controller.loadAutoSave(controller.getRedoSave());
|
|
|
canvas.repaint();
|
|
|
- ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
- if (cps instanceof HolonObject) {
|
|
|
- for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
- tempList.add(h);
|
|
|
- unitGraph.repaintWithNewElement(tempList);
|
|
|
- unitGraph.fillArrayofValue();
|
|
|
- tempList.remove(0);
|
|
|
- }
|
|
|
- } else if (cps instanceof HolonSwitch) {
|
|
|
- unitGraph.repaintWithNewSwitch((HolonSwitch) cps);
|
|
|
- unitGraph.fillArrayofBooleans();
|
|
|
- }
|
|
|
- }
|
|
|
- unitGraph.empty();
|
|
|
+ unitGraph.update(model.getObjectsOnCanvas());
|
|
|
} catch (IOException ex) {
|
|
|
// TODO Auto-generated catch block
|
|
|
ex.printStackTrace();
|
|
@@ -539,6 +511,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
.getComponent(0)).getMousePosition());
|
|
|
else
|
|
|
controller.paste(null, canvas.getMousePosition());
|
|
|
+ unitGraph.update(model.getSelectedCpsObjects());
|
|
|
} catch (HeadlessException | JsonParseException | UnsupportedFlavorException | IOException e1) {
|
|
|
// TODO Auto-generated catch block
|
|
|
JLabel message = new JLabel("The Clipboard information cannot be pasted into Application.");
|
|
@@ -1646,21 +1619,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
try {
|
|
|
controller.loadFile(file.getAbsolutePath());
|
|
|
canvas.repaint();
|
|
|
- ArrayList<HolonElement> tempList = new ArrayList<>();
|
|
|
- for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
|
|
|
- if (cps instanceof HolonObject) {
|
|
|
- for (HolonElement h : ((HolonObject) cps).getElements()) {
|
|
|
- tempList.add(h);
|
|
|
- unitGraph.repaintWithNewElement(tempList);
|
|
|
- unitGraph.fillArrayofValue();
|
|
|
- tempList.remove(0);
|
|
|
- }
|
|
|
- } else if (cps instanceof HolonSwitch) {
|
|
|
- unitGraph.repaintWithNewSwitch((HolonSwitch) cps);
|
|
|
- unitGraph.fillArrayofBooleans();
|
|
|
- }
|
|
|
- }
|
|
|
- unitGraph.empty();
|
|
|
+ unitGraph.update(model.getObjectsOnCanvas());
|
|
|
tree.repaint();
|
|
|
} catch (IOException | ArchiveException e) {
|
|
|
// TODO Auto-generated catch block
|
|
@@ -2147,7 +2106,7 @@ public class GUI<E> implements CategoryListener {
|
|
|
} else {
|
|
|
tabTemp = tabbedPane2;
|
|
|
}
|
|
|
- if (((JScrollPane) tabTemp.getSelectedComponent()).getViewport().getComponent(0) instanceof MyCanvas) {
|
|
|
+ if (((JScrollPane) tabTemp.getSelectedComponent()).getViewport().getComponent(0) instanceof MyCanvas) {
|
|
|
unc = new UpperNodeCanvas(model, controller, (CpsUpperNode) temp, "");
|
|
|
} else {
|
|
|
unc = new UpperNodeCanvas(model, controller, (CpsUpperNode) temp,
|