From 5e5b06fe0c831e66bc048d8bf8da40b32f79a5c9 Mon Sep 17 00:00:00 2001 From: Bruno Sinou Date: Mon, 8 Nov 2010 16:11:08 +0000 Subject: [PATCH] + refactor to separate runtime and module project under eclipse plugin. + add some pom to prepare the deployment + clean client rcp & ui project (change src & target folder) git-svn-id: https://svn.argeo.org/slc/trunk@3871 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org.argeo.slc.client.ui/.classpath | 7 + .../runtime/org.argeo.slc.client.ui/.project | 28 ++ .../.settings/org.eclipse.jdt.core.prefs | 12 + .../.settings/org.eclipse.pde.core.prefs | 3 + .../META-INF/MANIFEST.MF | 40 +++ .../META-INF/spring/commands.xml | 33 ++ .../META-INF/spring/controllers.xml | 10 + .../META-INF/spring/listeners.xml | 16 + .../META-INF/spring/osgi.xml | 59 ++++ .../META-INF/spring/views.xml | 58 ++++ .../org.argeo.slc.client.ui/build.properties | 6 + .../org.argeo.slc.client.ui/icons/archive.png | Bin 0 -> 985 bytes .../org.argeo.slc.client.ui/icons/batch.gif | Bin 0 -> 223 bytes .../icons/clear_batch.gif | Bin 0 -> 204 bytes .../icons/computer.png | Bin 0 -> 1146 bytes .../icons/edit_parameters.gif | Bin 0 -> 204 bytes .../org.argeo.slc.client.ui/icons/error.gif | Bin 0 -> 350 bytes .../icons/execution_module.gif | Bin 0 -> 145 bytes .../org.argeo.slc.client.ui/icons/folder.png | Bin 0 -> 397 bytes .../org.argeo.slc.client.ui/icons/launch.gif | Bin 0 -> 318 bytes .../org.argeo.slc.client.ui/icons/passed.gif | Bin 0 -> 76 bytes .../icons/process_details.gif | Bin 0 -> 368 bytes .../icons/processes.gif | Bin 0 -> 586 bytes .../icons/processes.png | Bin 0 -> 586 bytes .../org.argeo.slc.client.ui/icons/refresh.png | Bin 0 -> 934 bytes .../icons/remove_one.gif | Bin 0 -> 163 bytes .../icons/result_details.gif | Bin 0 -> 393 bytes .../org.argeo.slc.client.ui/icons/results.gif | Bin 0 -> 152 bytes .../org.argeo.slc.client.ui/icons/system.png | Bin 0 -> 3776 bytes .../org.argeo.slc.client.ui/plugin.xml | 170 ++++++++++ .../runtime/org.argeo.slc.client.ui/pom.xml | 73 ++++ .../client/ui/commands/ClearBatchHandler.java | 30 ++ .../ui/commands/LaunchBatchHandler.java | 30 ++ .../ProcessDetailsDisplayHandler.java | 43 +++ .../ProcessListViewRefreshHandler.java | 19 ++ ...RemoveSelectedProcessFromBatchHandler.java | 31 ++ .../commands/ResultDetailsDisplayHandler.java | 44 +++ .../ResultListViewRefreshHandler.java | 19 ++ .../ui/controllers/ProcessController.java | 19 ++ .../listeners/TestManagerServiceAdapter.java | 105 ++++++ .../client/ui/perspectives/SlcExecution.java | 44 +++ .../ExecutionModulesContentProvider.java | 261 +++++++++++++++ .../ProcessParametersEditingSupport.java | 118 +++++++ .../client/ui/views/ExecutionModulesView.java | 218 ++++++++++++ .../client/ui/views/ProcessBuilderView.java | 316 ++++++++++++++++++ .../client/ui/views/ProcessDetailView.java | 96 ++++++ .../slc/client/ui/views/ProcessListView.java | 163 +++++++++ .../ui/views/ProcessParametersView.java | 210 ++++++++++++ .../slc/client/ui/views/ResultDetailView.java | 121 +++++++ .../slc/client/ui/views/ResultListView.java | 198 +++++++++++ .../argeo/slc/client/ui/ClientUiPlugin.java | 88 +++++ .../client/ui/commands/ClearBatchHandler.java | 30 ++ .../ui/commands/LaunchBatchHandler.java | 30 ++ .../ProcessDetailsDisplayHandler.java | 43 +++ .../ProcessListViewRefreshHandler.java | 19 ++ ...RemoveSelectedProcessFromBatchHandler.java | 31 ++ .../commands/ResultDetailsDisplayHandler.java | 44 +++ .../ResultListViewRefreshHandler.java | 19 ++ .../ui/controllers/ProcessController.java | 19 ++ .../listeners/TestManagerServiceAdapter.java | 105 ++++++ .../client/ui/perspectives/SlcExecution.java | 44 +++ .../ExecutionModulesContentProvider.java | 261 +++++++++++++++ .../ProcessParametersEditingSupport.java | 118 +++++++ .../client/ui/views/ExecutionModulesView.java | 218 ++++++++++++ .../client/ui/views/ProcessBuilderView.java | 316 ++++++++++++++++++ .../client/ui/views/ProcessDetailView.java | 96 ++++++ .../slc/client/ui/views/ProcessListView.java | 163 +++++++++ .../ui/views/ProcessParametersView.java | 210 ++++++++++++ .../slc/client/ui/views/ResultDetailView.java | 121 +++++++ .../slc/client/ui/views/ResultListView.java | 198 +++++++++++ 70 files changed, 4773 insertions(+) create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/.classpath create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/.project create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.pde.core.prefs create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/MANIFEST.MF create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/controllers.xml create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/listeners.xml create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/build.properties create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/archive.png create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/batch.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/clear_batch.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/computer.png create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/edit_parameters.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/error.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/execution_module.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/folder.png create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/launch.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/passed.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/process_details.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/processes.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/processes.png create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/refresh.png create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/remove_one.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/result_details.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/results.gif create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/system.png create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/plugin.xml create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/pom.xml create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ClearBatchHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ClearBatchHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessParametersView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java create mode 100644 eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultListView.java diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/.classpath b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.classpath new file mode 100644 index 000000000..8b978d9ed --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/.project b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.project new file mode 100644 index 000000000..ed71a2e72 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.project @@ -0,0 +1,28 @@ + + + org.argeo.slc.client.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 000000000..95d6b05d7 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Wed Aug 04 16:31:36 CEST 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.pde.core.prefs b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.pde.core.prefs new file mode 100644 index 000000000..31cbfaeee --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,3 @@ +#Tue Jul 27 14:24:51 CEST 2010 +eclipse.preferences.version=1 +resolve.requirebundle=false diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/MANIFEST.MF b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/MANIFEST.MF new file mode 100644 index 000000000..5969e74d3 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/MANIFEST.MF @@ -0,0 +1,40 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Ui +Bundle-SymbolicName: org.argeo.slc.client.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: org.argeo.slc.client.ui.ClientUiPlugin +Require-Bundle: org.eclipse.ui;resolution:=optional, + org.eclipse.core.runtime;resolution:=optional +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: org.argeo.slc.client.ui.listeners, + org.argeo.slc.client.ui.perspectives, + org.argeo.slc.client.ui.views +Import-Package: org.argeo.slc.client.ui, + org.apache.commons.io;version="1.4.0", + org.apache.commons.logging;version="1.1.1", + org.argeo.eclipse.spring, + org.argeo.eclipse.ui, + org.argeo.slc, + org.argeo.slc.build, + org.argeo.slc.client.oxm, + org.argeo.slc.core.attachment, + org.argeo.slc.core.execution, + org.argeo.slc.core.runtime, + org.argeo.slc.core.structure.tree, + org.argeo.slc.core.test.tree, + org.argeo.slc.dao.process, + org.argeo.slc.dao.test, + org.argeo.slc.dao.test.tree, + org.argeo.slc.deploy, + org.argeo.slc.execution, + org.argeo.slc.msg.test.tree, + org.argeo.slc.process, + org.argeo.slc.runtime, + org.argeo.slc.services, + org.argeo.slc.services.impl, + org.argeo.slc.test, + org.springframework.beans.factory, + org.springframework.context, + org.springframework.core.io.support diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml new file mode 100644 index 000000000..5312a33a4 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/commands.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/controllers.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/controllers.xml new file mode 100644 index 000000000..62154375e --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/controllers.xml @@ -0,0 +1,10 @@ + + + + + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/listeners.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/listeners.xml new file mode 100644 index 000000000..509fe8127 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/listeners.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml new file mode 100644 index 000000000..e05a86585 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/osgi.xml @@ -0,0 +1,59 @@ + + + + Implements SLC specific RCP UIs. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml new file mode 100644 index 000000000..74b7d9262 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/META-INF/spring/views.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/build.properties b/eclipse/plugins/runtime/org.argeo.slc.client.ui/build.properties new file mode 100644 index 000000000..a1c313d1c --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/build.properties @@ -0,0 +1,6 @@ +source.. = src/main/java +output.. = target/classes +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/ diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/archive.png b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/archive.png new file mode 100644 index 0000000000000000000000000000000000000000..fb36f360b6be4c937021cc662a969a57d2ecd3e2 GIT binary patch literal 985 zcmV;~119{5P)n+PUioT~<5V)$E+#d}n6%5HsUZT;h>X z0jT4SjnzB2{rwkjm0W2Mc(@w^0mPjrKpigtw6bjdr8htPs+&W{OY!mhulGOm;yYWT z7b+&vIfw*=09J2(4rUJ`>cFY}P6U{Nzn5;`8-MqMFa4Q{uRT5WY^C{~Nq@_bb}jDf z?`uQw&_~oxAWd>{WMt$jfS=CVQqV+qUb>oC3tek;gGXM7A;y)qZJfV zFVXZ8&0L_F3p6r9WL*E~y;setilv~+A9wGlR^vVZZr`2eGX8(wh3Ol}8nqID>;#yE zsIzY%W(RE`Gx!t(M=*DiaXYQ)qm)Ty1;t}yW3Jh3s#l)BqNXNB*jh*3pe*y)*{_2@ zAYzmUO2-m0NXVA8J$V7Vx3||DLMZ+C)0&gB*CDJcsznZ|a+I7xqnX26*YS77DC2Lu z{C07Ui71aT4jw#cYNZVe;fN2n%MnT&Y#pS~+Q3EuR$i zw!Bf=WLjBwxG01OGJw$r+8BTojCJ4`+fD7nd1)RLnh5|aD=VIevSykaAysB<3C21Y z>#)7w!tWdVFxEh8gO+Ffy1IirilZ3o9E8*b@X=H#rFL7n9|y_YT6?7A$tN!0?&`nj zaS~w0xjup|TMV7=EtI2`$@GL`0GOVh-VGr}1_k3B4$V1-t51z0%>b!1lyMllG~8C& zWyaX_RK<&ni&1O+50MN2AN!Hpmb|-$2 zvauLCf37fQ-QOwYVvXnK=ETy{lHA$Z(E#MVwe3%L?`PwA?sW)3hY(eaQALiDnF*bv zM+jmmL{v%yC8b~gYx~yB8$-Q=gM(SMTJx?3nK%AG=mOE3}hz*Ys>?+zLd;)88b5@wUTCtWfpY#2H7RP(2A7mZYjMKq9xTO zSQ!=CAeNHN%)sKdy}Qhu$$^3OAltH?7b=tvJbuU^;IcYXe4&MmP=iRq!3YK(JqBI| O=A_0jy-syS25SJFSX2-I literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/clear_batch.gif b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/clear_batch.gif new file mode 100644 index 0000000000000000000000000000000000000000..28a3785aaca7c24373e69a73b2307fdb4331b725 GIT binary patch literal 204 zcmZ?wbhEHb6krfw*v!Dt(a|trLdS{~3vS%Fv0=l86+qU41v6&Mm;e+7$~81pR8$lc z6l7#%BqSvK|Nmd{CkrD313!Zf0}z1BU|^~IuvcM;=)qeJFP_d6<6(9$NpZ+va*#XV z$Tanv0@q6Ij$F;fM->-rkP#C*lC&X!LwxVz&)al#c-qnqcDm}#WIy(BLW0V%N5`2M zYBi)fD)t0U*`nI(nzTRThYA-TS95cdU1Kv3A5Uwk5NlIM^h7?h?zV>Mb~Eg!3Nly& E026Ie7ytkO literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/computer.png b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/computer.png new file mode 100644 index 0000000000000000000000000000000000000000..ff64b8426abdf1ed68edabca237f82e9d3dbfa6c GIT binary patch literal 1146 zcmV-=1cm#FP)Hq)$8FWQhbW?9;ba!ELWdL_~cP?peYja~^ zaAhuUa%Y?FJQ@H11NTWpK~y-6t(D7VnFx)U8{$zB>87@0=1<<@CF!b^wMu(*n?v56+%>ePQpybH>=og5Kt51yI$S<~KjL zY||@$T=~i+Niu)Wj(fMg_4X;YY`z;X7z4%_5Q7mA5kv$KKnX!nRa8MW5JEr|(zMCR zlP`01aWQcyG8&E8y=ylM`xda)mfc{D#aM$e7GnfK&=NQVPw)XBJl+Sq_gwnv5~I-? zsH&U9-|zQnx7#@DaL!_#!&!@U7Uvw+T8uG-5J8Hfz!#pvdwfw)6rSO52q=m&1zuh4 z(QdVH&fU_jD-W_35rgUkcmlZIJDoPFk#47`0Cc-Ok|ZesE4a!8(BZ5pITuhRgg}<( zH0ljjS}UY!O0(HyI2iKci!T5~DpaA{?c%+sQYoXYIIMM3zKx0EjmKjejXF1O)ESS* zLn;zJ<#C|*$%6nTMjZfbHj@nf&oqtoe> z{?w@pj5QcBh>_C8pg~I!qmbVF>7FQFw3~oVm7V5g2>&~WZP?&Yk8iLBuNx6%d)}J^3wIwr{9UIQ6EG^P$j6&5vPennkCAhYpTJEh!-)4 z;DDLs=F&=06u(PZHaD~JaFKCLamx|{omhdZ+pPy1w_LK}lAn?gfP%@e4Za z7j!fz^mBg6Cm<>)Iqd2GAv*PabjlI$z{B2wpAs@ZBxHU{%e_=seQ(b4%iWD9GU85T z#vRX$JCT!crab5N()q_zVvom19gmMb79V{tFY9Y-)92QvhpEX&qauz*MLs-q=>Px! z3}gYtpDc_F47v7O@vFB`qe}(^LZldT0EV8>Vg_9 zLJJQmK3X=#VuqVqOJj;^TG)i+hd&0SPGDu0Xl7#d(B)+m7ZYRT^^oKinmn1O-c?d$ wGK(mSkg(`@Cf|62_ON9lcoOJ}bmOHOv5R7r!u*hlEj`sZrbR8M20XzVCnE(I) literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/execution_module.gif b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/execution_module.gif new file mode 100644 index 0000000000000000000000000000000000000000..983932fcccdf483e87b2c27e6d1b574edb8d4042 GIT binary patch literal 145 zcmV;C0B-+BNk%w1VGsZi0J8u9Z+3+G_PW7(ExmRt!+txlXeYmUIjdnLlT{y*Qz5No zFO*m*vTHJMI~f1}{{R30A^8LW000gEEC2ui01yBW000C&(8)<_1vX181xW;van2Ad zfiVIsvNTIFPQ@88vveqnqU4&(Bm@#!NCung$O0r@F(AW+J5GGPpEbzsdLsZkG>S40 literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/folder.png b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/folder.png new file mode 100644 index 0000000000000000000000000000000000000000..6937ed4a3f2ead85a30b5a3ebf451d44e636f0ab GIT binary patch literal 397 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?p zUk71ECym(^Ktah8*NBqf{Irtt#G+J&^73-M%)IR49O@E7XGy2`RdXez*b@6vKm$k3FaP!4kbGF&t=DrMTbK-lq zUrTc~V0^%*K3)Iu!K21ktv41jm%sVA(&?Afx9Ze4-%lO;TF&3@()g{ft+&5EM!q9$ z!#IV+KWWK0UV6k5|b>{SE!fJwNTX?MAPGFtTII}~|pfm3j^Nf~GD<>VMxnWu8C>LYGk?k$b&z8+$4Uc}*p~PeJ(D@qf-;vpyH|7hx#0Ky_n+@Jtkk>AWWfHU nmO13W+yn54!E}icoQ{bso79d~jEnnoVP~@#t=BHW_s9qJM zRU4*R6|7Sirc)oL*ATAX5N^~QW!w^D(h_6T92vg4C}MSC1dv=+=({}4cX_Jsved-& ziHRE$n)fv}?`>$_+nBpGK6h)}HxkwZp6 z#@|enuI}!dc^e}PxRM+XU(Yd=!dWtVN2m6K!RaA#IlQc`AN@nlq2V`TDYnCm}( Jftw?PH2}meT_XSh literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/passed.gif b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/passed.gif new file mode 100644 index 0000000000000000000000000000000000000000..23c97f09e677bb8812b26d4415fd97997e5c95a4 GIT binary patch literal 76 zcmZ?wbhEHb6krfwn8?f!yfVYEKB{JS)&Kwh6@RiYGB7YR=r8~QNS=X7c257w({Jy) dG&pl*gzr#W|He>ggQJQAZ^o%@>w*~=tO0mX7=r)+ literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/process_details.gif b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/process_details.gif new file mode 100644 index 0000000000000000000000000000000000000000..c81630a08081ef028834e42594bfd40bb98f88c1 GIT binary patch literal 368 zcmZ?wbhEHb6krfwxXQqgQ8p>Nd_rDje}3!wqK=IvU7IWWx7AGCQ8#&K%glXE)AzK` zKG3t^NZ+EPh1I>?3l2|Qdc3r@v#O!}`=9@xfB*mX=l|8u|6l+7|L)iSmp}i%{q_ID z@BgoU{r~*u|M$QD-~Rsp>CgXffB)AvH@CFccXrnF^;ArmP&#vR;qo~d3uolaotnRN zR_6cz{~5>yia%Kx85nec5C}kiVqoia5XrE<)2g&1Ye6Yh%{$pqArjmOFr=-7_ZS-2Qr*6IeMi1XcFBKi-=$KGt9VIat0bYJ?E)F(U z78!9R9U(D^dGi-!2QvuUjXm!TdfM8Hb2nXEy7Tt)cRyde`|-ygpG`u5}Z!`D9^y!!t5&5tK+PqXU%vnDpS5D*?Bx$%1I52TfB*C4 zho3Lr|9Jo9*Qam4r_5RU^xco=?|;1d`19kp-=Dty`uOeF_g{Zz%wJ?aBVon4?KL}U z=PjDIXzA<~E2ghqJ!Rv%iCZ`H?cLhBb5qa$Z5{vr|7RG2K=CIFBLjmogAT~;pg3V* zU*6#C?9|fQ*3#7Ez|qs&=g{fw$YEh_(bwZR(Vo%V(wvc%nT5gBexjZ1R0~=5wQKDr z+A^tZW!kbu#de~N$!c9=Ha2M^n~Byk^UQS?E#bAEXeGK@^s17wsMSO>DMP8dckgML zP1Ms|ZJ^B~EF!5lQC0tx{#gcn)rnjRs}(d96cimaI$9DN+l4u7Z3-qFXzuiIHmI5L XgV9NeM?!&bXM&>>OK%esBZD;nX%XK6 literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/processes.png b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/processes.png new file mode 100644 index 0000000000000000000000000000000000000000..364c0e70b1d6dc48f9d9abfceafbb4f63e5e1edb GIT binary patch literal 586 zcmZ?wbhEHb6krfwc*el6W%tD&KmUCB_Pefs%iNVm(`#3L`uh9Zk3TTdfM8Hb2nXEy7Tt)cRyde`|-ygpG`u5}Z!`D9^y!!t5&5tK+PqXU%vnDpS5D*?Bx$%1I52TfB*C4 zho3Lr|9Jo9*Qam4r_5RU^xco=?|;1d`19kp-=Dty`uOeF_g{Zz%wJ?aBVon4?KL}U z=PjDIXzA<~E2ghqJ!Rv%iCZ`H?cLhBb5qa$Z5{vr|7RG2K=CIFBLjmogAT~;pg3V* zU*6#C?9|fQ*3#7Ez|qs&=g{fw$YEh_(bwZR(Vo%V(wvc%nT5gBexjZ1R0~=5wQKDr z+A^tZW!kbu#de~N$!c9=Ha2M^n~Byk^UQS?E#bAEXeGK@^s17wsMSO>DMP8dckgML zP1Ms|ZJ^B~EF!5lQC0tx{#gcn)rnjRs}(d96cimaI$9DN+l4u7Z3-qFXzuiIHmI5L XgV9NeM?!&bXM&>>OK%esBZD;nX%XK6 literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/refresh.png b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/refresh.png new file mode 100644 index 0000000000000000000000000000000000000000..bb3803b0770a81e334f8050687c8a8237997c9c8 GIT binary patch literal 934 zcmV;X16lluP){=lkBi-SyhBlR7C)T-v5-)li@~idq_w zBBg*Ts4y39fJDV#021QFsaz{KA}&arxS$A2AQUPPC{+9q0o*Eu(jE+NHFg;M?#?T4C}8B`%5 z9Qu0Z?Ae*Qsi%~%1@0#k8C0&kQjADKBl`MB}}9~2N; ztrqHyI*17q4^AL6m;nHsI$l<%Cdx2r3IT#e6*@6;VDQrMBPUg>-GWIBmVQ~npKCYa z7=?_T!Qv0!VyINandvha$`1hyNR|*JU=iV!QsJP}(>?Tb57(|=!#~ZtoOM+cMDdj{ zjg2SN`L=G^3x6%p?8#ZU?1CbKB!cC5YK{$PtG$Je-$DJ(ZFrvQclzODT;*F-p(&E| z3_nWrz~TMqT3z&a`tY}XPztt`Bg)#uNPHj7f18j-pclno?$+hG&aljj%)n3%$!3Uk ze-+)$F1VK>(dG-vzN{j%BNZ$lc4DZQ5JhIe%%|t~Y{LamP>{sLCIy=m9P_8#6`?ji zB1oW>hAA5GQNVHKELG^lo(9JR(MNV!7OiO#_8}P$z~C7^cg_pDC@bxA@}=aES(EuUe&pzA#aEcx=0Pe^LQxZswIrWjSeL6l#Q%o zqiA`syOIS6ye~}xO4fCp)Pg8lj=SdX{vXLg|ATm4aFuWLb^Nxstzy?w$k-OLj)LV8 za0C=iCKQdND(l(Da*q9Q!S*J@TKbmWNX7wRce9sU8^KqDt8O?bGH{gwWeJ`A8rx%i zv`00%BO&sZb1b+XoeSF0GJtRX2XK`cz_az0&YO+Jou1qjDFp=EwIB-uswaWp!N1No zbp57(8H^Y2WkC12^I-t50(epinq~&2%ryYt0eGLQe0#6|KSQi=IDDePAOHXW07*qo IM6N<$g3chO)c^nh literal 0 HcmV?d00001 diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/remove_one.gif b/eclipse/plugins/runtime/org.argeo.slc.client.ui/icons/remove_one.gif new file mode 100644 index 0000000000000000000000000000000000000000..2cd9c544436c47a57f20b348b3fb024bb50701a7 GIT binary patch literal 163 zcmZ?wbhEHb6krfw*v!DNV#SID3l_|nF=N7n2^}3B4Gj$y6%_>q1sNF`2?+`R|Nmz| z1&Tje7#SG27<53wATtBYuHJj2L#xNM)vQ#JRl<>hDKU#-N&yE`p}?0M(Gw4T zcQCOfDoF5h^e6?|s2Q}nBw9^!OQRNg)3%kxRBAkW9!LB3?4I> z>>K8v`g!xg3)YaO%`47cc=&n8;d9gHE!9q#Xpz4_GI6eV%leGv*H2x$fB3A@ynTq@31iOxG7C+bPzbDc(LQiJeN5J7CvIy2j%)T-dggA zH8XokK3d`|=kxT_%LYAB3H8!U6**yEUN+$lLB3`gSveJcepwD-)gDD$KmH z>@2gyWO=!S7N~G9k)6dME6d8gR!wb@#8wvJt+G;F3`ZGMSj4wVNgZTk@w%uk%qhEn eD-+kHixR@qwu*2y-M+}r#m&Y4op$N_rU!pFKlpp@&HrhazaM<@|J>XE z=imN+`0YOgFfcGE{$ycfVBllW0kVN62rw|PxL&YySiPrW(^-de2MTq%rq6l7%F`5B z;i$8k#Yy1a@~|oIyrHq)=PiaF#P*7-ZbZ>KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000B)Nkl9L0a{zL}AkGCW>qUZNzAIE?fX> zT!}F*TsE#6U6`4Dmhv&Bg+2y4AILBrX5M_f>q3Xjz*O0I zlACw)a__n4p8xq@MM}y40b9jfnVg*b%IS2rS1zzD3jir))qG=PVPs#)5Ps|i=LhyM<5XR^5VsdA3u|L_vU|tq9~}UN?lzYe!t)5_xryX z8yoAWNn9ut_FWhu1g2?XnkII;9m}#D_4W1B&s1FL>3@x`t}Zf}4C!lb-CY1pO-(E=%p-+^sXGsm@^1m@Y>8i{7Fb+bh$;bziYSKKdsr)l_RyeNj#pw`J9Rojr0A_Vb+sRk(Py#EV39^u^b2Sdv&BN z5sgMkCX;J5<5p?KxpU{3o0~&gMb4f)#*KSdnE37{cULmR(kj>waJ-|1{uA{quRP}3 z^_!pPa=CA67OxVTrV$JVxq9^~@4Ru0<+TkaZ{1}%o~N_3ldk6#-aq{U-ue>PZ!F?; zIzw)^d!>rFoa0m~RrO?sLLmZy0EJ?ak3M{pfm0j&et(q~f05T-cGKc*U^|zm?eJk9 zL?Wk)#o~`u#FV<^1{ca)ULd%#1sm&2C=0bm@oD(NS5Y`10k;rlKhC0TL)Z>+KjB8Tmldw9jI( qSbTPNc6e-TY!y%e7mzKl`)dH_&#l!9jZTUH0000 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/pom.xml b/eclipse/plugins/runtime/org.argeo.slc.client.ui/pom.xml new file mode 100644 index 000000000..895938dc8 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/pom.xml @@ -0,0 +1,73 @@ + + 4.0.0 + + org.argeo.slc.eclipse + plugins + 0.13.0-SNAPSHOT + .. + + org.argeo.slc.client.ui + SLC Client UI + jar + + + + org.argeo.slc.eclipse + org.argeo.slc.client.commons + ${project.version} + + + org.argeo.slc.eclipse + org.argeo.slc.client.oxm + ${project.version} + + + org.argeo.slc.eclipse + org.argeo.slc.client.hibernate + ${project.version} + + + org.argeo.slc.eclipse + org.argeo.slc.client.core + ${project.version} + + + + + org.argeo.slc.runtime + org.argeo.slc.core + ${project.version} + + + + org.argeo.slc.runtime + org.argeo.slc.server + ${project.version} + + + + org.argeo.commons.eclipse + org.argeo.eclipse.ui + ${version.argeo-commons} + + + + org.springframework + org.springframework.context + + + + org.eclipse.ui + org.eclipse.ui + + + org.eclipse.core + org.eclipse.core.runtime + + + org.eclipse.swt + org.eclipse.swt.gtk.linux.x86_64 + + + diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ClearBatchHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ClearBatchHandler.java new file mode 100644 index 000000000..eb6809c1f --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ClearBatchHandler.java @@ -0,0 +1,30 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * + * @author bsinou + * + * Remove all processes from the batch built in the ProcessBuilderView + * + * NOTE : only one batch is supported with this command, if more than + * one batch is planned, this class must be updated with parameter. + */ +public class ClearBatchHandler extends AbstractHandler { + // private final static Log log = + // LogFactory.getLog(ClearBatchHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessBuilderView.ID); + pbView.clearBatch(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java new file mode 100644 index 000000000..e770c34b0 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java @@ -0,0 +1,30 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * + * @author bsinou + * + * Launch the batch built in the ProcessBuilderView + * + * NOTE : only one batch is supported with this command, if more than + * one batch is planned, this class must be updated with parameter. + */ +public class LaunchBatchHandler extends AbstractHandler { + // private final static Log log = + // LogFactory.getLog(LaunchBatchHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessBuilderView.ID); + pbView.launchBatch(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java new file mode 100644 index 000000000..cdc28812b --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java @@ -0,0 +1,43 @@ +package org.argeo.slc.client.ui.commands; + +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 = 1 : VIEW_ACTIVATE, Show view mode that indicates the view + // should be made visible and activated. Use of this mode has the same + // effect as calling showView. + try { + ProcessDetailView pView = (ProcessDetailView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .showView(ProcessDetailView.ID, "UUID-" + uuid, 1); + pView.setUuid(uuid); + pView.retrieveResults(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java new file mode 100644 index 000000000..47f9d0041 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessListView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +public class ProcessListViewRefreshHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessListView pView = (ProcessListView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessListView.ID); + pView.retrieveResults(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java new file mode 100644 index 000000000..12e8de0ff --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java @@ -0,0 +1,31 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * + * @author bsinou + * + * Launch the batch built in the ProcessBuilderView + * + * NOTE : only one batch is supported with this command, if more than + * one batch is planned, this class must be updated with parameter. + */ + +public class RemoveSelectedProcessFromBatchHandler extends AbstractHandler { + // private final static Log log = + // LogFactory.getLog(RemoveSelectedProcessFromBatchHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessBuilderView.ID); + pbView.removeSelected(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java new file mode 100644 index 000000000..98c502f3e --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java @@ -0,0 +1,44 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ResultDetailView; +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 ResultDetailView. UUID of the + * testResult is passed via command parameters. + * + * @author bsinou + * + */ + +public class ResultDetailsDisplayHandler extends AbstractHandler { + // private static final Log log = LogFactory + // .getLog(ResultDetailsDisplayHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + + // We pass the UUID of the test result we want to display via command + // parameters. + String uuid = event + .getParameter("org.argeo.slc.client.commands.resultUuid"); + + // mode = 2 : VIEW_VISIBLE, Show view mode that indicates the view + // should be created or made visible if already created . + // mode = 1 : VIEW_ACTIVATE, Show view mode that indicates the view + // should be made visible and activated. Use of this mode has the same + // effect as calling + try { + ResultDetailView rView = (ResultDetailView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .showView(ResultDetailView.ID, "UUID-" + uuid, 1); + rView.setUuid(uuid); + rView.retrieveResults(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java new file mode 100644 index 000000000..23fa87916 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ResultListView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +public class ResultListViewRefreshHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + ResultListView view = (ResultListView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ResultListView.ID); + view.retrieveResults(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java new file mode 100644 index 000000000..5785305ab --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/controllers/ProcessController.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.controllers; + +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.runtime.SlcAgent; +import org.argeo.slc.services.SlcExecutionService; + +public class ProcessController { + private SlcExecutionService slcExecutionService; + + public void execute(SlcAgent agent, SlcExecution slcExecution) { + slcExecutionService.newExecution(slcExecution); + agent.runSlcExecution(slcExecution); + } + + public void setSlcExecutionService(SlcExecutionService slcExecutionService) { + this.slcExecutionService = slcExecutionService; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java new file mode 100644 index 000000000..499559833 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java @@ -0,0 +1,105 @@ +package org.argeo.slc.client.ui.listeners; + +import org.argeo.slc.SlcException; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.core.attachment.Attachment; +import org.argeo.slc.core.attachment.SimpleAttachment; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.core.test.tree.TreeTestResultListener; +import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest; +import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.ResultPartRequest; +import org.argeo.slc.services.TestManagerService; +import org.argeo.slc.test.TestResultPart; +import org.eclipse.ui.handlers.IHandlerService; + +/** In memory access to a test manager service */ +public class TestManagerServiceAdapter implements TreeTestResultListener { + // private static final Log log = LogFactory + // .getLog(TestManagerServiceAdapter.class); + + private Boolean onlyOnClose = false; + + private TestManagerService testManagerService; + + public void resultPartAdded(TreeTestResult testResult, + TestResultPart testResultPart) { + if (onlyOnClose) + return; + + if (testResult.getResultParts().size() == 1 + && testResult.getResultParts().values().iterator().next() + .getParts().size() == 1) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + testManagerService.createTreeTestResult(req); + } else { + ResultPartRequest req = new ResultPartRequest(testResult); + testManagerService.addResultPart(req); + } + } + + public void close(TreeTestResult testResult) { + + if (onlyOnClose) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + testManagerService.createTreeTestResult(req); + } else { + CloseTreeTestResultRequest req = new CloseTreeTestResultRequest( + testResult); + testManagerService.closeTreeTestResult(req); + } + + // TODO : clean this -> pb of thread && commandID hardCoded. + // We force the refresh of the list view. + ClientUiPlugin.getDefault().getWorkbench().getDisplay() + .syncExec(new Runnable() { + public void run() { + IHandlerService handlerService = (IHandlerService) ClientUiPlugin + .getDefault().getWorkbench() + .getService(IHandlerService.class); + try { + handlerService + .executeCommand( + "org.argeo.slc.client.ui.refreshResultList", + null); + handlerService + .executeCommand( + "org.argeo.slc.client.ui.refreshProcessList", + null); + + } catch (Exception e) { + e.printStackTrace(); + throw new SlcException( + "Problem while rendering result. " + + e.getMessage()); + } + } + } + + ); + + } + + public void addAttachment(TreeTestResult testResult, Attachment attachment) { + if (onlyOnClose) + return; + AddTreeTestResultAttachmentRequest req = new AddTreeTestResultAttachmentRequest(); + req.setResultUuid(testResult.getUuid()); + req.setAttachment((SimpleAttachment) attachment); + testManagerService.addAttachment(req); + + } + + /** Publishes the test result only when it gets closed. */ + public void setOnlyOnClose(Boolean onlyOnClose) { + this.onlyOnClose = onlyOnClose; + } + + public void setTestManagerService(TestManagerService testManagerService) { + this.testManagerService = testManagerService; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java new file mode 100644 index 000000000..f50ea1814 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/perspectives/SlcExecution.java @@ -0,0 +1,44 @@ +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); + + // Create the main ui layout + + // For a vertical split, the part on top gets the specified ratio of the + // current space and the part on bottom gets the rest. Likewise, for a + // horizontal split, the part at left gets the specified ratio of the + // current space. + IFolderLayout main = layout.createFolder("main", IPageLayout.RIGHT, + 0.3f, editorArea); + IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, + 0.3f, editorArea); + + IFolderLayout bottom = layout.createFolder("bottom", + IPageLayout.BOTTOM, 0.65f, "main"); + + IFolderLayout topRight = layout.createFolder("topRight", + IPageLayout.RIGHT, 0.6f, "main"); + + // add the views to the corresponding place holder + left.addView("org.argeo.slc.client.ui.executionModulesView"); + left.addView("org.argeo.slc.client.ui.resultListView"); + + main.addView("org.argeo.slc.client.ui.processBuilderView"); + main.addPlaceholder("org.argeo.slc.client.ui.resultDetailView:UUID-*"); + main.addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*"); + + bottom.addView("org.argeo.slc.client.ui.processListView"); + + topRight.addView("org.argeo.slc.client.ui.processParametersView"); + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java new file mode 100644 index 000000000..1278609bd --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java @@ -0,0 +1,261 @@ +package org.argeo.slc.client.ui.providers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + +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.execution.ExecutionFlowDescriptor; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.runtime.SlcAgent; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; + +public class ExecutionModulesContentProvider implements ITreeContentProvider { + private final static Log log = LogFactory + .getLog(ExecutionModulesContentProvider.class); + + // IoC + private List slcAgents; + + public Object[] getChildren(Object parent) { + if (parent instanceof ExecutionModuleNode) { + ExecutionModuleNode executionModuleNode = (ExecutionModuleNode) parent; + ExecutionModuleDescriptor emd = executionModuleNode.getDescriptor(); + + // Terminate the building of UI specific object emd + emd = executionModuleNode + .getAgentNode() + .getAgent() + .getExecutionModuleDescriptor(emd.getName(), + emd.getVersion()); + executionModuleNode.cacheDescriptor(emd); + + // 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; + + 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 agentNodes = new ArrayList(); + for (SlcAgent slcAgent : slcAgents) { + agentNodes.add(new AgentNode(slcAgent)); + } + return agentNodes.toArray(); + } + } + + 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) { + return getChildren(parent); + } + + + + 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 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; + } + + public void cacheDescriptor(ExecutionModuleDescriptor descriptor) { + this.descriptor = descriptor; + + SortedMap folderNodes = new TreeMap(); + flowDescriptors = new HashMap(); + + for (ExecutionFlowDescriptor fd : descriptor.getExecutionFlows()) { + // Find, format and store path and label values for each flow + // descritor: + + // we format name of type path="" & name="path/toTest/Test" to : + // path="path/toTest/" name="Test" + 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 (path == null || path.trim().equals("") + || path.trim().equals("/")) { + // directChildren.put(name, new FlowNode(name, this)); + addChild(new FlowNode(label, fd.getName(), fd, this)); + } else { + FolderNode folderNode = mkdirs(this, path, folderNodes); + folderNode.addChild(new FlowNode(label, fd.getName(), fd, + this)); + } + + flowDescriptors.put(fd.getName(), fd); + } + // TODO: make it readonly + } + + protected FolderNode mkdirs(TreeParent root, String path, + SortedMap 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 getFlowDescriptors() { + return flowDescriptors; + } + + } + + /** + * + * @author bsinou + * + * The implementation of a vernice of a given slc process. Note that + * we store the parent node (execution module node) & the + * ExecutionFlowDescriptor. + */ + public class FlowNode extends TreeObject { + + private final String flowName; + private final ExecutionModuleNode executionModuleNode; + private final ExecutionFlowDescriptor executionFlowDescriptor; + + public FlowNode(String label, String flowName, + ExecutionFlowDescriptor executionFlowDescriptor, + ExecutionModuleNode parent) { + super(label); + this.flowName = flowName; + this.executionFlowDescriptor = executionFlowDescriptor; + this.executionModuleNode = parent; + } + + public String getFlowName() { + return flowName; + } + + public ExecutionModuleNode getExecutionModuleNode() { + return executionModuleNode; + } + + public ExecutionFlowDescriptor getExecutionFlowDescriptor() { + return executionFlowDescriptor; + } + + } + + public class FolderNode extends TreeParent { + public FolderNode(String name) { + super(name); + } + + } + + // IoC + public void setSlcAgents(List slcAgents) { + this.slcAgents = slcAgents; + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java new file mode 100644 index 000000000..7ca534e0f --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java @@ -0,0 +1,118 @@ +package org.argeo.slc.client.ui.providers; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.argeo.slc.client.ui.views.ProcessParametersView; +import org.argeo.slc.core.execution.PrimitiveAccessor; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TextCellEditor; + +/** + * + * + * Implements the ability to edit and save various type of + * parameter of a given process. Parameter values are directly saved as + * soon as the focus on a given field is lost. + * + * + * Note that EditingSupport is tightly coupled with both + * ProcessParametersView and ProcessBuilderView; it cannot serve as a + * generic EditingSupport as is. Note also that it assumes that the + * processes in ProcessBuilderView as stored as an ordered list. + + @author bsinou + * + */ + +public class ProcessParametersEditingSupport extends EditingSupport { + + // private final static Log log = LogFactory + // .getLog(ProcessParametersEditingSupport.class); + + private CellEditor strEditor; + private CellEditor nbEditor; + // private int column; + + private final static String strType = "string", intType = "integer"; + + // different type of primitive + private static enum primitiveType { + strType, intType + }; + + // So that we can update corresponding process + private int curProcessIndex; + private ProcessBuilderView pbView; + + public ProcessParametersEditingSupport(ColumnViewer viewer, int column) { + super(viewer); + strEditor = new TextCellEditor(((TableViewer) viewer).getTable()); + // nbEditor = new NumberCellEditor(((TableViewer) viewer).getTable()); + // this.column = column; + } + + @Override + protected CellEditor getCellEditor(Object element) { + // TODO return specific editor depending on the parameter type. + return strEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected Object getValue(Object element) { + ProcessParametersView.ObjectWithName objectWithName = (ProcessParametersView.ObjectWithName) element; + + if (objectWithName.obj instanceof PrimitiveAccessor) { + PrimitiveAccessor pv = (PrimitiveAccessor) objectWithName.obj; + // we only handle string & integer parameter in a first time + if (strType.equals(pv.getType())) { + return pv.getValue(); + } + if (intType.equals(pv.getType())) { + return ((Integer) pv.getValue()).toString(); + } + } + return "unsupported param type"; + + } + + @Override + protected void setValue(Object element, Object value) { + ProcessParametersView.ObjectWithName objectWithName = (ProcessParametersView.ObjectWithName) element; + if (objectWithName.obj instanceof PrimitiveAccessor) { + PrimitiveAccessor pv = (PrimitiveAccessor) objectWithName.obj; + // we only handle string parameter in a first time + if (strType.equals(pv.getType())) { + pv.setValue(value); + pbView.updateParameter(curProcessIndex, objectWithName.name, + objectWithName.obj); + } else if (intType.equals(pv.getType())) { + + String stVal = (String) value; + Integer val = ("".equals(stVal)) ? new Integer(0) + : new Integer(stVal); + pv.setValue(val); + pbView.updateParameter(curProcessIndex, objectWithName.name, pv); + } + getViewer().update(element, null); + } + + } + + // Store the index of the process which parameters are being edited + public void setCurrentProcessIndex(int index) { + this.curProcessIndex = index; + } + + public void setCurrentProcessBuilderView( + ProcessBuilderView processbuilderView) { + this.pbView = processbuilderView; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java new file mode 100644 index 000000000..07df89af6 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java @@ -0,0 +1,218 @@ +package org.argeo.slc.client.ui.views; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.UUID; + +import org.apache.commons.io.IOUtils; +import org.argeo.slc.SlcException; +import org.argeo.slc.client.oxm.OxmInterface; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.controllers.ProcessController; +import org.argeo.slc.client.ui.providers.ExecutionModulesContentProvider; +import org.argeo.slc.client.ui.providers.ExecutionModulesContentProvider.FlowNode; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.process.RealizedFlow; +import org.argeo.slc.process.SlcExecution; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; +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.dnd.DND; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.DragSourceListener; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.ISharedImages; +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); + + public static final String ID = "org.argeo.slc.client.ui.executionModulesView"; + + private TreeViewer viewer; + + // Ioc + private IContentProvider contentProvider; + private OxmInterface oxmBean; + private ProcessController processController; + + public void createPartControl(Composite parent) { + viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + viewer.setContentProvider(contentProvider); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setInput(getViewSite()); + viewer.addDoubleClickListener(new ViewDoubleClickListener()); + int operations = DND.DROP_COPY | DND.DROP_MOVE; + Transfer[] tt = new Transfer[] { TextTransfer.getInstance() }; + viewer.addDragSupport(operations, tt, new ViewDragListener()); + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public TreeViewer getViewer() { + return viewer; + } + + class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + public String getColumnText(Object obj, int index) { + if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode) { + ExecutionModuleDescriptor emd = ((ExecutionModulesContentProvider.ExecutionModuleNode) obj) + .getDescriptor(); + if (emd.getLabel() != null) + return emd.getLabel(); + else + return getText(emd); + } else + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return getImage(obj); + } + + public Image getImage(Object obj) { + if (obj instanceof ExecutionModulesContentProvider.AgentNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("agent"); + else if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("executionModule"); + else if (obj instanceof ExecutionModulesContentProvider.FolderNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("folder"); + else if (obj instanceof ExecutionModulesContentProvider.FlowNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("flow"); + else + return PlatformUI.getWorkbench().getSharedImages() + .getImage(ISharedImages.IMG_OBJ_ELEMENT); + } + } + + class ViewDoubleClickListener implements IDoubleClickListener { + public void doubleClick(DoubleClickEvent evt) { + Object obj = ((IStructuredSelection) evt.getSelection()) + .getFirstElement(); + if (obj instanceof ExecutionModulesContentProvider.FlowNode) { + ExecutionModulesContentProvider.FlowNode fn = (ExecutionModulesContentProvider.FlowNode) obj; + + List realizedFlows = new ArrayList(); + RealizedFlow realizedFlow = new RealizedFlow(); + realizedFlow.setModuleName(fn.getExecutionModuleNode() + .getDescriptor().getName()); + realizedFlow.setModuleVersion(fn.getExecutionModuleNode() + .getDescriptor().getVersion()); + realizedFlow.setFlowDescriptor(fn.getExecutionModuleNode() + .getFlowDescriptors().get(fn.getFlowName())); + realizedFlows.add(realizedFlow); + + 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); + } + } + + } + + class ViewDragListener implements DragSourceListener { + + 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(); + + Properties props = new Properties(); + flowNodeAsProperties(props, flowNode); + props.setProperty("agentId", flowNode + .getExecutionModuleNode().getAgentNode().getAgent() + .getAgentUuid()); + props.setProperty("host", flowNode.getExecutionModuleNode().getAgentNode() + .getAgent().toString()); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + props.store(out, ""); + event.data = new String(out.toByteArray()); + } catch (IOException e) { + throw new SlcException( + "Cannot transform realized flow", e); + } finally { + IOUtils.closeQuietly(out); + } + } + } + } + + public void dragFinished(DragSourceEvent event) { + System.out.println("Finished Drag"); + } + + protected void flowNodeAsProperties(Properties props, FlowNode fn) { + + RealizedFlow realizedFlow = new RealizedFlow(); + realizedFlow.setModuleName(fn.getExecutionModuleNode() + .getDescriptor().getName()); + realizedFlow.setModuleVersion(fn.getExecutionModuleNode() + .getDescriptor().getVersion()); + realizedFlow.setFlowDescriptor(fn.getExecutionFlowDescriptor()); + + // As we want to have the effective ExecutionSpec and not a + // reference; we store it at the RealizeFlow level : thus the + // marshaller will store the object and not only a reference. + realizedFlow.setExecutionSpec(fn.getExecutionFlowDescriptor() + .getExecutionSpec()); + + props.setProperty("RealizedFlowAsXml", + oxmBean.marshal(realizedFlow)); + System.out + .println(oxmBean.marshal(fn.getExecutionFlowDescriptor())); + + } + + } + + // IoC + public void setContentProvider(IContentProvider contentProvider) { + this.contentProvider = contentProvider; + } + + public void setProcessController(ProcessController processController) { + this.processController = processController; + } + + public void setOxmBean(OxmInterface oxmBean) { + this.oxmBean = oxmBean; + } + +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java new file mode 100644 index 000000000..5d62983f9 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java @@ -0,0 +1,316 @@ +package org.argeo.slc.client.ui.views; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +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.oxm.OxmInterface; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.controllers.ProcessController; +import org.argeo.slc.process.RealizedFlow; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.runtime.SlcAgent; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerDropAdapter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.dnd.TransferData; +import org.eclipse.swt.graphics.Image; +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.PartInitException; +import org.eclipse.ui.part.ViewPart; + +/** + * Display a list of processes that are to be launched as batch. For the moment + * being, only one agent by batch is enabled. The batch is contructed by + * dropping process from the ExecutionModuleView. Wrong type of data dropped in + * this view might raise errors. + * + * @author bsinou + * + */ +public class ProcessBuilderView extends ViewPart { + private final static Log log = LogFactory.getLog(ProcessBuilderView.class); + + public static final String ID = "org.argeo.slc.client.ui.processBuilderView"; + private static final String EDIT_CMD = "org.argeo.slc.client.ui.editRealizedFlowDetails"; + private static final String FLOWASXML_PARAM = "org.argeo.slc.client.commands.realizedFlowAsXml"; + private static final String INDEX_PARAM = "org.argeo.slc.client.commands.realizedFlowIndex"; + + // private final static Log log = + // LogFactory.getLog(ProcessBuilderView.class); + + private TableViewer viewer; + private List realizedFlows = new ArrayList(); + private String currentAgentUuid = null; + private String host = null; + + // TODO find a better way to get index of the current selected row + // used in removeSelected + private int curSelectedRow = -1; + + // IoC + private OxmInterface oxmBean; + private ProcessController processController; + private List slcAgents; + + public void createPartControl(Composite parent) { + Table table = createTable(parent); + viewer = new TableViewer(table); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setContentProvider(new ViewContentProvider()); + viewer.addSelectionChangedListener(new SelectionChangedListener()); + + int operations = DND.DROP_COPY | DND.DROP_MOVE; + Transfer[] tt = new Transfer[] { TextTransfer.getInstance() }; + viewer.addDropSupport(operations, tt, new ViewDropListener(viewer)); + + viewer.setInput(getViewSite()); + } + + protected Table createTable(Composite parent) { + int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; + + Table table = new Table(parent, style); + + GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.grabExcessVerticalSpace = true; + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 3; + table.setLayoutData(gridData); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + TableColumn column = new TableColumn(table, SWT.LEFT, 0); + column.setText("Module"); + column.setWidth(200); + + column = new TableColumn(table, SWT.LEFT, 1); + column.setText("Flow"); + column.setWidth(200); + + return table; + } + + protected void execute() { + // TODO: use agent proxy to retrieve it + SlcAgent agent = null; + SlcExecution slcExecution = new SlcExecution(); + slcExecution.setUuid(UUID.randomUUID().toString()); + slcExecution.setRealizedFlows(realizedFlows); + processController.execute(agent, slcExecution); + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + // update one of the parameter of a given RealizedFlow + public void updateParameter(int realizedFlowIndex, String paramName, + Object value) { + RealizedFlow curRealizedFlow = realizedFlows.get(realizedFlowIndex); + curRealizedFlow.getFlowDescriptor().getValues().put(paramName, value); + } + + // clear the realizedFlow + public void clearBatch() { + // we clear the list + realizedFlows = new ArrayList(); + curSelectedRow = -1; + refreshParameterview(); + viewer.refresh(); + } + + // Remove the selected process from the batch + public void removeSelected() { + if (curSelectedRow == -1) + return; + else + realizedFlows.remove(curSelectedRow); + curSelectedRow = -1; + refreshParameterview(); + viewer.refresh(); + } + + // calling this method with index =-1 will cause the reset of the view. + private void refreshParameterview() { + // We choose to directly access the view rather than going through + // commands. + ProcessParametersView ppView; + try { + ppView = (ProcessParametersView) ClientUiPlugin.getDefault() + .getWorkbench().getActiveWorkbenchWindow().getActivePage() + .showView(ProcessParametersView.ID); + + if (curSelectedRow == -1) + ppView.setRealizedFlow(-1, null); + else + ppView.setRealizedFlow(curSelectedRow, + realizedFlows.get(curSelectedRow)); + } catch (PartInitException e) { + throw new SlcException( + "Cannot Retrieve ProcessParameterView to edit parameters of selected process", + e); + } + } + + // Return the list of the processes to execute. + public void launchBatch() { + SlcExecution slcExecution = new SlcExecution(); + slcExecution.setUuid(UUID.randomUUID().toString()); + + slcExecution.setRealizedFlows(realizedFlows); + slcExecution.setHost(host); + + // TODO : insure that the concept has been well understood & the + // specification respected + SlcAgent curAgent; + for (int i = 0; i < slcAgents.size(); i++) { + if (currentAgentUuid == null) + throw new SlcException( + "Cannot launch a batch if no agent is specified"); + if (currentAgentUuid.equals(slcAgents.get(i).getAgentUuid())) { + curAgent = slcAgents.get(i); + processController.execute(curAgent, slcExecution); + break; + } + } + } + + // Specific Providers for the current view. + protected class ViewContentProvider implements IStructuredContentProvider { + public void inputChanged(Viewer arg0, Object arg1, Object arg2) { + } + + public void dispose() { + } + + public Object[] getElements(Object obj) { + return realizedFlows.toArray(); + } + } + + protected class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + public String getColumnText(Object obj, int index) { + RealizedFlow rf = (RealizedFlow) obj; + switch (index) { + case 0: + return rf.getModuleName(); + case 1: + return rf.getFlowDescriptor().getName(); + } + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return null; + } + + } + + // Handle Events + class SelectionChangedListener implements ISelectionChangedListener { + public void selectionChanged(SelectionChangedEvent evt) { + + IStructuredSelection curSelection = (IStructuredSelection) evt + .getSelection(); + Object obj = curSelection.getFirstElement(); + + if (obj instanceof RealizedFlow) { + RealizedFlow rf = (RealizedFlow) obj; + curSelectedRow = realizedFlows.indexOf(rf); + refreshParameterview(); + } + } + } + + // Implementation of the Drop Listener + protected class ViewDropListener extends ViewerDropAdapter { + + public ViewDropListener(Viewer viewer) { + super(viewer); + } + + @Override + public boolean performDrop(Object data) { + + Properties props = new Properties(); + + // TODO : Handle wrong type of dropped data + ByteArrayInputStream in = new ByteArrayInputStream(data.toString() + .getBytes()); + try { + props.load(in); + } catch (IOException e) { + throw new SlcException("Cannot create read flow node", e); + } finally { + IOUtils.closeQuietly(in); + } + + String agentId = props.getProperty("agentId"); + if (currentAgentUuid == null) { + currentAgentUuid = agentId; + host = props.getProperty("host"); + } 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; + } + + String fdXml = props.getProperty("RealizedFlowAsXml"); + if (fdXml == null) + return false; + RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(fdXml); + realizedFlows.add(rf); + curSelectedRow = realizedFlows.indexOf(rf); + refreshParameterview(); + getViewer().refresh(); + return true; + } + + @Override + public boolean validateDrop(Object target, int operation, + TransferData transferType) { + return true; + } + } + + // IoC + public void setSlcAgents(List slcAgents) { + this.slcAgents = slcAgents; + } + + public void setOxmBean(OxmInterface oxmBean) { + this.oxmBean = oxmBean; + } + + public void setProcessController(ProcessController processController) { + this.processController = processController; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java new file mode 100644 index 000000000..944207eb1 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessDetailView.java @@ -0,0 +1,96 @@ +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.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; + +/** + * Multi-instance view that enables to browse the details of a given + * SlcExecution + * + * @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 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(new ProcessDetailLabelProvider()); + // viewer.setInput(getViewSite()); + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public TreeViewer getViewer() { + return viewer; + } + + public void retrieveResults() { + se = slcExecutionDao.getSlcExecution(uuid); + viewer.setInput(se); + } + + public void setUuid(String uuid) { + 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 setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { + this.slcExecutionDao = slcExecutionDao; + } +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java new file mode 100644 index 000000000..83194d603 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java @@ -0,0 +1,163 @@ +package org.argeo.slc.client.ui.views; + +import java.util.ArrayList; + +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; +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); + + public static final String ID = "org.argeo.slc.client.ui.processListView"; + + private TableViewer viewer; + + // IoC + private SlcExecutionDao slcExecutionDao; + private ITableLabelProvider tableLabelProvider; + private IStructuredContentProvider structuredContentProvider; + + public void createPartControl(Composite parent) { + Table table = createTable(parent); + viewer = new TableViewer(table); + viewer.setLabelProvider(tableLabelProvider); + viewer.setContentProvider(structuredContentProvider); + viewer.setInput(getViewSite()); + viewer.addDoubleClickListener(new ViewDoubleClickListener()); + + } + + protected Table createTable(Composite parent) { + int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; + + Table table = new Table(parent, style); + + GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.grabExcessVerticalSpace = true; + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 3; + table.setLayoutData(gridData); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + TableColumn column = new TableColumn(table, SWT.LEFT, 0); + column.setText("Date"); + column.setWidth(200); + + column = new TableColumn(table, SWT.LEFT, 1); + column.setText("Host"); + column.setWidth(100); + + column = new TableColumn(table, SWT.LEFT, 2); + column.setText("Id"); + column.setWidth(300); + + column = new TableColumn(table, SWT.LEFT, 3); + column.setText("Status"); + column.setWidth(100); + + return table; + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public void retrieveResults() { + 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; + + 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"); + + ArrayList parameters = new ArrayList(); + + // 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; + } + + public void setTableLabelProvider(ITableLabelProvider tableLabelProvider) { + this.tableLabelProvider = tableLabelProvider; + } + + public void setStructuredContentProvider( + IStructuredContentProvider structuredContentProvider) { + this.structuredContentProvider = structuredContentProvider; + } + +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java new file mode 100644 index 000000000..b45fb9981 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java @@ -0,0 +1,210 @@ +package org.argeo.slc.client.ui.views; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.providers.ProcessParametersEditingSupport; +import org.argeo.slc.core.execution.PrimitiveAccessor; +import org.argeo.slc.execution.ExecutionSpecAttribute; +import org.argeo.slc.process.RealizedFlow; +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; + +/** + * + * @author bsinou + * + * This view, directly linked with the ProcessBuilderView + * enables the display and editing the parameters of a given process. + * + * Note that for now we use ExecutionFlowDescriptor.values + * attribute to recall (and update ??) the various parameters. + */ +public class ProcessParametersView extends ViewPart { + private static final Log log = LogFactory + .getLog(ProcessParametersView.class); + + public static final String ID = "org.argeo.slc.client.ui.processParametersView"; + + // This map stores actual values set to default if existing at the begining + // and then the ones computed by the end user + private Map values; + // This map stores the spec of the attributes used to offer the end user + // some choices. + private Map specAttributes; + + // We must keep a reference to the current EditingSupport so that we can + // update the index of the process being updated + ProcessParametersEditingSupport ppEditingSupport; + + // view attributes + private TableViewer viewer; + + public void createPartControl(Composite parent) { + viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL + | SWT.V_SCROLL | SWT.FULL_SELECTION); + createColumns(viewer); + + // WARNING + // for the moment being, we support only one process builder at a time + // we set the corresponding view in the editor here. + ProcessBuilderView pbView = (ProcessBuilderView) ClientUiPlugin + .getDefault().getWorkbench().getActiveWorkbenchWindow() + .getActivePage().findView(ProcessBuilderView.ID); + ppEditingSupport.setCurrentProcessBuilderView(pbView); + + 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); + if (i == 1) { + // we create the used EditingSupport and enable editing support + // for value Column + ppEditingSupport = new ProcessParametersEditingSupport(viewer, + i); + column.setEditingSupport(ppEditingSupport); + } + } + Table table = viewer.getTable(); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + // set class attributes, refresh the lists of process paramaters to edit. + public void setRealizedFlow(int index, RealizedFlow rf) { + // force the cleaning of the view + if (index == -1) { + viewer.setInput(null); + return; + } + // we store the index of the edited Process in the editor so that it can + // save computed values. + ppEditingSupport.setCurrentProcessIndex(index); + + // TODO : + // We should handle ExecutionSpec here. need to be improved. + // ExecutionSpec es = rf.getExecutionSpec(); + // if (es != null && es.getAttributes() != null) + // parameters = es.getAttributes(); + // if (parameters != null) + // viewer.setInput(parameters); + + values = rf.getFlowDescriptor().getValues(); + specAttributes = rf.getFlowDescriptor().getExecutionSpec() + .getAttributes(); + + if (values != null) + viewer.setInput(values); + else + // No parameters to edit, we reset the view. + viewer.setInput(null); + + } + + // Inner Classes we should use ExecutionSpecAttribute instead of values + // see below + protected class ViewContentProvider implements IStructuredContentProvider { + public void inputChanged(Viewer arg0, Object arg1, Object arg2) { + } + + public void dispose() { + } + + @SuppressWarnings("unchecked") + // we cast the Map to List + public Object[] getElements(Object obj) { + + if (obj instanceof Map && ((Map) obj).size() != 0) { + List list = new ArrayList(); + Map map = (Map) obj; + for (String key : map.keySet()) { + list.add(new ObjectWithName(key, map.get(key))); + } + return list.toArray(); + } else { + return new Object[0]; + } + } + } + + protected class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + + public String getColumnText(Object obj, int index) { + // NOTE : the passed object is a line of the table !!! + + if (obj instanceof ObjectWithName) { + ObjectWithName own = (ObjectWithName) obj; + switch (index) { + case 0: + return own.name; + case 1: + if (own.obj instanceof PrimitiveAccessor) { + PrimitiveAccessor pa = (PrimitiveAccessor) own.obj; + if ("string".equals(pa.getType())) + return (String) pa.getValue(); + else if ("integer".equals(pa.getType())) + return ((Integer) pa.getValue()).toString(); + else + return "Type " + pa.getType() + + " not yet supported"; + } else + return own.obj.toString(); + default: + return getText(obj); + } + } else + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return null; + } + + } + + // We add an inner class to enrich the ExecutionSpecAttribute with a name + // so that we can display it. + public class ObjectWithName { + public Object obj; + public String name; + + public ObjectWithName(String name, Object obj) { + this.name = name; + this.obj = obj; + } + + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java new file mode 100644 index 000000000..6d9f90162 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultDetailView.java @@ -0,0 +1,121 @@ +package org.argeo.slc.client.ui.views; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.dao.test.tree.TreeTestResultDao; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.ui.part.ViewPart; + +/** + * Multi-instance view that enables to browse the details of a given + * TreeTestResult + * + * @author bsinou + * + */ + +public class ResultDetailView extends ViewPart { + private final static Log log = LogFactory.getLog(ResultDetailView.class); + public static final String ID = "org.argeo.slc.client.ui.resultDetailView"; + + protected String[] columnNames = new String[] { "Test", "State", "Message", + "Id" }; + + private TreeViewer viewer; + private Tree resultDetailTree; + + private String uuid; + private TreeTestResult ttr; + + // IoC + private IContentProvider contentProvider; + private ITableLabelProvider labelProvider; + private TreeTestResultDao treeTestResultDao; + + public void createPartControl(Composite parent) { + resultDetailTree = new Tree(parent, SWT.MULTI | SWT.H_SCROLL + | SWT.V_SCROLL); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 3; + resultDetailTree.setLayoutData(gd); + resultDetailTree.setLinesVisible(true); + resultDetailTree.setHeaderVisible(true); + + for (int i = 0; i < columnNames.length; i++) { + TreeColumn column = new TreeColumn(resultDetailTree, SWT.LEFT, i); + column.setText(columnNames[i]); + + // TIP: Don't forget to set the width. If not set it is set to + // 0 and it will look as if the column didn't exist. + switch (i) { + case 0: + column.setWidth(130); + case 1: + column.setWidth(200); + default: + column.setWidth(70); + } + } + viewer = new TreeViewer(resultDetailTree); + viewer.setColumnProperties(columnNames); + + viewer.setContentProvider(contentProvider); + // viewer.setLabelProvider(new ResultDetailLabelProvider()); + log.debug("Injected LabelProvider :" + labelProvider.toString()); + + // TIP: It seems, that if the table has not defined any TreeColumns then + // a plain LabelProvider will be used. Since, we don't provide an + // instance of LabelProvider, a default one will be used and + // the TableLableProvider is ignored without notice. Took me quite + // a while to find that one out. + viewer.setLabelProvider(labelProvider); + log.debug("Persisted labelProvider :" + + viewer.getLabelProvider().toString()); + // viewer.setInput(getViewSite()); + + // viewer.expandAll(); + + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public TreeViewer getViewer() { + return viewer; + } + + public void retrieveResults() { + ttr = treeTestResultDao.getTestResult(uuid); + viewer.setInput(ttr); + // viewer.setInput(getViewSite()); + + // setFocus(); + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + // IoC + public void setContentProvider(IContentProvider contentProvider) { + this.contentProvider = contentProvider; + } + + public void setLabelProvider(ITableLabelProvider labelProvider) { + this.labelProvider = labelProvider; + } + + public void setTreeTestResultDao(TreeTestResultDao treeTestResultDao) { + this.treeTestResultDao = treeTestResultDao; + } + +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java new file mode 100644 index 000000000..c61f8de34 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java @@ -0,0 +1,198 @@ +package org.argeo.slc.client.ui.views; + +import java.util.ArrayList; +import java.util.List; + +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.core.test.tree.ResultAttributes; +import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; +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.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +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; + +public class ResultListView extends ViewPart { + private final static Log log = LogFactory.getLog(ResultListView.class); + + public static final String ID = "org.argeo.slc.client.ui.resultListView"; + + private TableViewer viewer; + + private TreeTestResultCollectionDao testResultCollectionDao; + + public void createPartControl(Composite parent) { + Table table = createTable(parent); + viewer = new TableViewer(table); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setContentProvider(new ViewContentProvider()); + viewer.setInput(getViewSite()); + viewer.addDoubleClickListener(new ViewDoubleClickListener()); + } + + protected Table createTable(Composite parent) { + int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; + + Table table = new Table(parent, style); + + GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.grabExcessVerticalSpace = true; + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 3; + table.setLayoutData(gridData); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + TableColumn column = new TableColumn(table, SWT.LEFT, 0); + column.setText("Date"); + column.setWidth(200); + + column = new TableColumn(table, SWT.LEFT, 1); + column.setText("UUID"); + column.setWidth(300); + + return table; + } + + // View Specific inner class + protected static class ViewContentProvider implements + IStructuredContentProvider { + + public void inputChanged(Viewer arg0, Object arg1, Object arg2) { + } + + public void dispose() { + } + + @SuppressWarnings("unchecked") + public Object[] getElements(Object obj) { + if (obj instanceof List) { + return ((List) obj).toArray(); + } else { + return new Object[0]; + } + } + } + + protected class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + public String getColumnText(Object obj, int index) { + ResultAttributes ra = (ResultAttributes) obj; + switch (index) { + case 0: + return getText(ra.getCloseDate()); + case 1: + return ra.getUuid(); + } + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return null; + } + + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public void retrieveResults() { + try { + List lst = testResultCollectionDao + .listResultAttributes(null); + if (log.isTraceEnabled()) + log.trace("Result attributes count: " + lst.size()); + viewer.setInput(lst); + // viewer.refresh(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + // Handle Events + /** + * The ResultAttributes expose a part of the information contained in the + * TreeTestResult, It has the same UUID as the corresponding treeTestResult. + */ + class ViewDoubleClickListener implements IDoubleClickListener { + public void doubleClick(DoubleClickEvent evt) { + Object obj = ((IStructuredSelection) evt.getSelection()) + .getFirstElement(); + + if (obj instanceof ResultAttributes) { + ResultAttributes ra = (ResultAttributes) obj; + log.debug("Double-clic on result with UUID" + ra.getUuid()); + + 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.displayResultDetails"); + + // log.debug("cmd : " + cmd); + ArrayList parameters = new ArrayList(); + + // get the parameter + IParameter iparam = cmd + .getParameter("org.argeo.slc.client.commands.resultUuid"); + + Parameterization params = new Parameterization(iparam, + ra.getUuid()); + 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 setTestResultCollectionDao( + TreeTestResultCollectionDao testResultCollectionDao) { + this.testResultCollectionDao = testResultCollectionDao; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java new file mode 100644 index 000000000..7148f0f54 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/ClientUiPlugin.java @@ -0,0 +1,88 @@ +package org.argeo.slc.client.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class ClientUiPlugin extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.argeo.slc.client.ui"; + + // The shared instance + private static ClientUiPlugin plugin; + + private BundleContext bundleContext; + + /** + * The constructor + */ + public ClientUiPlugin() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + this.bundleContext = context; + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static ClientUiPlugin getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in + * relative path + * + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + @Override + protected void initializeImageRegistry(ImageRegistry reg) { + reg.put("agent", getImageDescriptor("icons/computer.png")); + reg.put("executionModule", getImageDescriptor("icons/archive.png")); + reg.put("folder", getImageDescriptor("icons/folder.png")); + reg.put("flow", getImageDescriptor("icons/system.png")); + reg.put("processes", getImageDescriptor("icons/processes.gif")); + reg.put("passedTest", getImageDescriptor("icons/passed.gif")); + reg.put("failedTest", getImageDescriptor("icons/error.gif")); + } + + public BundleContext getBundleContext() { + return bundleContext; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ClearBatchHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ClearBatchHandler.java new file mode 100644 index 000000000..eb6809c1f --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ClearBatchHandler.java @@ -0,0 +1,30 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * + * @author bsinou + * + * Remove all processes from the batch built in the ProcessBuilderView + * + * NOTE : only one batch is supported with this command, if more than + * one batch is planned, this class must be updated with parameter. + */ +public class ClearBatchHandler extends AbstractHandler { + // private final static Log log = + // LogFactory.getLog(ClearBatchHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessBuilderView.ID); + pbView.clearBatch(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java new file mode 100644 index 000000000..e770c34b0 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/LaunchBatchHandler.java @@ -0,0 +1,30 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * + * @author bsinou + * + * Launch the batch built in the ProcessBuilderView + * + * NOTE : only one batch is supported with this command, if more than + * one batch is planned, this class must be updated with parameter. + */ +public class LaunchBatchHandler extends AbstractHandler { + // private final static Log log = + // LogFactory.getLog(LaunchBatchHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessBuilderView.ID); + pbView.launchBatch(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java new file mode 100644 index 000000000..cdc28812b --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessDetailsDisplayHandler.java @@ -0,0 +1,43 @@ +package org.argeo.slc.client.ui.commands; + +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 = 1 : VIEW_ACTIVATE, Show view mode that indicates the view + // should be made visible and activated. Use of this mode has the same + // effect as calling showView. + try { + ProcessDetailView pView = (ProcessDetailView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .showView(ProcessDetailView.ID, "UUID-" + uuid, 1); + pView.setUuid(uuid); + pView.retrieveResults(); + } catch (Exception e) { + e.printStackTrace(); + } + + return null; + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java new file mode 100644 index 000000000..47f9d0041 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ProcessListViewRefreshHandler.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessListView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +public class ProcessListViewRefreshHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessListView pView = (ProcessListView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessListView.ID); + pView.retrieveResults(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java new file mode 100644 index 000000000..12e8de0ff --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/RemoveSelectedProcessFromBatchHandler.java @@ -0,0 +1,31 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * + * @author bsinou + * + * Launch the batch built in the ProcessBuilderView + * + * NOTE : only one batch is supported with this command, if more than + * one batch is planned, this class must be updated with parameter. + */ + +public class RemoveSelectedProcessFromBatchHandler extends AbstractHandler { + // private final static Log log = + // LogFactory.getLog(RemoveSelectedProcessFromBatchHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProcessBuilderView pbView = (ProcessBuilderView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ProcessBuilderView.ID); + pbView.removeSelected(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java new file mode 100644 index 000000000..98c502f3e --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultDetailsDisplayHandler.java @@ -0,0 +1,44 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ResultDetailView; +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 ResultDetailView. UUID of the + * testResult is passed via command parameters. + * + * @author bsinou + * + */ + +public class ResultDetailsDisplayHandler extends AbstractHandler { + // private static final Log log = LogFactory + // .getLog(ResultDetailsDisplayHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + + // We pass the UUID of the test result we want to display via command + // parameters. + String uuid = event + .getParameter("org.argeo.slc.client.commands.resultUuid"); + + // mode = 2 : VIEW_VISIBLE, Show view mode that indicates the view + // should be created or made visible if already created . + // mode = 1 : VIEW_ACTIVATE, Show view mode that indicates the view + // should be made visible and activated. Use of this mode has the same + // effect as calling + try { + ResultDetailView rView = (ResultDetailView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .showView(ResultDetailView.ID, "UUID-" + uuid, 1); + rView.setUuid(uuid); + rView.retrieveResults(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java new file mode 100644 index 000000000..23fa87916 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/commands/ResultListViewRefreshHandler.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.commands; + +import org.argeo.slc.client.ui.views.ResultListView; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +public class ResultListViewRefreshHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + ResultListView view = (ResultListView) HandlerUtil + .getActiveWorkbenchWindow(event).getActivePage() + .findView(ResultListView.ID); + view.retrieveResults(); + return null; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java new file mode 100644 index 000000000..5785305ab --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/controllers/ProcessController.java @@ -0,0 +1,19 @@ +package org.argeo.slc.client.ui.controllers; + +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.runtime.SlcAgent; +import org.argeo.slc.services.SlcExecutionService; + +public class ProcessController { + private SlcExecutionService slcExecutionService; + + public void execute(SlcAgent agent, SlcExecution slcExecution) { + slcExecutionService.newExecution(slcExecution); + agent.runSlcExecution(slcExecution); + } + + public void setSlcExecutionService(SlcExecutionService slcExecutionService) { + this.slcExecutionService = slcExecutionService; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java new file mode 100644 index 000000000..499559833 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/listeners/TestManagerServiceAdapter.java @@ -0,0 +1,105 @@ +package org.argeo.slc.client.ui.listeners; + +import org.argeo.slc.SlcException; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.core.attachment.Attachment; +import org.argeo.slc.core.attachment.SimpleAttachment; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.core.test.tree.TreeTestResultListener; +import org.argeo.slc.msg.test.tree.AddTreeTestResultAttachmentRequest; +import org.argeo.slc.msg.test.tree.CloseTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.CreateTreeTestResultRequest; +import org.argeo.slc.msg.test.tree.ResultPartRequest; +import org.argeo.slc.services.TestManagerService; +import org.argeo.slc.test.TestResultPart; +import org.eclipse.ui.handlers.IHandlerService; + +/** In memory access to a test manager service */ +public class TestManagerServiceAdapter implements TreeTestResultListener { + // private static final Log log = LogFactory + // .getLog(TestManagerServiceAdapter.class); + + private Boolean onlyOnClose = false; + + private TestManagerService testManagerService; + + public void resultPartAdded(TreeTestResult testResult, + TestResultPart testResultPart) { + if (onlyOnClose) + return; + + if (testResult.getResultParts().size() == 1 + && testResult.getResultParts().values().iterator().next() + .getParts().size() == 1) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + testManagerService.createTreeTestResult(req); + } else { + ResultPartRequest req = new ResultPartRequest(testResult); + testManagerService.addResultPart(req); + } + } + + public void close(TreeTestResult testResult) { + + if (onlyOnClose) { + CreateTreeTestResultRequest req = new CreateTreeTestResultRequest( + testResult); + testManagerService.createTreeTestResult(req); + } else { + CloseTreeTestResultRequest req = new CloseTreeTestResultRequest( + testResult); + testManagerService.closeTreeTestResult(req); + } + + // TODO : clean this -> pb of thread && commandID hardCoded. + // We force the refresh of the list view. + ClientUiPlugin.getDefault().getWorkbench().getDisplay() + .syncExec(new Runnable() { + public void run() { + IHandlerService handlerService = (IHandlerService) ClientUiPlugin + .getDefault().getWorkbench() + .getService(IHandlerService.class); + try { + handlerService + .executeCommand( + "org.argeo.slc.client.ui.refreshResultList", + null); + handlerService + .executeCommand( + "org.argeo.slc.client.ui.refreshProcessList", + null); + + } catch (Exception e) { + e.printStackTrace(); + throw new SlcException( + "Problem while rendering result. " + + e.getMessage()); + } + } + } + + ); + + } + + public void addAttachment(TreeTestResult testResult, Attachment attachment) { + if (onlyOnClose) + return; + AddTreeTestResultAttachmentRequest req = new AddTreeTestResultAttachmentRequest(); + req.setResultUuid(testResult.getUuid()); + req.setAttachment((SimpleAttachment) attachment); + testManagerService.addAttachment(req); + + } + + /** Publishes the test result only when it gets closed. */ + public void setOnlyOnClose(Boolean onlyOnClose) { + this.onlyOnClose = onlyOnClose; + } + + public void setTestManagerService(TestManagerService testManagerService) { + this.testManagerService = testManagerService; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java new file mode 100644 index 000000000..f50ea1814 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/perspectives/SlcExecution.java @@ -0,0 +1,44 @@ +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); + + // Create the main ui layout + + // For a vertical split, the part on top gets the specified ratio of the + // current space and the part on bottom gets the rest. Likewise, for a + // horizontal split, the part at left gets the specified ratio of the + // current space. + IFolderLayout main = layout.createFolder("main", IPageLayout.RIGHT, + 0.3f, editorArea); + IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, + 0.3f, editorArea); + + IFolderLayout bottom = layout.createFolder("bottom", + IPageLayout.BOTTOM, 0.65f, "main"); + + IFolderLayout topRight = layout.createFolder("topRight", + IPageLayout.RIGHT, 0.6f, "main"); + + // add the views to the corresponding place holder + left.addView("org.argeo.slc.client.ui.executionModulesView"); + left.addView("org.argeo.slc.client.ui.resultListView"); + + main.addView("org.argeo.slc.client.ui.processBuilderView"); + main.addPlaceholder("org.argeo.slc.client.ui.resultDetailView:UUID-*"); + main.addPlaceholder("org.argeo.slc.client.ui.processDetailView:UUID-*"); + + bottom.addView("org.argeo.slc.client.ui.processListView"); + + topRight.addView("org.argeo.slc.client.ui.processParametersView"); + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java new file mode 100644 index 000000000..1278609bd --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ExecutionModulesContentProvider.java @@ -0,0 +1,261 @@ +package org.argeo.slc.client.ui.providers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.SortedMap; +import java.util.TreeMap; + +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.execution.ExecutionFlowDescriptor; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.runtime.SlcAgent; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; + +public class ExecutionModulesContentProvider implements ITreeContentProvider { + private final static Log log = LogFactory + .getLog(ExecutionModulesContentProvider.class); + + // IoC + private List slcAgents; + + public Object[] getChildren(Object parent) { + if (parent instanceof ExecutionModuleNode) { + ExecutionModuleNode executionModuleNode = (ExecutionModuleNode) parent; + ExecutionModuleDescriptor emd = executionModuleNode.getDescriptor(); + + // Terminate the building of UI specific object emd + emd = executionModuleNode + .getAgentNode() + .getAgent() + .getExecutionModuleDescriptor(emd.getName(), + emd.getVersion()); + executionModuleNode.cacheDescriptor(emd); + + // 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; + + 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 agentNodes = new ArrayList(); + for (SlcAgent slcAgent : slcAgents) { + agentNodes.add(new AgentNode(slcAgent)); + } + return agentNodes.toArray(); + } + } + + 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) { + return getChildren(parent); + } + + + + 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 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; + } + + public void cacheDescriptor(ExecutionModuleDescriptor descriptor) { + this.descriptor = descriptor; + + SortedMap folderNodes = new TreeMap(); + flowDescriptors = new HashMap(); + + for (ExecutionFlowDescriptor fd : descriptor.getExecutionFlows()) { + // Find, format and store path and label values for each flow + // descritor: + + // we format name of type path="" & name="path/toTest/Test" to : + // path="path/toTest/" name="Test" + 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 (path == null || path.trim().equals("") + || path.trim().equals("/")) { + // directChildren.put(name, new FlowNode(name, this)); + addChild(new FlowNode(label, fd.getName(), fd, this)); + } else { + FolderNode folderNode = mkdirs(this, path, folderNodes); + folderNode.addChild(new FlowNode(label, fd.getName(), fd, + this)); + } + + flowDescriptors.put(fd.getName(), fd); + } + // TODO: make it readonly + } + + protected FolderNode mkdirs(TreeParent root, String path, + SortedMap 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 getFlowDescriptors() { + return flowDescriptors; + } + + } + + /** + * + * @author bsinou + * + * The implementation of a vernice of a given slc process. Note that + * we store the parent node (execution module node) & the + * ExecutionFlowDescriptor. + */ + public class FlowNode extends TreeObject { + + private final String flowName; + private final ExecutionModuleNode executionModuleNode; + private final ExecutionFlowDescriptor executionFlowDescriptor; + + public FlowNode(String label, String flowName, + ExecutionFlowDescriptor executionFlowDescriptor, + ExecutionModuleNode parent) { + super(label); + this.flowName = flowName; + this.executionFlowDescriptor = executionFlowDescriptor; + this.executionModuleNode = parent; + } + + public String getFlowName() { + return flowName; + } + + public ExecutionModuleNode getExecutionModuleNode() { + return executionModuleNode; + } + + public ExecutionFlowDescriptor getExecutionFlowDescriptor() { + return executionFlowDescriptor; + } + + } + + public class FolderNode extends TreeParent { + public FolderNode(String name) { + super(name); + } + + } + + // IoC + public void setSlcAgents(List slcAgents) { + this.slcAgents = slcAgents; + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java new file mode 100644 index 000000000..7ca534e0f --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java @@ -0,0 +1,118 @@ +package org.argeo.slc.client.ui.providers; + +import org.argeo.slc.client.ui.views.ProcessBuilderView; +import org.argeo.slc.client.ui.views.ProcessParametersView; +import org.argeo.slc.core.execution.PrimitiveAccessor; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TextCellEditor; + +/** + * + * + * Implements the ability to edit and save various type of + * parameter of a given process. Parameter values are directly saved as + * soon as the focus on a given field is lost. + * + * + * Note that EditingSupport is tightly coupled with both + * ProcessParametersView and ProcessBuilderView; it cannot serve as a + * generic EditingSupport as is. Note also that it assumes that the + * processes in ProcessBuilderView as stored as an ordered list. + + @author bsinou + * + */ + +public class ProcessParametersEditingSupport extends EditingSupport { + + // private final static Log log = LogFactory + // .getLog(ProcessParametersEditingSupport.class); + + private CellEditor strEditor; + private CellEditor nbEditor; + // private int column; + + private final static String strType = "string", intType = "integer"; + + // different type of primitive + private static enum primitiveType { + strType, intType + }; + + // So that we can update corresponding process + private int curProcessIndex; + private ProcessBuilderView pbView; + + public ProcessParametersEditingSupport(ColumnViewer viewer, int column) { + super(viewer); + strEditor = new TextCellEditor(((TableViewer) viewer).getTable()); + // nbEditor = new NumberCellEditor(((TableViewer) viewer).getTable()); + // this.column = column; + } + + @Override + protected CellEditor getCellEditor(Object element) { + // TODO return specific editor depending on the parameter type. + return strEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected Object getValue(Object element) { + ProcessParametersView.ObjectWithName objectWithName = (ProcessParametersView.ObjectWithName) element; + + if (objectWithName.obj instanceof PrimitiveAccessor) { + PrimitiveAccessor pv = (PrimitiveAccessor) objectWithName.obj; + // we only handle string & integer parameter in a first time + if (strType.equals(pv.getType())) { + return pv.getValue(); + } + if (intType.equals(pv.getType())) { + return ((Integer) pv.getValue()).toString(); + } + } + return "unsupported param type"; + + } + + @Override + protected void setValue(Object element, Object value) { + ProcessParametersView.ObjectWithName objectWithName = (ProcessParametersView.ObjectWithName) element; + if (objectWithName.obj instanceof PrimitiveAccessor) { + PrimitiveAccessor pv = (PrimitiveAccessor) objectWithName.obj; + // we only handle string parameter in a first time + if (strType.equals(pv.getType())) { + pv.setValue(value); + pbView.updateParameter(curProcessIndex, objectWithName.name, + objectWithName.obj); + } else if (intType.equals(pv.getType())) { + + String stVal = (String) value; + Integer val = ("".equals(stVal)) ? new Integer(0) + : new Integer(stVal); + pv.setValue(val); + pbView.updateParameter(curProcessIndex, objectWithName.name, pv); + } + getViewer().update(element, null); + } + + } + + // Store the index of the process which parameters are being edited + public void setCurrentProcessIndex(int index) { + this.curProcessIndex = index; + } + + public void setCurrentProcessBuilderView( + ProcessBuilderView processbuilderView) { + this.pbView = processbuilderView; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java new file mode 100644 index 000000000..07df89af6 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ExecutionModulesView.java @@ -0,0 +1,218 @@ +package org.argeo.slc.client.ui.views; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.UUID; + +import org.apache.commons.io.IOUtils; +import org.argeo.slc.SlcException; +import org.argeo.slc.client.oxm.OxmInterface; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.controllers.ProcessController; +import org.argeo.slc.client.ui.providers.ExecutionModulesContentProvider; +import org.argeo.slc.client.ui.providers.ExecutionModulesContentProvider.FlowNode; +import org.argeo.slc.execution.ExecutionModuleDescriptor; +import org.argeo.slc.process.RealizedFlow; +import org.argeo.slc.process.SlcExecution; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.IStructuredSelection; +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.dnd.DND; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.DragSourceListener; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.ISharedImages; +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); + + public static final String ID = "org.argeo.slc.client.ui.executionModulesView"; + + private TreeViewer viewer; + + // Ioc + private IContentProvider contentProvider; + private OxmInterface oxmBean; + private ProcessController processController; + + public void createPartControl(Composite parent) { + viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + viewer.setContentProvider(contentProvider); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setInput(getViewSite()); + viewer.addDoubleClickListener(new ViewDoubleClickListener()); + int operations = DND.DROP_COPY | DND.DROP_MOVE; + Transfer[] tt = new Transfer[] { TextTransfer.getInstance() }; + viewer.addDragSupport(operations, tt, new ViewDragListener()); + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public TreeViewer getViewer() { + return viewer; + } + + class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + public String getColumnText(Object obj, int index) { + if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode) { + ExecutionModuleDescriptor emd = ((ExecutionModulesContentProvider.ExecutionModuleNode) obj) + .getDescriptor(); + if (emd.getLabel() != null) + return emd.getLabel(); + else + return getText(emd); + } else + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return getImage(obj); + } + + public Image getImage(Object obj) { + if (obj instanceof ExecutionModulesContentProvider.AgentNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("agent"); + else if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("executionModule"); + else if (obj instanceof ExecutionModulesContentProvider.FolderNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("folder"); + else if (obj instanceof ExecutionModulesContentProvider.FlowNode) + return ClientUiPlugin.getDefault().getImageRegistry() + .get("flow"); + else + return PlatformUI.getWorkbench().getSharedImages() + .getImage(ISharedImages.IMG_OBJ_ELEMENT); + } + } + + class ViewDoubleClickListener implements IDoubleClickListener { + public void doubleClick(DoubleClickEvent evt) { + Object obj = ((IStructuredSelection) evt.getSelection()) + .getFirstElement(); + if (obj instanceof ExecutionModulesContentProvider.FlowNode) { + ExecutionModulesContentProvider.FlowNode fn = (ExecutionModulesContentProvider.FlowNode) obj; + + List realizedFlows = new ArrayList(); + RealizedFlow realizedFlow = new RealizedFlow(); + realizedFlow.setModuleName(fn.getExecutionModuleNode() + .getDescriptor().getName()); + realizedFlow.setModuleVersion(fn.getExecutionModuleNode() + .getDescriptor().getVersion()); + realizedFlow.setFlowDescriptor(fn.getExecutionModuleNode() + .getFlowDescriptors().get(fn.getFlowName())); + realizedFlows.add(realizedFlow); + + 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); + } + } + + } + + class ViewDragListener implements DragSourceListener { + + 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(); + + Properties props = new Properties(); + flowNodeAsProperties(props, flowNode); + props.setProperty("agentId", flowNode + .getExecutionModuleNode().getAgentNode().getAgent() + .getAgentUuid()); + props.setProperty("host", flowNode.getExecutionModuleNode().getAgentNode() + .getAgent().toString()); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + try { + props.store(out, ""); + event.data = new String(out.toByteArray()); + } catch (IOException e) { + throw new SlcException( + "Cannot transform realized flow", e); + } finally { + IOUtils.closeQuietly(out); + } + } + } + } + + public void dragFinished(DragSourceEvent event) { + System.out.println("Finished Drag"); + } + + protected void flowNodeAsProperties(Properties props, FlowNode fn) { + + RealizedFlow realizedFlow = new RealizedFlow(); + realizedFlow.setModuleName(fn.getExecutionModuleNode() + .getDescriptor().getName()); + realizedFlow.setModuleVersion(fn.getExecutionModuleNode() + .getDescriptor().getVersion()); + realizedFlow.setFlowDescriptor(fn.getExecutionFlowDescriptor()); + + // As we want to have the effective ExecutionSpec and not a + // reference; we store it at the RealizeFlow level : thus the + // marshaller will store the object and not only a reference. + realizedFlow.setExecutionSpec(fn.getExecutionFlowDescriptor() + .getExecutionSpec()); + + props.setProperty("RealizedFlowAsXml", + oxmBean.marshal(realizedFlow)); + System.out + .println(oxmBean.marshal(fn.getExecutionFlowDescriptor())); + + } + + } + + // IoC + public void setContentProvider(IContentProvider contentProvider) { + this.contentProvider = contentProvider; + } + + public void setProcessController(ProcessController processController) { + this.processController = processController; + } + + public void setOxmBean(OxmInterface oxmBean) { + this.oxmBean = oxmBean; + } + +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java new file mode 100644 index 000000000..5d62983f9 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessBuilderView.java @@ -0,0 +1,316 @@ +package org.argeo.slc.client.ui.views; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +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.oxm.OxmInterface; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.controllers.ProcessController; +import org.argeo.slc.process.RealizedFlow; +import org.argeo.slc.process.SlcExecution; +import org.argeo.slc.runtime.SlcAgent; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerDropAdapter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.dnd.TransferData; +import org.eclipse.swt.graphics.Image; +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.PartInitException; +import org.eclipse.ui.part.ViewPart; + +/** + * Display a list of processes that are to be launched as batch. For the moment + * being, only one agent by batch is enabled. The batch is contructed by + * dropping process from the ExecutionModuleView. Wrong type of data dropped in + * this view might raise errors. + * + * @author bsinou + * + */ +public class ProcessBuilderView extends ViewPart { + private final static Log log = LogFactory.getLog(ProcessBuilderView.class); + + public static final String ID = "org.argeo.slc.client.ui.processBuilderView"; + private static final String EDIT_CMD = "org.argeo.slc.client.ui.editRealizedFlowDetails"; + private static final String FLOWASXML_PARAM = "org.argeo.slc.client.commands.realizedFlowAsXml"; + private static final String INDEX_PARAM = "org.argeo.slc.client.commands.realizedFlowIndex"; + + // private final static Log log = + // LogFactory.getLog(ProcessBuilderView.class); + + private TableViewer viewer; + private List realizedFlows = new ArrayList(); + private String currentAgentUuid = null; + private String host = null; + + // TODO find a better way to get index of the current selected row + // used in removeSelected + private int curSelectedRow = -1; + + // IoC + private OxmInterface oxmBean; + private ProcessController processController; + private List slcAgents; + + public void createPartControl(Composite parent) { + Table table = createTable(parent); + viewer = new TableViewer(table); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setContentProvider(new ViewContentProvider()); + viewer.addSelectionChangedListener(new SelectionChangedListener()); + + int operations = DND.DROP_COPY | DND.DROP_MOVE; + Transfer[] tt = new Transfer[] { TextTransfer.getInstance() }; + viewer.addDropSupport(operations, tt, new ViewDropListener(viewer)); + + viewer.setInput(getViewSite()); + } + + protected Table createTable(Composite parent) { + int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; + + Table table = new Table(parent, style); + + GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.grabExcessVerticalSpace = true; + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 3; + table.setLayoutData(gridData); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + TableColumn column = new TableColumn(table, SWT.LEFT, 0); + column.setText("Module"); + column.setWidth(200); + + column = new TableColumn(table, SWT.LEFT, 1); + column.setText("Flow"); + column.setWidth(200); + + return table; + } + + protected void execute() { + // TODO: use agent proxy to retrieve it + SlcAgent agent = null; + SlcExecution slcExecution = new SlcExecution(); + slcExecution.setUuid(UUID.randomUUID().toString()); + slcExecution.setRealizedFlows(realizedFlows); + processController.execute(agent, slcExecution); + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + // update one of the parameter of a given RealizedFlow + public void updateParameter(int realizedFlowIndex, String paramName, + Object value) { + RealizedFlow curRealizedFlow = realizedFlows.get(realizedFlowIndex); + curRealizedFlow.getFlowDescriptor().getValues().put(paramName, value); + } + + // clear the realizedFlow + public void clearBatch() { + // we clear the list + realizedFlows = new ArrayList(); + curSelectedRow = -1; + refreshParameterview(); + viewer.refresh(); + } + + // Remove the selected process from the batch + public void removeSelected() { + if (curSelectedRow == -1) + return; + else + realizedFlows.remove(curSelectedRow); + curSelectedRow = -1; + refreshParameterview(); + viewer.refresh(); + } + + // calling this method with index =-1 will cause the reset of the view. + private void refreshParameterview() { + // We choose to directly access the view rather than going through + // commands. + ProcessParametersView ppView; + try { + ppView = (ProcessParametersView) ClientUiPlugin.getDefault() + .getWorkbench().getActiveWorkbenchWindow().getActivePage() + .showView(ProcessParametersView.ID); + + if (curSelectedRow == -1) + ppView.setRealizedFlow(-1, null); + else + ppView.setRealizedFlow(curSelectedRow, + realizedFlows.get(curSelectedRow)); + } catch (PartInitException e) { + throw new SlcException( + "Cannot Retrieve ProcessParameterView to edit parameters of selected process", + e); + } + } + + // Return the list of the processes to execute. + public void launchBatch() { + SlcExecution slcExecution = new SlcExecution(); + slcExecution.setUuid(UUID.randomUUID().toString()); + + slcExecution.setRealizedFlows(realizedFlows); + slcExecution.setHost(host); + + // TODO : insure that the concept has been well understood & the + // specification respected + SlcAgent curAgent; + for (int i = 0; i < slcAgents.size(); i++) { + if (currentAgentUuid == null) + throw new SlcException( + "Cannot launch a batch if no agent is specified"); + if (currentAgentUuid.equals(slcAgents.get(i).getAgentUuid())) { + curAgent = slcAgents.get(i); + processController.execute(curAgent, slcExecution); + break; + } + } + } + + // Specific Providers for the current view. + protected class ViewContentProvider implements IStructuredContentProvider { + public void inputChanged(Viewer arg0, Object arg1, Object arg2) { + } + + public void dispose() { + } + + public Object[] getElements(Object obj) { + return realizedFlows.toArray(); + } + } + + protected class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + public String getColumnText(Object obj, int index) { + RealizedFlow rf = (RealizedFlow) obj; + switch (index) { + case 0: + return rf.getModuleName(); + case 1: + return rf.getFlowDescriptor().getName(); + } + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return null; + } + + } + + // Handle Events + class SelectionChangedListener implements ISelectionChangedListener { + public void selectionChanged(SelectionChangedEvent evt) { + + IStructuredSelection curSelection = (IStructuredSelection) evt + .getSelection(); + Object obj = curSelection.getFirstElement(); + + if (obj instanceof RealizedFlow) { + RealizedFlow rf = (RealizedFlow) obj; + curSelectedRow = realizedFlows.indexOf(rf); + refreshParameterview(); + } + } + } + + // Implementation of the Drop Listener + protected class ViewDropListener extends ViewerDropAdapter { + + public ViewDropListener(Viewer viewer) { + super(viewer); + } + + @Override + public boolean performDrop(Object data) { + + Properties props = new Properties(); + + // TODO : Handle wrong type of dropped data + ByteArrayInputStream in = new ByteArrayInputStream(data.toString() + .getBytes()); + try { + props.load(in); + } catch (IOException e) { + throw new SlcException("Cannot create read flow node", e); + } finally { + IOUtils.closeQuietly(in); + } + + String agentId = props.getProperty("agentId"); + if (currentAgentUuid == null) { + currentAgentUuid = agentId; + host = props.getProperty("host"); + } 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; + } + + String fdXml = props.getProperty("RealizedFlowAsXml"); + if (fdXml == null) + return false; + RealizedFlow rf = (RealizedFlow) oxmBean.unmarshal(fdXml); + realizedFlows.add(rf); + curSelectedRow = realizedFlows.indexOf(rf); + refreshParameterview(); + getViewer().refresh(); + return true; + } + + @Override + public boolean validateDrop(Object target, int operation, + TransferData transferType) { + return true; + } + } + + // IoC + public void setSlcAgents(List slcAgents) { + this.slcAgents = slcAgents; + } + + public void setOxmBean(OxmInterface oxmBean) { + this.oxmBean = oxmBean; + } + + public void setProcessController(ProcessController processController) { + this.processController = processController; + } + +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java new file mode 100644 index 000000000..944207eb1 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessDetailView.java @@ -0,0 +1,96 @@ +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.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; + +/** + * Multi-instance view that enables to browse the details of a given + * SlcExecution + * + * @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 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(new ProcessDetailLabelProvider()); + // viewer.setInput(getViewSite()); + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public TreeViewer getViewer() { + return viewer; + } + + public void retrieveResults() { + se = slcExecutionDao.getSlcExecution(uuid); + viewer.setInput(se); + } + + public void setUuid(String uuid) { + 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 setSlcExecutionDao(SlcExecutionDao slcExecutionDao) { + this.slcExecutionDao = slcExecutionDao; + } +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java new file mode 100644 index 000000000..83194d603 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessListView.java @@ -0,0 +1,163 @@ +package org.argeo.slc.client.ui.views; + +import java.util.ArrayList; + +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; +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); + + public static final String ID = "org.argeo.slc.client.ui.processListView"; + + private TableViewer viewer; + + // IoC + private SlcExecutionDao slcExecutionDao; + private ITableLabelProvider tableLabelProvider; + private IStructuredContentProvider structuredContentProvider; + + public void createPartControl(Composite parent) { + Table table = createTable(parent); + viewer = new TableViewer(table); + viewer.setLabelProvider(tableLabelProvider); + viewer.setContentProvider(structuredContentProvider); + viewer.setInput(getViewSite()); + viewer.addDoubleClickListener(new ViewDoubleClickListener()); + + } + + protected Table createTable(Composite parent) { + int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; + + Table table = new Table(parent, style); + + GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.grabExcessVerticalSpace = true; + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 3; + table.setLayoutData(gridData); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + TableColumn column = new TableColumn(table, SWT.LEFT, 0); + column.setText("Date"); + column.setWidth(200); + + column = new TableColumn(table, SWT.LEFT, 1); + column.setText("Host"); + column.setWidth(100); + + column = new TableColumn(table, SWT.LEFT, 2); + column.setText("Id"); + column.setWidth(300); + + column = new TableColumn(table, SWT.LEFT, 3); + column.setText("Status"); + column.setWidth(100); + + return table; + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public void retrieveResults() { + 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; + + 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"); + + ArrayList parameters = new ArrayList(); + + // 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; + } + + public void setTableLabelProvider(ITableLabelProvider tableLabelProvider) { + this.tableLabelProvider = tableLabelProvider; + } + + public void setStructuredContentProvider( + IStructuredContentProvider structuredContentProvider) { + this.structuredContentProvider = structuredContentProvider; + } + +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessParametersView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessParametersView.java new file mode 100644 index 000000000..b45fb9981 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ProcessParametersView.java @@ -0,0 +1,210 @@ +package org.argeo.slc.client.ui.views; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.client.ui.ClientUiPlugin; +import org.argeo.slc.client.ui.providers.ProcessParametersEditingSupport; +import org.argeo.slc.core.execution.PrimitiveAccessor; +import org.argeo.slc.execution.ExecutionSpecAttribute; +import org.argeo.slc.process.RealizedFlow; +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; + +/** + * + * @author bsinou + * + * This view, directly linked with the ProcessBuilderView + * enables the display and editing the parameters of a given process. + * + * Note that for now we use ExecutionFlowDescriptor.values + * attribute to recall (and update ??) the various parameters. + */ +public class ProcessParametersView extends ViewPart { + private static final Log log = LogFactory + .getLog(ProcessParametersView.class); + + public static final String ID = "org.argeo.slc.client.ui.processParametersView"; + + // This map stores actual values set to default if existing at the begining + // and then the ones computed by the end user + private Map values; + // This map stores the spec of the attributes used to offer the end user + // some choices. + private Map specAttributes; + + // We must keep a reference to the current EditingSupport so that we can + // update the index of the process being updated + ProcessParametersEditingSupport ppEditingSupport; + + // view attributes + private TableViewer viewer; + + public void createPartControl(Composite parent) { + viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL + | SWT.V_SCROLL | SWT.FULL_SELECTION); + createColumns(viewer); + + // WARNING + // for the moment being, we support only one process builder at a time + // we set the corresponding view in the editor here. + ProcessBuilderView pbView = (ProcessBuilderView) ClientUiPlugin + .getDefault().getWorkbench().getActiveWorkbenchWindow() + .getActivePage().findView(ProcessBuilderView.ID); + ppEditingSupport.setCurrentProcessBuilderView(pbView); + + 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); + if (i == 1) { + // we create the used EditingSupport and enable editing support + // for value Column + ppEditingSupport = new ProcessParametersEditingSupport(viewer, + i); + column.setEditingSupport(ppEditingSupport); + } + } + Table table = viewer.getTable(); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + // set class attributes, refresh the lists of process paramaters to edit. + public void setRealizedFlow(int index, RealizedFlow rf) { + // force the cleaning of the view + if (index == -1) { + viewer.setInput(null); + return; + } + // we store the index of the edited Process in the editor so that it can + // save computed values. + ppEditingSupport.setCurrentProcessIndex(index); + + // TODO : + // We should handle ExecutionSpec here. need to be improved. + // ExecutionSpec es = rf.getExecutionSpec(); + // if (es != null && es.getAttributes() != null) + // parameters = es.getAttributes(); + // if (parameters != null) + // viewer.setInput(parameters); + + values = rf.getFlowDescriptor().getValues(); + specAttributes = rf.getFlowDescriptor().getExecutionSpec() + .getAttributes(); + + if (values != null) + viewer.setInput(values); + else + // No parameters to edit, we reset the view. + viewer.setInput(null); + + } + + // Inner Classes we should use ExecutionSpecAttribute instead of values + // see below + protected class ViewContentProvider implements IStructuredContentProvider { + public void inputChanged(Viewer arg0, Object arg1, Object arg2) { + } + + public void dispose() { + } + + @SuppressWarnings("unchecked") + // we cast the Map to List + public Object[] getElements(Object obj) { + + if (obj instanceof Map && ((Map) obj).size() != 0) { + List list = new ArrayList(); + Map map = (Map) obj; + for (String key : map.keySet()) { + list.add(new ObjectWithName(key, map.get(key))); + } + return list.toArray(); + } else { + return new Object[0]; + } + } + } + + protected class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + + public String getColumnText(Object obj, int index) { + // NOTE : the passed object is a line of the table !!! + + if (obj instanceof ObjectWithName) { + ObjectWithName own = (ObjectWithName) obj; + switch (index) { + case 0: + return own.name; + case 1: + if (own.obj instanceof PrimitiveAccessor) { + PrimitiveAccessor pa = (PrimitiveAccessor) own.obj; + if ("string".equals(pa.getType())) + return (String) pa.getValue(); + else if ("integer".equals(pa.getType())) + return ((Integer) pa.getValue()).toString(); + else + return "Type " + pa.getType() + + " not yet supported"; + } else + return own.obj.toString(); + default: + return getText(obj); + } + } else + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return null; + } + + } + + // We add an inner class to enrich the ExecutionSpecAttribute with a name + // so that we can display it. + public class ObjectWithName { + public Object obj; + public String name; + + public ObjectWithName(String name, Object obj) { + this.name = name; + this.obj = obj; + } + + } +} diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java new file mode 100644 index 000000000..6d9f90162 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultDetailView.java @@ -0,0 +1,121 @@ +package org.argeo.slc.client.ui.views; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.slc.core.test.tree.TreeTestResult; +import org.argeo.slc.dao.test.tree.TreeTestResultDao; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.ui.part.ViewPart; + +/** + * Multi-instance view that enables to browse the details of a given + * TreeTestResult + * + * @author bsinou + * + */ + +public class ResultDetailView extends ViewPart { + private final static Log log = LogFactory.getLog(ResultDetailView.class); + public static final String ID = "org.argeo.slc.client.ui.resultDetailView"; + + protected String[] columnNames = new String[] { "Test", "State", "Message", + "Id" }; + + private TreeViewer viewer; + private Tree resultDetailTree; + + private String uuid; + private TreeTestResult ttr; + + // IoC + private IContentProvider contentProvider; + private ITableLabelProvider labelProvider; + private TreeTestResultDao treeTestResultDao; + + public void createPartControl(Composite parent) { + resultDetailTree = new Tree(parent, SWT.MULTI | SWT.H_SCROLL + | SWT.V_SCROLL); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 3; + resultDetailTree.setLayoutData(gd); + resultDetailTree.setLinesVisible(true); + resultDetailTree.setHeaderVisible(true); + + for (int i = 0; i < columnNames.length; i++) { + TreeColumn column = new TreeColumn(resultDetailTree, SWT.LEFT, i); + column.setText(columnNames[i]); + + // TIP: Don't forget to set the width. If not set it is set to + // 0 and it will look as if the column didn't exist. + switch (i) { + case 0: + column.setWidth(130); + case 1: + column.setWidth(200); + default: + column.setWidth(70); + } + } + viewer = new TreeViewer(resultDetailTree); + viewer.setColumnProperties(columnNames); + + viewer.setContentProvider(contentProvider); + // viewer.setLabelProvider(new ResultDetailLabelProvider()); + log.debug("Injected LabelProvider :" + labelProvider.toString()); + + // TIP: It seems, that if the table has not defined any TreeColumns then + // a plain LabelProvider will be used. Since, we don't provide an + // instance of LabelProvider, a default one will be used and + // the TableLableProvider is ignored without notice. Took me quite + // a while to find that one out. + viewer.setLabelProvider(labelProvider); + log.debug("Persisted labelProvider :" + + viewer.getLabelProvider().toString()); + // viewer.setInput(getViewSite()); + + // viewer.expandAll(); + + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public TreeViewer getViewer() { + return viewer; + } + + public void retrieveResults() { + ttr = treeTestResultDao.getTestResult(uuid); + viewer.setInput(ttr); + // viewer.setInput(getViewSite()); + + // setFocus(); + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + // IoC + public void setContentProvider(IContentProvider contentProvider) { + this.contentProvider = contentProvider; + } + + public void setLabelProvider(ITableLabelProvider labelProvider) { + this.labelProvider = labelProvider; + } + + public void setTreeTestResultDao(TreeTestResultDao treeTestResultDao) { + this.treeTestResultDao = treeTestResultDao; + } + +} \ No newline at end of file diff --git a/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultListView.java b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultListView.java new file mode 100644 index 000000000..c61f8de34 --- /dev/null +++ b/eclipse/plugins/runtime/org.argeo.slc.client.ui/src/org/argeo/slc/client/ui/views/ResultListView.java @@ -0,0 +1,198 @@ +package org.argeo.slc.client.ui.views; + +import java.util.ArrayList; +import java.util.List; + +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.core.test.tree.ResultAttributes; +import org.argeo.slc.dao.test.tree.TreeTestResultCollectionDao; +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.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +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; + +public class ResultListView extends ViewPart { + private final static Log log = LogFactory.getLog(ResultListView.class); + + public static final String ID = "org.argeo.slc.client.ui.resultListView"; + + private TableViewer viewer; + + private TreeTestResultCollectionDao testResultCollectionDao; + + public void createPartControl(Composite parent) { + Table table = createTable(parent); + viewer = new TableViewer(table); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setContentProvider(new ViewContentProvider()); + viewer.setInput(getViewSite()); + viewer.addDoubleClickListener(new ViewDoubleClickListener()); + } + + protected Table createTable(Composite parent) { + int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.FULL_SELECTION | SWT.HIDE_SELECTION; + + Table table = new Table(parent, style); + + GridData gridData = new GridData(GridData.FILL_BOTH); + gridData.grabExcessVerticalSpace = true; + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 3; + table.setLayoutData(gridData); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + TableColumn column = new TableColumn(table, SWT.LEFT, 0); + column.setText("Date"); + column.setWidth(200); + + column = new TableColumn(table, SWT.LEFT, 1); + column.setText("UUID"); + column.setWidth(300); + + return table; + } + + // View Specific inner class + protected static class ViewContentProvider implements + IStructuredContentProvider { + + public void inputChanged(Viewer arg0, Object arg1, Object arg2) { + } + + public void dispose() { + } + + @SuppressWarnings("unchecked") + public Object[] getElements(Object obj) { + if (obj instanceof List) { + return ((List) obj).toArray(); + } else { + return new Object[0]; + } + } + } + + protected class ViewLabelProvider extends LabelProvider implements + ITableLabelProvider { + public String getColumnText(Object obj, int index) { + ResultAttributes ra = (ResultAttributes) obj; + switch (index) { + case 0: + return getText(ra.getCloseDate()); + case 1: + return ra.getUuid(); + } + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return null; + } + + } + + public void setFocus() { + viewer.getControl().setFocus(); + } + + public void retrieveResults() { + try { + List lst = testResultCollectionDao + .listResultAttributes(null); + if (log.isTraceEnabled()) + log.trace("Result attributes count: " + lst.size()); + viewer.setInput(lst); + // viewer.refresh(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + // Handle Events + /** + * The ResultAttributes expose a part of the information contained in the + * TreeTestResult, It has the same UUID as the corresponding treeTestResult. + */ + class ViewDoubleClickListener implements IDoubleClickListener { + public void doubleClick(DoubleClickEvent evt) { + Object obj = ((IStructuredSelection) evt.getSelection()) + .getFirstElement(); + + if (obj instanceof ResultAttributes) { + ResultAttributes ra = (ResultAttributes) obj; + log.debug("Double-clic on result with UUID" + ra.getUuid()); + + 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.displayResultDetails"); + + // log.debug("cmd : " + cmd); + ArrayList parameters = new ArrayList(); + + // get the parameter + IParameter iparam = cmd + .getParameter("org.argeo.slc.client.commands.resultUuid"); + + Parameterization params = new Parameterization(iparam, + ra.getUuid()); + 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 setTestResultCollectionDao( + TreeTestResultCollectionDao testResultCollectionDao) { + this.testResultCollectionDao = testResultCollectionDao; + } + +} -- 2.39.2