You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:22:48 UTC
[25/51] [partial] incubator-taverna-workbench git commit: Revert
"temporarily empty repository"
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
new file mode 100644
index 0000000..397ad1b
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationPanel.java
@@ -0,0 +1,360 @@
+/*******************************************************************************
+ * Copyright (C) 2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.config;
+
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NORTHWEST;
+import static java.awt.GridBagConstraints.RELATIVE;
+import static java.awt.GridBagConstraints.REMAINDER;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.SwingConstants.LEFT;
+import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
+import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.allportIcon;
+import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.blobIcon;
+import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.horizontalIcon;
+import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.noportIcon;
+import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.verticalIcon;
+import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ALIGNMENT;
+import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_ENABLED;
+import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.ANIMATION_SPEED;
+import static net.sf.taverna.t2.workbench.views.graph.config.GraphViewConfiguration.PORT_STYLE;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Hashtable;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JSlider;
+import javax.swing.JTextArea;
+import javax.swing.border.EmptyBorder;
+
+import net.sf.taverna.t2.workbench.models.graph.Graph.Alignment;
+import net.sf.taverna.t2.workbench.models.graph.GraphController.PortStyle;
+
+/**
+ * UI for GraphViewConfiguration.
+ *
+ * @author David Withers
+ */
+public class GraphViewConfigurationPanel extends JPanel {
+ private static final long serialVersionUID = 3779779432230124131L;
+ private static final int ANIMATION_SPEED_MIN = 100;
+ private static final int ANIMATION_SPEED_MAX = 3100;
+
+ private GraphViewConfiguration configuration;
+ private JRadioButton noPorts;
+ private JRadioButton allPorts;
+ private JRadioButton blobs;
+ private JRadioButton vertical;
+ private JRadioButton horizontal;
+ private JCheckBox animation;
+ private JLabel animationSpeedLabel;
+ private JSlider animationSpeedSlider;
+
+ public GraphViewConfigurationPanel(GraphViewConfiguration configuration) {
+ this.configuration = configuration;
+ GridBagLayout gridbag = new GridBagLayout();
+ GridBagConstraints c = new GridBagConstraints();
+ setLayout(gridbag);
+
+ // Title describing what kind of settings we are configuring here
+ JTextArea descriptionText = new JTextArea(
+ "Default settings for the workflow diagram");
+ descriptionText.setLineWrap(true);
+ descriptionText.setWrapStyleWord(true);
+ descriptionText.setEditable(false);
+ descriptionText.setFocusable(false);
+ descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
+
+ JLabel defaultLayoutLabel = new JLabel("Service display");
+
+ noPorts = new JRadioButton();
+ allPorts = new JRadioButton();
+ blobs = new JRadioButton();
+
+ JLabel noPortsLabel = new JLabel("Name only", noportIcon, LEFT);
+ JLabel allPortsLabel = new JLabel("Name and ports", allportIcon, LEFT);
+ JLabel blobsLabel = new JLabel("No text", blobIcon, LEFT);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(noPorts);
+ buttonGroup.add(allPorts);
+ buttonGroup.add(blobs);
+
+ JLabel defaultAlignmentLabel = new JLabel("Diagram alignment");
+
+ vertical = new JRadioButton();
+ horizontal = new JRadioButton();
+
+ JLabel verticalLabel = new JLabel("Vertical", verticalIcon, LEFT);
+ JLabel horizontalLabel = new JLabel("Horizontal", horizontalIcon, LEFT);
+
+ ButtonGroup alignmentButtonGroup = new ButtonGroup();
+ alignmentButtonGroup.add(horizontal);
+ alignmentButtonGroup.add(vertical);
+
+ animation = new JCheckBox("Enable animation");
+
+ animationSpeedLabel = new JLabel("Animation speed");
+
+ animationSpeedSlider = new JSlider(ANIMATION_SPEED_MIN,
+ ANIMATION_SPEED_MAX);
+ animationSpeedSlider.setMajorTickSpacing(500);
+ animationSpeedSlider.setMinorTickSpacing(100);
+ animationSpeedSlider.setPaintTicks(true);
+ animationSpeedSlider.setPaintLabels(true);
+ animationSpeedSlider.setInverted(true);
+ animationSpeedSlider.setSnapToTicks(true);
+
+ Hashtable<Integer, JLabel> labelTable = new Hashtable<>();
+ labelTable.put(new Integer(ANIMATION_SPEED_MIN), new JLabel("Fast"));
+ labelTable.put(new Integer(
+ ((ANIMATION_SPEED_MAX - ANIMATION_SPEED_MIN) / 2)
+ + ANIMATION_SPEED_MIN), new JLabel("Medium"));
+ labelTable.put(new Integer(ANIMATION_SPEED_MAX), new JLabel("Slow"));
+ animationSpeedSlider.setLabelTable(labelTable);
+
+ animation.addItemListener(new ItemListener() {
+ @Override
+ public void itemStateChanged(ItemEvent e) {
+ boolean animationEnabled = animation.isSelected();
+ animationSpeedLabel.setEnabled(animationEnabled);
+ animationSpeedSlider.setEnabled(animationEnabled);
+ }
+ });
+
+ // Set current configuration values
+ setFields(configuration);
+
+ c.anchor = WEST;
+ c.gridx = 0;
+ c.gridwidth = REMAINDER;
+ c.weightx = 1d;
+ c.weighty = 0d;
+ c.fill = HORIZONTAL;
+
+ add(descriptionText, c);
+
+ c.insets = new Insets(10, 0, 10, 0);
+ add(defaultLayoutLabel, c);
+
+ c.insets = new Insets(0, 20, 0, 0);
+ c.gridwidth = 1;
+ c.weightx = 0d;
+ add(noPorts, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridx = RELATIVE;
+ add(noPortsLabel, c);
+
+ c.insets = new Insets(0, 10, 0, 0);
+ add(allPorts, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ add(allPortsLabel, c);
+
+ c.insets = new Insets(0, 10, 0, 0);
+ add(blobs, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridwidth = REMAINDER;
+ c.weightx = 1d;
+ add(blobsLabel, c);
+
+ // alignment
+ c.insets = new Insets(20, 0, 10, 0);
+ c.gridx = 0;
+ add(defaultAlignmentLabel, c);
+
+ c.insets = new Insets(0, 20, 0, 0);
+ c.gridx = 0;
+ c.gridwidth = 1;
+ c.weightx = 0d;
+ add(vertical, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridx = RELATIVE;
+ add(verticalLabel, c);
+
+ c.insets = new Insets(0, 10, 0, 0);
+ add(horizontal, c);
+ c.insets = new Insets(0, 5, 0, 0);
+ c.gridwidth = REMAINDER;
+ c.weightx = 1d;
+ add(horizontalLabel, c);
+
+ // animation
+ c.gridx = 0;
+ c.gridwidth = REMAINDER;
+ c.insets = new Insets(20, 0, 10, 0);
+ add(animation, c);
+
+ c.insets = new Insets(0, 20, 0, 0);
+ add(animationSpeedLabel, c);
+
+ c.insets = new Insets(0, 20, 10, 30);
+ c.anchor = NORTHWEST;
+ c.weighty = 0d;
+ add(animationSpeedSlider, c);
+
+ // Buttons
+ c.gridx = 0;
+ c.insets = new Insets(0, 20, 10, 30);
+ c.anchor = NORTHWEST;
+ c.weighty = 1d;
+ add(createButtonPanel(), c);
+ }
+
+ /**
+ * Create the panel with the buttons.
+ */
+ @SuppressWarnings("serial")
+ private JPanel createButtonPanel() {
+ final JPanel panel = new JPanel();
+
+ /**
+ * The helpButton shows help about the current component
+ */
+ JButton helpButton = new JButton(new AbstractAction("Help") {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ showHelp(panel);
+ }
+ });
+ panel.add(helpButton);
+
+ /**
+ * The resetButton changes the property values shown to those
+ * corresponding to the configuration currently applied.
+ */
+ JButton resetButton = new JButton(new AbstractAction("Reset") {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ setFields(configuration);
+ }
+ });
+ panel.add(resetButton);
+
+ /**
+ * The applyButton applies the shown field values to the
+ * {@link HttpProxyConfiguration} and saves them for future.
+ */
+ JButton applyButton = new JButton(new AbstractAction("Apply") {
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ applySettings();
+ setFields(configuration);
+ }
+ });
+ panel.add(applyButton);
+
+ return panel;
+ }
+
+ /**
+ * Save the currently set field values to the {@link GraphViewConfiguration}
+ * . Also apply those values to the currently running Taverna.
+ */
+ private void applySettings() {
+ // Service display
+ if (noPorts.isSelected()) {
+ configuration.setProperty(PORT_STYLE, PortStyle.NONE.toString());
+ } else if (allPorts.isSelected()) {
+ configuration.setProperty(PORT_STYLE, PortStyle.ALL.toString());
+ } else if (blobs.isSelected()) {
+ configuration.setProperty(PORT_STYLE, PortStyle.BLOB.toString());
+ }
+
+ // Diagram alignment
+ if (vertical.isSelected()) {
+ configuration.setProperty(ALIGNMENT, Alignment.VERTICAL.toString());
+ } else if (horizontal.isSelected()) {
+ configuration.setProperty(ALIGNMENT,
+ Alignment.HORIZONTAL.toString());
+ }
+
+ // Animation and its speed
+ if (animation.isSelected()) {
+ configuration.setProperty(ANIMATION_ENABLED, String.valueOf(true));
+ } else {
+ configuration.setProperty(ANIMATION_ENABLED, String.valueOf(false));
+ }
+ int speed = animationSpeedSlider.getValue();
+ configuration.setProperty(ANIMATION_SPEED, String.valueOf(speed));
+ }
+
+ /**
+ * Set the shown configuration field values to those currently in use (i.e.
+ * last saved configuration).
+ */
+ private void setFields(GraphViewConfiguration configurable) {
+ PortStyle portStyle = PortStyle.valueOf(configurable
+ .getProperty(PORT_STYLE));
+ if (portStyle.equals(PortStyle.NONE)) {
+ noPorts.setSelected(true);
+ } else if (portStyle.equals(PortStyle.ALL)) {
+ allPorts.setSelected(true);
+ } else {
+ blobs.setSelected(true);
+ }
+
+ Alignment alignment = Alignment.valueOf(configurable
+ .getProperty(ALIGNMENT));
+ if (alignment.equals(Alignment.VERTICAL)) {
+ vertical.setSelected(true);
+ } else {
+ horizontal.setSelected(true);
+ }
+
+ boolean animationEnabled = Boolean.parseBoolean(configurable
+ .getProperty(ANIMATION_ENABLED));
+ animation.setSelected(animationEnabled);
+
+ Integer animationSpeed = Integer.valueOf(configurable
+ .getProperty(ANIMATION_SPEED));
+ if (animationSpeed > ANIMATION_SPEED_MAX) {
+ animationSpeed = ANIMATION_SPEED_MAX;
+ } else if (animationSpeed < ANIMATION_SPEED_MIN) {
+ animationSpeed = ANIMATION_SPEED_MIN;
+ }
+ animationSpeedSlider.setValue(animationSpeed);
+ animationSpeedSlider.setEnabled(animationEnabled);
+
+ animationSpeedLabel.setEnabled(animationEnabled);
+ }
+
+ // for testing only
+ public static void main(String[] args) {
+ JDialog dialog = new JDialog();
+ dialog.add(new GraphViewConfigurationPanel(null));
+ dialog.setModal(true);
+ dialog.setSize(500, 400);
+ dialog.setVisible(true);
+ System.exit(0);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
new file mode 100644
index 0000000..959b598
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/config/GraphViewConfigurationUIFactory.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (C) 2009 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.config;
+
+import javax.swing.JPanel;
+
+import uk.org.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+
+/**
+ * ConfigurationFactory for the GraphViewConfiguration.
+ *
+ * @author David Withers
+ */
+public class GraphViewConfigurationUIFactory implements ConfigurationUIFactory {
+ private GraphViewConfiguration graphViewConfiguration;
+
+ @Override
+ public boolean canHandle(String uuid) {
+ return uuid.equals(getConfigurable().getUUID());
+ }
+
+ @Override
+ public JPanel getConfigurationPanel() {
+ return new GraphViewConfigurationPanel(graphViewConfiguration);
+ }
+
+ @Override
+ public Configurable getConfigurable() {
+ return graphViewConfiguration;
+ }
+
+ public void setGraphViewConfiguration(
+ GraphViewConfiguration graphViewConfiguration) {
+ this.graphViewConfiguration = graphViewConfiguration;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
new file mode 100644
index 0000000..65448c3
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFInputMenuAction.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu.INSERT;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.actions.AddWFInputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFInputMenuAction extends AbstractMenuAction {
+ private static final URI ADD_WF_INPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddWFInput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFInputMenuAction() {
+ super(INSERT, 10, ADD_WF_INPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFInputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
new file mode 100644
index 0000000..522c841
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/AddWFOutputMenuAction.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.InsertMenu.INSERT;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.actions.AddWFOutputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFOutputMenuAction extends AbstractMenuAction {
+ private static final URI ADD_WF_OUTPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddWFOutput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFOutputMenuAction() {
+ super(INSERT, 20, ADD_WF_OUTPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFOutputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
new file mode 100644
index 0000000..654078f
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DeleteGraphComponentMenuAction.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.GraphDeleteMenuSection.GRAPH_DELETE_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.actions.DeleteGraphComponentAction;
+
+/**
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class DeleteGraphComponentMenuAction extends AbstractMenuAction {
+ private static final URI DELETE_GRAPH_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuDeleteGraphComponent");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public DeleteGraphComponentMenuAction() {
+ super(GRAPH_DELETE_MENU_SECTION, 10, DELETE_GRAPH_COMPONENT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new DeleteGraphComponentAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
new file mode 100644
index 0000000..02c71d8
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramMenu.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static java.awt.event.KeyEvent.VK_V;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenu;
+
+public class DiagramMenu extends AbstractMenu {
+ public static final URI DIAGRAM = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagram");
+
+ public DiagramMenu() {
+ super(DEFAULT_MENU_BAR, 65, DIAGRAM, "View");
+ }
+
+ public static DummyAction makeAction() {
+ DummyAction action = new DummyAction("View");
+ action.putValue(MNEMONIC_KEY, VK_V);
+ return action;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
new file mode 100644
index 0000000..5ebb770
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramSaveMenuSection.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class DiagramSaveMenuSection extends AbstractMenuSection {
+ public static final URI DIAGRAM_SAVE_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramSaveMenuSection");
+
+ public DiagramSaveMenuSection() {
+ super(DIAGRAM, 40, DIAGRAM_SAVE_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
new file mode 100644
index 0000000..639deee
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/DiagramZoomMenuSection.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramMenu.DIAGRAM;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class DiagramZoomMenuSection extends AbstractMenuSection {
+ public static final URI DIAGRAM_ZOOM_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramZoomMenuSection");
+
+ public DiagramZoomMenuSection() {
+ super(DIAGRAM, 20, DIAGRAM_ZOOM_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
new file mode 100644
index 0000000..70cc462
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphCopyMenuSection.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * ???
+ */
+public class GraphCopyMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_COPY_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphCopyMenuSection");
+
+ public GraphCopyMenuSection() {
+ super(GRAPH_MENU_SECTION, 15, GRAPH_COPY_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
new file mode 100644
index 0000000..28d2144
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDeleteMenuSection.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphDeleteMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_DELETE_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphDeleteMenuSection");
+
+ public GraphDeleteMenuSection() {
+ super(GRAPH_MENU_SECTION, 30, GRAPH_DELETE_MENU_SECTION);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
new file mode 100644
index 0000000..f2b6af1
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphDetailsMenuSection.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ * @author Alan R Williams
+ */
+public class GraphDetailsMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_DETAILS_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphDetailsMenuSection");
+
+ public GraphDetailsMenuSection() {
+ super(GRAPH_MENU_SECTION, 25, GRAPH_DETAILS_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
new file mode 100644
index 0000000..1a487b1
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphEditMenuSection.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.GraphMenuSection.GRAPH_MENU_SECTION;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphEditMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_EDIT_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphEditMenuSection");
+
+ public GraphEditMenuSection() {
+ super(GRAPH_MENU_SECTION, 20, GRAPH_EDIT_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
new file mode 100644
index 0000000..4030d34
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/GraphMenuSection.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuSection;
+
+/**
+ * @author Alex Nenadic
+ */
+public class GraphMenuSection extends AbstractMenuSection {
+ public static final URI GRAPH_MENU_SECTION = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuSection");
+ public static final URI EDIT_MENU_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#edit");
+
+ public GraphMenuSection() {
+ super(EDIT_MENU_URI, 20, GRAPH_MENU_SECTION);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
new file mode 100644
index 0000000..9b498e5
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/InsertMenu.java
@@ -0,0 +1,30 @@
+/**
+ *
+ */
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static java.awt.event.KeyEvent.VK_I;
+import static javax.swing.Action.MNEMONIC_KEY;
+import static net.sf.taverna.t2.ui.menu.DefaultMenuBar.DEFAULT_MENU_BAR;
+
+import java.net.URI;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenu;
+
+/**
+ * @author alanrw
+ */
+public class InsertMenu extends AbstractMenu {
+ public static final URI INSERT = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#insert");
+
+ public InsertMenu() {
+ super(DEFAULT_MENU_BAR, 64, INSERT, makeAction());
+ }
+
+ public static DummyAction makeAction() {
+ DummyAction action = new DummyAction("Insert");
+ action.putValue(MNEMONIC_KEY, VK_I);
+ return action;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
new file mode 100644
index 0000000..3cf9f66
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/RenameWFInputOutputProcessorMenuAction.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.GraphDetailsMenuSection.GRAPH_DETAILS_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.actions.RenameWFInputOutputProcessorAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class RenameWFInputOutputProcessorMenuAction extends AbstractMenuAction {
+ private static final URI RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuRenameWFInputOutputProcessor");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public RenameWFInputOutputProcessorMenuAction() {
+ super(GRAPH_DETAILS_MENU_SECTION, 30,
+ RENAME_WF_INPUT_OUTPUT_PROCESSOR_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new RenameWFInputOutputProcessorAction(editManager,
+ selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
new file mode 100644
index 0000000..9fbd452
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramAction.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_0;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.refreshIcon;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.DesignOrResultsAction;
+
+@SuppressWarnings("serial")
+public class ResetDiagramAction extends AbstractAction implements
+ DesignOrResultsAction {
+ private static Action designAction = null;
+ @SuppressWarnings("unused")
+ private static Action resultsAction = null;
+
+ public static void setResultsAction(Action resultsAction) {
+ ResetDiagramAction.resultsAction = resultsAction;
+ }
+
+ public static void setDesignAction(Action designAction) {
+ ResetDiagramAction.designAction = designAction;
+ }
+
+ public ResetDiagramAction() {
+ super("Reset diagram", refreshIcon);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_0, getDefaultToolkit().getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+// if (isWorkflowPerspective() && (designAction != null))
+ designAction.actionPerformed(e);
+// else if (isResultsPerspective() && (resultsAction != null))
+// resultsAction.actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
new file mode 100644
index 0000000..c4b402e
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ResetDiagramMenuAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+
+/**
+ * An action that zooms a diagram image
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class ResetDiagramMenuAction extends AbstractMenuAction {
+ public static final URI RESET_DIAGRAM_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuResetDiagram");
+
+ public ResetDiagramMenuAction() {
+ super(DIAGRAM_ZOOM_MENU_SECTION, 5, RESET_DIAGRAM_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ResetDiagramAction();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
new file mode 100644
index 0000000..49f948a
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/SaveGraphImageSubMenu.java
@@ -0,0 +1,315 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static javax.swing.JFileChooser.APPROVE_OPTION;
+import static javax.swing.JOptionPane.ERROR_MESSAGE;
+import static javax.swing.JOptionPane.WARNING_MESSAGE;
+import static javax.swing.JOptionPane.YES_NO_OPTION;
+import static javax.swing.JOptionPane.showConfirmDialog;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramSaveMenuSection.DIAGRAM_SAVE_MENU_SECTION;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URI;
+import java.net.URL;
+import java.util.prefs.Preferences;
+
+import javax.swing.AbstractAction;
+import javax.swing.ImageIcon;
+import javax.swing.JFileChooser;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+
+import net.sf.taverna.t2.lang.io.StreamCopier;
+import net.sf.taverna.t2.lang.io.StreamDevourer;
+import net.sf.taverna.t2.lang.observer.Observable;
+import net.sf.taverna.t2.lang.observer.SwingAwareObserver;
+import net.sf.taverna.t2.lang.ui.ExtensionFileFilter;
+import net.sf.taverna.t2.ui.menu.AbstractMenuCustom;
+import net.sf.taverna.t2.ui.menu.DesignOnlyAction;
+import net.sf.taverna.t2.workbench.configuration.workbench.WorkbenchConfiguration;
+import net.sf.taverna.t2.workbench.file.FileManager;
+import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
+import net.sf.taverna.t2.workbench.models.graph.DotWriter;
+import net.sf.taverna.t2.workbench.models.graph.GraphController;
+import net.sf.taverna.t2.workbench.models.graph.svg.SVGUtil;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.selection.events.PerspectiveSelectionEvent;
+import net.sf.taverna.t2.workbench.selection.events.SelectionManagerEvent;
+import net.sf.taverna.t2.workbench.views.graph.GraphViewComponent;
+
+import org.apache.log4j.Logger;
+
+import uk.org.taverna.scufl2.api.core.Workflow;
+
+/**
+ * An action that saves graph diagram image.
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ */
+public class SaveGraphImageSubMenu extends AbstractMenuCustom {
+ private static final Logger logger = Logger
+ .getLogger(SaveGraphImageSubMenu.class);
+ private static final String[] saveTypes = { "dot", "png", "svg", "ps",
+ "ps2" };
+ private static final String[] saveExtensions = { "dot", "png", "svg", "ps",
+ "ps" };
+ private static final String[] saveTypeNames = { "dot text", "PNG bitmap",
+ "scalable vector graphics", "postscript", "postscript for PDF" };
+ public static final URI SAVE_GRAPH_IMAGE_MENU_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuSaveGraphImage");
+
+ private JMenu saveDiagramMenu;
+ private FileManager fileManager;
+ private SelectionManager selectionManager;
+ private WorkbenchConfiguration workbenchConfiguration;
+ private GraphViewComponent graphViewComponent;
+
+ public SaveGraphImageSubMenu() {
+ super(DIAGRAM_SAVE_MENU_SECTION, 70, SAVE_GRAPH_IMAGE_MENU_URI);
+ }
+
+ @Override
+ protected Component createCustomComponent() {
+ saveDiagramMenu = new JMenu("Export diagram");
+ saveDiagramMenu
+ .setToolTipText("Open this menu to export the diagram in various formats");
+ for (int i = 0; i < saveTypes.length; i++) {
+ String type = saveTypes[i];
+ String extension = saveExtensions[i];
+ ImageIcon icon = new ImageIcon(
+ WorkbenchIcons.class.getResource("graph/saveAs"
+ + type.toUpperCase() + ".png"));
+ JMenuItem item = new JMenuItem(new DotInvoker("Export as "
+ + saveTypeNames[i], icon, type, extension));
+ saveDiagramMenu.add(item);
+ }
+ return saveDiagramMenu;
+ }
+
+ @SuppressWarnings("serial")
+ class DotInvoker extends AbstractAction implements DesignOnlyAction {
+ String type = "dot";
+ String extension = "dot";
+
+ public DotInvoker(String name, ImageIcon icon, String type,
+ String extension) {
+ super(name, icon);
+ this.type = type;
+ this.extension = extension;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ Workflow workflow = selectionManager.getSelectedWorkflow();
+ if (workflow == null) {
+ showMessageDialog(null, "Cannot export an empty diagram.",
+ "Warning", WARNING_MESSAGE);
+ return;
+ }
+
+ File file = saveDialogue(null, workflow, extension,
+ "Export workflow diagram");
+ if (file == null)
+ // User cancelled
+ return;
+
+ try {
+ GraphController graphController = graphViewComponent
+ .getGraphController(workflow);
+
+ if (type.equals("dot")) {
+ // Just write out the dot text, no processing required
+ PrintWriter out = new PrintWriter(new FileWriter(file));
+ DotWriter dotWriter = new DotWriter(out);
+ dotWriter.writeGraph(graphController.generateGraph());
+ out.flush();
+ out.close();
+ } else {
+ String dotLocation = (String) workbenchConfiguration
+ .getProperty("taverna.dotlocation");
+ if (dotLocation == null)
+ dotLocation = "dot";
+ logger.debug("GraphViewComponent: Invoking dot...");
+ Process dotProcess = Runtime.getRuntime().exec(
+ new String[] { dotLocation, "-T" + type });
+
+ FileOutputStream fos = new FileOutputStream(file);
+
+ StringWriter stringWriter = new StringWriter();
+ DotWriter dotWriter = new DotWriter(stringWriter);
+ dotWriter.writeGraph(graphController.generateGraph());
+
+ OutputStream dotOut = dotProcess.getOutputStream();
+ dotOut.write(SVGUtil.getDot(stringWriter.toString(),
+ workbenchConfiguration).getBytes());
+ dotOut.flush();
+ dotOut.close();
+ new StreamDevourer(dotProcess.getErrorStream()).start();
+ new StreamCopier(dotProcess.getInputStream(), fos).start();
+ }
+ } catch (Exception ex) {
+ logger.warn("GraphViewComponent: Could not export diagram to " + file, ex);
+ showMessageDialog(null,
+ "Problem saving diagram : \n" + ex.getMessage(),
+ "Error!", ERROR_MESSAGE);
+ }
+ }
+ }
+
+ /**
+ * Pop up a save dialogue relating to the given workflow. This method can be
+ * used, for example, for saving the workflow diagram as .png, and will use
+ * the existing workflow title as a base for suggesting a filename.
+ *
+ * @param parentComponent
+ * Parent component for dialogue window
+ * @param model
+ * Workflow to save
+ * @param extension
+ * Extension for filename, such as "jpg"
+ * @param windowTitle
+ * Title for dialogue box, such as "Save workflow diagram"
+ * @return File instance for the selected abstract filename, or null if the
+ * dialogue was cancelled.
+ */
+ private File saveDialogue(Component parentComponent, Workflow workflow,
+ String extension, String windowTitle) {
+ JFileChooser fc = new JFileChooser();
+ Preferences prefs = Preferences
+ .userNodeForPackage(SaveGraphImageSubMenu.class);
+ String curDir = prefs
+ .get("currentDir", System.getProperty("user.home"));
+ String suggestedFileName = "";
+ // Get the source the workflow was loaded from - can be File, URL, or InputStream
+ Object source = fileManager.getDataflowSource(workflow.getParent());
+ if (source instanceof File) {
+ suggestedFileName = ((File) source).getName();
+ // remove the file extension
+ suggestedFileName = suggestedFileName.substring(0,
+ suggestedFileName.lastIndexOf("."));
+ } else if (source instanceof URL) {
+ suggestedFileName = ((URL) source).getPath();
+ // remove the file extension
+ suggestedFileName = suggestedFileName.substring(0,
+ suggestedFileName.lastIndexOf("."));
+ } else {
+ // We cannot suggest the file name if workflow was read from an InputStream
+ }
+
+ fc.setDialogTitle(windowTitle);
+ fc.resetChoosableFileFilters();
+ fc.setFileFilter(new ExtensionFileFilter(new String[] { extension }));
+ if (suggestedFileName.isEmpty())
+ // No file suggestion, just the directory
+ fc.setCurrentDirectory(new File(curDir));
+ else
+ // Suggest a filename from the workflow file name
+ fc.setSelectedFile(new File(curDir, suggestedFileName + "." + extension));
+
+ while (true) {
+ if (fc.showSaveDialog(parentComponent) != APPROVE_OPTION) {
+ logger.info("GraphViewComponent: Aborting diagram export to "
+ + suggestedFileName);
+ return null;
+ }
+
+ File file = fixExtension(fc.getSelectedFile(), extension);
+ logger.debug("GraphViewComponent: Selected " + file + " as export target");
+ prefs.put("currentDir", fc.getCurrentDirectory().toString());
+
+ // If file doesn't exist, we may write it! (Well, probably...)
+ if (!file.exists())
+ return file;
+
+ // Ask the user if they want to overwrite the file
+ String msg = file.getAbsolutePath()
+ + " already exists. Do you want to overwrite it?";
+ if (showConfirmDialog(null, msg, "File already exists",
+ YES_NO_OPTION) == JOptionPane.YES_OPTION)
+ return file;
+ }
+ }
+
+ /**
+ * Make sure given File has the given extension. If it has no extension,
+ * a new File instance will be returned. Otherwise, the passed instance is
+ * returned unchanged.
+ *
+ * @param file
+ * File which extension is to be checked
+ * @param extension
+ * Extension desired, example: "xml"
+ * @return file parameter if the extension was OK, or a new File instance
+ * with the correct extension
+ */
+ private File fixExtension(File file, String extension) {
+ if (file.getName().endsWith("." + extension))
+ return file;
+ // Append the extension (keep the existing one)
+ String name = file.getName();
+ return new File(file.getParent(), name + "." + extension);
+ }
+
+ public void setFileManager(FileManager fileManager) {
+ this.fileManager = fileManager;
+ }
+
+ public void setWorkbenchConfiguration(
+ WorkbenchConfiguration workbenchConfiguration) {
+ this.workbenchConfiguration = workbenchConfiguration;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+
+ public void setGraphViewComponent(GraphViewComponent graphViewComponent) {
+ this.graphViewComponent = graphViewComponent;
+ }
+
+ private static final String DESIGN_PERSPECTIVE_ID = "net.sf.taverna.t2.ui.perspectives.design.DesignPerspective";
+
+ @SuppressWarnings("unused")
+ private final class SelectionManagerObserver extends
+ SwingAwareObserver<SelectionManagerEvent> {
+ @Override
+ public void notifySwing(Observable<SelectionManagerEvent> sender,
+ SelectionManagerEvent message) {
+ if (!(message instanceof PerspectiveSelectionEvent))
+ return;
+ PerspectiveSelectionEvent event = (PerspectiveSelectionEvent) message;
+
+ saveDiagramMenu.setEnabled((DESIGN_PERSPECTIVE_ID.equals(event
+ .getSelectedPerspective().getID())));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
new file mode 100644
index 0000000..b8735c9
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInAction.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_EQUALS;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static net.sf.taverna.t2.workbench.icons.WorkbenchIcons.zoomInIcon;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.DesignOrResultsAction;
+
+import org.apache.log4j.Logger;
+
+@SuppressWarnings("serial")
+public class ZoomInAction extends AbstractAction implements
+ DesignOrResultsAction {
+ @SuppressWarnings("unused")
+ private static Logger logger = Logger.getLogger(ZoomInAction.class);
+ private static Action designAction = null;
+ @SuppressWarnings("unused")
+ private static Action resultsAction = null;
+
+ public static void setResultsAction(Action resultsAction) {
+ ZoomInAction.resultsAction = resultsAction;
+ }
+
+ public static void setDesignAction(Action designAction) {
+ ZoomInAction.designAction = designAction;
+ }
+
+ ZoomInAction() {
+ super("Zoom in", zoomInIcon);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_EQUALS, getDefaultToolkit()
+ .getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+// if (isWorkflowPerspective()) {
+// if (designAction != null)
+ designAction.actionPerformed(e);
+// else
+// logger.error("ZoomInAction.designAction is null");
+// } else if (isResultsPerspective() && (resultsAction != null))
+// resultsAction.actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
new file mode 100644
index 0000000..89eea7d
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomInMenuAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+
+/**
+ * An action that zooms a diagram image
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class ZoomInMenuAction extends AbstractMenuAction {
+ public static final URI ZOOM_IN_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuZoomIn");
+
+ public ZoomInMenuAction() {
+ super(DIAGRAM_ZOOM_MENU_SECTION, 10, ZOOM_IN_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ZoomInAction();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
new file mode 100644
index 0000000..bd2a2b9
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutAction.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static java.awt.Toolkit.getDefaultToolkit;
+import static java.awt.event.KeyEvent.VK_MINUS;
+import static javax.swing.KeyStroke.getKeyStroke;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.DesignOrResultsAction;
+import net.sf.taverna.t2.workbench.icons.WorkbenchIcons;
+
+@SuppressWarnings("serial")
+public class ZoomOutAction extends AbstractAction implements
+ DesignOrResultsAction {
+ private static Action designAction = null;
+ @SuppressWarnings("unused")
+ private static Action resultsAction = null;
+
+ public static void setResultsAction(Action resultsAction) {
+ ZoomOutAction.resultsAction = resultsAction;
+ }
+
+ public static void setDesignAction(Action designAction) {
+ ZoomOutAction.designAction = designAction;
+ }
+
+ ZoomOutAction() {
+ super("Zoom out", WorkbenchIcons.zoomOutIcon);
+ putValue(
+ ACCELERATOR_KEY,
+ getKeyStroke(VK_MINUS, getDefaultToolkit()
+ .getMenuShortcutKeyMask()));
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+// if (isWorkflowPerspective() && (designAction != null))
+ designAction.actionPerformed(e);
+// else if (isResultsPerspective() && (resultsAction != null))
+// resultsAction.actionPerformed(e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
new file mode 100644
index 0000000..bc34252
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/menu/ZoomOutMenuAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.menu;
+
+import static net.sf.taverna.t2.workbench.views.graph.menu.DiagramZoomMenuSection.DIAGRAM_ZOOM_MENU_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+
+/**
+ * An action that zooms a diagram image
+ *
+ * @author Alex Nenadic
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class ZoomOutMenuAction extends AbstractMenuAction {
+ public static final URI ZOOM_OUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#diagramMenuZoomOut");
+
+ public ZoomOutMenuAction() {
+ super(DIAGRAM_ZOOM_MENU_SECTION, 20, ZOOM_OUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new ZoomOutAction();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
new file mode 100644
index 0000000..736ba8d
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFInputToolbarAction.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.toolbar;
+
+import static net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.actions.AddWFInputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFInputToolbarAction extends AbstractMenuAction {
+ private static final URI ADD_WF_INPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarAddWFInput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFInputToolbarAction() {
+ super(GRAPH_EDIT_TOOLBAR_SECTION, 10, ADD_WF_INPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFInputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
new file mode 100644
index 0000000..ae7d5d0
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/AddWFOutputToolbarAction.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.toolbar;
+
+import static net.sf.taverna.t2.workbench.views.graph.toolbar.GraphEditToolbarSection.GRAPH_EDIT_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.actions.AddWFOutputAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class AddWFOutputToolbarAction extends AbstractMenuAction {
+ private static final URI ADD_WF_OUTPUT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarAddWFOutput");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public AddWFOutputToolbarAction() {
+ super(GRAPH_EDIT_TOOLBAR_SECTION, 20, ADD_WF_OUTPUT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new AddWFOutputAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/8c4b365e/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
----------------------------------------------------------------------
diff --git a/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
new file mode 100644
index 0000000..068c530
--- /dev/null
+++ b/taverna-workbench-graph-view/src/main/java/net/sf/taverna/t2/workbench/views/graph/toolbar/DeleteGraphComponentToolbarAction.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester
+ *
+ * Modifications to the initial code base are copyright of their
+ * respective authors, or their employers as appropriate.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ ******************************************************************************/
+package net.sf.taverna.t2.workbench.views.graph.toolbar;
+
+import static net.sf.taverna.t2.workbench.views.graph.toolbar.GraphDeleteToolbarSection.GRAPH_DELETE_TOOLBAR_SECTION;
+
+import java.net.URI;
+
+import javax.swing.Action;
+
+import net.sf.taverna.t2.ui.menu.AbstractMenuAction;
+import net.sf.taverna.t2.workbench.edits.EditManager;
+import net.sf.taverna.t2.workbench.selection.SelectionManager;
+import net.sf.taverna.t2.workbench.views.graph.actions.DeleteGraphComponentAction;
+
+/**
+ * @author Alex Nenadic
+ */
+public class DeleteGraphComponentToolbarAction extends AbstractMenuAction {
+ private static final URI DELETE_GRAPH_COMPONENT_URI = URI
+ .create("http://taverna.sf.net/2008/t2workbench/menu#graphToolbarDeleteGraphComponent");
+
+ private EditManager editManager;
+ private SelectionManager selectionManager;
+
+ public DeleteGraphComponentToolbarAction() {
+ super(GRAPH_DELETE_TOOLBAR_SECTION, 10, DELETE_GRAPH_COMPONENT_URI);
+ }
+
+ @Override
+ protected Action createAction() {
+ return new DeleteGraphComponentAction(editManager, selectionManager);
+ }
+
+ public void setEditManager(EditManager editManager) {
+ this.editManager = editManager;
+ }
+
+ public void setSelectionManager(SelectionManager selectionManager) {
+ this.selectionManager = selectionManager;
+ }
+}