|
@@ -121,7 +121,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
* the Controller
|
|
|
*/
|
|
|
public UpperNodeCanvas(Model mod, Control control, CpsUpperNode UpperNode, String parentPath) {
|
|
|
- this.add(objectTT);
|
|
|
+ //this.add(objectTT);
|
|
|
this.controller = control;
|
|
|
this.model = mod;
|
|
|
this.upperNode = UpperNode;
|
|
@@ -160,7 +160,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
itemTrack.setEnabled(false);
|
|
|
itemUntrack.setEnabled(false);
|
|
|
updCon = new UpdateController(model, controller);
|
|
|
-
|
|
|
+
|
|
|
itemGroup.addActionListener(new ActionListener() {
|
|
|
@Override
|
|
|
public void actionPerformed(ActionEvent e) {
|
|
@@ -462,13 +462,18 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
for (CpsEdge con : upperNode.getNodeEdges()) {
|
|
|
if (con.getA().getID() != model.getSelectedObjectID() && con.getB().getID() != model.getSelectedObjectID()
|
|
|
&& con != edgeHighlight) {
|
|
|
- if (con.getState()) {
|
|
|
- g2.setColor(Color.GREEN);
|
|
|
- if (con.getCapacity() != -1) {
|
|
|
- g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
|
|
|
+ if(con.getConnected()){
|
|
|
+ if (con.getState()) {
|
|
|
+ g2.setColor(Color.GREEN);
|
|
|
+ if (con.getCapacity() != -1) {
|
|
|
+ g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ g2.setColor(Color.RED);
|
|
|
+ g2.setStroke(new BasicStroke(2));
|
|
|
}
|
|
|
- } else {
|
|
|
- g2.setColor(Color.RED);
|
|
|
+ }else{
|
|
|
+ g2.setColor(Color.DARK_GRAY);
|
|
|
g2.setStroke(new BasicStroke(2));
|
|
|
}
|
|
|
g2.drawLine(con.getA().getPosition().x + controller.getScaleDiv2(),
|
|
@@ -482,9 +487,15 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
maxCap = String.valueOf(con.getCapacity());
|
|
|
}
|
|
|
if (showedInformation[0]) {
|
|
|
- g2.drawString(con.getFlow() + "/" + maxCap,
|
|
|
- (con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
|
|
|
- (con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
|
|
|
+ if(con.getConnected()){
|
|
|
+ g2.drawString(con.getFlow() + "/" + maxCap,
|
|
|
+ (con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
|
|
|
+ (con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
|
|
|
+ }else{
|
|
|
+ g2.drawString("not connected",
|
|
|
+ (con.getA().getPosition().x + con.getB().getPosition().x) / 2 + controller.getScaleDiv2(),
|
|
|
+ (con.getA().getPosition().y + con.getB().getPosition().y) / 2 + controller.getScaleDiv2());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -514,11 +525,19 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
maxCap = String.valueOf(con.getCapacity());
|
|
|
}
|
|
|
if (showedInformation[0]) {
|
|
|
- g2.drawString(con.getFlow() + "/" + maxCap,
|
|
|
- (con.getA().getPosition().x + con.getB().getPosition().x) / 2
|
|
|
+ if(con.getConnected()){
|
|
|
+ g2.drawString(con.getFlow() + "/" + maxCap,
|
|
|
+ (con.getA().getPosition().x + con.getB().getPosition().x) / 2
|
|
|
+ controller.getScaleDiv2(),
|
|
|
- (con.getA().getPosition().y + con.getB().getPosition().y) / 2
|
|
|
+ (con.getA().getPosition().y + con.getB().getPosition().y) / 2
|
|
|
+ controller.getScaleDiv2());
|
|
|
+ }else{
|
|
|
+ g2.drawString("not connected",
|
|
|
+ (con.getA().getPosition().x + con.getB().getPosition().x) / 2
|
|
|
+ + controller.getScaleDiv2(),
|
|
|
+ (con.getA().getPosition().y + con.getB().getPosition().y) / 2
|
|
|
+ + controller.getScaleDiv2());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -639,6 +658,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
|
|
|
|
|
|
// Border Highlighting
|
|
|
if(showedInformation[3]){
|
|
|
+ System.out.println("here");
|
|
|
g2.setColor(cps.getBorderColor());
|
|
|
if (g2.getColor() != Color.WHITE) {
|
|
|
g2.fillRect((int) ((borderPos >> 1) - model.getScaleDiv2() - scalediv20) - 3,
|