You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/26 19:51:59 UTC

[10/51] [partial] incubator-taverna-workbench git commit: all packages are moved to org.apache.taverna.*

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java
new file mode 100644
index 0000000..90f7874
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpCollator.java
@@ -0,0 +1,326 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import java.awt.Component;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.help.BadIDException;
+import javax.help.HelpSet;
+import javax.help.HelpSetException;
+import javax.help.Map.ID;
+import javax.help.TryMap;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreePath;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class loads the {@link HelpSet} and also deals with the registration of
+ * ids and the decoding from a {@link Component} to the corresponding id. These
+ * two sets of functionality should possibly be separated.
+ * 
+ * @author alanrw
+ */
+// TODO Convert to a bean
+public final class HelpCollator {
+	private static Logger logger = Logger.getLogger(HelpCollator.class);
+	/**
+	 * The HelpSet that is being used.
+	 */
+	private static HelpSet hs = null;
+	/**
+	 * The mapping from components to ids. This is used because of problems with
+	 * CSH throwing exceptions because it tried to use ids that were not in the
+	 * map.
+	 */
+	private static Map<Component, String> idMap;
+	/**
+	 * Indicates whether the HelpCollator has been initialized.
+	 */
+	private static boolean initialized = false;
+	/**
+	 * A Pattern for normalizing the ids.
+	 */
+	private static Pattern nonAlphanumeric;
+	/**
+	 * The emptyHelp is set if the HelpCollator was unable to read the
+	 */
+	private static boolean emptyHelp = true;
+	private static int TIMEOUT = 5000;
+
+	private static String externalHelpSetURL = "http://www.mygrid.org.uk/taverna/helpset/"
+			+ version() + "/helpset.hs";
+
+	// private static Profile profile = ProfileFactory.getInstance().getProfile();
+	private static String version() {
+		return "NO-VERSION";//profile.getVersion();
+		// TODO find a better way to find the version
+	}
+
+	/**
+	 * Attempt to read the up-to-date HelpSet from the web
+	 */
+	private static void readExternalHelpSet() {
+		try {
+			URL url = new URL(externalHelpSetURL);
+			checkConnection(url);
+			hs = new HelpSet(null, url);
+			if (hs.getLocalMap() == null) {
+			    hs = null;
+				logger.error("Helpset from " + externalHelpSetURL
+						+ " local map was null");
+			} else
+				logger.info("Read external help set from " + externalHelpSetURL);
+		} catch (MissingResourceException e) {
+		    logger.error("No external HelpSet URL specified", e);
+		} catch (MalformedURLException e) {
+		    logger.error("External HelpSet URL is malformed", e);
+		} catch (HelpSetException e) {
+		    logger.error("External HelpSet could not be read", e);
+		} catch (IOException e) {
+			logger.error("IOException reading External HelpSet", e);
+		}
+	}
+
+	private static void checkConnection(URL url) throws IOException {
+		if (!url.getProtocol().startsWith("http"))
+			return;
+		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+		connection.setReadTimeout(TIMEOUT);
+		connection.setConnectTimeout(TIMEOUT);
+		connection.setRequestMethod("HEAD");
+		connection.getInputStream().close();
+		connection.disconnect();
+	}
+
+	/**
+	 * This methods creates a HelpSet based upon, in priority, the external
+	 * HelpSet, then a newly created empty HelpSet.
+	 */
+	private static void initialize() {
+		if (initialized)
+			return;
+		readExternalHelpSet();
+		if (hs == null) {
+			hs = new HelpSet();
+			hs.setLocalMap(new TryMap());
+		} else {
+			logger.trace("EmptyHelp set to false");
+			emptyHelp = false;
+		}
+		idMap = new HashMap<>();
+		nonAlphanumeric = Pattern.compile("[^a-z0-9\\.]");
+		initialized = true;
+	}
+
+	/**
+	 * Indicates if an empty HelpSet is being used
+	 *
+	 * @return
+	 */
+	public static boolean isEmptyHelp() {
+		return emptyHelp;
+	}
+
+	public static URL getURLFromID(String id) throws BadIDException,
+			MalformedURLException {
+		initialize();
+		logger.trace("Looking for id: " + id);
+		ID theId = ID.create(id, hs);
+		if (theId == null)
+			return null;
+		return hs.getCombinedMap().getURLFromID(theId);
+	}
+
+	/**
+	 * Register a component under the specified id. The method checks that the
+	 * id is known to the HelpSet's map.
+	 * 
+	 * @param component
+	 * @param id
+	 */
+	public static void registerComponent(Component component, String id) {
+		logger.trace("Attempting to register " + id);
+		initialize();
+		String normalizedId = normalizeString(id.toLowerCase());
+		if (idMap.containsKey(component)) {
+			logger.info("Registered " + normalizedId);
+			return;
+		}
+
+		/*
+		 * If Workbench is started up while there is no network connection -
+		 * hs.getLocalMap() is null for some reason
+		 */
+		if (hs != null && hs.getLocalMap() != null
+				&& hs.getLocalMap().isValidID(normalizedId, hs)) {
+			idMap.put(component, normalizedId);
+			logger.info("Registered " + normalizedId);
+		} else
+			logger.warn("Refused to register component as " + normalizedId
+					+ " not in map");
+	}
+
+	/**
+	 * Register a component. Since no id is specified, the HelpCollator takes
+	 * the canonical name of the component's class. This is useful when an
+	 * explicit hierarchy-based approach has been taken.
+	 *
+	 * @param component
+	 */
+	public static void registerComponent(Component component) {
+		String canonicalName = component.getClass().getCanonicalName();
+		if (canonicalName != null)
+			registerComponent(component, canonicalName);
+	}
+
+	/**
+	 * Register a component based upon its parent's class and a suffix
+	 * indicating the component's purpose in the parent.
+	 *
+	 * @param component
+	 * @param parent
+	 * @param suffix
+	 */
+	public static void registerComponent(Component component, Object parent,
+			String suffix) {
+		String canonicalName = parent.getClass().getCanonicalName();
+		if (canonicalName != null)
+			registerComponent(component, canonicalName + "-" + suffix);
+	}
+
+	/**
+	 * Try to find an id for the Component. This code should be re-written when
+	 * we have more experience in how to couple the UI and HelpSets.
+	 *
+	 * @param c
+	 * @return
+	 */
+	static String getHelpID(Component c) {
+		initialize();
+		boolean found = false;
+		String result = null;
+		if (c instanceof JTree) {
+			String idInTree = getHelpIDInTree((JTree) c);
+			if (idInTree != null) {
+				found = true;
+				result = idInTree;
+			}
+		}
+		Component working = c;
+		if (c != null)
+			logger.trace("Starting at a " + working.getClass());
+		while (!found && (working != null)) {
+			if (idMap.containsKey(working)) {
+				result = idMap.get(working);
+				found = true;
+				logger.trace("Found component id " + result);
+			} else {
+				String className = working.getClass().getCanonicalName();
+				if (hs.getLocalMap().isValidID(className, hs)) {
+					result = className;
+					found = true;
+					logger.trace("Found class name " + result);
+				}
+			}
+			if (!found) {
+				working = working.getParent();
+				if (working != null)
+					logger.trace("Moved up to a " + working.getClass());
+			}
+		}
+		return result;
+	}
+
+	/**
+	 * Change the input String into an id that contains only alphanumeric
+	 * characters or hyphens.
+	 *
+	 * @param input
+	 * @return
+	 */
+	private static String normalizeString(String input) {
+		Matcher m = nonAlphanumeric.matcher(input);
+		return m.replaceAll("-");
+	}
+
+	/**
+	 * If help is sought on part of a JTree, then this method attempts to find a
+	 * node of the tree that can be mapped to an id. The possibilities are ad
+	 * hoc and should be re-examined when more experience is gained.
+	 * 
+	 * @param c
+	 * @return
+	 */
+	private static String getHelpIDInTree(JTree c) {
+		initialize();
+
+		TreePath tp = c.getSelectionPath();
+		if (tp == null)
+			return null;
+
+		Object o = tp.getLastPathComponent();
+		if (o == null)
+			return null;
+
+		if (o instanceof DefaultMutableTreeNode) {
+			DefaultMutableTreeNode dmtn = (DefaultMutableTreeNode) o;
+			if (dmtn.getUserObject() != null)
+				o = dmtn.getUserObject();
+		}
+
+		String className = o.getClass().getCanonicalName();
+
+		logger.trace("Tree node as a string is " + o);
+
+		String possibility = normalizeString(o.toString().toLowerCase());
+
+		logger.trace("Normalized is " + possibility);
+		logger.trace("Tree node class name is " + className);
+
+		possibility = className + "-" + possibility;
+
+		logger.trace("Possibility is " + possibility);
+
+		String result;
+		if (hs.getLocalMap().isValidID(possibility, hs)) {
+			result = possibility;
+			logger.trace("Accepted tree node " + result);
+		} else if (hs.getLocalMap().isValidID(className, hs)) {
+			result = className;
+			logger.trace("Found tree node class name " + result);
+		} else {
+			result = null;
+		}
+
+		logger.debug("Tree node is a " + o.getClass());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java
new file mode 100644
index 0000000..0d3bbdf
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/HelpEnabledDialog.java
@@ -0,0 +1,117 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import static org.apache.taverna.workbench.MainWindow.getMainWindow;
+import static org.apache.taverna.workbench.helper.HelpCollator.registerComponent;
+import static org.apache.taverna.workbench.helper.Helper.setKeyCatcher;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.HeadlessException;
+
+import javax.swing.JDialog;
+
+/**
+ * This class extends JDialog to register the dialog and also attach a key
+ * catcher so that F1 is interpreted as help
+ *
+ * @author alanrw
+ */
+public class HelpEnabledDialog extends JDialog {
+	private static final long serialVersionUID = -5068807887477419800L;
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @param id
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Frame owner, String title, boolean modal, String id)
+			throws HeadlessException {
+		super(owner == null ? getMainWindow() : owner, title, modal);
+
+		if (id != null)
+			registerComponent(this, id);
+		else if (owner != null)
+			registerComponent(this, owner.getClass().getCanonicalName()
+					+ "-dialog");
+		else if (title != null && !title.isEmpty())
+			registerComponent(this, title);
+		setKeyCatcher(this);
+	}
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @param id
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Dialog owner, String title, boolean modal,
+			String id) throws HeadlessException {
+		super(owner, title, modal);
+		if (id != null)
+			registerComponent(this, id);
+		else if (owner != null)
+			registerComponent(this, owner.getClass().getCanonicalName()
+					+ "-dialog");
+		setKeyCatcher(this);
+	}
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Frame parent, String title, boolean modal) {
+		this(parent, title, modal, null);
+	}
+
+	/**
+	 * Create a HelpEnabledDialog, register it (if possible) with the
+	 * HelpCollator and attach a keycatcher.
+	 *
+	 * @param owner
+	 * @param title
+	 * @param modal
+	 * @throws HeadlessException
+	 */
+	public HelpEnabledDialog(Dialog parent, String title, boolean modal) {
+		this(parent, title, modal, null);
+	}
+
+	@Override
+	public void setVisible(boolean b) {
+		setLocationRelativeTo(getParent());
+		super.setVisible(b);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java
new file mode 100644
index 0000000..f5315d5
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/Helper.java
@@ -0,0 +1,203 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import static java.awt.Desktop.getDesktop;
+import static java.awt.MouseInfo.getPointerInfo;
+import static javax.swing.JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT;
+import static javax.swing.KeyStroke.getKeyStroke;
+import static org.apache.taverna.workbench.helper.HelpCollator.getHelpID;
+import static org.apache.taverna.workbench.helper.HelpCollator.getURLFromID;
+
+import java.awt.AWTEvent;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.help.BadIDException;
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
+import javax.swing.JComponent;
+import javax.swing.JRootPane;
+import javax.swing.RootPaneContainer;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class creates the dialogs for the presentation of the HelpSet held by
+ * the HelpCollator.
+ *
+ * @author alanrw
+ */
+public final class Helper {
+	private static Helper instance;
+	private static Logger logger = Logger.getLogger(Helper.class);
+
+	/**
+	 * Create a Helper and initialize the static variables.
+	 */
+	private Helper() {
+	}
+
+	/**
+	 * Get the singleton instance of Helper. In theory there could be more than
+	 * one.
+	 *
+	 * @return
+	 */
+	private static Helper getInstance() {
+		if (instance == null)
+			instance = new Helper();
+		return instance;
+	}
+
+	/**
+	 * Show in the current dialog the entry (if any) corresponding to the
+	 * specified id.
+	 *
+	 * @param id
+	 */
+	private static void showID(String id) {
+		getInstance();
+		try {
+			URL result = getURLFromID(id);
+			if (result == null)
+				result = getURLFromID("home");
+			getDesktop().browse(result.toURI());
+		} catch (BadIDException | IOException | URISyntaxException e) {
+			logger.error(e);
+		}
+	}
+
+	/**
+	 * Show the most suitable help for the specified component.
+	 *
+	 * @param c
+	 */
+	public static void showHelp(Component c) {
+		showID(getHelpID(c));
+	}
+
+	/**
+	 * Display the default home page help.
+	 *
+	 * @param e
+	 */
+	public static void displayDefaultHelp(AWTEvent e) {
+		showID("home");
+	}
+
+	public static void displayFieldLevelHelp(ActionEvent e) {
+		//
+	}
+
+	private static final String HELP_KEY = "F1";
+
+	/**
+	 * Associated the specified action with key presses in the specified
+	 * component.
+	 * 
+	 * @param component
+	 * @param theAction
+	 */
+	public static void setKeyCatcher(final JComponent component,
+			final AbstractAction theAction) {
+		InputMap oldInputMap = component
+				.getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+		InputMap newInputMap = new InputMap();
+		newInputMap.setParent(oldInputMap);
+		newInputMap.put(getKeyStroke(HELP_KEY), "doSomething");
+		component.setInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, newInputMap);
+		ActionMap oldActionMap = component.getActionMap();
+		ActionMap newActionMap = new ActionMap();
+		newActionMap.setParent(oldActionMap);
+		newActionMap.put("doSomething", theAction);
+		component.setActionMap(newActionMap);
+	}
+
+	/**
+	 * Set up a key-press catcher for the specified component such that when F1
+	 * is pressed it should help for the component where the cursor is.
+	 *
+	 * @param rootpanecontainer
+	 */
+	public static void setKeyCatcher(final RootPaneContainer rootpanecontainer) {
+		@SuppressWarnings("serial")
+		AbstractAction theAction = new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent evt) {
+				Component component = (Component) rootpanecontainer;
+				Container container = (Container) rootpanecontainer;
+				logger.info("frame action F1 pressed with source "
+						+ evt.getSource().getClass().getName());
+				Point mousePosition = getPointerInfo().getLocation();
+				Point framePosition = component.getLocation();
+				Point relativePosition = (Point) mousePosition.clone();
+				relativePosition.translate(-framePosition.x, -framePosition.y);
+				Component c = container.findComponentAt(relativePosition);
+				if (c != null)
+					logger.info("F1 pressed in a " + c.getClass().getName());
+				showHelpWithinContainer(rootpanecontainer, c);
+			}
+		};
+
+		JRootPane pane = rootpanecontainer.getRootPane();
+		setKeyCatcher(pane, theAction);
+	}
+
+	/**
+	 * Show the help most associated with the specific component within the container.
+	 *
+	 * @param root
+	 * @param c
+	 */
+	static void showHelpWithinContainer(RootPaneContainer root, Component c) {
+		getInstance();
+		showHelp(c);
+	}
+
+	/**
+	 * Register a component with the {@link HelpCollator} under the specified
+	 * id.
+	 * 
+	 * @param component
+	 * @param id
+	 */
+	public static void registerComponent(Component component, final String id) {
+		HelpCollator.registerComponent(component, id);
+	}
+
+	/**
+	 * Register a component with the {@link HelpCollator}.
+	 *
+	 * @param component
+	 * @param parent
+	 * @param suffix
+	 */
+	public static void registerComponent(Component component, Object parent,
+			String suffix) {
+		HelpCollator.registerComponent(component, parent, suffix);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java
----------------------------------------------------------------------
diff --git a/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java
new file mode 100644
index 0000000..6e94ab2
--- /dev/null
+++ b/taverna-helper-api/src/main/java/org/apache/taverna/workbench/helper/NonBlockedHelpEnabledDialog.java
@@ -0,0 +1,56 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.workbench.helper;
+
+import static java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE;
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.awt.HeadlessException;
+
+/**
+ * @author alanrw
+ */
+public class NonBlockedHelpEnabledDialog extends HelpEnabledDialog {
+	private static final long serialVersionUID = -2455471377333940417L;
+
+	public NonBlockedHelpEnabledDialog(Dialog owner, String title,
+			boolean modal, String id) throws HeadlessException {
+		super(owner, title, modal, id);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+
+	public NonBlockedHelpEnabledDialog(Frame owner, String title,
+			boolean modal, String id) throws HeadlessException {
+		super(owner, title, modal, id);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+
+	public NonBlockedHelpEnabledDialog(Frame parent, String title, boolean modal) {
+		super(parent, title, modal, null);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+
+	public NonBlockedHelpEnabledDialog(Dialog parent, String title,
+			boolean modal) {
+		super(parent, title, modal, null);
+		this.setModalExclusionType(APPLICATION_EXCLUDE);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java b/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
deleted file mode 100644
index 18ceeb4..0000000
--- a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
+++ /dev/null
@@ -1,582 +0,0 @@
-/*******************************************************************************
- * 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.httpproxy.config;
-
-import static java.awt.GridBagConstraints.BOTH;
-import static java.awt.GridBagConstraints.CENTER;
-import static java.awt.GridBagConstraints.HORIZONTAL;
-import static java.awt.GridBagConstraints.NONE;
-import static java.awt.GridBagConstraints.WEST;
-import static javax.swing.JOptionPane.showMessageDialog;
-import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
-import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
-import static net.sf.taverna.t2.workbench.helper.Helper.showHelp;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.PROXY_USE_OPTION;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_NON_PROXY_HOSTS;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_HOST;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PASSWORD;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PORT;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_USER;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_NON_PROXY_HOSTS;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_HOST;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PASSWORD;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PORT;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_USER;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_NO_PROXY_OPTION;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SPECIFIED_VALUES_OPTION;
-import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SYSTEM_PROPERTIES_OPTION;
-
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.AbstractAction;
-import javax.swing.ButtonGroup;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
-import javax.swing.JTextField;
-import javax.swing.border.EmptyBorder;
-
-import net.sf.taverna.t2.lang.ui.DialogTextArea;
-import org..taverna.configuration.proxy.HttpProxyConfiguration;
-
-/**
- * The HttpProxyConfigurationPanel provides the user interface to a
- * {@link HttpProxyConfiguration} to determine how HTTP Connections are made by
- * Taverna.
- * 
- * @author alanrw
- * @author David Withers
- */
-public class HttpProxyConfigurationPanel extends JPanel {
-	static final long serialVersionUID = 3668473431971125038L;
-	/**
-	 * The size of the field for the JTextFields.
-	 */
-	private static int TEXTFIELD_SIZE = 25;
-
-	private final HttpProxyConfiguration httpProxyConfiguration;
-	/**
-	 * RadioButtons that are in a common ButtonGroup. Selecting one of them
-	 * indicates whether the system http proxy settings, the ad hoc specified
-	 * values or no proxy settings at all should be used.
-	 */
-	private JRadioButton useSystemProperties;
-	private JRadioButton useSpecifiedValues;
-	private JRadioButton useNoProxy;
-	/**
-	 * JTextFields and one DialogTextArea to hold the settings for the HTTP
-	 * proxy properties. The values are only editable if the user picks
-	 * useSpecifiedValues.
-	 */
-	private JTextField proxyHostField;
-	private JTextField proxyPortField;
-	private JTextField proxyUserField;
-	private JTextField proxyPasswordField;
-	private DialogTextArea nonProxyHostsArea;
-	private JScrollPane nonProxyScrollPane;
-	/**
-	 * A string that indicates which HTTP setting option the user has currently
-	 * picked. This does not necesarily match that which has been applied.
-	 */
-	private String shownOption = USE_SYSTEM_PROPERTIES_OPTION;
-
-	/**
-	 * The HttpProxyConfigurationPanel consists of a set of properties where the
-	 * configuration values for HTTP can be specified and a set of buttons where
-	 * the more general apply, help etc. appear.
-	 */
-	public HttpProxyConfigurationPanel(
-			HttpProxyConfiguration httpProxyConfiguration) {
-		this.httpProxyConfiguration = httpProxyConfiguration;
-		initComponents();
-	}
-
-	/**
-	 * Populates the panel with a representation of the current HTTP proxy
-	 * settings for the specified {@link HttpProxyConfiguration} and also the
-	 * capability to alter them.
-	 */
-	private void initComponents() {
-		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
-
-		this.setLayout(new GridBagLayout());
-
-		GridBagConstraints gbc = new GridBagConstraints();
-
-		// Title describing what kind of settings we are configuring here
-		JTextArea descriptionText = new JTextArea("HTTP proxy configuration");
-		descriptionText.setLineWrap(true);
-		descriptionText.setWrapStyleWord(true);
-		descriptionText.setEditable(false);
-		descriptionText.setFocusable(false);
-		descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
-		gbc.anchor = WEST;
-		gbc.gridx = 0;
-		gbc.gridy = 0;
-		gbc.gridwidth = 2;
-		gbc.weightx = 1.0;
-		gbc.weighty = 0.0;
-		gbc.fill = HORIZONTAL;
-		this.add(descriptionText, gbc);
-
-		/**
-		 * Generate the three radio buttons and put them in a group. Each button
-		 * is bound to an action that alters the shownOption and re-populates
-		 * the shown HTTP property fields.
-		 */
-		useNoProxy = new JRadioButton("Do not use a proxy");
-		useNoProxy.setAlignmentX(LEFT_ALIGNMENT);
-		gbc.gridx = 0;
-		gbc.gridy = 1;
-		gbc.gridwidth = 2;
-		gbc.weightx = 0.0;
-		gbc.weighty = 0.0;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(useNoProxy, gbc);
-		ActionListener useNoProxyListener = new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				shownOption = USE_NO_PROXY_OPTION;
-				populateFields();
-			}
-		};
-		useNoProxy.addActionListener(useNoProxyListener);
-
-		useSystemProperties = new JRadioButton("Use system properties");
-		useSystemProperties.setAlignmentX(LEFT_ALIGNMENT);
-		gbc.gridx = 0;
-		gbc.gridy = 2;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		this.add(useSystemProperties, gbc);
-		ActionListener systemPropertiesListener = new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				shownOption = USE_SYSTEM_PROPERTIES_OPTION;
-				populateFields();
-			}
-		};
-		useSystemProperties.addActionListener(systemPropertiesListener);
-
-		useSpecifiedValues = new JRadioButton("Use specified values");
-		useSpecifiedValues.setAlignmentX(LEFT_ALIGNMENT);
-		gbc.gridx = 0;
-		gbc.gridy = 3;
-		this.add(useSpecifiedValues, gbc);
-		ActionListener specifiedValuesListener = new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent arg0) {
-				shownOption = USE_SPECIFIED_VALUES_OPTION;
-				populateFields();
-			}
-		};
-		useSpecifiedValues.addActionListener(specifiedValuesListener);
-
-		ButtonGroup bg = new ButtonGroup();
-		bg.add(useSystemProperties);
-		bg.add(useSpecifiedValues);
-		bg.add(useNoProxy);
-
-		/**
-		 * Create the fields to show the HTTP proxy property values. These
-		 * become editable if the shown option is to use specified values.
-		 */
-		proxyHostField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 4;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(new JLabel("Proxy host"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 4;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyHostField, gbc);
-
-		proxyPortField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 5;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		this.add(new JLabel("Proxy port"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 5;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyPortField, gbc);
-
-		proxyUserField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 6;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		this.add(new JLabel("Proxy user"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 6;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyUserField, gbc);
-
-		proxyPasswordField = new JTextField(TEXTFIELD_SIZE);
-		gbc.gridx = 0;
-		gbc.gridy = 7;
-		gbc.gridwidth = 1;
-		gbc.fill = NONE;
-		this.add(new JLabel("Proxy password"), gbc);
-		gbc.gridx = 1;
-		gbc.gridy = 7;
-		gbc.gridwidth = 1;
-		gbc.fill = HORIZONTAL;
-		this.add(proxyPasswordField, gbc);
-
-		nonProxyHostsArea = new DialogTextArea(10, 40);
-		nonProxyScrollPane = new JScrollPane(nonProxyHostsArea);
-		nonProxyScrollPane
-				.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED);
-		nonProxyScrollPane
-				.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_AS_NEEDED);
-		// nonProxyScrollPane.setPreferredSize(new Dimension(300, 500));
-		gbc.gridx = 0;
-		gbc.gridy = 8;
-		gbc.gridwidth = 2;
-		gbc.fill = NONE;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(new JLabel("Non-proxy hosts"), gbc);
-		gbc.gridx = 0;
-		gbc.gridy = 9;
-		gbc.weightx = 1.0;
-		gbc.weighty = 1.0;
-		gbc.gridwidth = 2;
-		gbc.insets = new Insets(0, 0, 0, 0);
-		gbc.fill = BOTH;
-		this.add(nonProxyScrollPane, gbc);
-
-		// Add buttons panel
-		gbc.gridx = 0;
-		gbc.gridy = 10;
-		gbc.weightx = 0.0;
-		gbc.weighty = 0.0;
-		gbc.gridwidth = 2;
-		gbc.fill = HORIZONTAL;
-		gbc.anchor = CENTER;
-		gbc.insets = new Insets(10, 0, 0, 0);
-		this.add(createButtonPanel(), gbc);
-
-		setFields();
-	}
-
-	/**
-	 * Populate the fields in the property panel according to which option is
-	 * being shown and the stored values within the
-	 * {@link HttpProxyConfiguration}.
-	 */
-	private void populateFields() {
-		/**
-		 * Editing of the property fields is only available when the option is
-		 * to use the specified values.
-		 */
-		boolean editingEnabled = shownOption
-				.equals(USE_SPECIFIED_VALUES_OPTION);
-
-		if (shownOption.equals(USE_SYSTEM_PROPERTIES_OPTION)) {
-			proxyHostField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_HOST));
-			proxyPortField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_PORT));
-			proxyUserField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_USER));
-			proxyPasswordField.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_PROXY_PASSWORD));
-			nonProxyHostsArea.setText(httpProxyConfiguration
-					.getProperty(SYSTEM_NON_PROXY_HOSTS));
-		} else if (shownOption.equals(USE_SPECIFIED_VALUES_OPTION)) {
-			proxyHostField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_HOST));
-			proxyPortField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_PORT));
-			proxyUserField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_USER));
-			proxyPasswordField.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_PROXY_PASSWORD));
-			nonProxyHostsArea.setText(httpProxyConfiguration
-					.getProperty(TAVERNA_NON_PROXY_HOSTS));
-		} else {
-			proxyHostField.setText(null);
-			proxyPortField.setText(null);
-			proxyUserField.setText(null);
-			proxyPasswordField.setText(null);
-			nonProxyHostsArea.setText(null);
-		}
-
-		proxyHostField.setEnabled(editingEnabled);
-		proxyPortField.setEnabled(editingEnabled);
-		proxyUserField.setEnabled(editingEnabled);
-		proxyPasswordField.setEnabled(editingEnabled);
-		nonProxyHostsArea.setEnabled(editingEnabled);
-		nonProxyHostsArea.setEditable(editingEnabled);
-		nonProxyScrollPane.setEnabled(editingEnabled);
-	}
-
-	/**
-	 * Create the panel to contain the buttons
-	 * 
-	 * @return
-	 */
-	@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();
-			}
-		});
-		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();
-			}
-		});
-		panel.add(applyButton);
-
-		return panel;
-	}
-
-	/**
-	 * Checks that the specified values for the HTTP properties are a valid
-	 * combination and, if so, saves them for future use. It does not apply them
-	 * to the currently executing Taverna.
-	 */
-	private void saveSettings() {
-		if (useSystemProperties.isSelected()) {
-			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
-					USE_SYSTEM_PROPERTIES_OPTION);
-		} else if (useNoProxy.isSelected()) {
-			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
-					USE_NO_PROXY_OPTION);
-		} else {
-			if (validateFields()) {
-				httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
-						USE_SPECIFIED_VALUES_OPTION);
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_HOST,
-						proxyHostField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PORT,
-						proxyPortField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_USER,
-						proxyUserField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PASSWORD,
-						proxyPasswordField.getText());
-				httpProxyConfiguration.setProperty(TAVERNA_NON_PROXY_HOSTS,
-						nonProxyHostsArea.getText());
-			}
-		}
-	}
-
-	/**
-	 * Validates and, where appropriate formats, the properties values specified
-	 * for HTTP Proxy configuration.
-	 * 
-	 * @return
-	 */
-	private boolean validateFields() {
-		boolean result = true;
-		result = result && validateHostField();
-		result = result && validatePortField();
-		result = result && validateUserField();
-		result = result && validatePasswordField();
-		result = result && validateNonProxyHostsArea();
-		return result;
-	}
-
-	/**
-	 * Checks that, if a value is specified for non-proxy hosts then a proxy
-	 * host has also been specified. Formats the non-proxy hosts string so that
-	 * if the user has entered the hosts on separate lines, then the stored
-	 * values are separated by bars.
-	 * 
-	 * @return
-	 */
-	private boolean validateNonProxyHostsArea() {
-		boolean result = true;
-		String value = nonProxyHostsArea.getText();
-		if ((value != null) && (!value.equals(""))) {
-			value = value.replaceAll("\\n", "|");
-			nonProxyHostsArea.setText(value);
-			result = result
-					&& dependsUpon("non-proxy host", "host",
-							proxyHostField.getText());
-		}
-		return result;
-	}
-
-	/**
-	 * Checks that, if a password has been specified, then a user has also been
-	 * specified.
-	 * 
-	 * @return
-	 */
-	private boolean validatePasswordField() {
-		boolean result = true;
-		String value = proxyPasswordField.getText();
-		if ((value != null) && !value.isEmpty())
-			result = result
-					&& dependsUpon("password", "user", proxyHostField.getText());
-		return result;
-	}
-
-	/**
-	 * Checks that if a user has been specified, then a host has also been
-	 * specified.
-	 * 
-	 * @return
-	 */
-	private boolean validateUserField() {
-		boolean result = true;
-		String value = proxyUserField.getText();
-		if ((value != null) && !value.isEmpty())
-			result = result
-					&& dependsUpon("user", "host", proxyHostField.getText());
-		return result;
-	}
-
-	/**
-	 * Checks that if a port has been specified then a host has also been
-	 * specified. Checks that the port number is a non-negative integer. If the
-	 * port has not been specified, then if a host has been specified, the
-	 * default value 80 is used.
-	 * 
-	 * @return
-	 */
-	private boolean validatePortField() {
-		boolean result = true;
-		String value = proxyPortField.getText();
-		if ((value != null) && (!value.equals(""))) {
-			result = result
-					&& dependsUpon("port", "host", proxyHostField.getText());
-			try {
-				int parsedNumber = Integer.parseInt(value);
-				if (parsedNumber <= 0) {
-					showMessageDialog(this, "The port must be non-negative");
-					result = false;
-				}
-			} catch (NumberFormatException e) {
-				showMessageDialog(this, "The port must be an integer");
-				result = false;
-			}
-		} else {
-			String hostField = proxyHostField.getText();
-			if ((hostField != null) && !hostField.isEmpty())
-				proxyPortField.setText("80");
-		}
-		return result;
-	}
-
-	/**
-	 * Checks if the targetValue has been specified. If not then a message is
-	 * displayed indicating that the dependent cannot be specified with the
-	 * target.
-	 * 
-	 * @param dependent
-	 * @param target
-	 * @param targetValue
-	 * @return
-	 */
-	private boolean dependsUpon(String dependent, String target,
-			String targetValue) {
-		boolean result = true;
-		if ((targetValue == null) || target.equals("")) {
-			showMessageDialog(this, "A " + dependent
-					+ " cannot be specified without a " + target);
-			result = false;
-		}
-		return result;
-	}
-
-	/**
-	 * Could validate the host field e.g. by establishing a connection.
-	 * Currently no validation is done.
-	 * 
-	 * @return
-	 */
-	private boolean validateHostField() {
-		boolean result = true;
-		// String value = proxyHostField.getText();
-		return result;
-	}
-
-	/**
-	 * Save the currently set field values (if valid) to the
-	 * {@link HttpProxyConfiguration}. Also applies those values to the
-	 * currently running Taverna.
-	 */
-	private void applySettings() {
-		if (validateFields()) {
-			saveSettings();
-			httpProxyConfiguration.changeProxySettings();
-		}
-	}
-
-	/**
-	 * Set the shown field values to those currently in use (i.e. last saved
-	 * configuration).
-	 */
-	private void setFields() {
-		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
-		useSystemProperties.setSelected(shownOption
-				.equals(USE_SYSTEM_PROPERTIES_OPTION));
-		useSpecifiedValues.setSelected(shownOption
-				.equals(USE_SPECIFIED_VALUES_OPTION));
-		useNoProxy.setSelected(shownOption.equals(USE_NO_PROXY_OPTION));
-		populateFields();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java b/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
deleted file mode 100644
index 4cf3967..0000000
--- a/taverna-httpproxy-config/src/main/java/net/sf/taverna/t2/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * 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.httpproxy.config;
-
-import javax.swing.JPanel;
-
-import org.apache.taverna.configuration.Configurable;
-import uk.org.taverna.configuration.ConfigurationUIFactory;
-import uk.org.taverna.configuration.proxy.HttpProxyConfiguration;
-
-/**
- * A Factory to create a HttpProxyConfiguration
- *
- * @author alanrw
- * @author David Withers
- */
-public class HttpProxyConfigurationUIFactory implements ConfigurationUIFactory {
-	private HttpProxyConfiguration httpProxyConfiguration;
-
-	@Override
-	public boolean canHandle(String uuid) {
-		return uuid.equals(getConfigurable().getUUID());
-	}
-
-	@Override
-	public JPanel getConfigurationPanel() {
-		return new HttpProxyConfigurationPanel(httpProxyConfiguration);
-	}
-
-	@Override
-	public Configurable getConfigurable() {
-		return httpProxyConfiguration;
-	}
-
-	public void setHttpProxyConfiguration(HttpProxyConfiguration httpProxyConfiguration) {
-		this.httpProxyConfiguration = httpProxyConfiguration;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
new file mode 100644
index 0000000..4c57cb2
--- /dev/null
+++ b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationPanel.java
@@ -0,0 +1,582 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.httpproxy.config;
+
+import static java.awt.GridBagConstraints.BOTH;
+import static java.awt.GridBagConstraints.CENTER;
+import static java.awt.GridBagConstraints.HORIZONTAL;
+import static java.awt.GridBagConstraints.NONE;
+import static java.awt.GridBagConstraints.WEST;
+import static javax.swing.JOptionPane.showMessageDialog;
+import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
+import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
+import static org.apache.taverna.workbench.helper.Helper.showHelp;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.PROXY_USE_OPTION;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_NON_PROXY_HOSTS;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_HOST;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PASSWORD;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_PORT;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.SYSTEM_PROXY_USER;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_NON_PROXY_HOSTS;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_HOST;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PASSWORD;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_PORT;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.TAVERNA_PROXY_USER;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_NO_PROXY_OPTION;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SPECIFIED_VALUES_OPTION;
+import static uk.org.taverna.configuration.proxy.HttpProxyConfiguration.USE_SYSTEM_PROPERTIES_OPTION;
+
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.AbstractAction;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+
+import org.apache.taverna.lang.ui.DialogTextArea;
+import org..taverna.configuration.proxy.HttpProxyConfiguration;
+
+/**
+ * The HttpProxyConfigurationPanel provides the user interface to a
+ * {@link HttpProxyConfiguration} to determine how HTTP Connections are made by
+ * Taverna.
+ * 
+ * @author alanrw
+ * @author David Withers
+ */
+public class HttpProxyConfigurationPanel extends JPanel {
+	static final long serialVersionUID = 3668473431971125038L;
+	/**
+	 * The size of the field for the JTextFields.
+	 */
+	private static int TEXTFIELD_SIZE = 25;
+
+	private final HttpProxyConfiguration httpProxyConfiguration;
+	/**
+	 * RadioButtons that are in a common ButtonGroup. Selecting one of them
+	 * indicates whether the system http proxy settings, the ad hoc specified
+	 * values or no proxy settings at all should be used.
+	 */
+	private JRadioButton useSystemProperties;
+	private JRadioButton useSpecifiedValues;
+	private JRadioButton useNoProxy;
+	/**
+	 * JTextFields and one DialogTextArea to hold the settings for the HTTP
+	 * proxy properties. The values are only editable if the user picks
+	 * useSpecifiedValues.
+	 */
+	private JTextField proxyHostField;
+	private JTextField proxyPortField;
+	private JTextField proxyUserField;
+	private JTextField proxyPasswordField;
+	private DialogTextArea nonProxyHostsArea;
+	private JScrollPane nonProxyScrollPane;
+	/**
+	 * A string that indicates which HTTP setting option the user has currently
+	 * picked. This does not necesarily match that which has been applied.
+	 */
+	private String shownOption = USE_SYSTEM_PROPERTIES_OPTION;
+
+	/**
+	 * The HttpProxyConfigurationPanel consists of a set of properties where the
+	 * configuration values for HTTP can be specified and a set of buttons where
+	 * the more general apply, help etc. appear.
+	 */
+	public HttpProxyConfigurationPanel(
+			HttpProxyConfiguration httpProxyConfiguration) {
+		this.httpProxyConfiguration = httpProxyConfiguration;
+		initComponents();
+	}
+
+	/**
+	 * Populates the panel with a representation of the current HTTP proxy
+	 * settings for the specified {@link HttpProxyConfiguration} and also the
+	 * capability to alter them.
+	 */
+	private void initComponents() {
+		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
+
+		this.setLayout(new GridBagLayout());
+
+		GridBagConstraints gbc = new GridBagConstraints();
+
+		// Title describing what kind of settings we are configuring here
+		JTextArea descriptionText = new JTextArea("HTTP proxy configuration");
+		descriptionText.setLineWrap(true);
+		descriptionText.setWrapStyleWord(true);
+		descriptionText.setEditable(false);
+		descriptionText.setFocusable(false);
+		descriptionText.setBorder(new EmptyBorder(10, 10, 10, 10));
+		gbc.anchor = WEST;
+		gbc.gridx = 0;
+		gbc.gridy = 0;
+		gbc.gridwidth = 2;
+		gbc.weightx = 1.0;
+		gbc.weighty = 0.0;
+		gbc.fill = HORIZONTAL;
+		this.add(descriptionText, gbc);
+
+		/**
+		 * Generate the three radio buttons and put them in a group. Each button
+		 * is bound to an action that alters the shownOption and re-populates
+		 * the shown HTTP property fields.
+		 */
+		useNoProxy = new JRadioButton("Do not use a proxy");
+		useNoProxy.setAlignmentX(LEFT_ALIGNMENT);
+		gbc.gridx = 0;
+		gbc.gridy = 1;
+		gbc.gridwidth = 2;
+		gbc.weightx = 0.0;
+		gbc.weighty = 0.0;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(useNoProxy, gbc);
+		ActionListener useNoProxyListener = new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				shownOption = USE_NO_PROXY_OPTION;
+				populateFields();
+			}
+		};
+		useNoProxy.addActionListener(useNoProxyListener);
+
+		useSystemProperties = new JRadioButton("Use system properties");
+		useSystemProperties.setAlignmentX(LEFT_ALIGNMENT);
+		gbc.gridx = 0;
+		gbc.gridy = 2;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		this.add(useSystemProperties, gbc);
+		ActionListener systemPropertiesListener = new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				shownOption = USE_SYSTEM_PROPERTIES_OPTION;
+				populateFields();
+			}
+		};
+		useSystemProperties.addActionListener(systemPropertiesListener);
+
+		useSpecifiedValues = new JRadioButton("Use specified values");
+		useSpecifiedValues.setAlignmentX(LEFT_ALIGNMENT);
+		gbc.gridx = 0;
+		gbc.gridy = 3;
+		this.add(useSpecifiedValues, gbc);
+		ActionListener specifiedValuesListener = new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				shownOption = USE_SPECIFIED_VALUES_OPTION;
+				populateFields();
+			}
+		};
+		useSpecifiedValues.addActionListener(specifiedValuesListener);
+
+		ButtonGroup bg = new ButtonGroup();
+		bg.add(useSystemProperties);
+		bg.add(useSpecifiedValues);
+		bg.add(useNoProxy);
+
+		/**
+		 * Create the fields to show the HTTP proxy property values. These
+		 * become editable if the shown option is to use specified values.
+		 */
+		proxyHostField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 4;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(new JLabel("Proxy host"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 4;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyHostField, gbc);
+
+		proxyPortField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 5;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		this.add(new JLabel("Proxy port"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 5;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyPortField, gbc);
+
+		proxyUserField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 6;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		this.add(new JLabel("Proxy user"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 6;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyUserField, gbc);
+
+		proxyPasswordField = new JTextField(TEXTFIELD_SIZE);
+		gbc.gridx = 0;
+		gbc.gridy = 7;
+		gbc.gridwidth = 1;
+		gbc.fill = NONE;
+		this.add(new JLabel("Proxy password"), gbc);
+		gbc.gridx = 1;
+		gbc.gridy = 7;
+		gbc.gridwidth = 1;
+		gbc.fill = HORIZONTAL;
+		this.add(proxyPasswordField, gbc);
+
+		nonProxyHostsArea = new DialogTextArea(10, 40);
+		nonProxyScrollPane = new JScrollPane(nonProxyHostsArea);
+		nonProxyScrollPane
+				.setHorizontalScrollBarPolicy(HORIZONTAL_SCROLLBAR_AS_NEEDED);
+		nonProxyScrollPane
+				.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_AS_NEEDED);
+		// nonProxyScrollPane.setPreferredSize(new Dimension(300, 500));
+		gbc.gridx = 0;
+		gbc.gridy = 8;
+		gbc.gridwidth = 2;
+		gbc.fill = NONE;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(new JLabel("Non-proxy hosts"), gbc);
+		gbc.gridx = 0;
+		gbc.gridy = 9;
+		gbc.weightx = 1.0;
+		gbc.weighty = 1.0;
+		gbc.gridwidth = 2;
+		gbc.insets = new Insets(0, 0, 0, 0);
+		gbc.fill = BOTH;
+		this.add(nonProxyScrollPane, gbc);
+
+		// Add buttons panel
+		gbc.gridx = 0;
+		gbc.gridy = 10;
+		gbc.weightx = 0.0;
+		gbc.weighty = 0.0;
+		gbc.gridwidth = 2;
+		gbc.fill = HORIZONTAL;
+		gbc.anchor = CENTER;
+		gbc.insets = new Insets(10, 0, 0, 0);
+		this.add(createButtonPanel(), gbc);
+
+		setFields();
+	}
+
+	/**
+	 * Populate the fields in the property panel according to which option is
+	 * being shown and the stored values within the
+	 * {@link HttpProxyConfiguration}.
+	 */
+	private void populateFields() {
+		/**
+		 * Editing of the property fields is only available when the option is
+		 * to use the specified values.
+		 */
+		boolean editingEnabled = shownOption
+				.equals(USE_SPECIFIED_VALUES_OPTION);
+
+		if (shownOption.equals(USE_SYSTEM_PROPERTIES_OPTION)) {
+			proxyHostField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_HOST));
+			proxyPortField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_PORT));
+			proxyUserField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_USER));
+			proxyPasswordField.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_PROXY_PASSWORD));
+			nonProxyHostsArea.setText(httpProxyConfiguration
+					.getProperty(SYSTEM_NON_PROXY_HOSTS));
+		} else if (shownOption.equals(USE_SPECIFIED_VALUES_OPTION)) {
+			proxyHostField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_HOST));
+			proxyPortField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_PORT));
+			proxyUserField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_USER));
+			proxyPasswordField.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_PROXY_PASSWORD));
+			nonProxyHostsArea.setText(httpProxyConfiguration
+					.getProperty(TAVERNA_NON_PROXY_HOSTS));
+		} else {
+			proxyHostField.setText(null);
+			proxyPortField.setText(null);
+			proxyUserField.setText(null);
+			proxyPasswordField.setText(null);
+			nonProxyHostsArea.setText(null);
+		}
+
+		proxyHostField.setEnabled(editingEnabled);
+		proxyPortField.setEnabled(editingEnabled);
+		proxyUserField.setEnabled(editingEnabled);
+		proxyPasswordField.setEnabled(editingEnabled);
+		nonProxyHostsArea.setEnabled(editingEnabled);
+		nonProxyHostsArea.setEditable(editingEnabled);
+		nonProxyScrollPane.setEnabled(editingEnabled);
+	}
+
+	/**
+	 * Create the panel to contain the buttons
+	 * 
+	 * @return
+	 */
+	@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();
+			}
+		});
+		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();
+			}
+		});
+		panel.add(applyButton);
+
+		return panel;
+	}
+
+	/**
+	 * Checks that the specified values for the HTTP properties are a valid
+	 * combination and, if so, saves them for future use. It does not apply them
+	 * to the currently executing Taverna.
+	 */
+	private void saveSettings() {
+		if (useSystemProperties.isSelected()) {
+			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
+					USE_SYSTEM_PROPERTIES_OPTION);
+		} else if (useNoProxy.isSelected()) {
+			httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
+					USE_NO_PROXY_OPTION);
+		} else {
+			if (validateFields()) {
+				httpProxyConfiguration.setProperty(PROXY_USE_OPTION,
+						USE_SPECIFIED_VALUES_OPTION);
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_HOST,
+						proxyHostField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PORT,
+						proxyPortField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_USER,
+						proxyUserField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_PROXY_PASSWORD,
+						proxyPasswordField.getText());
+				httpProxyConfiguration.setProperty(TAVERNA_NON_PROXY_HOSTS,
+						nonProxyHostsArea.getText());
+			}
+		}
+	}
+
+	/**
+	 * Validates and, where appropriate formats, the properties values specified
+	 * for HTTP Proxy configuration.
+	 * 
+	 * @return
+	 */
+	private boolean validateFields() {
+		boolean result = true;
+		result = result && validateHostField();
+		result = result && validatePortField();
+		result = result && validateUserField();
+		result = result && validatePasswordField();
+		result = result && validateNonProxyHostsArea();
+		return result;
+	}
+
+	/**
+	 * Checks that, if a value is specified for non-proxy hosts then a proxy
+	 * host has also been specified. Formats the non-proxy hosts string so that
+	 * if the user has entered the hosts on separate lines, then the stored
+	 * values are separated by bars.
+	 * 
+	 * @return
+	 */
+	private boolean validateNonProxyHostsArea() {
+		boolean result = true;
+		String value = nonProxyHostsArea.getText();
+		if ((value != null) && (!value.equals(""))) {
+			value = value.replaceAll("\\n", "|");
+			nonProxyHostsArea.setText(value);
+			result = result
+					&& dependsUpon("non-proxy host", "host",
+							proxyHostField.getText());
+		}
+		return result;
+	}
+
+	/**
+	 * Checks that, if a password has been specified, then a user has also been
+	 * specified.
+	 * 
+	 * @return
+	 */
+	private boolean validatePasswordField() {
+		boolean result = true;
+		String value = proxyPasswordField.getText();
+		if ((value != null) && !value.isEmpty())
+			result = result
+					&& dependsUpon("password", "user", proxyHostField.getText());
+		return result;
+	}
+
+	/**
+	 * Checks that if a user has been specified, then a host has also been
+	 * specified.
+	 * 
+	 * @return
+	 */
+	private boolean validateUserField() {
+		boolean result = true;
+		String value = proxyUserField.getText();
+		if ((value != null) && !value.isEmpty())
+			result = result
+					&& dependsUpon("user", "host", proxyHostField.getText());
+		return result;
+	}
+
+	/**
+	 * Checks that if a port has been specified then a host has also been
+	 * specified. Checks that the port number is a non-negative integer. If the
+	 * port has not been specified, then if a host has been specified, the
+	 * default value 80 is used.
+	 * 
+	 * @return
+	 */
+	private boolean validatePortField() {
+		boolean result = true;
+		String value = proxyPortField.getText();
+		if ((value != null) && (!value.equals(""))) {
+			result = result
+					&& dependsUpon("port", "host", proxyHostField.getText());
+			try {
+				int parsedNumber = Integer.parseInt(value);
+				if (parsedNumber <= 0) {
+					showMessageDialog(this, "The port must be non-negative");
+					result = false;
+				}
+			} catch (NumberFormatException e) {
+				showMessageDialog(this, "The port must be an integer");
+				result = false;
+			}
+		} else {
+			String hostField = proxyHostField.getText();
+			if ((hostField != null) && !hostField.isEmpty())
+				proxyPortField.setText("80");
+		}
+		return result;
+	}
+
+	/**
+	 * Checks if the targetValue has been specified. If not then a message is
+	 * displayed indicating that the dependent cannot be specified with the
+	 * target.
+	 * 
+	 * @param dependent
+	 * @param target
+	 * @param targetValue
+	 * @return
+	 */
+	private boolean dependsUpon(String dependent, String target,
+			String targetValue) {
+		boolean result = true;
+		if ((targetValue == null) || target.equals("")) {
+			showMessageDialog(this, "A " + dependent
+					+ " cannot be specified without a " + target);
+			result = false;
+		}
+		return result;
+	}
+
+	/**
+	 * Could validate the host field e.g. by establishing a connection.
+	 * Currently no validation is done.
+	 * 
+	 * @return
+	 */
+	private boolean validateHostField() {
+		boolean result = true;
+		// String value = proxyHostField.getText();
+		return result;
+	}
+
+	/**
+	 * Save the currently set field values (if valid) to the
+	 * {@link HttpProxyConfiguration}. Also applies those values to the
+	 * currently running Taverna.
+	 */
+	private void applySettings() {
+		if (validateFields()) {
+			saveSettings();
+			httpProxyConfiguration.changeProxySettings();
+		}
+	}
+
+	/**
+	 * Set the shown field values to those currently in use (i.e. last saved
+	 * configuration).
+	 */
+	private void setFields() {
+		shownOption = httpProxyConfiguration.getProperty(PROXY_USE_OPTION);
+		useSystemProperties.setSelected(shownOption
+				.equals(USE_SYSTEM_PROPERTIES_OPTION));
+		useSpecifiedValues.setSelected(shownOption
+				.equals(USE_SPECIFIED_VALUES_OPTION));
+		useNoProxy.setSelected(shownOption.equals(USE_NO_PROXY_OPTION));
+		populateFields();
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
new file mode 100644
index 0000000..dabe6a8
--- /dev/null
+++ b/taverna-httpproxy-config/src/main/java/org/apache/taverna/workbench/httpproxy/config/HttpProxyConfigurationUIFactory.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * 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 org.apache.taverna.workbench.httpproxy.config;
+
+import javax.swing.JPanel;
+
+import org.apache.taverna.configuration.Configurable;
+import uk.org.taverna.configuration.ConfigurationUIFactory;
+import uk.org.taverna.configuration.proxy.HttpProxyConfiguration;
+
+/**
+ * A Factory to create a HttpProxyConfiguration
+ *
+ * @author alanrw
+ * @author David Withers
+ */
+public class HttpProxyConfigurationUIFactory implements ConfigurationUIFactory {
+	private HttpProxyConfiguration httpProxyConfiguration;
+
+	@Override
+	public boolean canHandle(String uuid) {
+		return uuid.equals(getConfigurable().getUUID());
+	}
+
+	@Override
+	public JPanel getConfigurationPanel() {
+		return new HttpProxyConfigurationPanel(httpProxyConfiguration);
+	}
+
+	@Override
+	public Configurable getConfigurable() {
+		return httpProxyConfiguration;
+	}
+
+	public void setHttpProxyConfiguration(HttpProxyConfiguration httpProxyConfiguration) {
+		this.httpProxyConfiguration = httpProxyConfiguration;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory b/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
deleted file mode 100644
index d87772b..0000000
--- a/taverna-httpproxy-config/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.configuration.ConfigurationUIFactory
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workbench.httpproxy.config.HttpProxyConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory b/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
new file mode 100644
index 0000000..d6cdb0c
--- /dev/null
+++ b/taverna-httpproxy-config/src/main/resources/META-INF/services/org.apache.taverna.workbench.configuration.ConfigurationUIFactory
@@ -0,0 +1 @@
+org.apache.taverna.workbench.httpproxy.config.HttpProxyConfigurationUIFactory
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
----------------------------------------------------------------------
diff --git a/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml b/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
index 6d6060f..4eb6820 100644
--- a/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
+++ b/taverna-httpproxy-config/src/main/resources/META-INF/spring/httpproxy-config-context.xml
@@ -3,7 +3,7 @@
 	xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-	<bean id="HttpProxyConfigurationUIFactory" class="net.sf.taverna.t2.workbench.httpproxy.config.HttpProxyConfigurationUIFactory">
+	<bean id="HttpProxyConfigurationUIFactory" class="org.apache.taverna.workbench.httpproxy.config.HttpProxyConfigurationUIFactory">
 		<property name="httpProxyConfiguration" ref="httpProxyConfiguration" />
 	</bean>
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java b/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
deleted file mode 100644
index b0d600d..0000000
--- a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamCopier.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * 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.lang.io;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.log4j.Logger;
-
-/**
- * Copies an InputStream to an OutputStream.
- * 
- * @author Tom Oinn
- */
-public class StreamCopier extends Thread {
-
-	private static Logger logger = Logger
-	.getLogger(StreamCopier.class);
-
-	InputStream is;
-
-	OutputStream os;
-
-	/**
-	 * Create a new StreamCopier which will, when started, copy the specified
-	 * InputStream to the specified OutputStream
-	 */
-	public StreamCopier(InputStream is, OutputStream os) {
-		super("StreamCopier");
-		this.is = is;
-		this.os = os;
-	}
-
-	/**
-	 * Start copying the stream, exits when the InputStream runs out of data
-	 */
-	public void run() {
-		try {
-			byte[] buffer = new byte[1024];
-			int bytesRead;
-			while ((bytesRead = is.read(buffer)) != -1) {
-				os.write(buffer, 0, bytesRead);
-			}
-			os.flush();
-			os.close();
-		} catch (Exception ex) {
-			logger.error("Could not copy stream", ex);
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java b/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
deleted file mode 100644
index 8495e27..0000000
--- a/taverna-io/src/main/java/net/sf/taverna/t2/lang/io/StreamDevourer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * 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.lang.io;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.apache.log4j.Logger;
-
-/**
- * Devours an input stream and allows the contents to be read as a String once
- * the stream has completed.
- * 
- * @author Tom Oinn
- * @author Alan R Williams
- */
-public class StreamDevourer extends Thread {
-	
-	private static Logger logger = Logger.getLogger(StreamDevourer.class);
-
-	private static byte[] newLine = System.getProperty("line.separator").getBytes();
-
-	BufferedReader br;
-
-	ByteArrayOutputStream output;
-
-	/**
-	 * Returns the current value of the internal ByteArrayOutputStream
-	 */
-	@Override
-	public String toString() {
-		return output.toString();
-	}
-
-	/**
-	 * Waits for the stream to close then returns the String representation of
-	 * its contents (this is equivalent to doing a join then calling toString)
-	 */
-	public String blockOnOutput() {
-		try {
-			this.join();
-			return output.toString();
-		} catch (InterruptedException ie) {
-			logger.error("Interrupted", ie);
-			interrupt();
-			return "";
-		}
-	}
-
-	/**
-	 * Create the StreamDevourer and point it at an InputStream to consume
-	 */
-	public StreamDevourer(InputStream is) {
-		super("StreamDevourer");
-		this.br = new BufferedReader(new InputStreamReader(is));
-		this.output = new ByteArrayOutputStream();
-	}
-
-	/**
-	 * When started this Thread will copy all data from the InputStream into a
-	 * ByteArrayOutputStream via a BufferedReader. Because of the use of the
-	 * BufferedReader this is only really appropriate for streams of textual
-	 * data
-	 */
-	@Override
-	public void run() {
-		try {
-			String line = null;
-			while ((line = br.readLine()) != null) {
-				// && line.endsWith("</svg>") == false) {
-				if (line.endsWith("\\") && !line.endsWith("\\\\")) {
-					line = line.substring(0, line.length() - 1);
-					output.write(line.getBytes());
-				} else {
-					output.write(line.getBytes());
-					output.write(newLine);
-				}
-			}
-			br.close();
-		} catch (IOException ioe) {
-			logger.error(ioe);
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java
new file mode 100644
index 0000000..616b4f3
--- /dev/null
+++ b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamCopier.java
@@ -0,0 +1,68 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.lang.io;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Copies an InputStream to an OutputStream.
+ * 
+ * @author Tom Oinn
+ */
+public class StreamCopier extends Thread {
+
+	private static Logger logger = Logger
+	.getLogger(StreamCopier.class);
+
+	InputStream is;
+
+	OutputStream os;
+
+	/**
+	 * Create a new StreamCopier which will, when started, copy the specified
+	 * InputStream to the specified OutputStream
+	 */
+	public StreamCopier(InputStream is, OutputStream os) {
+		super("StreamCopier");
+		this.is = is;
+		this.os = os;
+	}
+
+	/**
+	 * Start copying the stream, exits when the InputStream runs out of data
+	 */
+	public void run() {
+		try {
+			byte[] buffer = new byte[1024];
+			int bytesRead;
+			while ((bytesRead = is.read(buffer)) != -1) {
+				os.write(buffer, 0, bytesRead);
+			}
+			os.flush();
+			os.close();
+		} catch (Exception ex) {
+			logger.error("Could not copy stream", ex);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java
----------------------------------------------------------------------
diff --git a/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java
new file mode 100644
index 0000000..a5d9a9f
--- /dev/null
+++ b/taverna-io/src/main/java/org/apache/taverna/lang/io/StreamDevourer.java
@@ -0,0 +1,105 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.lang.io;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Devours an input stream and allows the contents to be read as a String once
+ * the stream has completed.
+ * 
+ * @author Tom Oinn
+ * @author Alan R Williams
+ */
+public class StreamDevourer extends Thread {
+	
+	private static Logger logger = Logger.getLogger(StreamDevourer.class);
+
+	private static byte[] newLine = System.getProperty("line.separator").getBytes();
+
+	BufferedReader br;
+
+	ByteArrayOutputStream output;
+
+	/**
+	 * Returns the current value of the internal ByteArrayOutputStream
+	 */
+	@Override
+	public String toString() {
+		return output.toString();
+	}
+
+	/**
+	 * Waits for the stream to close then returns the String representation of
+	 * its contents (this is equivalent to doing a join then calling toString)
+	 */
+	public String blockOnOutput() {
+		try {
+			this.join();
+			return output.toString();
+		} catch (InterruptedException ie) {
+			logger.error("Interrupted", ie);
+			interrupt();
+			return "";
+		}
+	}
+
+	/**
+	 * Create the StreamDevourer and point it at an InputStream to consume
+	 */
+	public StreamDevourer(InputStream is) {
+		super("StreamDevourer");
+		this.br = new BufferedReader(new InputStreamReader(is));
+		this.output = new ByteArrayOutputStream();
+	}
+
+	/**
+	 * When started this Thread will copy all data from the InputStream into a
+	 * ByteArrayOutputStream via a BufferedReader. Because of the use of the
+	 * BufferedReader this is only really appropriate for streams of textual
+	 * data
+	 */
+	@Override
+	public void run() {
+		try {
+			String line = null;
+			while ((line = br.readLine()) != null) {
+				// && line.endsWith("</svg>") == false) {
+				if (line.endsWith("\\") && !line.endsWith("\\\\")) {
+					line = line.substring(0, line.length() - 1);
+					output.write(line.getBytes());
+				} else {
+					output.write(line.getBytes());
+					output.write(newLine);
+				}
+			}
+			br.close();
+		} catch (IOException ioe) {
+			logger.error(ioe);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/a9a52bd5/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java b/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java
deleted file mode 100644
index 350c0cc..0000000
--- a/taverna-iteration-strategy-ui/src/main/java/net/sf/taverna/t2/workbench/iterationstrategy/IterationStrategyIcons.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * 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.iterationstrategy;
-
-import javax.swing.ImageIcon;
-
-import org.apache.log4j.Logger;
-
-public class IterationStrategyIcons {
-
-	private static Logger logger = Logger
-			.getLogger(IterationStrategyIcons.class);
-
-	public static ImageIcon joinIteratorIcon, lockStepIteratorIcon,
-			leafnodeicon;
-
-	static {
-		try {
-			Class<?> c = IterationStrategyIcons.class;
-			joinIteratorIcon = new ImageIcon(c
-					.getResource("icons/crossproducticon.png"));
-			lockStepIteratorIcon = new ImageIcon(c
-					.getResource("icons/dotproducticon.png"));
-			leafnodeicon = new ImageIcon(c
-					.getResource("icons/leafnodeicon.png"));
-		} catch (Exception ex) {
-			logger.warn("Could not find icon", ex);
-		}
-	}
-}