summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java')
-rw-r--r--src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java b/src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java
index b200991..87742f8 100644
--- a/src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java
+++ b/src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java
@@ -9,11 +9,13 @@ import com.c2kernel.graph.model.GraphPoint;
import com.c2kernel.graph.model.Vertex;
import com.c2kernel.gui.graph.view.EditorModeListener;
import com.c2kernel.gui.graph.view.EditorToolBar;
+import com.c2kernel.gui.graph.view.GraphPanel;
public class EdgeConstructionController extends MouseAdapter implements EditorModeListener
{
private GraphModelManager mGraphModelManager = null;
+ private GraphPanel mGraphPanel = null;
private EditorToolBar mEditorToolBar = null;
@@ -165,6 +167,11 @@ public class EdgeConstructionController extends MouseAdapter implements EditorMo
{
mGraphModelManager = graphModelManager;
}
+
+ public void setGraphPanel(GraphPanel graphPanel)
+ {
+ mGraphPanel = graphPanel;
+ }
public void setEditorToolBar(EditorToolBar editorToolBar)
@@ -194,11 +201,11 @@ public class EdgeConstructionController extends MouseAdapter implements EditorMo
Vertex vertex = null;
Point mousePoint = null;
- if(mGraphModelManager != null)
+ if(mGraphModelManager != null && mGraphPanel != null)
{
// Determine if there is a vertex under the mouse cursor
mousePoint = me.getPoint();
- vertex = mGraphModelManager.getModel().getVertex(new GraphPoint(mousePoint.x, mousePoint.y));
+ vertex = mGraphPanel.getVertex(new GraphPoint(mousePoint.x, mousePoint.y));
// If the mouse has been pressed on a vertex
if(vertex != null)
@@ -215,11 +222,11 @@ public class EdgeConstructionController extends MouseAdapter implements EditorMo
Vertex vertex = null;
Point mousePoint = null;
- if(mGraphModelManager != null)
+ if(mGraphModelManager != null && mGraphPanel != null)
{
// Determine if there is a vertex under the mouse cursor
mousePoint = me.getPoint();
- vertex = mGraphModelManager.getModel().getVertex(new GraphPoint(mousePoint.x, mousePoint.y));
+ vertex = mGraphPanel.getVertex(new GraphPoint(mousePoint.x, mousePoint.y));
// If the mouse has been released on a vertex which is not the origin vertex
if((vertex != null) && (vertex != mGraphModelManager.getModel().getNewEdgeOriginVertex()))