summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-07-12 14:55:03 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-07-12 14:55:03 +0200
commit5c0e57f4e126e3c6560f8eab695eb2d591a8c335 (patch)
tree3aae863338016ecce125f6adbb70d48924bf553e /src/main/java/com/c2kernel/gui/graph/controller/EdgeConstructionController.java
parenteacd6cecdeeb14f9c96e74fafbacbc7f7c4804b8 (diff)
Take getVertex(point) and getEdge(point) from GraphModel
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()))