summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/graph/view/EditorPanel.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-05-30 08:37:45 +0200
commitb086f57f56bf0eb9dab9cf321a0f69aaaae84347 (patch)
tree8e6e26e8b7eed6abad7a17b093bdbb55c5e6b1ba /source/com/c2kernel/graph/view/EditorPanel.java
parent22088ae8d2d5ff390518dbe1c4372325ffb3a647 (diff)
Initial Maven Conversion
Diffstat (limited to 'source/com/c2kernel/graph/view/EditorPanel.java')
-rw-r--r--source/com/c2kernel/graph/view/EditorPanel.java104
1 files changed, 0 insertions, 104 deletions
diff --git a/source/com/c2kernel/graph/view/EditorPanel.java b/source/com/c2kernel/graph/view/EditorPanel.java
deleted file mode 100644
index fb25b68..0000000
--- a/source/com/c2kernel/graph/view/EditorPanel.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.c2kernel.graph.view;
-import java.awt.BorderLayout;
-import java.awt.Dimension;
-
-import javax.swing.JButton;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-
-import com.c2kernel.graph.controller.AutoScrollController;
-import com.c2kernel.graph.controller.EdgeConstructionController;
-import com.c2kernel.graph.controller.MultiSelectionDragController;
-import com.c2kernel.graph.controller.VertexConstructionController;
-import com.c2kernel.graph.model.EdgeFactory;
-import com.c2kernel.graph.model.GraphModelManager;
-import com.c2kernel.graph.model.TypeNameAndConstructionInfo;
-import com.c2kernel.graph.model.VertexFactory;
-import com.c2kernel.graph.model.VertexOutlineCreator;
-public class EditorPanel extends JPanel
-{
- // Graph Model
- public final GraphModelManager mGraphModelManager = new GraphModelManager();
- // Graph View
- public GraphPanel mGraphPanel = null;
- protected JScrollPane mGraphScrollPane = null;
- // Graph Controllers
- protected MultiSelectionDragController mMultiSelectionDragController = new MultiSelectionDragController();
- protected VertexConstructionController mVertexConstructionController = new VertexConstructionController();
- protected EdgeConstructionController mEdgeConstructionController = new EdgeConstructionController();
- protected AutoScrollController mAutoScrollController = new AutoScrollController();
- // Tool bar
- protected EditorToolBar mEditorToolBar = null;
- protected EditorPanel()
- {
- }
- public EditorPanel(EdgeFactory eFactory, VertexFactory vFactory, VertexOutlineCreator vOutlineCreator, boolean edgeCreationMode, // True
- // if
- // edges
- // can
- // be
- // created
- JButton[] otherButtons, GraphPanel graphPanel)
- {
- // Create the graph panel and editor tool bar
- setDoubleBuffered(true);
- mGraphPanel = graphPanel;
- mGraphPanel.setGraphModelManager(mGraphModelManager);
- mGraphScrollPane = new JScrollPane(mGraphPanel);
- mGraphModelManager.setExternalEdgeFactory(eFactory);
- mGraphModelManager.setExternalVertexFactory(vFactory);
- mGraphModelManager.setVertexOutlineCreator(vOutlineCreator);
- mEditorToolBar = new EditorToolBar(edgeCreationMode, otherButtons, graphPanel);
- mEditorToolBar.setGraphModelManager(mGraphModelManager);
- mEditorToolBar.setGraphPanel(mGraphPanel);
- createLayout();
- // The graph panel observes the graph model
- mGraphModelManager.addObserver(mGraphPanel);
- // The multi selection drag controller modifies the graph model
- // and listens to the graph panel and editor tool bar
- mMultiSelectionDragController.setGraphModelManager(mGraphModelManager);
- mGraphPanel.addMouseListener(mMultiSelectionDragController);
- mGraphPanel.addMouseMotionListener(mMultiSelectionDragController);
- mGraphPanel.addKeyListener(mMultiSelectionDragController);
- mEditorToolBar.addEditorModeListener(mMultiSelectionDragController);
- // The edge construction controller modifies the graph model
- // and listens to the graph panel and editor tool bar
- mEdgeConstructionController.setGraphModelManager(mGraphModelManager);
- mGraphPanel.addMouseListener(mEdgeConstructionController);
- mGraphPanel.addMouseMotionListener(mEdgeConstructionController);
- mEdgeConstructionController.setEditorToolBar(mEditorToolBar);
- // The vertex construction controller modifies the graph model
- // and listens to the graph panel and editor tool bar
- mVertexConstructionController.setGraphModelManager(mGraphModelManager);
- mGraphPanel.addMouseListener(mVertexConstructionController);
- mVertexConstructionController.setEditorToolBar(mEditorToolBar);
- // The auto scroll controller listens to and modifies the
- // graph panel
- mAutoScrollController.setGraphPanel(mGraphPanel);
- }
-
- protected void createLayout()
- {
- setLayout(new BorderLayout());
- add(mEditorToolBar, BorderLayout.NORTH);
- mGraphPanel.setPreferredSize(new Dimension(mGraphModelManager.getModel().getWidth(), mGraphModelManager.getModel().getHeight()));
- add(mGraphScrollPane, BorderLayout.CENTER);
- }
- public void enterSelectMode()
- {
- mEditorToolBar.enterSelectMode();
- }
- public void updateEdgeTypes(TypeNameAndConstructionInfo[] typeNameAndConstructionInfo)
- {
- mEditorToolBar.updateEdgeTypes(typeNameAndConstructionInfo);
- }
- public void updateVertexTypes(TypeNameAndConstructionInfo[] typeNameAndConstructionInfo)
- {
- mEditorToolBar.updateVertexTypes(typeNameAndConstructionInfo);
- }
- public void setEditable(boolean editable)
- {
- mGraphModelManager.setEditable(editable);
- mEditorToolBar.setGraphEditable(editable);
- }
-}