Repository: incubator-taverna-workbench
Updated Branches:
  refs/heads/master da7d4e4c8 -> 393b3224e


TAVERNA-999 Some attempts to tidy up


Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/commit/2ab2bfe5
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/tree/2ab2bfe5
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/diff/2ab2bfe5

Branch: refs/heads/master
Commit: 2ab2bfe55f2c4ad6ac60bc7a1e6b24aa4ba98543
Parents: da7d4e4
Author: Stian Soiland-Reyes <[email protected]>
Authored: Fri Jul 1 01:18:02 2016 +0100
Committer: Stian Soiland-Reyes <[email protected]>
Committed: Fri Jul 1 01:18:02 2016 +0100

----------------------------------------------------------------------
 taverna-iteration-strategy-ui/pom.xml           |   5 +
 .../IterationStrategyIcons.java                 |  34 ++--
 .../IterationStrategyConfigurationDialog.java   |  32 ++--
 .../IterationStrategyContextualView.java        | 162 ++++++++-----------
 .../IterationStrategyContextualViewFactory.java |  38 +++--
 .../editor/IterationStrategyCellRenderer.java   |  35 ++--
 .../editor/IterationStrategyEditor.java         |  40 +++--
 .../editor/IterationStrategyEditorControl.java  |  94 ++++++-----
 .../editor/IterationStrategyTree.java           |  46 +++---
 .../editor/IterationStrategyTreeModel.java      | 105 ++++++++++++
 .../editor/IterationStrategyTreeNode.java       |  94 +++++++++++
 .../IterationStrategyConfigureMenuAction.java   |  34 ++--
 .../editor/RunIterationStrategyEditor.java      |  68 ++++----
 13 files changed, 488 insertions(+), 299 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-iteration-strategy-ui/pom.xml 
b/taverna-iteration-strategy-ui/pom.xml
index c8ff8a8..174c7eb 100644
--- a/taverna-iteration-strategy-ui/pom.xml
+++ b/taverna-iteration-strategy-ui/pom.xml
@@ -28,6 +28,11 @@
        <name>Apache Taverna Iteration Strategy UI</name>
        <dependencies>
                <dependency>
+                       <groupId>org.apache.taverna.language</groupId>
+                       <artifactId>taverna-scufl2-api</artifactId>
+                       <version>0.15.2-incubating-SNAPSHOT</version>
+               </dependency>
+               <dependency>
                        <groupId>org.apache.taverna.engine</groupId>
                        <artifactId>taverna-workflowmodel-api</artifactId>
                        <version>${taverna.engine.version}</version>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
index bdfe724..6ed1da9 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/IterationStrategyIcons.java
@@ -1,23 +1,21 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester   
+/*
+ * 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
  * 
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
+ *   http://www.apache.org/licenses/LICENSE-2.0
  * 
- *  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
- 
******************************************************************************/
+ * 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.iterationstrategy;
 
 import javax.swing.ImageIcon;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
