]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Add support for combo box in editing parameters.
authorBruno Sinou <bsinou@argeo.org>
Wed, 16 Feb 2011 18:43:27 +0000 (18:43 +0000)
committerBruno Sinou <bsinou@argeo.org>
Wed, 16 Feb 2011 18:43:27 +0000 (18:43 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@4152 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

13 files changed:
demo/slc_demo_rap.properties
dep/pom.xml
eclipse/plugins/org.argeo.slc.client.rap/plugin.xml
eclipse/plugins/org.argeo.slc.client.rcp/plugin.xml
eclipse/plugins/org.argeo.slc.client.ui/plugin.xml
eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/commands/ManageBundlesHandler.java
eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/providers/ProcessParametersEditingSupport.java
eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ExecutionModulesView.java
eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessBuilderView.java
eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessListView.java
eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ProcessParametersView.java
eclipse/plugins/org.argeo.slc.client.ui/src/main/java/org/argeo/slc/client/ui/views/ResultListView.java
runtime/pom.xml

index e736cdbe725c8345318c43fcb6f71e231e7900c2..32d19a347b420de084a1198d27ff2bc1ab72efea 100644 (file)
@@ -7,10 +7,16 @@ org.eclipse.equinox.http.registry,\
 org.eclipse.equinox.launcher,\
 org.mortbay.jetty.server,\
 org.springframework.osgi.extender,\
+org.argeo.security.manager.ldap,\
+org.argeo.security.services,\
+org.argeo.security.equinox,\
+org.argeo.security.ui,\
+org.argeo.security.ui.application,\
 org.argeo.slc.agent,\
 org.argeo.slc.client.agent,\
 org.argeo.slc.client.hibernate,\
 org.argeo.slc.client.oxm,\
+org.argeo.slc.client.ui,\
 org.argeo.slc.demo.ant,\
 org.argeo.slc.demo.basic,\
 org.argeo.slc.server.castor,\
@@ -18,10 +24,9 @@ org.argeo.slc.server.h2,\
 org.argeo.slc.server.hibernate,\
 org.argeo.slc.server.services,\
 org.argeo.server.ads.server,\
-org.argeo.security.manager.ldap,\
-org.argeo.security.services,\
 
-#org.argeo.security.ui.initialPerspective=com.agfa.sebi.client.ui.consultEbiPerspective
+
+org.argeo.security.ui.initialPerspective=org.argeo.slc.client.ui.perspectives.slcExecution
 
 # LDAP
 #argeo.ldap.rootdn=dc=slc,dc=argeo,dc=net
@@ -35,4 +40,4 @@ log4j.configuration=file:../../log4j.properties
 org.eclipse.equinox.http.jetty.log.stderr.threshold=debug
 org.osgi.service.http.port=9090
 
-# java -Dlog4j.configuration=file:/home/mbaudier/dev/src/agfa-sebi/demo/log4j.properties -Dosgi.framework=lib/org.eclipse.osgi_3.6.1.R36x_v20100806.jar -jar lib/org.eclipse.equinox.launcher_1.1.0.v20100507.jar -console -configuration configuration
\ No newline at end of file
+# java -Dlog4j.configuration=file:/home/mbaudier/dev/src/slc/demo/log4j.properties -Dosgi.framework=lib/org.eclipse.osgi_3.6.1.R36x_v20100806.jar -jar lib/org.eclipse.equinox.launcher_1.1.0.v20100507.jar -console -configuration configuration
\ No newline at end of file
index be5f94f714bc73be44af2fe5e1f1b769c42b9230..421e5796c5c767add4238eef9a0ed7400b3e4880 100644 (file)
                                        <useLastCommittedRevision>false</useLastCommittedRevision>
                                </configuration>
                        </plugin>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                       </plugin>
                </plugins>
                <pluginManagement>
                        <plugins>
index 3658bee278c50f59f2e773b14c6026d9a990eb0f..64ae650172e35377f79b1a6aaba7d09b594bcb82 100644 (file)
@@ -3,10 +3,10 @@
 <plugin>\r
 \r
  <extension\r
-         id="SlcRapProduct"\r
+         id="org.argeo.slc.client.rcp.product"\r
          point="org.eclipse.core.runtime.products">\r
       <product\r
-            name="ArgeoSlcProduct"\r
+            name="Slc RAP Product"\r
             application="org.eclipse.ui.ide.workbench"\r
             >\r
          <property\r
index 454fc00b82fd271ad0556d73a43fcf559a45f88b..a2babbae2d149d0ff59f43fa13910196be0257b1 100644 (file)
             name="Exit">
       </command>
    </extension>
+   
+    <!-- RCP Specific, does not function with RAP --> 
    <extension
-         id="product"
-         point="org.eclipse.core.runtime.products">
-      <product
-            application="org.argeo.slc.client.rcp.application"
-            name="SLC">
-         <property
-               name="windowImages"
-               value="icons/argeo-icon-256.png">
-         </property>
-         <property
-               name="appName"
-               value="SLC">
-         </property>
-      </product>
-   </extension>
-
-   <!-- <extension
-         id="product"
-         point="org.eclipse.core.runtime.products">
-      <product
-            application="org.argeo.slc.client.rcp.application"
-            name="SLC">
-         <property
-               name="windowImages"
-               value="icons/argeo-icon-256.png">
-         </property>
-         <property
-               name="appName"
-               value="SLC">
-         </property>
-      </product>
-   </extension> -->
-
+        point="org.eclipse.ui.bindings">
+     <key
+           commandId="org.argeo.slc.client.ui.refreshExecutionModulesView"
+           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+           sequence="CTRL+R">
+     </key>
+  </extension>
 </plugin>
index 3c626c793ae199aa8f2bb29042143332491b0a87..7a47446bfb5336d1319034bb31eef286d24c5fc8 100644 (file)
@@ -1,8 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?eclipse version="3.4"?>
 <plugin>
-
-       
    <extension
          point="org.eclipse.ui.views">
    <view
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
             id="org.argeo.slc.client.ui.refreshResultList"
-            name="RefreshResultList">
+            name="Refresh Result List">
       </command>
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
             id="org.argeo.slc.client.ui.refreshExecutionModulesView"
-            name="refreshExecutionModulesView">
+            name="Refresh Execution Modules View">
       </command>
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
             id="org.argeo.slc.client.ui.launchBatch"
-            name="LaunchBatch">
+            name="Launch Batch">
       </command>
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
             id="org.argeo.slc.client.ui.removeSelectedFromBatch"
-            name="RemoveSelectedFromBatch">
+            name="Remove Selected From Batch">
       </command>
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
             id="org.argeo.slc.client.ui.clearBatch"
-            name="ClearBatch">
+            name="Clear Batch">
       </command>
       <command
             defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
             id="org.argeo.slc.client.ui.refreshProcessList"
-            name="RefreshProcessList ">
+            name="Refresh Process List ">
       </command>
         <command 
                defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
    <command 
                defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
                id="org.argeo.slc.client.ui.displayResultDetails"
-               name="DisplayResultDetails">
+               name="Display Result Details">
                        <commandParameter
                        id="org.argeo.slc.client.commands.resultUuid"
                        name="Result UUID">
    <command 
                defaultHandler="org.argeo.eclipse.spring.SpringCommandHandler"
                id="org.argeo.slc.client.ui.manageBundles"
-               name="ManageBundles">
+               name="Manage Bundles">
        </command>
     </extension>
-   <extension
-        point="org.eclipse.ui.bindings">
-     <key
-           commandId="org.argeo.slc.client.ui.refreshResultList"
-           schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
-           sequence="CTRL+R">
-     </key>
-  </extension>
    
    <extension
          id="menu:org.eclipse.ui.main.menu"
          point="org.eclipse.ui.menus">
-      <!-- commented menu so that it does not show up on sparta
-               TODO : add a specific bundle with only a pluggin.xml for SLC / no sparta specific menus
-      <menuContribution
-            locationURI="menu:org.eclipse.ui.main.menu?after=fileMenu">
-         <menu
-               id="slcMenu"
-               label="SLC">
-            <command
-                  commandId="org.argeo.slc.client.ui.refreshResultList"
-                  label="Refresh"
-                  style="push"
-                  tooltip="Refresh the result list">
-            </command>
-         </menu>
-      </menuContribution>
-      -->
        <menuContribution
             locationURI="menu:fileMenu">
             <!-- Should be implemented in later version.
          </command>
       </menuContribution>
   </extension>
-</plugin>
+</plugin>
\ No newline at end of file
index 81b109074e184e813fdce440f201112168962068..8d916dfaa37a49710312009f5d470e0bd6a13f4a 100644 (file)
@@ -7,7 +7,6 @@ import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;\r
 import org.eclipse.core.commands.ExecutionException;\r
 import org.eclipse.jface.dialogs.TitleAreaDialog;\r
-import org.eclipse.swt.widgets.DirectoryDialog;\r
 import org.eclipse.swt.widgets.Shell;\r
 \r
 /**\r
@@ -35,14 +34,15 @@ public class ManageBundlesHandler extends AbstractHandler {
                tad.setTitle("Manage Bundles");\r
                tad.open();\r
 \r
-               DirectoryDialog dialog2 = new DirectoryDialog(shell);\r
-               String path = dialog2.open();\r
-\r
-               if (path == null)\r
-                       // action canceled by user\r
-                       return null;\r
-               log.debug("Path chosen by user : " + path);\r
-\r
+               \r
+               // RCP Specific, commented for now.\r
+               // DirectoryDialog dialog2 = new DirectoryDialog(shell);\r
+               // String path = dialog2.open();\r
+               //\r
+               // if (path == null)\r
+               // // action canceled by user\r
+               // return null;\r
+               // log.debug("Path chosen by user : " + path);\r
                \r
                // the following does not work : it doesn't display anything.\r
                // Label label = new Label(shell, SWT.WRAP);\r
index fb81153bda4a5ff8bb4157af10597523d5894011..6446df35cf30fe27572da4c7c14df3b08dfb1c27 100644 (file)
@@ -1,10 +1,25 @@
 package org.argeo.slc.client.ui.providers;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+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.views.ProcessBuilderView;
 import org.argeo.slc.client.ui.views.ProcessParametersView;
 import org.argeo.slc.core.execution.PrimitiveAccessor;
+import org.argeo.slc.core.execution.PrimitiveUtils;
+import org.argeo.slc.core.execution.RefSpecAttribute;
+import org.argeo.slc.core.execution.RefValue;
+import org.argeo.slc.core.execution.RefValueChoice;
+import org.argeo.slc.execution.ExecutionSpec;
+import org.argeo.slc.execution.ExecutionSpecAttribute;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.ColumnViewer;
+import org.eclipse.jface.viewers.ComboBoxCellEditor;
 import org.eclipse.jface.viewers.EditingSupport;
 import org.eclipse.jface.viewers.TableViewer;
 import org.eclipse.jface.viewers.TextCellEditor;
@@ -12,94 +27,129 @@ 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.
+ * 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
+ * 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 processes in the ProcessBuilderView are stored
+ * as an ordered list.
+ * 
@author bsinou
  * 
  */
 
 public class ProcessParametersEditingSupport extends EditingSupport {
 
-       // private final static Log log = LogFactory
-       // .getLog(ProcessParametersEditingSupport.class);
+       private final static Log log = LogFactory
+                       .getLog(ProcessParametersEditingSupport.class);
 
        private CellEditor strEditor;
-       //private CellEditor nbEditor;
+       // private ComboBoxCellEditor comboEditor;
        // 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;
 
+       // To populate drop down lists
+       private ExecutionSpec executionSpec;
+
+       // To persist combo box elements indexes
+       Map<String, List<String>> comboBoxes = new HashMap<String, List<String>>();
+
        public ProcessParametersEditingSupport(ColumnViewer viewer, int column) {
                super(viewer);
                strEditor = new TextCellEditor(((TableViewer) viewer).getTable());
-               // nbEditor = new NumberCellEditor(((TableViewer) viewer).getTable());
-               // this.column = column;
+               // TODO : add cell validators.
        }
 
        @Override
        protected CellEditor getCellEditor(Object element) {
-               // TODO return specific editor depending on the parameter type.
-               return strEditor;
+
+               // TODO : check if all parameter always have a linked attribute.
+               if (element instanceof ProcessParametersView.ObjectWithName) {
+                       ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element;
+                       ExecutionSpecAttribute esa = executionSpec.getAttributes().get(
+                                       own.name);
+                       if (esa != null) {
+                               // Paramater is a primitive with no list of choices linked by
+                               // the specs
+                               if (own.obj instanceof PrimitiveAccessor
+                                               && !(esa instanceof RefSpecAttribute))
+                                       return strEditor;
+                               else if (esa instanceof RefSpecAttribute) {
+                                       RefSpecAttribute rsa = (RefSpecAttribute) esa;
+
+                                       Iterator<RefValueChoice> choices = rsa.getChoices()
+                                                       .iterator();
+                                       List<String> items = new ArrayList<String>();
+                                       while (choices.hasNext()) {
+                                               items.add(choices.next().getName());
+                                       }
+
+                                       // persists order of the elements in the current combo box
+                                       comboBoxes.put(own.name, items);
+
+                                       String[] itemsStr = new String[items.size()];
+                                       ComboBoxCellEditor comboEditor = new ComboBoxCellEditor(
+                                                       ((TableViewer) getViewer()).getTable(),
+                                                       items.toArray(itemsStr));
+                                       return comboEditor;
+                               }
+                       }
+               }
+               if (log.isTraceEnabled()) {
+                       log.warn(" No cell Editor fits for element : " + element.toString()
+                                       + " of class : " + element.getClass().getName());
+               }
+               return null;
        }
 
        @Override
        protected boolean canEdit(Object element) {
-               return true;
+               if (element instanceof ProcessParametersView.ObjectWithName) {
+                       ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element;
+                       ExecutionSpecAttribute esa = executionSpec.getAttributes().get(
+                                       own.name);
+                       if (esa != null && !esa.getIsFrozen())
+                               return true;
+               }
+               return false;
        }
 
        @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";
-
+               ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element;
+
+               if (own.obj instanceof PrimitiveAccessor) {
+                       PrimitiveAccessor pv = (PrimitiveAccessor) own.obj;
+                       return pv.getValue().toString();
+               } else if (own.obj instanceof RefValue) {
+                       RefValue rv = (RefValue) own.obj;
+                       List<String> values = comboBoxes.get(own.name);
+                       log.debug("Get Value : " + rv.getRef() + " & index : "
+                                       + values.indexOf(rv.getRef()));
+                       return values.indexOf(rv.getRef());
+               } else
+                       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())) {
+               ProcessParametersView.ObjectWithName own = (ProcessParametersView.ObjectWithName) element;
+               if (own.obj instanceof PrimitiveAccessor) {
+                       PrimitiveAccessor pv = (PrimitiveAccessor) own.obj;
+                       if (PrimitiveUtils.typeAsClass(pv.getType()) != null)
                                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);
-                       }
+                       pbView.updateParameter(curProcessIndex, own.name, own.obj);
+                       getViewer().update(element, null);
+               } else if (own.obj instanceof RefValue) {
+                       RefValue rv = (RefValue) own.obj;
+                       List<String> values = comboBoxes.get(own.name);
+                       rv.setRef(values.get(((Integer) value).intValue()));
                        getViewer().update(element, null);
                }
 
