From 81e6c485feb88ddad5487c5fb7045a8c447ec4b0 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Tue, 15 May 2018 16:45:37 +0000 Subject: [PATCH] Added method to show/edit one configuration git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@167501 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/WsTaskExecutorWidget.java | 35 +++--- .../client/dialog/PanelConfirmBuilder.java | 6 +- .../CreateTaskConfigurationEventHandler.java | 19 ---- ...ava => CreatedTaskConfigurationEvent.java} | 19 ++-- .../CreatedTaskConfigurationEventHandler.java | 23 ++++ ...howCreateTaskConfigurationDialogEvent.java | 100 ++++++++++++++++++ ...eTaskConfigurationDialogEventHandler.java} | 8 +- .../ShowCreateTaskConfigurationEvent.java | 63 ----------- .../client/view/FormatUtil.java | 21 ++++ .../view/WsTaskExecutorWidgetViewManager.java | 8 +- .../binder/CreateTaskConfigurationView.java | 70 +++++++++--- .../binder/ShowTaskConfigurationsView.java | 20 ++-- 12 files changed, 255 insertions(+), 137 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreateTaskConfigurationEventHandler.java rename src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/{CreateTaskConfigurationEvent.java => CreatedTaskConfigurationEvent.java} (68%) create mode 100644 src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreatedTaskConfigurationEventHandler.java create mode 100644 src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationDialogEvent.java rename src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/{ShowCreateTaskConfigurationEventHandler.java => ShowCreateTaskConfigurationDialogEventHandler.java} (60%) delete mode 100644 src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java index d24ea76..12eb9ef 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/WsTaskExecutorWidget.java @@ -10,14 +10,15 @@ import org.gcube.common.workspacetaskexecutor.shared.exception.WorkspaceFolderLo import org.gcube.portlets.widgets.wstaskexecutor.client.TaskCompletedNotification.TaskCompletedNotificationListner; import org.gcube.portlets.widgets.wstaskexecutor.client.dialog.DialogConfirm; import org.gcube.portlets.widgets.wstaskexecutor.client.dialog.DialogResult; -import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEvent; -import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEventHandler; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreatedTaskConfigurationEvent; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreatedTaskConfigurationEventHandler; import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEvent; import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEventHandler; import org.gcube.portlets.widgets.wstaskexecutor.client.event.PerformRunTaskEvent; import org.gcube.portlets.widgets.wstaskexecutor.client.event.PerformRunTaskEventHandler; -import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationEvent; -import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationEventHandler; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationDialogEvent; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationDialogEvent.Operation; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationDialogEventHandler; import org.gcube.portlets.widgets.wstaskexecutor.client.rpc.WsTaskExecutorWidgetServiceAsync; import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon; import org.gcube.portlets.widgets.wstaskexecutor.client.view.WsTaskExecutorWidgetViewManager; @@ -97,7 +98,7 @@ public class WsTaskExecutorWidget { @Override public void onRemoveConfiguration(final DeleteConfigurationEvent dcEvent) { - GWT.log("qui remove"); + //GWT.log("qui remove"); if(dcEvent.getTaskConf()!=null){ @@ -143,24 +144,30 @@ public class WsTaskExecutorWidget { } }); - eventBus.addHandler(ShowCreateTaskConfigurationEvent.TYPE, new ShowCreateTaskConfigurationEventHandler() { + eventBus.addHandler(ShowCreateTaskConfigurationDialogEvent.TYPE, new ShowCreateTaskConfigurationDialogEventHandler() { @Override public void onShowCreateConfiguration( - ShowCreateTaskConfigurationEvent showCreateTaskConfigurationEvent) { + ShowCreateTaskConfigurationDialogEvent event) { - if(showCreateTaskConfigurationEvent.getWsItem()!=null) - viewManager.showCreateTaskConfigurationForFolder(showCreateTaskConfigurationEvent.getWsItem(), null); + if(event.getWsItem()!=null){ + + if(event.getOperation().equals(Operation.CREATE_NEW)){ + viewManager.showCreateTaskConfigurationForFolder(event.getWsItem(), null); + }else { + viewManager.showCreateTaskConfigurationForFolder(event.getWsItem(), event.getTaskConfiguration()); + } + } } }); - eventBus.addHandler(CreateTaskConfigurationEvent.TYPE, new CreateTaskConfigurationEventHandler() { + eventBus.addHandler(CreatedTaskConfigurationEvent.TYPE, new CreatedTaskConfigurationEventHandler() { @Override - public void onCreateConfiguration( - final CreateTaskConfigurationEvent createTCE) { + public void onCreatedConfiguration( + final CreatedTaskConfigurationEvent createTCE) { if(createTCE.getWsItem()!=null && createTCE.getConf()!=null){ GWT.log("Creating the configuration: "+createTCE.getConf()); @@ -236,7 +243,9 @@ public class WsTaskExecutorWidget { final Modal box = new Modal(true); box.setTitle("Checking configurations..."); - LoaderIcon loader = new LoaderIcon("Checking folder configurations..."); + + String suffix = wsItem.getItemName()!=null || !wsItem.getItemName().isEmpty()?wsItem.getItemName():wsItem.getItemId(); + LoaderIcon loader = new LoaderIcon("Checking task configurations for item: "+suffix); box.add(loader); GWT.log("Performing checkItemTaskConfigurations: "+wsItem.getItemId()); diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/dialog/PanelConfirmBuilder.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/dialog/PanelConfirmBuilder.java index 1f076b9..526c2e6 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/dialog/PanelConfirmBuilder.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/dialog/PanelConfirmBuilder.java @@ -7,12 +7,12 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.dialog; import org.gcube.portlets.widgets.wstaskexecutor.client.resource.Icons; import com.github.gwtbootstrap.client.ui.Alert; +import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.constants.AlertType; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.resources.client.ImageResource; -import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.DockPanel; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HasHorizontalAlignment; @@ -83,10 +83,12 @@ public abstract class PanelConfirmBuilder { }); vpContainer = new VerticalPanel(); - vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX); + vpContainer.getElement().getStyle().setMarginTop(20.0, Unit.PX); Alert txt = new Alert(text); txt.setType(type); txt.setClose(false); + txt.getElement().getStyle().setMarginBottom(2, Unit.PX); + txt.getElement().getStyle().setBackgroundColor("transparent"); vpContainer.add(txt); hpButtons = new HorizontalPanel(); hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreateTaskConfigurationEventHandler.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreateTaskConfigurationEventHandler.java deleted file mode 100644 index eb812e4..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreateTaskConfigurationEventHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.gcube.portlets.widgets.wstaskexecutor.client.event; - -import com.google.gwt.event.shared.EventHandler; - - -/** - * The Interface CreateTaskConfigurationEventHandler. - * - * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) - * May 9, 2018 - */ -public interface CreateTaskConfigurationEventHandler extends EventHandler { - - /** - * @param createTaskConfigurationEvent - */ - void onCreateConfiguration( - CreateTaskConfigurationEvent createTaskConfigurationEvent); -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreateTaskConfigurationEvent.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreatedTaskConfigurationEvent.java similarity index 68% rename from src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreateTaskConfigurationEvent.java rename to src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreatedTaskConfigurationEvent.java index e46e819..2732b64 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreateTaskConfigurationEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/CreatedTaskConfigurationEvent.java @@ -9,17 +9,16 @@ import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import com.google.gwt.event.shared.GwtEvent; - /** - * The Class CreateTaskConfigurationEvent. + * The Class CreatedTaskConfigurationEvent. * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) - * May 9, 2018 + * May 15, 2018 */ -public class CreateTaskConfigurationEvent extends GwtEvent { +public class CreatedTaskConfigurationEvent extends GwtEvent { /** The type. */ - public static Type TYPE = new Type(); + public static Type TYPE = new Type(); private TaskConfiguration conf; private WSItem wsItem; private boolean isUpdate; @@ -32,7 +31,7 @@ public class CreateTaskConfigurationEvent extends GwtEvent getAssociatedType() { + public Type getAssociatedType() { return TYPE; } @@ -51,12 +50,14 @@ public class CreateTaskConfigurationEvent extends GwtEvent { + + /** The type. */ + public static Type TYPE = new Type(); + private WSItem wsItem; + private Operation operation; + private TaskConfiguration taskConfiguration; + + /** + * The Enum Operation. + * + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) + * May 15, 2018 + */ + public static enum Operation{CREATE_NEW, EDIT_EXISTING} + + + /** + * Instantiates a new show create task configuration dialog event. + * + * @param wsItem the ws item + * @param taskConfiguration the task configuration + * @param op the op + */ + public ShowCreateTaskConfigurationDialogEvent(WSItem wsItem, TaskConfiguration taskConfiguration, Operation op) { + this.wsItem = wsItem; + this.taskConfiguration = taskConfiguration; + this.operation = op; + + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() + */ + @Override + public Type getAssociatedType() { + return TYPE; + } + + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) + */ + @Override + protected void dispatch(ShowCreateTaskConfigurationDialogEventHandler handler) { + handler.onShowCreateConfiguration(this); + } + + /* Gets the folder. + * + * @return the folder + */ + /** + * Gets the folder. + * + * @return the folder + */ + public WSItem getWsItem() { + return wsItem; + } + + + /** + * Gets the operation. + * + * @return the operation + */ + public Operation getOperation() { + + return operation; + } + + + /** + * Gets the task configuration. + * + * @return the taskConfiguration + */ + public TaskConfiguration getTaskConfiguration() { + + return taskConfiguration; + } + +} diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEventHandler.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationDialogEventHandler.java similarity index 60% rename from src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEventHandler.java rename to src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationDialogEventHandler.java index 25881c4..5ab1976 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEventHandler.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationDialogEventHandler.java @@ -5,12 +5,12 @@ import com.google.gwt.event.shared.EventHandler; /** - * The Interface ShowCreateTaskConfigurationEventHandler. + * The Interface ShowCreateTaskConfigurationDialogEventHandler. * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) - * May 9, 2018 + * May 15, 2018 */ -public interface ShowCreateTaskConfigurationEventHandler extends EventHandler { +public interface ShowCreateTaskConfigurationDialogEventHandler extends EventHandler { /** * On show create configuration. @@ -18,5 +18,5 @@ public interface ShowCreateTaskConfigurationEventHandler extends EventHandler { * @param showCreateTaskConfigurationEvent the show create task configuration event */ void onShowCreateConfiguration( - ShowCreateTaskConfigurationEvent showCreateTaskConfigurationEvent); + ShowCreateTaskConfigurationDialogEvent showCreateTaskConfigurationEvent); } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java deleted file mode 100644 index d8d569d..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - */ -package org.gcube.portlets.widgets.wstaskexecutor.client.event; - -import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; - -import com.google.gwt.event.shared.GwtEvent; - - - -/** - * The Class CreateTaskConfigurationEvent. - * - * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) - * May 9, 2018 - */ -public class ShowCreateTaskConfigurationEvent extends GwtEvent { - - /** The type. */ - public static Type TYPE = new Type(); - private WSItem wsItem; - - /** - * Instantiates a new creates the task configuration event. - * - * @param folder the folder - */ - public ShowCreateTaskConfigurationEvent(WSItem wsItem) { - this.wsItem = wsItem; - - } - - /* (non-Javadoc) - * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() - */ - @Override - public Type getAssociatedType() { - return TYPE; - } - - /* (non-Javadoc) - * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) - */ - @Override - protected void dispatch(ShowCreateTaskConfigurationEventHandler handler) { - handler.onShowCreateConfiguration(this); - } - - /* Gets the folder. - * - * @return the folder - */ - /** - * Gets the folder. - * - * @return the folder - */ - public WSItem getWsItem() { - return wsItem; - } - -} diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/FormatUtil.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/FormatUtil.java index b487898..c882d16 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/FormatUtil.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/FormatUtil.java @@ -55,4 +55,25 @@ public class FormatUtil { return "("+gcubeScope.getScopeType()+") "+gcubeScope.getScopeTitle(); } + + + /** + * This method returns only the VRE name from the input scope if the input scope is a VRE. Otherwise it returns the input scope + * + * @param scope the vre full scope + * @return the string + */ + public static String toVREName(String scope){ + + if(scope==null) + return null; + + System.out.println(scope.split("/").length); + + if(scope.split("/").length<4) + return scope; + + return scope.substring(scope.lastIndexOf("/")+1, scope.length()); + } + } diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java index 60d1111..584e7c5 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/WsTaskExecutorWidgetViewManager.java @@ -10,7 +10,7 @@ import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus; import org.gcube.portlets.widgets.wstaskexecutor.client.TaskCompletedNotification.TaskCompletedNotificationListner; import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget; -import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEvent; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreatedTaskConfigurationEvent; import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEvent; import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.AbstractViewDialogBox; import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.CreateTaskConfigurationView; @@ -237,7 +237,7 @@ public class WsTaskExecutorWidgetViewManager { public void showTaskConfigurationsFolderInfo(WSItem wsItem, final List listTaskConfigurations, final List taskEventsListeners) { final Modal box = new Modal(true); //box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+20+"px"); - box.setTitle("Task Configuration created for: "+FormatUtil.getFolderTitle(wsItem.getItemName(), 20)); + box.setTitle("Task Configurations created for: "+FormatUtil.getFolderTitle(wsItem.getItemName(), 20)); box.addStyleName("ws-task-modal-body"); box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+50); @@ -340,7 +340,7 @@ public class WsTaskExecutorWidgetViewManager { } }; - CreateTaskConfigurationView createTaskConfiguration = new CreateTaskConfigurationView(wsItem) { + CreateTaskConfigurationView createTaskConfiguration = new CreateTaskConfigurationView(wsItem, conf) { @Override public void submitHandler() { @@ -352,7 +352,7 @@ public class WsTaskExecutorWidgetViewManager { conf.setWorkspaceItemId(wsItem.getItemId()); conf.setListParameters(getParameters()); - WsTaskExecutorWidget.eventBus.fireEvent(new CreateTaskConfigurationEvent(wsItem, conf, false)); + WsTaskExecutorWidget.eventBus.fireEvent(new CreatedTaskConfigurationEvent(wsItem, conf, false)); } @Override diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.java index 35b14e7..50b423d 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.java @@ -8,6 +8,7 @@ import java.util.Map; import org.gcube.common.workspacetaskexecutor.shared.TaskParameter; import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType; +import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration; import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget; import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEvent; import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEventHandler; @@ -48,8 +49,7 @@ import com.google.gwt.user.client.ui.Widget; public abstract class CreateTaskConfigurationView extends Composite { /** The ui binder. */ - private static CreateTaskConfigurationViewUiBinder uiBinder = - GWT.create(CreateTaskConfigurationViewUiBinder.class); + private static CreateTaskConfigurationViewUiBinder uiBinder = GWT.create(CreateTaskConfigurationViewUiBinder.class); /** * The Interface CreateTaskConfigurationViewUiBinder. @@ -110,6 +110,12 @@ public abstract class CreateTaskConfigurationView extends Composite { private WSItem folder; + + private boolean isEditConfiguration; + + + private TaskConfiguration editConfiguration; + /** * Submit handler. */ @@ -146,10 +152,16 @@ public abstract class CreateTaskConfigurationView extends Composite { * implement HasHTML instead of HasText. * * @param folder the folder + * @param conf the conf */ - public CreateTaskConfigurationView(WSItem folder) { + public CreateTaskConfigurationView(WSItem folder, TaskConfiguration conf) { this.folder = folder; + if(conf!=null) + this.isEditConfiguration = true; + + this.editConfiguration = conf; + initWidget(uiBinder.createAndBindUi(this)); bindEvents(); @@ -183,7 +195,14 @@ public abstract class CreateTaskConfigurationView extends Composite { } if(result.size()>0){ - field_select_scope.setSelectedValue(result.get(0).getScopeName()); + + if(isEditConfiguration){ + String vreName = FormatUtil.toVREName(editConfiguration.getScope()); + field_select_scope.setSelectedValue(vreName); + } + else + field_select_scope.setSelectedValue(result.get(0).getScopeName()); + //field_select_vre.setSelectedIndex(0); //field_select_vre.fireEvent(DomEvent.fireNativeEvent(nativeEvent, handlerSource);); DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_scope); @@ -197,29 +216,48 @@ public abstract class CreateTaskConfigurationView extends Composite { } }); -// CustomFieldEntry customFieldEntry; -// if(folder.getPublicLink()!=null){ -// customFieldEntry = new CustomFieldEntry(eventBus, "publicLink", folder.getPublicLink(), "FILE"); -// customFieldEntry.setEnableValue(false); -// customFieldEntriesList.add(customFieldEntry); -// cg_parameters_control.add(customFieldEntry); -// }else - addCustomFieldEvent(null); + if(isEditConfiguration){ + + field_task_id.setValue(editConfiguration.getTaskId()); + field_task_description.setValue(editConfiguration.getTaskDescription()); + + List params = editConfiguration.getListParameters(); + for (TaskParameter taskParameter : params) { + appendCustomField(taskParameter.getKey(), taskParameter.getValue(), taskParameter.getType().getType()); + } + + pager.getRight().setText("Update Configuration"); + } + else + addEmptyCustomFieldEvent(null); } + /** - * Adds the custom field event. + * Adds the empty custom field event. * * @param e the e */ @UiHandler("addCustomFieldButton") - void addCustomFieldEvent(ClickEvent e){ + void addEmptyCustomFieldEvent(ClickEvent e){ - CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, null, null, null); + appendCustomField(null, null, null); + + } + + /** + * Append custom field. + * + * @param key the key + * @param value the value + * @param parameterType the parameter type + */ + private void appendCustomField(String key, String value, String parameterType){ + + CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, key, value, parameterType); customFieldEntriesList.add(toAdd); cg_parameters_control.add(toAdd); - } /** diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java index de7d4bd..3c5fa6b 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java @@ -7,7 +7,8 @@ import java.util.List; import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration; import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget; -import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationEvent; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationDialogEvent; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationDialogEvent.Operation; import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import com.github.gwtbootstrap.client.ui.Button; @@ -84,9 +85,14 @@ public abstract class ShowTaskConfigurationsView extends Composite { flex_table_configurations.getElement().getStyle().setMarginTop(10, Unit.PX); flex_table_configurations.addStyleName("table-fixed"); //flex_table_configurations.setWidget(0, 0, new HTML("Config Id")); - flex_table_configurations.setWidget(0, 0, new HTML("Algorithm Id")); - flex_table_configurations.setWidget(0, 1, new HTML("N.Par.")); - flex_table_configurations.setWidget(0, 2, new HTML("VRE")); + HTML h0 = new HTML("Algorithm Id"); + h0.setTitle("The Algorithm Id"); + flex_table_configurations.setWidget(0, 0, h0); + HTML h1 = new HTML("N.Par."); + h1.setTitle("Number of parameters used by the Algorithm"); + flex_table_configurations.setWidget(0, 1, h1); + HTML h2 = new HTML("VRE"); + flex_table_configurations.setWidget(0, 2, h2); flex_table_configurations.setWidget(0, 3, new HTML("Owner")); flex_table_configurations.setWidget(0, 4, new HTML("Oper.")); flex_table_configurations.setWidget(0, 5, new HTML("Oper.")); @@ -138,7 +144,7 @@ public abstract class ShowTaskConfigurationsView extends Composite { @Override public void onClick(ClickEvent event) { - + WsTaskExecutorWidget.eventBus.fireEvent(new ShowCreateTaskConfigurationDialogEvent(wsItem, taskConfiguration, Operation.EDIT_EXISTING)); } }); @@ -153,7 +159,7 @@ public abstract class ShowTaskConfigurationsView extends Composite { @Override public void onClick(ClickEvent event) { selectedConfiguration = taskConfiguration; - setConfirm(true, "Deleting che configuration:
"+taskConfiguration+".
Confirm?"); + setConfirm(true, "
Deleting che configuration:

"+taskConfiguration+".

Confirm?
"); } }); @@ -180,7 +186,7 @@ public abstract class ShowTaskConfigurationsView extends Composite { @UiHandler("butt_CreateNewConfiguration") void addCustomFieldEvent(ClickEvent e){ - WsTaskExecutorWidget.eventBus.fireEvent(new ShowCreateTaskConfigurationEvent(wsItem)); + WsTaskExecutorWidget.eventBus.fireEvent(new ShowCreateTaskConfigurationDialogEvent(wsItem, null, Operation.CREATE_NEW)); }