index ef45ec3..497a387 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyConfigurationDialog.java
@@ -1,5 +1,20 @@
-/**
- *
+/*
+ * 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.iterationstrategy.contextview;
 
@@ -15,18 +30,17 @@ import javax.swing.JDialog;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 
+import org.apache.log4j.Logger;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
 import org.apache.taverna.workbench.edits.EditManager;
 import org.apache.taverna.workbench.file.FileManager;
 import org.apache.taverna.workbench.helper.HelpEnabledDialog;
 import 
org.apache.taverna.workbench.iterationstrategy.editor.IterationStrategyEditorControl;
+import org.apache.taverna.workflow.edits.SetIterationStrategyStackEdit;
 import org.apache.taverna.workflowmodel.Edit;
 import org.apache.taverna.workflowmodel.EditException;
-import org.apache.taverna.workflowmodel.Edits;
-import org.apache.taverna.workflowmodel.Processor;
 import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-import 
org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyStack;
-
-import org.apache.log4j.Logger;
 
 /**
  * @author alanrw
@@ -88,9 +102,9 @@ public class IterationStrategyConfigurationDialog extends 
HelpEnabledDialog {
                }
 
                public void actionPerformed(ActionEvent e) {
-                       Edits edits = editManager.getEdits();
+                       
                        try {
-                               Edit<?> edit = 
edits.getSetIterationStrategyStackEdit(
+                               SetIterationStrategyStackEdit edit = new 
SetIterationStrategyStackEdit(
                                                processor,
                                                
IterationStrategyContextualView.copyIterationStrategyStack(workingStack));
                                editManager.doDataflowEdit(

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
index 2f516ef..4e50dca 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualView.java
@@ -1,25 +1,20 @@
-/*******************************************************************************
- * 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
- 
******************************************************************************/
-/**
- *
+/*
+ * 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.iterationstrategy.contextview;
 
@@ -31,18 +26,15 @@ import javax.swing.AbstractAction;
 import javax.swing.Action;
 import javax.swing.JComponent;
 
+import org.apache.log4j.Logger;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyStack;
+import 
org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
 import org.apache.taverna.workbench.edits.EditManager;
 import org.apache.taverna.workbench.file.FileManager;
 import org.apache.taverna.workbench.helper.HelpEnabledDialog;
 import 
org.apache.taverna.workbench.iterationstrategy.editor.IterationStrategyTree;
 import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView;
-import org.apache.taverna.workflowmodel.Processor;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-import 
org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyStack;
-import 
org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
-import 
org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
-
-import org.apache.log4j.Logger;
 import org.jdom.Content;
 import org.jdom.Element;
 import org.jdom.filter.ElementFilter;
@@ -50,13 +42,10 @@ import org.jdom.filter.ElementFilter;
 /**
  * Contextual view of an {@link IterationStrategyStack}.
  *
- * @author Stian Soiland-Reyes
- *
  */
 public class IterationStrategyContextualView extends ContextualView {
 
-       private static Logger logger = Logger
-                       .getLogger(IterationStrategyContextualView.class);
+       private static Logger logger = 
Logger.getLogger(IterationStrategyContextualView.class);
 
        private EditManager editManager;
 
@@ -70,49 +59,37 @@ public class IterationStrategyContextualView extends 
ContextualView {
 
        static {
 
-// This should be enabled and modified for T2-822
-/*             editManager.addObserver(new Observer<EditManagerEvent> () {
-
-                       private void examineEdit(Edit edit) {
-                               if (edit instanceof ConnectDatalinkEdit) {
-                                       
processConnectDatalinkEdit((ConnectDatalinkEdit) edit);
-                               }
-                               if (edit instanceof CompoundEdit) {
-                                       processCompoundEdit((CompoundEdit) 
edit);
-                               }
-                       }
-
-                       private void 
processConnectDatalinkEdit(ConnectDatalinkEdit edit) {
-                               Datalink d = ((ConnectDatalinkEdit) 
edit).getSubject();
-                               EventHandlingInputPort sink = d.getSink();
-                               if (sink instanceof ProcessorInputPort) {
-                                       ProcessorInputPort pip = 
(ProcessorInputPort) sink;
-                                       Processor p = pip.getProcessor();
-                                       final HelpEnabledDialog dialog = new 
IterationStrategyConfigurationDialog(null, p, 
copyIterationStrategyStack(p.getIterationStrategy()));
-                                       dialog.setVisible(true);
-                               }
-                       }
-
-                       private void processCompoundEdit(CompoundEdit edit) {
-                               for (Edit e : edit.getChildEdits()) {
-                                       examineEdit(e);
-                               }
-                       }
-
-                       @Override
-                       public void notify(Observable<EditManagerEvent> sender,
-                                       EditManagerEvent message) throws 
Exception {
-                               if (!(message instanceof DataflowEditEvent)) {
-                                       return;
-                               }
-                               examineEdit(message.getEdit());
-                       }});*/
+               // This should be enabled and modified for T2-822
+               /*
+                * editManager.addObserver(new Observer<EditManagerEvent> () {
+                * 
+                * private void examineEdit(Edit edit) { if (edit instanceof
+                * ConnectDatalinkEdit) {
+                * processConnectDatalinkEdit((ConnectDatalinkEdit) edit); } if 
(edit
+                * instanceof CompoundEdit) { 
processCompoundEdit((CompoundEdit) edit);
+                * } }
+                * 
+                * private void processConnectDatalinkEdit(ConnectDatalinkEdit 
edit) {
+                * Datalink d = ((ConnectDatalinkEdit) edit).getSubject();
+                * EventHandlingInputPort sink = d.getSink(); if (sink 
instanceof
+                * ProcessorInputPort) { ProcessorInputPort pip = 
(ProcessorInputPort)
+                * sink; Processor p = pip.getProcessor(); final 
HelpEnabledDialog
+                * dialog = new IterationStrategyConfigurationDialog(null, p,
+                * copyIterationStrategyStack(p.getIterationStrategy()));
+                * dialog.setVisible(true); } }
+                * 
+                * private void processCompoundEdit(CompoundEdit edit) { for 
(Edit e :
+                * edit.getChildEdits()) { examineEdit(e); } }
+                * 
+                * @Override public void notify(Observable<EditManagerEvent> 
sender,
+                * EditManagerEvent message) throws Exception { if (!(message 
instanceof
+                * DataflowEditEvent)) { return; } 
examineEdit(message.getEdit()); }});
+                */
        }
 
        public IterationStrategyContextualView(Processor processor, EditManager 
editManager, FileManager fileManager) {
-               if (processor == null || processor.getIterationStrategy() == 
null) {
-                       throw new NullPointerException(
-                                       "Iteration strategy stack can't be 
null");
+               if (processor == null) {
+                       throw new NullPointerException("Iteration strategy 
stack can't be null");
                }
                this.processor = processor;
                this.editManager = editManager;
@@ -136,14 +113,13 @@ public class IterationStrategyContextualView extends 
ContextualView {
                
strategyTree.setIterationStrategy(getIterationStrategy(iterationStack));
        }
 
-       public static IterationStrategyStack copyIterationStrategyStack(
-                       IterationStrategyStack stack) {
-               Element asXML = ((IterationStrategyStackImpl)stack).asXML();
+       public static IterationStrategyStack 
copyIterationStrategyStack(IterationStrategyStack stack) {
+               Element asXML = ((IterationStrategyStack) stack).asXML();
                stripEmptyElements(asXML);
-               IterationStrategyStackImpl copyStack = new 
IterationStrategyStackImpl();
+               IterationStrategyStack copyStack = new IterationStrategyStack();
                copyStack.configureFromElement(asXML);
                if (copyStack.getStrategies().isEmpty()) {
-                       copyStack.addStrategy(new IterationStrategyImpl());
+                       copyStack.addStrategy(new IterationStrategy());
                }
                return copyStack;
        }
@@ -157,8 +133,7 @@ public class IterationStrategyContextualView extends 
ContextualView {
                                Element childElement = (Element) child;
                                if (childElement.getName().equals("port")) {
                                        index++;
-                               }
-                               else if (childElement.getDescendants(new 
ElementFilter("port")).hasNext()) {
+                               } else if (childElement.getDescendants(new 
ElementFilter("port")).hasNext()) {
                                        stripEmptyElements(childElement);
                                        index++;
                                } else {
@@ -170,29 +145,23 @@ public class IterationStrategyContextualView extends 
ContextualView {
        }
 
        public static IterationStrategy 
getIterationStrategy(IterationStrategyStack iStack) {
-               List<? extends IterationStrategy> strategies = iStack
-                               .getStrategies();
+               List<? extends IterationStrategy> strategies = 
iStack.getStrategies();
                if (strategies.isEmpty()) {
                        throw new IllegalStateException("Empty iteration 
stack");
                }
                IterationStrategy strategy = strategies.get(0);
-               if (!(strategy instanceof IterationStrategyImpl)) {
-                       throw new IllegalStateException(
-                                       "Can't edit unknown iteration strategy 
implementation "
-                                                       + strategy);
+               if (!(strategy instanceof IterationStrategy)) {
+                       throw new IllegalStateException("Can't edit unknown 
iteration strategy implementation " + strategy);
                }
-               return (IterationStrategyImpl) strategy;
+               return (IterationStrategy) strategy;
        }
 
        private void refreshIterationStrategyStack() {
-               IterationStrategyStack originalIterationStrategy = processor
-                               .getIterationStrategy();
-               if (!(originalIterationStrategy instanceof 
IterationStrategyStackImpl)) {
-                       throw new IllegalStateException(
-                                       "Unknown iteration strategy 
implementation "
-                                                       + 
originalIterationStrategy);
+               IterationStrategyStack originalIterationStrategy = 
processor.getIterationStrategy();
+               if (!(originalIterationStrategy instanceof 
IterationStrategyStack)) {
+                       throw new IllegalStateException("Unknown iteration 
strategy implementation " + originalIterationStrategy);
                }
-               this.iterationStack = 
copyIterationStrategyStack((IterationStrategyStackImpl) 
originalIterationStrategy);
+               this.iterationStack = 
copyIterationStrategyStack((IterationStrategyStack) originalIterationStrategy);
        }
 
        @Override
@@ -215,13 +184,12 @@ public class IterationStrategyContextualView extends 
ContextualView {
                }
 
                public void actionPerformed(ActionEvent e) {
-                       final HelpEnabledDialog dialog = new 
IterationStrategyConfigurationDialog(owner, processor, iterationStack, 
editManager, fileManager);
+                       final HelpEnabledDialog dialog = new 
IterationStrategyConfigurationDialog(owner, processor, iterationStack,
+                                       editManager, fileManager);
                        dialog.setVisible(true);
                        refreshView();
                }
 
-
-
        }
 
        @Override

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
index 412e081..c9b99dd 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/contextview/IterationStrategyContextualViewFactory.java
@@ -1,23 +1,21 @@
-/*******************************************************************************
- * 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
- 
******************************************************************************/
+/*
+ * 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.iterationstrategy.contextview;
 
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
index 4be3997..e607d26 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyCellRenderer.java
@@ -1,25 +1,20 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester   
+/*
+ * 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
  * 
- *  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
- 
******************************************************************************/
-/**
+ *   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.iterationstrategy.editor;
 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
index 695fd0b..13f8309 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditor.java
@@ -1,24 +1,21 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester   
+/*
+ * 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
  * 
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
+ *   http://www.apache.org/licenses/LICENSE-2.0
  * 
- *  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.iterationstrategy.editor;
+ * 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.iterationstrategy.editor;
 
 import java.awt.GraphicsEnvironment;
 import java.awt.datatransfer.DataFlavor;
@@ -35,6 +32,7 @@ import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeSelectionModel;
 
+import 
org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
 import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
 import 
org.apache.taverna.workflowmodel.processor.iteration.AbstractIterationStrategyNode;
 import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
@@ -69,9 +67,9 @@ public class IterationStrategyEditor extends 
IterationStrategyTree implements
                //
        }
 
-       public IterationStrategyEditor(IterationStrategy theStrategy) {
+       public IterationStrategyEditor(IterationStrategyTopNode strategy) {
                this();
-               setIterationStrategy(theStrategy);
+               setIterationStrategy(strategy);
        }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
index df5e078..d0213da 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyEditorControl.java
@@ -1,27 +1,20 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester   
+/*
+ * 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
  * 
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
+ *   http://www.apache.org/licenses/LICENSE-2.0
  * 
- *  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
- 
******************************************************************************/
-/**
- * This file is a component of the Taverna project,
- * and is licensed under the GNU LGPL.
- * Copyright Tom Oinn, EMBL-EBI
+ * 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.iterationstrategy.editor;
 
@@ -46,15 +39,16 @@ import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreePath;
 
+import org.apache.log4j.Logger;
+import org.apache.taverna.scufl2.api.common.Scufl2Tools;
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.DotProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
+import 
org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
 import org.apache.taverna.workbench.icons.WorkbenchIcons;
 import org.apache.taverna.workbench.iterationstrategy.IterationStrategyIcons;
-import org.apache.taverna.workflowmodel.processor.iteration.CrossProduct;
-import org.apache.taverna.workflowmodel.processor.iteration.DotProduct;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
-import 
org.apache.taverna.workflowmodel.processor.iteration.IterationStrategyNode;
-import org.apache.taverna.workflowmodel.processor.iteration.TerminalNode;
-
-import org.apache.log4j.Logger;
 
 /**
  * A control panel for the iteration tree editor allowing the user to 
manipulate
@@ -81,12 +75,16 @@ public class IterationStrategyEditorControl extends JPanel {
                        visitedNodes.add(visiting);
                        nodesToVisit.remove(visiting);
 
+                       if (! (visiting instanceof IterationStrategyTopNode))  {
+                               // It's a PortNode with no more children - we 
were already 
+                               // added in the level above 
+                               continue;
+                       }
+                       // List is superclass of IterationStrategyTopNode
+                       List<IterationStrategyNode> children = 
(IterationStrategyTopNode)visiting;                      
+                       Set<IterationStrategyNode> newNodes = new 
HashSet<IterationStrategyNode>(children);
                        // Find new and interesting children
-                       List<IterationStrategyNode> children = 
visiting.getChildren();
-                       Set<IterationStrategyNode> newNodes = new 
HashSet<IterationStrategyNode>(
-                                       children);
-                       newNodes.removeAll(visitedNodes);
-
+                       newNodes.removeAll(visitedNodes);                       
        
                        descendants.addAll(newNodes);
                        nodesToVisit.addAll(newNodes);
                }
@@ -115,14 +113,28 @@ public class IterationStrategyEditorControl extends 
JPanel {
        //protected ImageIcon arrowRight = WorkbenchIcons.rightArrowIcon;
        protected ImageIcon normalizeIcon = WorkbenchIcons.normalizeIcon;
 
-       private final IterationStrategy strategy;
+       private final IterationStrategyTopNode strategy;
+
+       private Processor processor;
 
        /**
         * Create a new panel from the supplied iteration strategy
         */
-       public IterationStrategyEditorControl(IterationStrategy strategy) {
+       public IterationStrategyEditorControl(Processor p) {
+               this.processor = p;
+               if (p.getIterationStrategyStack() == null || 
p.getIterationStrategyStack().isEmpty()) {
+                       new 
Scufl2Tools().createDefaultIterationStrategyStack(p);
+               }
+               
+               if (p.getIterationStrategyStack().size() > 1) {
+                       // TODO: Edit more than 1 layer
+                       logger.warn("More than 1 layer in iteration strategy 
stack: " + p.getIterationStrategyStack().size());
+                       throw new IllegalStateException("Can't edit iteration 
strategy with more than 1 layer");
+               }
+               
+               this.strategy = p.getIterationStrategyStack().get(0);
 
-               this.strategy = strategy;
+               
                setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
 
                // Create the components
@@ -174,7 +186,7 @@ public class IterationStrategyEditorControl extends JPanel {
                add(treePane);
        }
 
-       public void setIterationStrategy(IterationStrategy iterationStrategy) {
+       public void setIterationStrategy(IterationStrategyTopNode 
iterationStrategy) {
                tree.setIterationStrategy(iterationStrategy);
                disableButtons();
                selectNode(null);
@@ -188,7 +200,9 @@ public class IterationStrategyEditorControl extends JPanel {
        }
 
        private IterationStrategyNode findRoot() {
-               IterationStrategyNode root = (IterationStrategyNode) 
tree.getModel()
+               IterationStrategyNode root = tree.getModel(); 
+                               
+                               (IterationStrategyNode) tree.getModel()
                                .getRoot();
                if (root.getChildCount() > 0) {
                        return root.getChildAt(0);
@@ -248,7 +262,7 @@ public class IterationStrategyEditorControl extends JPanel {
                        selectedNode = selectedObject;
                        if (selectedObject instanceof CrossProduct
                                        || selectedObject instanceof 
DotProduct) {
-                               if ((selectedObject.getParent() == null) || 
(selectedObject.getParent() instanceof TerminalNode)) {
+                               if ((selectedObject.getParent() == null) || 
(selectedObject.getParent() instanceof PortNode)) {
                                        remove.setEnabled(false);
                                } else {
                                        remove.setEnabled(true);

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
index c5e9390..fa86f75 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTree.java
@@ -1,23 +1,21 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester   
+/*
+ * 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
  * 
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
+ *   http://www.apache.org/licenses/LICENSE-2.0
  * 
- *  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
- 
******************************************************************************/
+ * 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.iterationstrategy.editor;
 
 import java.util.Enumeration;
@@ -31,14 +29,14 @@ import javax.swing.tree.TreeNode;
 import javax.swing.tree.TreePath;
 import javax.swing.tree.TreeSelectionModel;
 
+import 
org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
 import org.apache.taverna.workbench.iterationstrategy.IterationStrategyIcons;
 import org.apache.taverna.workbench.ui.zaria.UIComponentSPI;
-import org.apache.taverna.workflowmodel.processor.iteration.IterationStrategy;
 
 @SuppressWarnings("serial")
 public class IterationStrategyTree extends JTree implements UIComponentSPI {
 
-       private IterationStrategy strategy = null;
+       private IterationStrategyTopNode strategy = null;
 
        public IterationStrategyTree() {
                super();
@@ -60,10 +58,10 @@ public class IterationStrategyTree extends JTree implements 
UIComponentSPI {
        }
 
        public synchronized void setIterationStrategy(
-                       IterationStrategy theStrategy) {
-               if (theStrategy != this.strategy) {
-                       this.strategy = theStrategy;
-                       TreeNode terminal = theStrategy.getTerminalNode();
+                       IterationStrategyTopNode strategy2) {
+               if (strategy2 != this.strategy) {
+                       this.strategy = strategy2;
+                       TreeNode terminal = strategy2.getTerminalNode();
                        setModel(new DefaultTreeModel(terminal));
                        
this.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
                        expandTree();

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeModel.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeModel.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeModel.java
new file mode 100644
index 0000000..bd4d5c9
--- /dev/null
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeModel.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.workbench.iterationstrategy.editor;
+
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
+import 
org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
+
+/**
+ * An experimental TreeModel view of a SCUFL2 IterationStrategyTopNode tree.
+ * <p>
+ * TODO: This class does not yet support the methods 
+ * {@link #addTreeModelListener(TreeModelListener)},
+ * {@link #removeTreeModelListener(TreeModelListener)}
+ * or {@link #valueForPathChanged(TreePath, Object)}.
+ *
+ */
+public class IterationStrategyTreeModel implements TreeModel {
+
+       private IterationStrategyTopNode topNode;
+
+       public IterationStrategyTreeModel(IterationStrategyTopNode topNode) {
+               this.topNode = topNode;
+       }
+       
+       @Override
+       public IterationStrategyTopNode getRoot() {
+               return topNode;
+       }
+
+       @Override
+       public IterationStrategyNode getChild(Object parent, int index) {
+               if (!(parent instanceof IterationStrategyTopNode)) {
+                       return null;
+               }
+               try { 
+                       return ((IterationStrategyTopNode)parent).get(index);
+               } catch (IndexOutOfBoundsException ex) {
+                       return null;
+               }
+       }
+
+       @Override
+       public int getChildCount(Object parent) {
+               if (!(parent instanceof IterationStrategyTopNode)) {
+                       return 0;
+               }
+               return ((IterationStrategyTopNode)parent).size();
+       }
+
+       @Override
+       public boolean isLeaf(Object node) {
+               if (!(node instanceof IterationStrategyTopNode)) {
+                       return true;
+               }
+               return ((IterationStrategyTopNode)node).isEmpty();
+       }
+
+       @Override
+       public void valueForPathChanged(TreePath path, Object newValue) {
+               // TODO
+       }
+
+       @Override
+       public int getIndexOfChild(Object parent, Object child) {
+               if (parent == null || child == null) { 
+                       return -1;
+               }
+               if (! (parent instanceof IterationStrategyTopNode)) { 
+                       return -1;
+               }
+               return ((IterationStrategyTopNode)parent).indexOf(child);
+       }
+
+       @Override
+       public void addTreeModelListener(TreeModelListener l) {
+               // TODO
+       }
+
+       @Override
+       public void removeTreeModelListener(TreeModelListener l) {
+               // TODO
+
+       }
+       
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeNode.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeNode.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeNode.java
new file mode 100644
index 0000000..b5502e3
--- /dev/null
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/editor/IterationStrategyTreeNode.java
@@ -0,0 +1,94 @@
+package org.apache.taverna.workbench.iterationstrategy.editor;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyNode;
+import org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyParent;
+import 
org.apache.taverna.scufl2.api.iterationstrategy.IterationStrategyTopNode;
+
+/**
+ * An experimental view of of a IterationStrategyNode as a TreeNode.
+ * <p>
+ * This can be used with a {@link DefaultTreeModel}
+ * as an alternative to {@link IterationStrategyTreeModel}. 
+ *
+ */
+public class IterationStrategyTreeNode implements TreeNode {
+
+       private final IterationStrategyNode node;
+
+       public IterationStrategyTreeNode(IterationStrategyNode node) {
+               this.node = node;
+       }
+
+       @Override
+       public IterationStrategyTreeNode getChildAt(int childIndex) {
+               if (node instanceof IterationStrategyTopNode) {                 
+                       IterationStrategyNode child = 
((IterationStrategyTopNode) node).get(childIndex);
+                       return new IterationStrategyTreeNode(child);
+               }
+               throw new IndexOutOfBoundsException("This node has no children: 
" + node);
+       }
+
+       @Override
+       public int getChildCount() {
+               if (node instanceof IterationStrategyTopNode) {
+                       return ((IterationStrategyTopNode) node).size();
+               }
+               return 0;
+       }
+
+       @Override
+       public TreeNode getParent() {
+               IterationStrategyParent parent = node.getParent();
+               if (parent == null || ! (parent instanceof 
IterationStrategyTopNode)) {
+                       // It might be the IterationStrategyStack, 
+                       // which we don't show in the tree
+                       return null;
+               }
+               return new 
IterationStrategyTreeNode((IterationStrategyTopNode)parent);
+       }
+
+       @Override
+       public int getIndex(TreeNode child) {
+               if (node instanceof IterationStrategyTopNode) {
+                       IterationStrategyNode childNode = 
((IterationStrategyTreeNode)child).node;
+                       return ((IterationStrategyTopNode) 
node).indexOf(childNode);
+               }
+               return -1;
+       }
+
+       @Override
+       public boolean getAllowsChildren() {
+               return node instanceof IterationStrategyTopNode;
+       }
+
+       @Override
+       public boolean isLeaf() {       
+               return ! getAllowsChildren() || ((IterationStrategyTopNode) 
node).isEmpty();
+       }
+
+       @Override
+       public Enumeration<IterationStrategyTreeNode> children() {
+               // Yes.. going old-skool with Enumeration and Vector!
+               
+               Vector<IterationStrategyTreeNode> children = new Vector<>();
+               if (node instanceof IterationStrategyTopNode) {                 
+                       for (IterationStrategyNode child : 
(IterationStrategyTopNode)node) {
+                               children.add(new 
IterationStrategyTreeNode(child));
+                       }
+               } 
+               return children.elements();
+       }
+
+       public IterationStrategyNode getIterationStrategyNode() {
+               return node;
+       }
+
+       
+       
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
index 8a31b59..1793375 100644
--- 
a/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
+++ 
b/taverna-iteration-strategy-ui/src/main/java/org/apache/taverna/workbench/iterationstrategy/menu/IterationStrategyConfigureMenuAction.java
@@ -1,23 +1,21 @@
-/**********************************************************************
- * Copyright (C) 2007-2009 The University of Manchester   
+/*
+ * 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
  * 
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
+ *   http://www.apache.org/licenses/LICENSE-2.0
  * 
- *  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
- **********************************************************************/
+ * 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.iterationstrategy.menu;
 
 import java.awt.event.ActionEvent;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench/blob/2ab2bfe5/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
----------------------------------------------------------------------
diff --git 
a/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
 
b/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
index d5a28b9..cf08594 100644
--- 
a/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
+++ 
b/taverna-iteration-strategy-ui/src/test/java/org/apache/taverna/workbench/iterationstrategy/editor/RunIterationStrategyEditor.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester   
+/*
+ * 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
  * 
- *  Modifications to the initial code base are copyright of their
- *  respective authors, or their employers as appropriate.
+ *   http://www.apache.org/licenses/LICENSE-2.0
  * 
- *  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
- 
******************************************************************************/
+ * 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.iterationstrategy.editor;
 
+import org.apache.taverna.scufl2.api.core.Processor;
+import org.apache.taverna.scufl2.api.iterationstrategy.CrossProduct;
+import org.apache.taverna.scufl2.api.iterationstrategy.PortNode;
+import org.apache.taverna.scufl2.api.port.InputProcessorPort;
 import 
org.apache.taverna.workbench.iterationstrategy.editor.IterationStrategyEditorControl;
 import javax.swing.JFrame;
 
-import org.apache.taverna.workflowmodel.processor.iteration.NamedInputPortNode;
-import 
org.apache.taverna.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
 
 public class RunIterationStrategyEditor {
 
@@ -32,19 +32,23 @@ public class RunIterationStrategyEditor {
         * @param args
         */
        public static void main(String[] args) {
-               IterationStrategyImpl iterationStrategyImpl = new 
IterationStrategyImpl();
-               NamedInputPortNode fishPort = new NamedInputPortNode("fish", 2);
-               NamedInputPortNode otherPort = new NamedInputPortNode("other", 
0);
-               NamedInputPortNode soupPort = new NamedInputPortNode("soup", 1);
-               iterationStrategyImpl.addInput(fishPort);
-               iterationStrategyImpl.addInput(soupPort);
-               iterationStrategyImpl.addInput(otherPort);
-
-               iterationStrategyImpl.connectDefault(otherPort);
-               iterationStrategyImpl.connectDefault(fishPort);
-               iterationStrategyImpl.connectDefault(soupPort);
                
-               IterationStrategyEditorControl editorControl = new 
IterationStrategyEditorControl(iterationStrategyImpl);
+               Processor p = new Processor();
+               InputProcessorPort fish = new InputProcessorPort(p, "fish");
+               fish.setDepth(2);
+               InputProcessorPort other = new InputProcessorPort(p, "other");
+               other.setDepth(0)
+               InputProcessorPort soup = new InputProcessorPort(p, "soup");
+               soup.setDepth(1);
+               
+               CrossProduct iterationStrategy = new CrossProduct();
+               iterationStrategy.add(new PortNode(iterationStrategy, fish));
+               iterationStrategy.add(new PortNode(iterationStrategy, other));
+               iterationStrategy.add(new PortNode(iterationStrategy, soup));
+               p.getIterationStrategyStack().add(iterationStrategy);
+               
+               
+               IterationStrategyEditorControl editorControl = new 
IterationStrategyEditorControl(p);
                
                JFrame frame = new JFrame("List handling editor");
                frame.add(editorControl);

Reply via email to