Fix drag & drop and begin implementation of test parameters.
authorBruno Sinou <bsinou@argeo.org>
Fri, 22 Oct 2010 15:14:13 +0000 (15:14 +0000)
committerBruno Sinou <bsinou@argeo.org>
Fri, 22 Oct 2010 15:14:13 +0000 (15:14 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3844 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

20 files changed:
eclipse/plugins/org.argeo.slc.client.rcp/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml
eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationActionBarAdvisor.java
eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationWorkbenchAdvisor.java
eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/ApplicationWorkbenchWindowAdvisor.java
eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java [deleted file]
eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/commands/ExitHandler.java
eclipse/plugins/org.argeo.slc.client.ui/META-INF/MANIFEST.MF
eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/osgi.xml
eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/views.xml
eclipse/plugins/org.argeo.slc.client.ui/plugin.xml
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesContentProvider.java
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailLabelProvider.java [deleted file]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessParametersView.java [new file with mode: 0644]

index 56d20f9cbe48cbf8aee9e4907a1fc6755a964558..c59ffec616c844bad7292b287f56e9cfc0a5d0d5 100644 (file)
@@ -8,7 +8,8 @@ Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: org.argeo.slc.core.test.tree;version="0.13.0.SNAPSHOT-r3768",
+Import-Package: org.argeo.slc.client.ui.perspectives,
+ org.argeo.slc.core.test.tree;version="0.13.0.SNAPSHOT-r3768",
  org.argeo.slc.execution;version="0.13.0.SNAPSHOT-r3770",
  org.argeo.slc.process;version="0.13.0.SNAPSHOT-r3770",
  org.argeo.slc.runtime;version="0.13.0.SNAPSHOT-r3770",
diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml b/eclipse/plugins/org.argeo.slc.client.rcp/META-INF/spring/osgi.xml
new file mode 100644 (file)
index 0000000..4b7f32a
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
+       xsi:schemaLocation="http://www.springframework.org/schema/osgi  
+       http://www.springframework.org/schema/osgi/spring-osgi-1.1.xsd
+       http://www.springframework.org/schema/beans   
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+       <beans:description> Implements All RCP basic classes that are not SLC
+               dependent.
+       </beans:description>
+</beans:beans>
\ No newline at end of file
index b7ce60120baa93a27477bf4e9a8125302b23fb37..8b78bb3683817b0e4a37c1322f11b871aa10b9de 100644 (file)
@@ -15,8 +15,8 @@
          point="org.eclipse.ui.perspectives">
       <perspective
             name="Perspective"
-            class="org.argeo.slc.client.rcp.Perspective"
-            id="org.argeo.slc.client.rcp.perspective">
+            class="org.argeo.slc.client.ui.perspectives.SlcExecution"
+            id="org.argeo.slc.client.ui.perspectives.slcExecution">
       </perspective>
    </extension>
    <extension
index 70f6217cd39f5f5096df34c66c45eed3c7b8f0af..5f013ced1ab6bfcd482607202b72fcc428f6e597 100644 (file)
@@ -13,8 +13,7 @@ import org.eclipse.ui.application.IActionBarConfigurer;
 public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
 
        // Actions - important to allocate these only in makeActions, and then use
-       // them
-       // in the fill methods. This ensures that the actions aren't recreated
+       // them in the fill methods. This ensures that the actions aren't recreated
        // when fillActionBars is called with FILL_PROXY.
 
        public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
index a97fb5706f9888162c3b870d12a4ebbdc6de83a3..f8a47ae9f275d5bf373b533a757e158dc060d171 100644 (file)
@@ -6,7 +6,7 @@ import org.eclipse.ui.application.WorkbenchWindowAdvisor;
 
 public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
 
-       private static final String PERSPECTIVE_ID = "org.argeo.slc.client.rcp.perspective";
+       private static final String PERSPECTIVE_ID = "org.argeo.slc.client.ui.perspectives.slcExecution";
 
        public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
                        IWorkbenchWindowConfigurer configurer) {
index cda5efc3c6ee6094d49ac78078486713014ee03e..c7ae9a86c5fd485193e37f73379af52799044ab4 100644 (file)
@@ -32,7 +32,7 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
 
        public void preWindowOpen() {
                IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
-               configurer.setInitialSize(new Point(1024, 800));
+               configurer.setInitialSize(new Point(1600, 800));
                configurer.setShowCoolBar(true);
                configurer.setShowStatusLine(true);
                configurer.setShowPerspectiveBar(true);
@@ -61,8 +61,8 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
                        return;
 
                // image
-               Image trayImage = ClientRcpPlugin.getDefault().getImageRegistry().get(
-                               "argeoTrayIcon");
+               Image trayImage = ClientRcpPlugin.getDefault().getImageRegistry()
+                               .get("argeoTrayIcon");
                trayItem.setImage(trayImage);
                trayItem.setToolTipText("Argeo SLC");
 
diff --git a/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java b/eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java
deleted file mode 100644 (file)
index 66d3924..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.argeo.slc.client.rcp;
-
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-public class Perspective implements IPerspectiveFactory {
-
-       public void createInitialLayout(IPageLayout layout) {
-               String editorArea = layout.getEditorArea();
-               layout.setEditorAreaVisible(false);
-               layout.setFixed(false);
-
-               IFolderLayout topLeft = layout.createFolder("topLeft",
-                               IPageLayout.LEFT, 0.5f, editorArea);
-               topLeft.addView("org.argeo.slc.client.ui.executionModulesView");
-
-               IFolderLayout topRight = layout.createFolder("topRight",
-                               IPageLayout.RIGHT, 0.5f, editorArea);
-               topRight.addView("org.argeo.slc.client.ui.resultListView");
-               topRight
-                               .addPlaceholder("org.argeo.slc.client.ui.resultDetailView:UUID-*");
-
-               IFolderLayout bottomRight = layout.createFolder("bottomRight",
-                               IPageLayout.BOTTOM, 0.6f, "topRight");
-               bottomRight.addView("org.argeo.slc.client.ui.processListView");
-               bottomRight
-                               .addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*");
-
-               IFolderLayout bottomLeft = layout.createFolder("bottomLeft",
-                               IPageLayout.BOTTOM, 0.6f, "topLeft");
-               bottomLeft.addView("org.argeo.slc.client.ui.processBuilderView");
-       }
-
-}
index f5eaff52f35b8bb4b833f326e24541717df68963..0b593732a54b7e85d6ca264b16e39f9956c2f8b5 100644 (file)
@@ -7,6 +7,8 @@ import org.eclipse.ui.handlers.HandlerUtil;
 
 public class ExitHandler extends AbstractHandler {
 
+       // TODO: Could be implemented using default RCP commands.
+
        public Object execute(ExecutionEvent event) throws ExecutionException {
                HandlerUtil.getActiveWorkbenchWindow(event).close();
                return null;
index 6902f06280a7612f1a7ff5cd0db1afad38432d72..b025a7dd072cba401cb1fd4c399ce71d10af9451 100644 (file)
@@ -10,6 +10,7 @@ Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Export-Package: org.argeo.slc.client.ui,
  org.argeo.slc.client.ui.listeners,
+ org.argeo.slc.client.ui.perspectives,
  org.argeo.slc.client.ui.views
 Import-Package: org.apache.commons.io;version="1.4.0",
  org.apache.commons.logging;version="1.1.1",
@@ -22,6 +23,7 @@ Import-Package: org.apache.commons.io;version="1.4.0",
  org.argeo.slc.core.structure.tree,
  org.argeo.slc.core.test.tree;version="0.13.0.SNAPSHOT-r3768",
  org.argeo.slc.dao.process,
+ org.argeo.slc.dao.test,
  org.argeo.slc.dao.test.tree;version="0.13.0.SNAPSHOT-r3768",
  org.argeo.slc.deploy;version="0.13.0.SNAPSHOT-r3724",
  org.argeo.slc.execution;version="0.13.0.SNAPSHOT-r3685",
@@ -33,6 +35,5 @@ Import-Package: org.apache.commons.io;version="1.4.0",
  org.argeo.slc.test,
  org.springframework.beans.factory,
  org.springframework.context,
- org.springframework.core.io.support,
- org.argeo.slc.dao.test
+ org.springframework.core.io.support
 
index 8f5dcaba6e9312683e20fb08ff8a3de5c1d5dbde..d77570ce0bfd914a5324e49ce8f4c10f7c5f4dc3 100644 (file)
@@ -6,7 +6,7 @@
        http://www.springframework.org/schema/beans   \r
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">\r
 \r
-       <beans:description> Implements SLC specific rcp uis.\r
+       <beans:description> Implements SLC specific RCP UIs.\r
        </beans:description>\r
 \r
        <!-- Services exposed by the current bundle -->\r
index 0d2b0a3acd193bfaa5cad4f0fb4c5457e5cc2f4d..4cb9bc59bfeb8e4e95c078376f635fe4bcf5ed60 100644 (file)
                <property name="processController" ref="processController" />
        </bean>
 
+       <bean id="org.argeo.slc.client.ui.processParametersView" class="org.argeo.slc.client.ui.views.ProcessParametersView"
+               scope="prototype">
+       </bean>
+
+
        <bean id="executionModulesContentProvider"
                class="org.argeo.slc.client.ui.views.ExecutionModulesContentProvider">
                <property name="slcAgents" ref="slcAgents" />
index 743dc915fab618ccf0ec43b7acee7eb377785359..d55bd58882ccc9b981029b4595e5363eb9beb1d8 100644 (file)
          allowMultiple="true"
          restorable="true">
    </view>
+   <view
+         id="org.argeo.slc.client.ui.processParametersView"
+         class="org.argeo.eclipse.spring.SpringExtensionFactory"
+         name="Process Parameters"
+         restorable="true">
+   </view>
    <view
          id="org.argeo.slc.client.ui.processBuilderView"
          class="org.argeo.eclipse.spring.SpringExtensionFactory"
index 9a255dfffab7a177318a29b218a6519f9780f27c..98c502f3e6789c2a92aaca4d4f549c423bae92da 100644 (file)
@@ -1,7 +1,5 @@
 package org.argeo.slc.client.ui.commands;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.client.ui.views.ResultDetailView;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
@@ -17,8 +15,8 @@ import org.eclipse.ui.handlers.HandlerUtil;
  */
 
 public class ResultDetailsDisplayHandler extends AbstractHandler {
-       private static final Log log = LogFactory
-                       .getLog(ResultDetailsDisplayHandler.class);
+       // private static final Log log = LogFactory
+       // .getLog(ResultDetailsDisplayHandler.class);
 
        public Object execute(ExecutionEvent event) throws ExecutionException {
 
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java
new file mode 100644 (file)
index 0000000..bb533cb
--- /dev/null
@@ -0,0 +1,38 @@
+package org.argeo.slc.client.ui.perspectives;
+
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+public class SlcExecution implements IPerspectiveFactory {
+
+       public void createInitialLayout(IPageLayout layout) {
+               String editorArea = layout.getEditorArea();
+               layout.setEditorAreaVisible(false);
+               layout.setFixed(false);
+
+               IFolderLayout topLeft = layout.createFolder("topLeft",
+                               IPageLayout.LEFT, 0.7f, editorArea);
+               topLeft.addView("org.argeo.slc.client.ui.executionModulesView");
+
+               IFolderLayout topRight = layout.createFolder("topRight",
+                               IPageLayout.RIGHT, 0.3f, editorArea);
+               topRight.addView("org.argeo.slc.client.ui.resultListView");
+               topRight.addPlaceholder("org.argeo.slc.client.ui.resultDetailView:UUID-*");
+
+               IFolderLayout bottomRight = layout.createFolder("bottomRight",
+                               IPageLayout.BOTTOM, 0.6f, "topRight");
+               bottomRight.addView("org.argeo.slc.client.ui.processListView");
+               bottomRight
+                               .addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*");
+
+               IFolderLayout bottomLeft = layout.createFolder("bottomLeft",
+                               IPageLayout.BOTTOM, 0.6f, "topLeft");
+               bottomLeft.addView("org.argeo.slc.client.ui.processBuilderView");
+               IFolderLayout paramsEditor = layout.createFolder("paramsEditor",
+                               IPageLayout.RIGHT, 0.6f, "bottomLeft");
+               paramsEditor.addView("org.argeo.slc.client.ui.processParametersView");
+
+       }
+
+}
index 4627d26def2f10a3502af74a830f768c2b67ee78..365f046503bfe3e312420d33e639216caaa6e54c 100644 (file)
@@ -11,6 +11,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.eclipse.ui.TreeObject;
 import org.argeo.eclipse.ui.TreeParent;
+import org.argeo.slc.SlcException;
 import org.argeo.slc.execution.ExecutionFlowDescriptor;
 import org.argeo.slc.execution.ExecutionModuleDescriptor;
 import org.argeo.slc.runtime.SlcAgent;
@@ -24,18 +25,23 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
        private List<SlcAgent> slcAgents;
 
        public Object[] getChildren(Object parent) {
+
                if (parent instanceof ExecutionModuleNode) {
                        ExecutionModuleNode executionModuleNode = (ExecutionModuleNode) parent;
                        ExecutionModuleDescriptor emd = executionModuleNode.getDescriptor();
-                       emd = executionModuleNode.getAgentNode().getAgent()
+
+                       // Terminate the building of UI specific object emd
+                       emd = executionModuleNode
+                                       .getAgentNode()
+                                       .getAgent()
                                        .getExecutionModuleDescriptor(emd.getName(),
                                                        emd.getVersion());
                        executionModuleNode.cacheDescriptor(emd);
-                       // for (String flowName : executionModuleNode.getFlowDescriptors()
-                       // .keySet()) {
-                       // executionModuleNode.addChild(new FlowNode(flowName,
-                       // executionModuleNode));
-                       // }
+
+                       // This is not recursive, e.g. ExecutionModuleNode build a Tree of
+                       // specific
+                       // treeObject and cache it in the cacheDescriptor.
+                       // Then we only have TreeObjects
                        return executionModuleNode.getChildren();
                } else if (parent instanceof AgentNode) {
                        AgentNode agentNode = (AgentNode) parent;
@@ -92,7 +98,13 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
        }
 
        public void setSlcAgents(List<SlcAgent> slcAgents) {
-               this.slcAgents = slcAgents;
+               this.slcAgents = slcAgents// for (String flowName :
+                                                                       // executionModuleNode.getFlowDescriptors()
+               // .keySet()) {
+               // executionModuleNode.addChild(new FlowNode(flowName,
+               // executionModuleNode));
+               // }
+               ;
        }
 
        public class AgentNode extends TreeParent {
@@ -136,9 +148,16 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
 
                        flowDescriptors = new HashMap<String, ExecutionFlowDescriptor>();
                        for (ExecutionFlowDescriptor fd : descriptor.getExecutionFlows()) {
-                               // if (log.isTraceEnabled())
-                               // log.trace("fd.path=" + fd.getPath() + ", fd.name="
-                               // + fd.getName());
+                               if (log.isTraceEnabled())
+                                       log.trace("fd.path=" + fd.getPath() + ", fd.name="
+                                                       + fd.getName());
+                               Map<String, Object> values = fd.getValues();
+
+                               if (values == null)
+                                       log.debug("No attribute for " + fd.getName());
+                               else
+                                       for (String key : values.keySet())
+                                               log.debug(key + " - " + values.get(key));
 
                                // find path and label
                                String path;
@@ -158,11 +177,16 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
                                if (path == null || path.trim().equals("")
                                                || path.trim().equals("/")) {
                                        // directChildren.put(name, new FlowNode(name, this));
-                                       addChild(new FlowNode(label, fd.getName(), this));
+                                       addChild(new FlowNode(label, fd.getName(), fd.getValues(),
+                                                       this));
                                } else {
                                        FolderNode folderNode = mkdirs(this, path, folderNodes);
-                                       folderNode
-                                                       .addChild(new FlowNode(label, fd.getName(), this));
+                                       // TODO : why do we add a reference to the parent ?
+                                       // Probably to differentiate 2 flow nodes with same name but
+                                       // distinct execution Node. TBC
+                                       folderNode.addChild(new FlowNode(label, fd.getName(), fd
+                                                       .getValues(), this));
+
                                }
 
                                flowDescriptors.put(fd.getName(), fd);
@@ -213,11 +237,33 @@ public class ExecutionModulesContentProvider implements ITreeContentProvider {
                private final String flowName;
                private final ExecutionModuleNode executionModuleNode;
 
+               // TODO : handle casting from various object type to String and reverse.
+               private final Map<String, Object> values;
+
                public FlowNode(String label, String flowName,
-                               ExecutionModuleNode executionModuleNode) {
+                               Map<String, Object> values, ExecutionModuleNode parent) {
                        super(label);
                        this.flowName = flowName;
-                       this.executionModuleNode = executionModuleNode;
+                       this.values = values;
+                       this.executionModuleNode = parent;
+               }
+
+               public Map<String, Object> getValues() {
+                       return values;
+               }
+
+               public Object getValueByKey(String key) {
+                       return values.get(key);
+               }
+
+               public void setValueByKey(String key, Object value) {
+                       if (values.get(key) == null)
+                               throw new SlcException("Unsupported Parameter " + key
+                                               + " for FlowNode " + flowName);
+                       else {
+                               values.remove(key);
+                               values.put(key, value);
+                       }
                }
 
                public String getFlowName() {
index 0adc32835e2fe8edceca63185445b7952bc9133e..370ed3889440827ccdb950322754d430baf7fe41 100644 (file)
@@ -4,12 +4,11 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 import java.util.UUID;
 
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.client.ui.ClientUiPlugin;
 import org.argeo.slc.client.ui.controllers.ProcessController;
@@ -37,8 +36,8 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 
 public class ExecutionModulesView extends ViewPart {
-       private final static Log log = LogFactory
-                       .getLog(ExecutionModulesView.class);
+       // private final static Log log = LogFactory
+       // .getLog(ExecutionModulesView.class);
 
        public static final String ID = "org.argeo.slc.client.ui.executionModulesView";
 
@@ -142,15 +141,19 @@ public class ExecutionModulesView extends ViewPart {
        }
 
        class ViewDragListener implements DragSourceListener {
-               public void dragFinished(DragSourceEvent event) {
-                       System.out.println("Finished Drag");
+
+               public void dragStart(DragSourceEvent event) {
+                       System.out.println("Start Drag");
                }
 
                public void dragSetData(DragSourceEvent event) {
                        System.out.println("dragSetData: " + event);
+                       // System.out.println("dataType: " + event.dataType);
+
                        IStructuredSelection selection = (IStructuredSelection) viewer
                                        .getSelection();
                        if (selection.getFirstElement() instanceof ExecutionModulesContentProvider.FlowNode) {
+                               
                                if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
                                        ExecutionModulesContentProvider.FlowNode flowNode = (ExecutionModulesContentProvider.FlowNode) selection
                                                        .getFirstElement();
@@ -166,8 +169,8 @@ public class ExecutionModulesView extends ViewPart {
                                                props.store(out, "");
                                                event.data = new String(out.toByteArray());
                                        } catch (IOException e) {
-                                               throw new SlcException("Cannot transfor realized flow",
-                                                               e);
+                                               throw new SlcException(
+                                                               "Cannot transform realized flow", e);
                                        } finally {
                                                IOUtils.closeQuietly(out);
                                        }
@@ -175,8 +178,8 @@ public class ExecutionModulesView extends ViewPart {
                        }
                }
 
-               public void dragStart(DragSourceEvent event) {
-                       System.out.println("Start Drag");
+               public void dragFinished(DragSourceEvent event) {
+                       System.out.println("Finished Drag");
                }
 
                private RealizedFlow nodeAsRealizedFlow(
@@ -188,6 +191,7 @@ public class ExecutionModulesView extends ViewPart {
                                        .getDescriptor().getVersion());
                        ExecutionFlowDescriptor efd = new ExecutionFlowDescriptor();
                        efd.setName(flowNode.getFlowName());
+                       efd.setValues(flowNode.getValues());
                        rf.setFlowDescriptor(efd);
                        return rf;
                }
@@ -196,6 +200,11 @@ public class ExecutionModulesView extends ViewPart {
                        props.setProperty("moduleName", rf.getModuleName());
                        props.setProperty("moduleVersion", rf.getModuleVersion());
                        props.setProperty("flowName", rf.getFlowDescriptor().getName());
+                       Map<String, Object> values = rf.getFlowDescriptor().getValues();
+                       if (values != null && values.size() > 0)
+                               for (String key : values.keySet())
+                                       props.setProperty("values-" + key, values.get(key)
+                                                       .toString());
                }
 
        }
index a587d1b5c878728219cc3c16b1e7f67a232362d6..cd2546aebe5534eff764bd2da5a13da5c998792b 100644 (file)
@@ -154,11 +154,27 @@ public class ProcessBuilderView extends ViewPart {
                        String agentId = props.getProperty("agentId");
                        if (currentAgentUuid == null)
                                currentAgentUuid = agentId;
-                       else if (currentAgentUuid.equals(agentId))
-                               return false;
+                       else if (!currentAgentUuid.equals(agentId)) {
+                               // TODO: as for now, we can only construct batch on a single
+                               // Agent,
+                               // must be upgraded to enable batch on various agent.
+                               throw new SlcException(
+                                               "Cannot create batch on two (or more) distinct agents",
+                                               null);
+                               // return false;
+                       }
 
                        RealizedFlow rf = realizedFlowFromProperties(props);
                        realizedFlows.add(rf);
+
+                       // Map<String, Object> descriptors = rf.getFlowDescriptor()
+                       // .getValues();
+                       // if (descriptors != null && descriptors.size() > 0 ){
+                       // for (String key : descriptors.keySet()) {
+                       // System.out.println("[" + key + "] "
+                       // + descriptors.get(key).toString());
+                       // }}
+
                        getViewer().refresh();
                        return true;
                }
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailLabelProvider.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailLabelProvider.java
deleted file mode 100644 (file)
index 0e4573e..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.argeo.slc.client.ui.views;
-
-import org.argeo.slc.process.SlcExecution;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author bsinou
- * 
- *         Fill ProcessDetail view. Deported in an external bundle so that main
- *         slc ui bundle does not depend on DB implementation.
- */
-public class ProcessDetailLabelProvider extends LabelProvider implements
-               ITableLabelProvider {
-       public String getColumnText(Object obj, int index) {
-               // log.debug(sessionFactory.getClass().toString());
-
-               SlcExecution se = (SlcExecution) obj;
-               switch (index) {
-
-               case 0:
-                       return getText(se.getStartDate());
-               case 1:
-                       return se.getHost();
-               case 2:
-                       return se.getUuid();
-               case 3:
-                       return se.currentStep().getType();
-               }
-               return getText(obj);
-       }
-
-       public Image getColumnImage(Object obj, int index) {
-               return null;
-       }
-
-}
index d08a4540700bf6f5488f6d054fa816d58455aa8f..944207eb13f3f6e97124295f8da07d53f8463e37 100644 (file)
@@ -3,9 +3,11 @@ package org.argeo.slc.client.ui.views;
 import org.argeo.slc.dao.process.SlcExecutionDao;
 import org.argeo.slc.process.SlcExecution;
 import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.part.ViewPart;
 
@@ -29,13 +31,13 @@ public class ProcessDetailView extends ViewPart {
 
        // IoC
        private IContentProvider contentProvider;
-       private ILabelProvider labelProvider;
        private SlcExecutionDao slcExecutionDao;
 
        public void createPartControl(Composite parent) {
                viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
                viewer.setContentProvider(contentProvider);
-               viewer.setLabelProvider(labelProvider);
+               // viewer.setLabelProvider(labelProvider);
+               viewer.setLabelProvider(new ProcessDetailLabelProvider());
                // viewer.setInput(getViewSite());
        }
 
@@ -56,15 +58,38 @@ public class ProcessDetailView extends ViewPart {
                this.uuid = uuid;
        }
 
+       // Inner Class
+       public class ProcessDetailLabelProvider extends LabelProvider implements
+                       ITableLabelProvider {
+               public String getColumnText(Object obj, int index) {
+                       // log.debug(sessionFactory.getClass().toString());
+
+                       SlcExecution se = (SlcExecution) obj;
+                       switch (index) {
+
+                       case 0:
+                               return getText(se.getStartDate());
+                       case 1:
+                               return se.getHost();
+                       case 2:
+                               return se.getUuid();
+                       case 3:
+                               return se.currentStep().getType();
+                       }
+                       return getText(obj);
+               }
+
+               public Image getColumnImage(Object obj, int index) {
+                       return null;
+               }
+
+       }
+
        // IoC
        public void setContentProvider(IContentProvider contentProvider) {
                this.contentProvider = contentProvider;
        }
 
-       public void setLabelProvider(ILabelProvider labelProvider) {
-               this.labelProvider = labelProvider;
-       }
-
        public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {
                this.slcExecutionDao = slcExecutionDao;
        }
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessParametersView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessParametersView.java
new file mode 100644 (file)
index 0000000..9cff1f6
--- /dev/null
@@ -0,0 +1,82 @@
+package org.argeo.slc.client.ui.views;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.part.ViewPart;
+
+public class ProcessParametersView extends ViewPart {
+       public static final String ID = "org.argeo.slc.client.ui.processParametersView";
+
+       private TableViewer viewer;
+
+       private List<String[]> parameters = new ArrayList<String[]>();
+
+       public void createPartControl(Composite parent) {
+               viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL
+                               | SWT.V_SCROLL | SWT.FULL_SELECTION);
+               createColumns(viewer);
+
+               viewer.setLabelProvider(new ViewLabelProvider());
+               viewer.setContentProvider(new ViewContentProvider());
+               viewer.setInput(getViewSite());
+       }
+
+       // This will create the columns for the table
+       private void createColumns(TableViewer viewer) {
+
+               String[] titles = { "Attribute name", "value" };
+               int[] bounds = { 200, 200 };
+
+               for (int i = 0; i < titles.length; i++) {
+                       TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
+                       column.getColumn().setText(titles[i]);
+                       column.getColumn().setWidth(bounds[i]);
+                       column.getColumn().setResizable(true);
+                       column.getColumn().setMoveable(true);
+               }
+               Table table = viewer.getTable();
+               table.setHeaderVisible(true);
+               table.setLinesVisible(true);
+       }
+
+       public void setFocus() {
+               viewer.getControl().setFocus();
+       }
+
+       // Inner Classes
+       protected class ViewContentProvider implements IStructuredContentProvider {
+               public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+               }
+
+               public void dispose() {
+               }
+
+               public Object[] getElements(Object obj) {
+                       return parameters.toArray();
+               }
+       }
+
+       protected class ViewLabelProvider extends LabelProvider implements
+                       ITableLabelProvider {
+               public String getColumnText(Object obj, int index) {
+                       String[] param = (String[]) obj;
+                       return param[index];
+               }
+
+               public Image getColumnImage(Object obj, int index) {
+                       return null;
+               }
+
+       }
+}