First draft of ProcessDetail Implementation
authorBruno Sinou <bsinou@argeo.org>
Fri, 1 Oct 2010 08:44:29 +0000 (08:44 +0000)
committerBruno Sinou <bsinou@argeo.org>
Fri, 1 Oct 2010 08:44:29 +0000 (08:44 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@3813 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

16 files changed:
eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/aspects/ContentProviderAspect.java
eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessDetailContentProvider.java [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/core.xml
eclipse/plugins/org.argeo.slc.client.hibernate/META-INF/spring/osgi.xml
eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml
eclipse/plugins/org.argeo.slc.client.rcp/src/org/argeo/slc/client/rcp/Perspective.java
eclipse/plugins/org.argeo.slc.client.ui/META-INF/spring/commands.xml
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/ProcessDetailsDisplayHandler.java [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.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/ProcessDetailLabelProvider.java [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java [new file with mode: 0644]
eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java

index 0cd9c28d775b675e392e44ea10beccc9fdb3311b..f92d9d57174222b0114a491f5f6662ec82b5ec16 100644 (file)
@@ -3,6 +3,7 @@ package org.argeo.slc.client.aspects;
 import org.aspectj.lang.ProceedingJoinPoint;
 import org.aspectj.lang.annotation.Around;
 import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
 import org.hibernate.LockMode;
 import org.hibernate.SessionFactory;
 
@@ -23,20 +24,27 @@ public class ContentProviderAspect {
 
        private SessionFactory sessionFactory;
 
+       // We select here only getters from classes of the contentprovider package
+       // that need to get data from hibernate
+
+       // PointCuts
+       @Pointcut("(execution (* org.argeo.slc.client.contentprovider.ProcessListTableLabelProvider.get*(..)) && args(o,..))"
+                       + " || (execution (* org.argeo.slc.client.contentprovider.ProcessDetailContentProvider.get*(..)) && args(o,..))")
+       void contentProviderGetterWrapper(Object o) {
+       }
+
        // Advices
-       @Around("execution (* org.argeo.slc.client.contentprovider.*.get*(Object, int))")
-       public Object aroundGetVariable(ProceedingJoinPoint thisJoinPoint)
+       @Around("contentProviderGetterWrapper(o)")
+       public Object aroundGetWrapper(ProceedingJoinPoint thisJoinPoint, Object o)
                        throws Throwable {
 
-               Object o = thisJoinPoint.getArgs()[0];
-
                // TODO : find a mean to handle session & manager with txManager
                // in order to not have to re-begin a transaction here.
                sessionFactory.getCurrentSession().beginTransaction();
-               
+
                // reassociate a transient instance with a session (LockMode.NONE).
                sessionFactory.getCurrentSession().lock(o, LockMode.NONE);
-               
+
                Object result = thisJoinPoint.proceed();
                sessionFactory.getCurrentSession().getTransaction().commit();
                return result;
diff --git a/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessDetailContentProvider.java b/eclipse/plugins/org.argeo.slc.client.core/src/main/java/org/argeo/slc/client/contentprovider/ProcessDetailContentProvider.java
new file mode 100644 (file)
index 0000000..da2a793
--- /dev/null
@@ -0,0 +1,275 @@
+package org.argeo.slc.client.contentprovider;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.argeo.slc.process.RealizedFlow;
+import org.argeo.slc.process.SlcExecution;
+import org.argeo.slc.process.SlcExecutionStep;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * Basic tree view of the chosen process details
+ */
+public class ProcessDetailContentProvider implements ITreeContentProvider {
+       private final static Log log = LogFactory
+                       .getLog(ProcessDetailContentProvider.class);
+
+       private SlcExecution slcExecution;
+
+       // private List<SlcAgent> slcAgents;
+
+       public Object[] getChildren(Object parent) {
+               if (parent instanceof SlcExecution) {
+                       slcExecution = (SlcExecution) parent;
+
+                       List<SlcExecutionStep> steps = slcExecution.getSteps();
+                       List<RealizedFlow> realizedFlows = slcExecution.getRealizedFlows();
+
+                       for (int i = 0; i < steps.size(); i++) {
+                               log.debug("step[" + i + "] : " + steps.get(i).getType());
+                       }
+                       for (int i = 0; i < realizedFlows.size(); i++) {
+                               log.debug("step[" + i + "] : "
+                                               + realizedFlows.get(i).toString());
+                       }
+
+                       log.debug(" Realized flows : ");
+                       return steps.toArray();
+               }
+               // if (parent instanceof ExecutionModuleNode) {
+               // ExecutionModuleNode executionModuleNode = (ExecutionModuleNode)
+               // parent;
+               // ExecutionModuleDescriptor emd =
+               // executionModuleNode.getDescriptor();
+               // emd = executionModuleNode.getAgentNode().getAgent()
+               // .getExecutionModuleDescriptor(emd.getName(),
+               // emd.getVersion());
+               // executionModuleNode.cacheDescriptor(emd);
+               // // for (String flowName :
+               // executionModuleNode.getFlowDescriptors()
+               // // .keySet()) {
+               // // executionModuleNode.addChild(new FlowNode(flowName,
+               // // executionModuleNode));
+               // // }
+               // return executionModuleNode.getChildren();
+               // } else if (parent instanceof AgentNode) {
+               // AgentNode agentNode = (AgentNode) parent;
+               //
+               // if (log.isTraceEnabled())
+               // log.trace("Scan agent " + agentNode);
+               //
+               // agentNode.clearChildren();
+               // for (ExecutionModuleDescriptor desc : agentNode.getAgent()
+               // .listExecutionModuleDescriptors()) {
+               // agentNode.addChild(new ExecutionModuleNode(agentNode, desc));
+               // }
+               //
+               // return agentNode.getChildren();
+               // } else if (parent instanceof TreeParent) {
+               // return ((TreeParent) parent).getChildren();
+               // } else if (parent instanceof FlowNode) {
+               // return new Object[0];
+               // } else {
+               // List<AgentNode> agentNodes = new ArrayList<AgentNode>();
+               // for (SlcAgent slcAgent : slcAgents) {
+               // agentNodes.add(new AgentNode(slcAgent));
+               // }
+               // return agentNodes.toArray();
+               // }
+               return null;
+       }
+
+       public Object getParent(Object node) {
+               // if (node instanceof TreeObject) {
+               // return ((TreeObject) node).getParent();
+               // }
+               return null;
+       }
+
+       public boolean hasChildren(Object parent) {
+               // if (parent instanceof TreeParent && ((TreeParent) parent).isLoaded())
+               // {
+               // return ((TreeParent) parent).hasChildren();
+               // } else if (parent instanceof AgentNode) {
+               // return true;
+               // } else if (parent instanceof ExecutionModuleNode) {
+               // return true;
+               // }
+               return false;
+       }
+
+       public void inputChanged(Viewer v, Object oldInput, Object newInput) {
+       }
+
+       public void dispose() {
+       }
+
+       public Object[] getElements(Object parent) {
+               if (parent instanceof SlcExecution) {
+                       slcExecution = (SlcExecution) parent;
+
+                       List<SlcExecutionStep> steps = slcExecution.getSteps();
+                       List<RealizedFlow> realizedFlows = slcExecution.getRealizedFlows();
+
+                       for (int i = 0; i < steps.size(); i++) {
+                               log.debug("step[" + i + "] : " + steps.get(i).getType());
+                       }
+                       for (int i = 0; i < realizedFlows.size(); i++) {
+                               log.debug("step[" + i + "] : "
+                                               + realizedFlows.get(i).toString());
+                       }
+
+                       log.debug(" Realized flows : ");
+                       return steps.toArray();
+               }
+               // return getChildren(parent);
+               return null;
+       }
+
+       // public class AgentNode extends TreeParent {
+       // private final SlcAgent agent;
+       //
+       // public AgentNode(SlcAgent agent) {
+       // super(agent.toString());
+       // this.agent = agent;
+       // }
+
+       // public SlcAgent getAgent() {
+       // return agent;
+       // }
+       // }
+
+       // public class ExecutionModuleNode extends TreeParent {
+       // private final AgentNode agentNode;
+       // private ExecutionModuleDescriptor descriptor;
+       // private Map<String, ExecutionFlowDescriptor> flowDescriptors;
+       //
+       // public ExecutionModuleNode(AgentNode agentNode,
+       // ExecutionModuleDescriptor descriptor) {
+       // super(descriptor.toString());
+       // this.agentNode = agentNode;
+       // this.descriptor = descriptor;
+       //
+       // }
+       //
+       // public AgentNode getAgentNode() {
+       // return agentNode;
+       // }
+       //
+       // public ExecutionModuleDescriptor getDescriptor() {
+       // return descriptor;
+       // }
+       //              Object o = thisJoinPoint.getArgs()[0];
+
+       // public void cacheDescriptor(ExecutionModuleDescriptor descriptor) {
+       // this.descriptor = descriptor;
+       //
+       // SortedMap<String, FolderNode> folderNodes = new TreeMap<String,
+       // FolderNode>();
+       //
+       // flowDescriptors = new HashMap<String, ExecutionFlowDescriptor>();
+       // for (ExecutionFlowDescriptor fd : descriptor.getExecutionFlows()) {
+       // // if (log.isTraceEnabled())
+       // // log.trace("fd.path=" + fd.getPath() + ", fd.name="
+       // // + fd.getName());
+       //
+       // // find path and label
+       // String path;
+       // String label;
+       // int lastSlash = fd.getName().lastIndexOf('/');
+       // if ((fd.getPath() == null || fd.getPath().trim().equals(""))
+       // && lastSlash >= 0) {
+       // path = fd.getName().substring(0, lastSlash);
+       // label = fd.getName().substring(lastSlash + 1);
+       // } else {
+       // path = fd.getPath();
+       // label = fd.getName();
+       // }
+       // // if (log.isTraceEnabled())
+       // // log.trace("path=" + path + ", label=" + label);
+       //
+       // if (path == null || path.trim().equals("")
+       // || path.trim().equals("/")) {
+       // // directChildren.put(name, new FlowNode(name, this));
+       // addChild(new FlowNode(label, fd.getName(), this));
+       // } else {
+       // FolderNode folderNode = mkdirs(this, path, folderNodes);
+       // folderNode
+       // .addChild(new FlowNode(label, fd.getName(), this));
+       // }
+       //
+       // flowDescriptors.put(fd.getName(), fd);
+       // }
+       // // TODO: make it readonly
+       // }
+       //
+       // protected FolderNode mkdirs(TreeParent root, String path,
+       // SortedMap<String, FolderNode> folderNodes) {
+       // // Normalize
+       // if (path.charAt(0) != '/')
+       // path = '/' + path;
+       // if (path.charAt(path.length() - 1) == '/')
+       // path = path.substring(0, path.length() - 1);
+       //
+       // if (folderNodes.containsKey(path))
+       // return folderNodes.get(path);
+       //
+       // int lastIndx = path.lastIndexOf('/');
+       // String folderName;
+       // String parentPath;
+       // if (lastIndx >= 0) {
+       // folderName = path.substring(lastIndx + 1);
+       // parentPath = path.substring(0, lastIndx);
+       // } else {
+       // folderName = path;
+       // parentPath = "";
+       // }
+       //
+       // TreeParent parent;
+       // if (parentPath.equals(""))
+       // parent = root;
+       // else
+       // parent = mkdirs(root, parentPath, folderNodes);
+       // FolderNode newFolder = new FolderNode(folderName);
+       // parent.addChild(newFolder);
+       // folderNodes.put(path, newFolder);
+       // return newFolder;
+       // }
+       //
+       // public Map<String, ExecutionFlowDescriptor> getFlowDescriptors() {
+       // return flowDescriptors;
+       // }
+       //
+       // }
+       //
+       // public class FlowNode extends TreeObject {
+       // private final String flowName;
+       // private final ExecutionModuleNode executionModuleNode;
+       //
+       // public FlowNode(String label, String flowName,
+       // ExecutionModuleNode executionModuleNode) {
+       // super(label);
+       // this.flowName = flowName;
+       // this.executionModuleNode = executionModuleNode;
+       // }
+       //
+       // public String getFlowName() {
+       // return flowName;
+       // }
+       //
+       // public ExecutionModuleNode getExecutionModuleNode() {
+       // return executionModuleNode;
+       // }
+       //
+       // }
+       //
+       // public class FolderNode extends TreeParent {
+       // public FolderNode(String name) {
+       // super(name);
+       // }
+       //
+       // }
+}
index 43b6e0f1ea3f9a6f91016f372bdf88ef942eb445..62f8cbbd4d0eb75b3e6dbc175708e810cd9d73a3 100644 (file)
@@ -6,10 +6,14 @@
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
               ">
 
+       <!-- Providers -->
        <bean id="processListTableLabelProvider"
                class="org.argeo.slc.client.contentprovider.ProcessListTableLabelProvider" />
        <bean id="processListStructuredContentProvider"
                class="org.argeo.slc.client.contentprovider.ProcessListStructuredContentProvider" />
+       <bean id="processDetailContentProvider"
+               class="org.argeo.slc.client.contentprovider.ProcessDetailContentProvider"
+               scope="prototype" />
 
        <!-- Aspects -->
        <aop:aspectj-autoproxy />
index 1427a591a8add6119cf02ded7d12e8d138f63596..97e6e54749eaf00b7d4a5fdf7f81dea2c8e3ed52 100644 (file)
@@ -20,7 +20,7 @@
        <service ref="processListTableLabelProvider" interface="org.eclipse.jface.viewers.ITableLabelProvider" />\r
        <service ref="processListStructuredContentProvider"\r
                interface="org.eclipse.jface.viewers.IStructuredContentProvider" />\r
-\r
+       <service ref="processDetailContentProvider" interface="org.eclipse.jface.viewers.ITreeContentProvider" />\r
 \r
        <!-- References Needed -->\r
        <reference id="slcExecutionDao" interface="org.argeo.slc.dao.process.SlcExecutionDao"\r
index 41eb2daa3cfa3acd9e5e00746e2b101efc568928..be1a9c1a143b31f099d453a585dc74ed169bd3a1 100644 (file)
                name="windowImages"
                value="icons/argeo-icon-256.png">
          </property>
+         <property
+               name="appName"
+               value="SLC">
+         </property>
       </product>
    </extension>
    <!-- <extension
index c5b83678429aa9e9bcd49d75f96776b681ca0fbb..31f1b404c1b2a764118648aaccb7e931734be9a2 100644 (file)
@@ -9,7 +9,7 @@ public class Perspective implements IPerspectiveFactory {
        public void createInitialLayout(IPageLayout layout) {
                String editorArea = layout.getEditorArea();
                layout.setEditorAreaVisible(false);
-               layout.setFixed(true);
+               layout.setFixed(false);
 
                IFolderLayout topLeft = layout.createFolder("topLeft",
                                IPageLayout.LEFT, 0.5f, editorArea);
@@ -22,6 +22,11 @@ public class Perspective implements IPerspectiveFactory {
                IFolderLayout bottomRight = layout.createFolder("bottomRight",
                                IPageLayout.BOTTOM, 0.6f, "topRight");
                bottomRight.addView("org.argeo.slc.client.ui.processListView");
+               // bottomRight.addView("org.argeo.slc.client.ui.processDetailView");
+               bottomRight
+                               .addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*");
+
+               // bottomRight.addView("org.argeo.slc.client.ui.resultListView");
 
                IFolderLayout bottomLeft = layout.createFolder("bottomLeft",
                                IPageLayout.BOTTOM, 0.6f, "topLeft");
index 2abb6ed673b6d7cd6c62c4eb5235c79c5730aa5b..083eb4beeb27f555510b03c31054f33ab41f79b7 100644 (file)
@@ -4,12 +4,16 @@
        xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd">
 
-       <bean id="org.argeo.slc.client.ui.RefreshResultList"
+       <bean id="org.argeo.slc.client.ui.refreshResultList"
                class="org.argeo.slc.client.ui.commands.ResultListViewRefreshHandler"
                scope="prototype">
        </bean>
-       <bean id="org.argeo.slc.client.ui.RefreshProcessList"
+       <bean id="org.argeo.slc.client.ui.refreshProcessList"
                class="org.argeo.slc.client.ui.commands.ProcessListViewRefreshHandler"
                scope="prototype">
        </bean>
+       <bean id="org.argeo.slc.client.ui.displayProcessDetails"
+               class="org.argeo.slc.client.ui.commands.ProcessDetailsDisplayHandler"
+               scope="prototype">
+       </bean>
 </beans>
index 621d0c3d972b1c22afaaafbe47e80672499dff50..89fb801c19037131a36359e5c20d37f59d0ff2c9 100644 (file)
                context-class-loader="service-provider" />\r
 \r
        <!-- Content providers are deported in an other bundle for UI not to depend \r
-               on DB used implementation -->\r
+               on DB used implementation. We use bean-name reference because interface is \r
+               not enough to choose between various been with same interface -->\r
        <reference id="processListTableLabelProvider" interface="org.eclipse.jface.viewers.ITableLabelProvider"\r
                bean-name="processListTableLabelProvider" />\r
        <reference id="processListStructuredContentProvider"\r
                interface="org.eclipse.jface.viewers.IStructuredContentProvider"\r
                bean-name="processListStructuredContentProvider" />\r
+       <reference id="processDetailContentProvider"\r
+               interface="org.eclipse.jface.viewers.ITreeContentProvider" bean-name="processDetailContentProvider" />\r
+\r
+\r
 \r
        <!-- TODO : what is it for ? -->\r
        <list id="slcAgents" interface="org.argeo.slc.runtime.SlcAgent" />\r
index 9b65ea05c2a13164cc367d760c76adc111d23c66..5ad45642ae96a5cb9a0bd738b9a833d68527ff09 100644 (file)
                <property name="tableLabelProvider" ref="processListTableLabelProvider" />
        </bean>
 
+       <bean id="org.argeo.slc.client.ui.processDetailView" class="org.argeo.slc.client.ui.views.ProcessDetailView"
+               scope="prototype">
+               <property name="slcExecutionDao" ref="slcExecutionDao" />
+               <property name="contentProvider" ref="processDetailContentProvider" />
+               <property name="labelProvider" ref="processDetailLabelProvider" />
+       </bean>
+
+       <bean id="processDetailLabelProvider"
+               class="org.argeo.slc.client.ui.views.ProcessDetailLabelProvider"
+               scope="prototype" />
+
        <bean id="org.argeo.slc.client.ui.processBuilderView" class="org.argeo.slc.client.ui.views.ProcessBuilderView"
                scope="prototype">
                <property name="processController" ref="processController" />
index 3ca7dafa868c581a896ab904912b0e71726c1e1f..4c822efc52e6f717620e9d9f37aab9f8c91ce99c 100644 (file)
          name="Process List"
          restorable="true">
    </view>
+   <view
+         id="org.argeo.slc.client.ui.processDetailView"
+         class="org.argeo.eclipse.spring.SpringExtensionFactory"
+         name="Process Details"
+         allowMultiple="true"
+         restorable="true">
+   </view>
    <view
          id="org.argeo.slc.client.ui.processBuilderView"
          class="org.argeo.eclipse.spring.SpringExtensionFactory"
 
    <extension
          point="org.eclipse.ui.commands">
-       <!--defaultHandler="org.argeo.slc.client.ui.commands.RefreshHandler" -->
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-            id="org.argeo.slc.client.ui.RefreshResultList"
+            id="org.argeo.slc.client.ui.refreshResultList"
             name="RefreshResultList ">
       </command>
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
-            id="org.argeo.slc.client.ui.RefreshProcessList"
+            id="org.argeo.slc.client.ui.refreshProcessList"
             name="RefreshProcessList ">
       </command>
+        <command 
+               defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
+               id="org.argeo.slc.client.ui.displayProcessDetails"
+               name="DisplayProcessDetails">
+                       <commandParameter
+                       id="org.argeo.slc.client.commands.processUuid"
+                       name="Process UUID">
+                       </commandParameter>
+       </command>
    </extension>
    <extension
         point="org.eclipse.ui.bindings">
      <key
-           commandId="org.argeo.slc.client.ui.RefreshResultList"
+           commandId="org.argeo.slc.client.ui.refreshResultList"
            schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
            sequence="CTRL+R">
      </key>
@@ -63,7 +78,7 @@
                id="slcMenu"
                label="SLC">
             <command
-                  commandId="org.argeo.slc.client.ui.RefreshResultList"
+                  commandId="org.argeo.slc.client.ui.refreshResultList"
                   label="Refresh"
                   style="push"
                   tooltip="Refresh  the result list">
@@ -75,7 +90,7 @@
          <toolbar
                id="org.argeo.slc.client.ui.ResultViewToolbar">
             <command
-                  commandId="org.argeo.slc.client.ui.RefreshResultList"
+                  commandId="org.argeo.slc.client.ui.refreshResultList"
                   icon="icons/refresh.png"
                   label="Refresh"
                   style="toggle"
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java
new file mode 100644 (file)
index 0000000..a538ca0
--- /dev/null
@@ -0,0 +1,46 @@
+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.ProcessDetailView;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Command handler to set visible or create a ProcessDetailView. UUID of the
+ * process is passed via command parameters.
+ * 
+ * @author bsinou
+ * 
+ */
+
+public class ProcessDetailsDisplayHandler extends AbstractHandler {
+       private static final Log log = LogFactory
+                       .getLog(ProcessDetailsDisplayHandler.class);
+
+       public Object execute(ExecutionEvent event) throws ExecutionException {
+
+               // We pass the UUID of the process we want to display via command
+               // parameters.
+               String uuid = event
+                               .getParameter("org.argeo.slc.client.commands.processUuid");
+
+               // mode = 2 : VIEW_VISIBLE, Show view mode that indicates the view
+               // should be created or made visible if already created .
+               try {
+                       ProcessDetailView pView = (ProcessDetailView) HandlerUtil
+                                       .getActiveWorkbenchWindow(event).getActivePage()
+                                       .showView(ProcessDetailView.ID, "UUID-" + uuid, 2);
+                       log.debug("Newly created pView :  " + pView);
+                       pView.setUuid(uuid);
+                       log.debug("uuid set");
+                       pView.retrieveResults();
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+
+               return null;
+       }
+}
index 094a9b9103be48765cb21318ba29bf4f8da63530..499559833f24eda809b65db637821a9f3bc5b2bd 100644 (file)
@@ -63,11 +63,11 @@ public class TestManagerServiceAdapter implements TreeTestResultListener {
                                                try {
                                                        handlerService
                                                                        .executeCommand(
-                                                                                       "org.argeo.slc.client.ui.RefreshResultList",
+                                                                                       "org.argeo.slc.client.ui.refreshResultList",
                                                                                        null);
                                                        handlerService
                                                                        .executeCommand(
-                                                                                       "org.argeo.slc.client.ui.RefreshProcessList",
+                                                                                       "org.argeo.slc.client.ui.refreshProcessList",
                                                                                        null);
 
                                                } catch (Exception e) {
index 4c01230bf3912cccf36ee6edcdb90eacc0fcea90..5d306c852d853e30c073ca87d13c236a7a6dff7b 100644 (file)
@@ -90,20 +90,20 @@ public class ExecutionModulesView extends ViewPart {
 
                public Image getImage(Object obj) {
                        if (obj instanceof ExecutionModulesContentProvider.AgentNode)
-                               return ClientUiPlugin.getDefault().getImageRegistry().get(
-                                               "agent");
+                               return ClientUiPlugin.getDefault().getImageRegistry()
+                                               .get("agent");
                        else if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode)
-                               return ClientUiPlugin.getDefault().getImageRegistry().get(
-                                               "executionModule");
+                               return ClientUiPlugin.getDefault().getImageRegistry()
+                                               .get("executionModule");
                        else if (obj instanceof ExecutionModulesContentProvider.FolderNode)
-                               return ClientUiPlugin.getDefault().getImageRegistry().get(
-                                               "folder");
+                               return ClientUiPlugin.getDefault().getImageRegistry()
+                                               .get("folder");
                        else if (obj instanceof ExecutionModulesContentProvider.FlowNode)
-                               return ClientUiPlugin.getDefault().getImageRegistry().get(
-                                               "flow");
+                               return ClientUiPlugin.getDefault().getImageRegistry()
+                                               .get("flow");
                        else
-                               return PlatformUI.getWorkbench().getSharedImages().getImage(
-                                               ISharedImages.IMG_OBJ_ELEMENT);
+                               return PlatformUI.getWorkbench().getSharedImages()
+                                               .getImage(ISharedImages.IMG_OBJ_ELEMENT);
                }
        }
 
@@ -127,6 +127,8 @@ public class ExecutionModulesView extends ViewPart {
                                SlcExecution slcExecution = new SlcExecution();
                                slcExecution.setUuid(UUID.randomUUID().toString());
                                slcExecution.setRealizedFlows(realizedFlows);
+                               slcExecution.setHost(fn.getExecutionModuleNode().getAgentNode()
+                                               .getAgent().toString());
                                processController.execute(fn.getExecutionModuleNode()
                                                .getAgentNode().getAgent(), slcExecution);
                        }
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
new file mode 100644 (file)
index 0000000..0e4573e
--- /dev/null
@@ -0,0 +1,38 @@
+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;
+       }
+
+}
diff --git a/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java b/eclipse/plugins/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java
new file mode 100644 (file)
index 0000000..51b8f26
--- /dev/null
@@ -0,0 +1,77 @@
+package org.argeo.slc.client.ui.views;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Multi-instance view that enables to browse the details of a given
+ * TreeTestResult
+ * 
+ * @author bsinou
+ * 
+ */
+
+public class ProcessDetailView extends ViewPart {
+       private final static Log log = LogFactory.getLog(ProcessDetailView.class);
+       public static final String ID = "org.argeo.slc.client.ui.processDetailView";
+
+       private TreeViewer viewer;
+
+       private String uuid;
+       private SlcExecution se;
+
+       // IoC
+       private IContentProvider contentProvider;
+       private ILabelProvider labelProvider;
+       private SlcExecutionDao slcExecutionDao;
+
+       public void createPartControl(Composite parent) {
+               // log.debug("In  create part Control &&& uuid = " + uuid);
+               viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+               viewer.setContentProvider(contentProvider);
+               viewer.setLabelProvider(labelProvider);
+               // viewer.setInput(getViewSite());
+               log.debug("PartControl CREATED.");
+       }
+
+       public void setFocus() {
+               viewer.getControl().setFocus();
+       }
+
+       public TreeViewer getViewer() {
+               return viewer;
+       }
+
+       public void retrieveResults() {
+               se = slcExecutionDao.getSlcExecution(uuid);
+               log.debug("========= Se : " + se);
+               viewer.setInput(se);
+               log.debug("Input SET");
+       }
+
+       public void setUuid(String uuid) {
+               this.uuid = uuid;
+       }
+
+       // 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;
+       }
+
+}
\ No newline at end of file
index 8e44a08bead92f5d9f1c3e07e0d743293a15b875..63d017b7964ae648b5961f3e5e4546ae418143d3 100644 (file)
@@ -1,7 +1,21 @@
 package org.argeo.slc.client.ui.views;
 
+import java.util.ArrayList;
+
+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.dao.process.SlcExecutionDao;
+import org.argeo.slc.process.SlcExecution;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.IParameter;
+import org.eclipse.core.commands.Parameterization;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITableLabelProvider;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.swt.SWT;
@@ -9,10 +23,21 @@ import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
 import org.eclipse.ui.part.ViewPart;
 
+/**
+ * This class display the list of all processes that have run in the
+ * corresponding agent. Currently, the local agent.
+ * 
+ * @author bsinou
+ * 
+ */
 public class ProcessListView extends ViewPart {
-       // private final static Log log = LogFactory.getLog(ProcessListView.class);
+       private final static Log log = LogFactory.getLog(ProcessListView.class);
 
        public static final String ID = "org.argeo.slc.client.ui.processListView";
 
@@ -29,6 +54,8 @@ public class ProcessListView extends ViewPart {
                viewer.setLabelProvider(tableLabelProvider);
                viewer.setContentProvider(structuredContentProvider);
                viewer.setInput(getViewSite());
+               viewer.addDoubleClickListener(new ViewDoubleClickListener());
+
        }
 
        protected Table createTable(Composite parent) {
@@ -73,6 +100,59 @@ public class ProcessListView extends ViewPart {
                viewer.setInput(slcExecutionDao.listSlcExecutions());
        }
 
+       // Handle Events
+       class ViewDoubleClickListener implements IDoubleClickListener {
+               public void doubleClick(DoubleClickEvent evt) {
+                       Object obj = ((IStructuredSelection) evt.getSelection())
+                                       .getFirstElement();
+
+                       if (obj instanceof SlcExecution) {
+                               SlcExecution se = (SlcExecution) obj;
+                               log.debug("DOUBLE CLICK ON process d'UUID" + se.getUuid());
+
+                               // ClientUiPlugin.getDefault().getWorkbench().getDisplay()
+                               // .syncExec(new Runnable() {
+                               // public void run() {
+                               IWorkbench iw = ClientUiPlugin.getDefault().getWorkbench();
+                               IHandlerService handlerService = (IHandlerService) iw
+                                               .getService(IHandlerService.class);
+                               try {
+                                       // get the command from plugin.xml
+                                       IWorkbenchWindow window = iw.getActiveWorkbenchWindow();
+                                       ICommandService cmdService = (ICommandService) window
+                                                       .getService(ICommandService.class);
+                                       Command cmd = cmdService
+                                                       .getCommand("org.argeo.slc.client.ui.displayProcessDetails");
+
+                                       // log.debug("cmd : " + cmd);
+                                       ArrayList<Parameterization> parameters = new ArrayList<Parameterization>();
+
+                                       // get the parameter
+                                       IParameter iparam = cmd
+                                                       .getParameter("org.argeo.slc.client.commands.processUuid");
+                                       Parameterization params = new Parameterization(iparam,
+                                                       se.getUuid()); // "testUUID");//
+                                       parameters.add(params);
+
+                                       // build the parameterized command
+                                       ParameterizedCommand pc = new ParameterizedCommand(cmd,
+                                                       parameters.toArray(new Parameterization[parameters
+                                                                       .size()]));
+
+                                       // execute the command
+                                       handlerService = (IHandlerService) window
+                                                       .getService(IHandlerService.class);
+                                       handlerService.executeCommand(pc, null);
+
+                               } catch (Exception e) {
+                                       e.printStackTrace();
+                                       throw new SlcException("Problem while rendering result. "
+                                                       + e.getMessage());
+                               }
+                       }
+               }
+       }
+
        // IoC
        public void setSlcExecutionDao(SlcExecutionDao slcExecutionDao) {
                this.slcExecutionDao = slcExecutionDao;