@@ -110,6 +160,10 @@ public class ProcessParametersEditingSupport extends EditingSupport {
                this.curProcessIndex = index;
        }
 
+       public void setCurrentExecutionSpec(ExecutionSpec executionSpec) {
+               this.executionSpec = executionSpec;
+       }
+
        public void setCurrentProcessBuilderView(
                        ProcessBuilderView processbuilderView) {
                this.pbView = processbuilderView;
index 325257ff79a651af1111019b8a056732bd2eb9b8..ee78b30aa50f3bad96cd7854946ca76319b52b6d 100644 (file)
@@ -8,6 +8,8 @@ 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;
@@ -37,8 +39,8 @@ import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.part.ViewPart;
 
 public class ExecutionModulesView extends ViewPart {
-       // private final static Log log = LogFactory
-       // .getLog(ExecutionModulesView.class);
+       private final static Log log = LogFactory
+                       .getLog(ExecutionModulesView.class);
 
        public static final String ID = "org.argeo.slc.client.ui.executionModulesView";
 
@@ -78,10 +80,16 @@ public class ExecutionModulesView extends ViewPart {
                        if (obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode) {
                                ExecutionModuleDescriptor emd = ((ExecutionModulesContentProvider.ExecutionModuleNode) obj)
                                                .getDescriptor();
-                               if (emd.getLabel() != null)
+                               System.out
+                                               .println("obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode");
+                               log.debug("obj instanceof ExecutionModulesContentProvider.ExecutionModuleNode");
+                               if (emd.getLabel() != null) {
+                                       log.debug("and label is : " + emd.getLabel());
                                        return emd.getLabel();
-                               else
+                               } else {
+                                       log.debug("label is null and text is : " + getText(emd));
                                        return getText(emd);
+                               }
                        } else
                                return getText(obj);
                }
@@ -145,8 +153,8 @@ public class ExecutionModulesView extends ViewPart {
                }
 
                public void dragSetData(DragSourceEvent event) {
-                       System.out.println("dragSetData: " + event);
-                       // System.out.println("dataType: " + event.dataType);
+
+                       // System.out.println("dragSetData: " + event);
 
                        IStructuredSelection selection = (IStructuredSelection) viewer
                                        .getSelection();
index 37000e2a125f89fe376bbecac7ce68b6a00af605..e8f6a66bf7014cc5f9c92bfe988f20e91825613d 100644 (file)
@@ -30,7 +30,6 @@ 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;
@@ -39,9 +38,9 @@ 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
+ * being, only one agent by batch is enabled. The batch is constructed by
  * dropping process from the ExecutionModuleView. Wrong type of data dropped in
- * this view might raise errors.
+ * this view raises an error.
  * 
  * @author bsinou
  * 
@@ -52,9 +51,6 @@ public class ProcessBuilderView extends ViewPart {
 
        public static final String ID = "org.argeo.slc.client.ui.processBuilderView";
 
-       // private final static Log log =
-       // LogFactory.getLog(ProcessBuilderView.class);
-
        private TableViewer viewer;
        private List<RealizedFlow> realizedFlows = new ArrayList<RealizedFlow>();
        private String currentAgentUuid = null;
@@ -85,16 +81,10 @@ public class ProcessBuilderView extends ViewPart {
 
        protected Table createTable(Composite parent) {
                int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
-                               | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+                               | SWT.FULL_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);
 
@@ -171,7 +161,7 @@ public class ProcessBuilderView extends ViewPart {
                }
        }
 
-       // Return the list of the processes to execute.
+       // Launches the execution of listed realized flow with specified parameters.
        public void launchBatch() {
                SlcExecution slcExecution = new SlcExecution();
                slcExecution.setUuid(UUID.randomUUID().toString());
@@ -226,7 +216,7 @@ public class ProcessBuilderView extends ViewPart {
 
        }
 
-       // Handle Events
+       // Parameter view is updated each time a new line is selected
        class SelectionChangedListener implements ISelectionChangedListener {
                public void selectionChanged(SelectionChangedEvent evt) {
 
@@ -276,7 +266,6 @@ public class ProcessBuilderView extends ViewPart {
                                throw new SlcException(
                                                "Cannot create batch on two (or more) distinct agents",
                                                null);
-                               // return false;
                        }
 
                        String fdXml = props.getProperty("RealizedFlowAsXml");
index 0d356bf8b0281314c9f337b5fb995e8b65c8bede..862dab429897d5f11e30b1ea4f0c0f16ef1e20c9 100644 (file)
@@ -17,7 +17,6 @@ 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;
@@ -58,15 +57,17 @@ public class ProcessListView extends ViewPart {
 
        protected Table createTable(Composite parent) {
                int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
-                               | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+                               | SWT.FULL_SELECTION;
+               // does not function with RAP, commented for the moment being
+               // | 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);
+               // 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);
@@ -123,8 +124,8 @@ public class ProcessListView extends ViewPart {
                                        // get the parameter
                                        IParameter iparam = cmd
                                                        .getParameter("org.argeo.slc.client.commands.processUuid");
-                                       Parameterization params = new Parameterization(iparam, se
-                                                       .getUuid()); // "testUUID");//
+                                       Parameterization params = new Parameterization(iparam,
+                                                       se.getUuid()); // "testUUID");//
                                        parameters.add(params);
 
                                        // build the parameterized command
index 402f7675aeb1ca23c0b6f5888b03c030d5992b0b..5ae234d70d9320682539afdbed6035ee91ae3a47 100644 (file)
@@ -4,9 +4,12 @@ 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.core.execution.RefValue;
 import org.argeo.slc.process.RealizedFlow;
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.ITableLabelProvider;
@@ -27,21 +30,31 @@ import org.eclipse.ui.part.ViewPart;
  *         This view, directly linked with the <code> ProcessBuilderView </code>
  *         enables the display and editing the parameters of a given process.
  * 
- *         Note that for now we use <code>ExecutionFlowDescriptor.values</code>
- *         attribute to recall (and update ??) the various parameters.
+ * 
+ *         Note that for a given RealizedFlow :
+ * 
+ *         + paramaters value are set using
+ *         <code>RealizedFlow.ExecutionFlowDescriptor.values</code>, that might
+ *         have default values
+ * 
+ *         + possible "values" for a given parameters are stored in
+ *         <code>RealizedFlow.ExecutionSpec.</code>
+ * 
  */
 public class ProcessParametersView extends ViewPart {
-       // private static final Log log = LogFactory
-       // .getLog(ProcessParametersView.class);
+       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
+       // This map stores actual values :
+       // * default values (if defined) at instantiation time
+       // * values filled-in or modified by the end-user
        private Map<String, Object> values;
+
        // This map stores the spec of the attributes used to offer the end user
        // some choices.
-       //private Map<String, ExecutionSpecAttribute> specAttributes;
+       // private Map<String, ExecutionSpecAttribute> specAttributes;
 
        // We must keep a reference to the current EditingSupport so that we can
        // update the index of the process being updated
@@ -107,11 +120,12 @@ public class ProcessParametersView extends ViewPart {
                        return;
                }
                // we store the index of the edited Process in the editor so that it can
-               // save computed values.
+               // save entries modified by the end user.
                ppEditingSupport.setCurrentProcessIndex(index);
 
-               // TODO :
-               // We should handle ExecutionSpec here. need to be improved.
+               // We also store corresponding ExecutionSpec to be able to retrieve
+               // possible values for dropdown lists
+               ppEditingSupport.setCurrentExecutionSpec(rf.getExecutionSpec());
                // ExecutionSpec es = rf.getExecutionSpec();
                // if (es != null && es.getAttributes() != null)
                // parameters = es.getAttributes();
@@ -170,20 +184,25 @@ public class ProcessParametersView extends ViewPart {
                                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 pa.getValue().toString();
+                                       } else if (own.obj instanceof RefValue) {
+                                               RefValue refValue = (RefValue) own.obj;
+                                               return refValue.getRef();
+                                       } else {
+                                               if (log.isTraceEnabled()) {
+                                                       log.warn("Not a Primitive accessor neither a ref Value : "
+                                                                       + own.obj.toString()
+                                                                       + " and class : "
+                                                                       + own.obj.getClass().toString());
+                                               }
                                                return own.obj.toString();
+                                       }
                                default:
                                        return getText(obj);
                                }
-                       } else
+                       } else {
                                return getText(obj);
+                       }
                }
 
                public Image getColumnImage(Object obj, int index) {
@@ -202,6 +221,5 @@ public class ProcessParametersView extends ViewPart {
                        this.name = name;
                        this.obj = obj;
                }
-
        }
-}
+}
\ No newline at end of file
index d49d67026942d3677def6753bf882df44fb25b26..837456d5bc36c9c5bccfe3a557b1f846b1f7bfdc 100644 (file)
@@ -32,7 +32,6 @@ 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.Menu;
 import org.eclipse.swt.widgets.Table;
@@ -91,15 +90,17 @@ public class ResultListView extends ViewPart {
 
        protected Table createTable(Composite parent) {
                int style = SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
-                               | SWT.FULL_SELECTION | SWT.HIDE_SELECTION;
+                               | SWT.FULL_SELECTION;
+               // does not function with RAP, commented for the moment being
+               // | SWT.HIDE_SELECTION;
 
                Table table = new Table(parent, style);
                // table.addMouseListener(new RightClickListener());
-               //GridData gridData = new GridData(GridData.FILL_BOTH);
-               //gridData.grabExcessVerticalSpace = true;
-               //gridData.grabExcessHorizontalSpace = true;
-               //gridData.horizontalSpan = 3;
-               //table.setLayoutData(gridData);
+               // 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);
index a7baf8a1d79a2b108a0961c57acf230dd2a77f4a..e554f1727fe245b357aed15eb0f66a4b84943834 100644 (file)
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
                <groupId>org.argeo.slc</groupId>
                        <plugin>
                                <groupId>org.apache.felix</groupId>
                                <artifactId>maven-bundle-plugin</artifactId>
-                               <version>${version.maven-bundle-plugin}</version>
-                               <extensions>true</extensions>
-                               <configuration>
-                                       <manifestLocation>META-INF</manifestLocation>
-                                       <instructions>
-                                               <Bundle-Version>${project.version}-r${buildNumber}</Bundle-Version>
-                                               <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                                               <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
-                                               <_removeheaders>Bnd-LastModified</_removeheaders>
-                                       </instructions>
-                               </configuration>
-                               <executions>
-                                       <execution>
-                                               <id>bundle-manifest</id>
-                                               <phase>process-classes</phase>
-                                               <goals>
-                                                       <goal>manifest</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
                        </plugin>
+                       <!-- TO BE DELETED Configuration herited from commons/pom.xml <version>${version.maven-bundle-plugin}</version> 
+                               <extensions>true</extensions> <configuration> <manifestLocation>META-INF</manifestLocation> 
+                               <instructions> <Bundle-Version>${project.version}-r${buildNumber}</Bundle-Version> 
+                               <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment> 
+                               <_removeheaders>Bnd-LastModified</_removeheaders> </instructions> </configuration> 
+                               <executions> <execution> <id>bundle-manifest</id> <phase>process-classes</phase> 
+                               <goals> <goal>manifest</goal> </goals> </execution> </executions> </plugin> -->
                </plugins>
        </build>
-       <!--
-               <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId>
-               <artifactId>cobertura-maven-plugin</artifactId> </plugin> </plugins>
-               </reporting>
-       -->
+       <!-- <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> 
+               <artifactId>cobertura-maven-plugin</artifactId> </plugin> </plugins> </reporting> -->
 </project>