|
@@ -171,6 +171,10 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
* FindSmartDevice that was clicked
|
|
|
*/
|
|
|
clicked = getSmartDeviceAtPosition(e.getX(), e.getY());
|
|
|
+ clickedConnection.clear();
|
|
|
+ if(clicked == null)
|
|
|
+ clickedConnection = getConnectionsAtPosition(e.getX(), e.getY());
|
|
|
+
|
|
|
|
|
|
switch (mode) {
|
|
|
case DRAG_CONNECTION:
|
|
@@ -206,18 +210,8 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
mode = NOTHING;
|
|
|
else if(!selectedDevices.isEmpty())
|
|
|
mode = SELECTED;
|
|
|
-
|
|
|
- //TODO: Click on Edge functionalities
|
|
|
- LinkedList<Pair<Connection, Pair<Port, Port>>> clickedCons = getConnectionsAtPosition(e.getX(), e.getY());
|
|
|
- System.out.println("Click on Edge?: "+!clickedCons.isEmpty());
|
|
|
- if(!(clickedCons.isEmpty()&&clickedConnection.isEmpty())){
|
|
|
- clickedConnection.clear();
|
|
|
- clickedConnection = clickedCons;
|
|
|
- if(!clickedConnection.isEmpty())
|
|
|
- mode = SELECTED;
|
|
|
- panel.repaint();
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ panel.repaint();
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -298,7 +292,7 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
|
|
|
@Override
|
|
|
public void mouseDragged(MouseEvent e) {
|
|
|
- // move dragged object/objecte selection on screen
|
|
|
+ // move dragged object/object selection on screen
|
|
|
switch (mode) {
|
|
|
case DRAG_SELECT:
|
|
|
case DRAG_CONNECTION:
|
|
@@ -481,7 +475,7 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
for(Pair<Port, Port> p: c.getProtocol().getTopology()){
|
|
|
if(pointOnConnection(x,y,p)){
|
|
|
edges.add(new Pair<Connection, Pair<Port,Port>>(c, p));
|
|
|
- break;//Connection was clicked - check for further connections
|
|
|
+ //break;//Connection was clicked - check for further connections
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -651,6 +645,7 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
else
|
|
|
mode = SELECTED;
|
|
|
});
|
|
|
+ rightClickMenu.add(itemCreateLink);
|
|
|
|
|
|
// Create Connection
|
|
|
itemCreateConnection = new JMenuItem("Create Connection");
|