|
@@ -185,8 +185,13 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
*/
|
|
|
public boolean controlDown = false;
|
|
|
|
|
|
+ /**
|
|
|
+ * ToolTip which describes the Links
|
|
|
+ */
|
|
|
private LinkToolTip toolTip;
|
|
|
|
|
|
+ private Link clickedLink = null;
|
|
|
+
|
|
|
/**
|
|
|
* Creates a new VisualisationInteractor
|
|
|
*
|
|
@@ -707,18 +712,28 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
* @param clickedLink Link which was clicked, otherwise null
|
|
|
*/
|
|
|
protected void showRightClickMenu(SmartDevice clickedOn, Link clickedLink) {
|
|
|
+ this.clickedLink = clickedLink;
|
|
|
/**
|
|
|
* Mouse Position on the VisualisationPanel
|
|
|
*/
|
|
|
Point mousePos = panel.getMousePosition();
|
|
|
// Just execute if Mouse Position is on the Panel
|
|
|
- if (mousePos != null) {
|
|
|
+ if (mousePos != null) {
|
|
|
if (clickedOn == null) {
|
|
|
+
|
|
|
+ //TODO: EditLink
|
|
|
+ if(clickedLink == null){
|
|
|
+ itemCreateLink.setText("Create Link");
|
|
|
+ itemCreateLink.setEnabled(false);
|
|
|
+ }else{
|
|
|
+ itemCreateLink.setText("Edit Link");
|
|
|
+ itemCreateLink.setEnabled(true);
|
|
|
+ }
|
|
|
+
|
|
|
itemCreate.setText("Create Device");
|
|
|
itemCreate.setEnabled(true);
|
|
|
itemDelete.setEnabled(false);
|
|
|
itemDeleteSelected.setEnabled(false);
|
|
|
- itemCreateLink.setEnabled(false);
|
|
|
if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().clickedConnection.size()>0){
|
|
|
/**
|
|
|
* Update Connections which can be edited
|
|
@@ -758,6 +773,8 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
rightClickMenu.remove(itemEditConnection);
|
|
|
rightClickMenu.add(itemCreateConnection,editCreateConnectionIndex);
|
|
|
}
|
|
|
+ //TODO EditLink
|
|
|
+ itemCreateLink.setText("Create Link");
|
|
|
if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.contains(clickedOn)){
|
|
|
itemDeleteSelected.setEnabled(true);
|
|
|
itemCreateLink.setEnabled(true);
|
|
@@ -809,11 +826,16 @@ public class VisualisationInteractor implements MouseInputListener,
|
|
|
itemCreateLink = new JMenuItem("Create Link");
|
|
|
|
|
|
itemCreateLink.addActionListener(e -> {
|
|
|
- new LinkCreationDialog(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices, controller, panel);
|
|
|
+ if(clickedLink!=null){
|
|
|
+ new LinkCreationDialog(clickedLink, controller, panel);
|
|
|
+ }else{
|
|
|
+ new LinkCreationDialog(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices, controller, panel);
|
|
|
+ }
|
|
|
if(controller.getControllerConfiguration().getConfigurationManager().getSelectionModel().selectedDevices.isEmpty())
|
|
|
mode = NOTHING;
|
|
|
else
|
|
|
mode = SELECTED;
|
|
|
+
|
|
|
});
|
|
|
rightClickMenu.add(itemCreateLink);
|
|
|
|