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