|
@@ -32,6 +32,7 @@ import classes.AbstractCpsObject;
|
|
import classes.HolonElement;
|
|
import classes.HolonElement;
|
|
import classes.HolonObject;
|
|
import classes.HolonObject;
|
|
import classes.HolonSwitch;
|
|
import classes.HolonSwitch;
|
|
|
|
+import classes.SubNet;
|
|
import ui.controller.Control;
|
|
import ui.controller.Control;
|
|
import ui.model.Model;
|
|
import ui.model.Model;
|
|
|
|
|
|
@@ -166,6 +167,20 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
g2.setRenderingHints(rh);
|
|
g2.setRenderingHints(rh);
|
|
|
|
|
|
|
|
+ // Test SubNet Coloring
|
|
|
|
+ int i = 0;
|
|
|
|
+ for (SubNet s : controller.getSimManager().getSubNets()) {
|
|
|
|
+
|
|
|
|
+ if(model.getSubNetColors().size()-1 < i){
|
|
|
|
+ controller.addSubNetColor(new Color((int) (Math.random() * 255), (int) (Math.random() * 255), (int) (Math.random() * 255)));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (HolonObject cps : s.getObjects()) {
|
|
|
|
+ cps.setBorderColor(model.getSubNetColors().get(i));
|
|
|
|
+ }
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+
|
|
// drawEdges that is being dragged
|
|
// drawEdges that is being dragged
|
|
if (drawEdge) {
|
|
if (drawEdge) {
|
|
g2.setColor(Color.BLACK);
|
|
g2.setColor(Color.BLACK);
|
|
@@ -380,14 +395,14 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
// Edge Selection
|
|
// Edge Selection
|
|
if (tempCps == null) {
|
|
if (tempCps == null) {
|
|
edgeHighlight = mousePositionOnEdge(x, y);
|
|
edgeHighlight = mousePositionOnEdge(x, y);
|
|
controller.setSelecteEdge(edgeHighlight);
|
|
controller.setSelecteEdge(edgeHighlight);
|
|
controller.setSelectedObjectID(0);
|
|
controller.setSelectedObjectID(0);
|
|
if (!e.isControlDown() && e.getButton() != MouseEvent.BUTTON3) {
|
|
if (!e.isControlDown() && e.getButton() != MouseEvent.BUTTON3) {
|
|
- model. getSelectedCpsObjects().clear();
|
|
|
|
|
|
+ model.getSelectedCpsObjects().clear();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -397,7 +412,6 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
doMark = true;
|
|
doMark = true;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
repaint();
|
|
repaint();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -409,7 +423,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
drawEdge = false;
|
|
drawEdge = false;
|
|
drawDeleteEdge();
|
|
drawDeleteEdge();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (dragged == true) {
|
|
if (dragged == true) {
|
|
try {
|
|
try {
|
|
controller.autoSave();
|
|
controller.autoSave();
|
|
@@ -418,15 +432,14 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
|
|
ex.printStackTrace();
|
|
ex.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
|
|
if (!e.isControlDown() && dragged == false && tempCps != null && e.BUTTON3 != e.getButton()) {
|
|
if (!e.isControlDown() && dragged == false && tempCps != null && e.BUTTON3 != e.getButton()) {
|
|
model.getSelectedCpsObjects().clear();
|
|
model.getSelectedCpsObjects().clear();
|
|
controller.addSelectedObject(tempCps);
|
|
controller.addSelectedObject(tempCps);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
dragged = false;
|
|
dragged = false;
|
|
-
|
|
|
|
|
|
+
|
|
// Rightclick List
|
|
// Rightclick List
|
|
if (e.getButton() == MouseEvent.BUTTON3) {
|
|
if (e.getButton() == MouseEvent.BUTTON3) {
|
|
if (e.getButton() == MouseEvent.BUTTON3 && tempCps != null) {
|
|
if (e.getButton() == MouseEvent.BUTTON3 && tempCps != null) {
|