diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/TaskCompletedNotification.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/TaskCompletedNotification.java index 81c9cb0..1573041 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/TaskCompletedNotification.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/TaskCompletedNotification.java @@ -3,7 +3,7 @@ */ package org.gcube.portlets.widgets.wstaskexecutor.client; -import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder; +import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; @@ -30,21 +30,21 @@ public class TaskCompletedNotification { * * @param folder the folder */ - void onTaskComputationCompleted(WsFolder folder); + void onTaskComputationCompleted(WSItem folder); /** * On task computation error. * * @param folder the folder */ - void onTaskComputationError(WsFolder folder); + void onTaskComputationError(WSItem folder); /** * On remove task configurations performed. * * @param folder the folder */ - void onRemoveTaskConfigurationsPerformed(WsFolder folder); + void onRemoveTaskConfigurationsPerformed(WSItem folder); } 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 e31b94d..67dc454 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 @@ -12,11 +12,13 @@ import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigur import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEventHandler; 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.rpc.WsTaskExecutorWidgetServiceAsync; import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon; import org.gcube.portlets.widgets.wstaskexecutor.client.view.WsTaskExecutorWidgetViewManager; import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.MonitorFolderTaskExecutionStatusView; -import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder; +import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import com.github.gwtbootstrap.client.ui.Alert; import com.github.gwtbootstrap.client.ui.Modal; @@ -86,14 +88,29 @@ public class WsTaskExecutorWidget { } }); + eventBus.addHandler(ShowCreateTaskConfigurationEvent.TYPE, new ShowCreateTaskConfigurationEventHandler() { + + @Override + public void onShowCreateConfiguration( + ShowCreateTaskConfigurationEvent showCreateTaskConfigurationEvent) { + + if(showCreateTaskConfigurationEvent.getFolder()!=null) + viewManager.showCreateTaskConfigurationForFolder(showCreateTaskConfigurationEvent.getFolder(), null); + } + }); + + + eventBus.addHandler(CreateTaskConfigurationEvent.TYPE, new CreateTaskConfigurationEventHandler() { @Override public void onCreateConfiguration( final CreateTaskConfigurationEvent createTCE) { - if(createTCE.getFolder()!=null && createTCE.getConf()!=null){ - WsTaskExecutorWidget.wsTaskService.createTaskConfiguration(createTCE.getFolder().getFolderId(), createTCE.getConf(), createTCE.isUpdate(), new AsyncCallback() { + if(createTCE.getWsItem()!=null && createTCE.getConf()!=null){ + GWT.log("Creating the configuration: "+createTCE.getConf()); + + WsTaskExecutorWidget.wsTaskService.createTaskConfiguration(createTCE.getWsItem().getItemId(), createTCE.getConf(), createTCE.isUpdate(), new AsyncCallback() { @Override public void onFailure(Throwable caught) { @@ -106,7 +123,7 @@ public class WsTaskExecutorWidget { public void onSuccess(Boolean result) { try { - showTaskConfigurationsForFolder(createTCE.getFolder()); + showTaskConfigurationsForFolder(createTCE.getWsItem()); } catch (Exception e) { // TODO Auto-generated catch block @@ -125,14 +142,14 @@ public class WsTaskExecutorWidget { /** * Perform run task. * - * @param folder the folder + * @param wsItem the folder * @param conf the conf * @throws Exception the exception */ - public void performRunTask(WsFolder folder, TaskConfiguration conf) throws Exception { + public void performRunTask(WSItem wsItem, TaskConfiguration conf) throws Exception { - if(folder==null || folder.getFolderId()==null) - throw new Exception("Invalid parameter folder null"); + if(wsItem==null || wsItem.getItemId()==null) + throw new Exception("Invalid parameter workpace item or its id is null"); if(conf==null) throw new Exception("Invalid parameter the configuration is null"); @@ -145,20 +162,20 @@ public class WsTaskExecutorWidget { /** * Show task configurations for folder. * - * @param folder the folder + * @param wsItem the folder * @throws Exception the exception */ - public void showTaskConfigurationsForFolder(final WsFolder folder) throws Exception { + public void showTaskConfigurationsForFolder(final WSItem wsItem) throws Exception { - if(folder==null || folder.getFolderId()==null) - throw new Exception("Invalid parameter folder null"); + if(wsItem==null || wsItem.getItemId()==null) + throw new Exception("Invalid parameter workpace item or its id is null"); - MonitorFolderTaskExecutionStatusView monitor = viewManager.getMonitor(folder); + MonitorFolderTaskExecutionStatusView monitor = viewManager.getMonitor(wsItem); //SHOWING CURRENT ACTIVE MONITOR if(monitor!=null) { - GWT.log("Monitor for folder: "+folder.getFolderId() +" exists showing it.."); - viewManager.showMonitorTaskStatusFor(folder, monitor.getTaskConfiguration(), monitor.getTaskComputation(), taskEventsListeners); + GWT.log("Monitor for workpace item: "+wsItem.getItemId() +" exists showing it.."); + viewManager.showMonitorTaskStatusFor(wsItem, monitor.getTaskConfiguration(), monitor.getTaskComputation(), taskEventsListeners); return; } @@ -167,15 +184,15 @@ public class WsTaskExecutorWidget { LoaderIcon loader = new LoaderIcon("Checking folder configurations..."); box.add(loader); - GWT.log("Performing checkItemTaskConfigurations: "+folder.getFolderId()); + GWT.log("Performing checkItemTaskConfigurations: "+wsItem.getItemId()); - WsTaskExecutorWidget.wsTaskService.checkItemTaskConfigurations(folder.getFolderId(), new AsyncCallback>() { + WsTaskExecutorWidget.wsTaskService.checkItemTaskConfigurations(wsItem.getItemId(), new AsyncCallback>() { @Override public void onSuccess(List result) { box.hide(); - viewManager.showTaskConfigurationsFolderInfo(folder, result, taskEventsListeners); + viewManager.showTaskConfigurationsFolderInfo(wsItem, result, taskEventsListeners); } @Override @@ -184,7 +201,7 @@ public class WsTaskExecutorWidget { if(caught instanceof ItemNotConfiguredException){ - viewManager.showCreateTaskConfigurationForFolder(folder, null); + viewManager.showCreateTaskConfigurationForFolder(wsItem, null); }else if(caught instanceof WorkspaceFolderLocked){ VerticalPanel v = new VerticalPanel(); 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/CreateTaskConfigurationEvent.java index f36252e..e46e819 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/CreateTaskConfigurationEvent.java @@ -4,7 +4,7 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.event; import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration; -import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder; +import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import com.google.gwt.event.shared.GwtEvent; @@ -21,18 +21,19 @@ public class CreateTaskConfigurationEvent extends GwtEvent TYPE = new Type(); private TaskConfiguration conf; - private WsFolder folder; + private WSItem wsItem; private boolean isUpdate; + /** * Instantiates a new creates the task configuration event. * - * @param folder the folder + * @param wsItem the ws item * @param conf the conf * @param isUpdate the is update */ - public CreateTaskConfigurationEvent(WsFolder folder, TaskConfiguration conf, boolean isUpdate) { - this.folder = folder; + public CreateTaskConfigurationEvent(WSItem wsItem, TaskConfiguration conf, boolean isUpdate) { + this.wsItem = wsItem; this.conf = conf; this.isUpdate = isUpdate; @@ -79,8 +80,8 @@ public class CreateTaskConfigurationEvent extends GwtEvent { /** The type. */ public static Type TYPE = new Type(); private TaskConfiguration conf; - private WsFolder folder; + private WSItem folder; /** @@ -29,7 +29,7 @@ public class PerformRunTaskEvent extends GwtEvent { * @param folder the folder * @param conf the conf */ - public PerformRunTaskEvent(WsFolder folder, TaskConfiguration conf) { + public PerformRunTaskEvent(WSItem folder, TaskConfiguration conf) { this.folder = folder; this.conf = conf; @@ -67,7 +67,7 @@ public class PerformRunTaskEvent extends GwtEvent { * * @return the folder */ - public WsFolder getFolder() { + public WSItem getFolder() { return folder; } 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 new file mode 100644 index 0000000..fec1099 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEvent.java @@ -0,0 +1,63 @@ +/* + * + */ +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 folder; + + /** + * Instantiates a new creates the task configuration event. + * + * @param folder the folder + */ + public ShowCreateTaskConfigurationEvent(WSItem folder) { + this.folder = folder; + + } + + /* (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 getFolder() { + return folder; + } + +} 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/ShowCreateTaskConfigurationEventHandler.java new file mode 100644 index 0000000..25881c4 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/event/ShowCreateTaskConfigurationEventHandler.java @@ -0,0 +1,22 @@ +package org.gcube.portlets.widgets.wstaskexecutor.client.event; + +import com.google.gwt.event.shared.EventHandler; + + + +/** + * The Interface ShowCreateTaskConfigurationEventHandler. + * + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) + * May 9, 2018 + */ +public interface ShowCreateTaskConfigurationEventHandler extends EventHandler { + + /** + * On show create configuration. + * + * @param showCreateTaskConfigurationEvent the show create task configuration event + */ + void onShowCreateConfiguration( + ShowCreateTaskConfigurationEvent showCreateTaskConfigurationEvent); +} \ No newline at end of file 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 9320baa..d31a196 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,11 +10,12 @@ 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.PerformRunTaskEvent; +import org.gcube.portlets.widgets.wstaskexecutor.client.event.CreateTaskConfigurationEvent; import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.AbstractViewDialogBox; import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.CreateTaskConfigurationView; import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.MonitorFolderTaskExecutionStatusView; -import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder; +import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.ShowTaskConfigurationsView; +import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import com.github.gwtbootstrap.client.ui.Modal; import com.google.gwt.core.shared.GWT; @@ -34,18 +35,17 @@ public class WsTaskExecutorWidgetViewManager { private Map mapMonitor = new HashMap(); - /** * Cancel scheduler. * - * @param folder the folder + * @param wsItem the ws item * @return the monitor folder task execution status view */ - private MonitorFolderTaskExecutionStatusView cancelScheduler(final WsFolder folder) { + private MonitorFolderTaskExecutionStatusView cancelScheduler(final WSItem wsItem) { - MonitorFolderTaskExecutionStatusView monitor = getMonitor(folder); + MonitorFolderTaskExecutionStatusView monitor = getMonitor(wsItem); if(monitor.getSchedulerTime()!=null) { - GWT.log("Cancelling scheduler time on folder: "+folder.getFolderId()); + GWT.log("Cancelling scheduler time on folder: "+wsItem.getItemId()); monitor.getSchedulerTime().cancel(); } @@ -53,20 +53,21 @@ public class WsTaskExecutorWidgetViewManager { } + /** * Cancel monitor. * - * @param folder the folder + * @param wsItem the ws item */ - public void cancelMonitor(WsFolder folder) { + public void cancelMonitor(WSItem wsItem) { try { - MonitorFolderTaskExecutionStatusView monitor = cancelScheduler(folder); + MonitorFolderTaskExecutionStatusView monitor = cancelScheduler(wsItem); if(monitor!=null) { - GWT.log("Removed monitor for folder: "+folder.getFolderId()); - mapMonitor.remove(folder.getFolderId()); + GWT.log("Removed monitor for folder: "+wsItem.getItemId()); + mapMonitor.remove(wsItem.getItemId()); } }catch (Exception e) { - GWT.log("Error on removing map monitor for id: "+folder.getFolderId()); + GWT.log("Error on removing map monitor for id: "+wsItem.getItemId()); } } @@ -74,26 +75,27 @@ public class WsTaskExecutorWidgetViewManager { /** * Gets the monitor. * - * @param folder the folder + * @param wsItem the ws item * @return the monitor */ - public MonitorFolderTaskExecutionStatusView getMonitor(WsFolder folder){ + public MonitorFolderTaskExecutionStatusView getMonitor(WSItem wsItem){ - if(folder==null) + if(wsItem==null) return null; - return mapMonitor.get(folder.getFolderId()); + return mapMonitor.get(wsItem.getItemId()); } + /** * Save monitor. * - * @param folder the folder + * @param wsItem the ws item * @param monitor the monitor */ - private void saveMonitor(WsFolder folder, MonitorFolderTaskExecutionStatusView monitor) { - GWT.log("Saving monitor for folder: "+folder.getFolderId()); - mapMonitor.put(folder.getFolderId(), monitor); + private void saveMonitor(WSItem wsItem, MonitorFolderTaskExecutionStatusView monitor) { + GWT.log("Saving monitor for folder: "+wsItem.getItemId()); + mapMonitor.put(wsItem.getItemId(), monitor); } @@ -108,14 +110,14 @@ public class WsTaskExecutorWidgetViewManager { * @param taskEventsListeners the task events listeners */ public void showMonitorTaskStatusFor( - final WsFolder folder, + final WSItem folder, final TaskConfiguration configuration, final TaskComputation taskComputation, final List taskEventsListeners) { - GWT.log("showMonitorSyncToFolder for folder: "+folder.getFolderId()); + GWT.log("showMonitorSyncToFolder for folder: "+folder.getItemId()); final Modal box = new Modal(true); box.addStyleName("ws-thredds-modal-body"); - box.setTitle("Monitor transferring of: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20)); + box.setTitle("Monitor transferring of: "+FormatUtil.getFolderTitle(folder.getItemName(), 20)); box.setWidth(800); box.hide(false); @@ -223,29 +225,38 @@ public class WsTaskExecutorWidgetViewManager { } + /** * Show task configurations folder info. * - * @param folder the folder - * @param result the result + * @param wsItem the ws item + * @param listTaskConfigurations the list task configurations * @param taskEventsListeners the task events listeners */ - public void showTaskConfigurationsFolderInfo(WsFolder folder, final List result, final List taskEventsListeners) { - } + 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.addStyleName("ws-task-modal-body"); + box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+50); + ShowTaskConfigurationsView panelConfigs = new ShowTaskConfigurationsView(wsItem, listTaskConfigurations); + box.add(panelConfigs); + box.show(); + } /** * Show create task configuration for folder. * - * @param folder the folder + * @param wsItem the ws item * @param conf the conf */ - public void showCreateTaskConfigurationForFolder(final WsFolder folder, TaskConfiguration conf){ + public void showCreateTaskConfigurationForFolder(final WSItem wsItem, TaskConfiguration conf){ final Modal box = new Modal(true); //box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+20+"px"); - box.setTitle("Create Task Configuration for: "+FormatUtil.getFolderTitle(folder.getFoderName(), 20)); + box.setTitle("Create Task Configuration for: "+FormatUtil.getFolderTitle(wsItem.getItemName(), 20)); box.addStyleName("ws-task-modal-body"); box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+50); //box.getElement().getStyle().setZIndex(10000); @@ -271,7 +282,7 @@ public class WsTaskExecutorWidgetViewManager { } }; - CreateTaskConfigurationView createTaskConfiguration = new CreateTaskConfigurationView(folder) { + CreateTaskConfigurationView createTaskConfiguration = new CreateTaskConfigurationView(wsItem) { @Override public void submitHandler() { @@ -279,11 +290,11 @@ public class WsTaskExecutorWidgetViewManager { TaskConfiguration conf = new TaskConfiguration(); conf.setScope(getSelectedScope().getScopeName()); conf.setTaskId(getTaskId()); - conf.setTaskDescription(""); - conf.setWorkspaceItemId(folder.getFolderId()); + conf.setTaskDescription(getDescription()); + conf.setWorkspaceItemId(wsItem.getItemId()); conf.setListParameters(getParameters()); - WsTaskExecutorWidget.eventBus.fireEvent(new PerformRunTaskEvent(folder, conf)); + WsTaskExecutorWidget.eventBus.fireEvent(new CreateTaskConfigurationEvent(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 f0d56af..35b14e7 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 @@ -13,7 +13,7 @@ import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldE import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEventHandler; import org.gcube.portlets.widgets.wstaskexecutor.client.view.FormatUtil; import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope; -import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder; +import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.ControlGroup; @@ -21,6 +21,7 @@ import com.github.gwtbootstrap.client.ui.Controls; import com.github.gwtbootstrap.client.ui.Fieldset; import com.github.gwtbootstrap.client.ui.ListBox; import com.github.gwtbootstrap.client.ui.Pager; +import com.github.gwtbootstrap.client.ui.TextArea; import com.github.gwtbootstrap.client.ui.TextBox; import com.github.gwtbootstrap.client.ui.constants.ControlGroupType; import com.google.gwt.core.client.GWT; @@ -92,6 +93,9 @@ public abstract class CreateTaskConfigurationView extends Composite { @UiField HTMLPanel html_panel_field; + @UiField + TextArea field_task_description; + /** The map VR es. */ private Map mapScopes = new HashMap(); @@ -104,7 +108,7 @@ public abstract class CreateTaskConfigurationView extends Composite { private List customFieldEntriesList = new ArrayList(); - private WsFolder folder; + private WSItem folder; /** * Submit handler. @@ -143,7 +147,7 @@ public abstract class CreateTaskConfigurationView extends Composite { * * @param folder the folder */ - public CreateTaskConfigurationView(WsFolder folder) { + public CreateTaskConfigurationView(WSItem folder) { this.folder = folder; initWidget(uiBinder.createAndBindUi(this)); @@ -193,13 +197,14 @@ public abstract class CreateTaskConfigurationView extends Composite { } }); - CustomFieldEntry customFieldEntry; - if(folder.getPublicLink()!=null){ - customFieldEntry = new CustomFieldEntry(eventBus, "publicLink", folder.getPublicLink(), "FILE"); - customFieldEntriesList.add(customFieldEntry); - cg_parameters_control.add(customFieldEntry); - }else - addCustomFieldEvent(null); +// 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); } @@ -308,4 +313,13 @@ public abstract class CreateTaskConfigurationView extends Composite { return listParameters; } + + /** + * Gets the description. + * + * @return the description + */ + public String getDescription(){ + return field_task_description.getValue(); + } } diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.ui.xml b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.ui.xml index 25941fb..9783cc0 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CreateTaskConfigurationView.ui.xml @@ -28,6 +28,14 @@ ui:field="field_task_id" addStyleNames="my-external-input-width"> + + Description + + + + @@ -40,7 +48,7 @@ - + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.java index 7b2440e..49523f8 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/CustomFieldEntry.java @@ -70,7 +70,7 @@ public class CustomFieldEntry extends Composite { * @param eventBus the event bus * @param key the key * @param value the value - * @param isCustomCreatedByUser the is custom created by user + * @param parameterType the parameter type */ public CustomFieldEntry(HandlerManager eventBus, String key, String value, final String parameterType) { initWidget(uiBinder.createAndBindUi(this)); @@ -96,15 +96,6 @@ public class CustomFieldEntry extends Composite { ((TextBox)this.valueFieldPrepend.getWidget(1)).setText(value); } - //this.isCustomCreatedByUser = isCustomCreatedByUser; - - // remove the first appendbox -// if(!isCustomCreatedByUser){ -// this.valueFieldPrepend.removeFromParent(); -// this.keyFieldPrepend.setPrependText(key + ":"); -// ((TextBox)this.keyFieldPrepend.getWidget(1)).setText(value); -// } - WsTaskExecutorWidget.wsTaskService.getAvailableParameterTypes(new AsyncCallback>() { @@ -138,8 +129,19 @@ public class CustomFieldEntry extends Composite { } + /** + * Sets the enable value. + * + * @param enabled the new enable value + */ + public void setEnableValue(boolean enabled){ + ((TextBox)this.valueFieldPrepend.getWidget(1)).setEnabled(enabled); + } + /** + * Gets the control group. + * * @return the cg_parameter */ public ControlGroup getControlGroup() { diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/MonitorFolderTaskExecutionStatusView.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/MonitorFolderTaskExecutionStatusView.java index f17e376..6d9de1c 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/MonitorFolderTaskExecutionStatusView.java +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/MonitorFolderTaskExecutionStatusView.java @@ -6,7 +6,7 @@ import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation; import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration; import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus; import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon; -import org.gcube.portlets.widgets.wstaskexecutor.shared.WsFolder; +import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem; import com.github.gwtbootstrap.client.ui.Alert; import com.github.gwtbootstrap.client.ui.Form; @@ -93,7 +93,7 @@ public abstract class MonitorFolderTaskExecutionStatusView extends Composite { @UiField Form field_form; - private WsFolder folder; + private WSItem folder; /** The scheduler time. */ @@ -171,7 +171,7 @@ public abstract class MonitorFolderTaskExecutionStatusView extends Composite { * @param folder the folder * @param taskExecutionStatus the sync status */ - public void updateStatusView(WsFolder folder, TaskExecutionStatus taskExecutionStatus) { + public void updateStatusView(WSItem folder, TaskExecutionStatus taskExecutionStatus) { this.folder = folder; field_loader.clear(); 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 new file mode 100644 index 0000000..4343251 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/client/view/binder/ShowTaskConfigurationsView.java @@ -0,0 +1,133 @@ +/** + * + */ +package org.gcube.portlets.widgets.wstaskexecutor.client.view.binder; + +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.shared.WSItem; + +import com.github.gwtbootstrap.client.ui.Button; +import com.github.gwtbootstrap.client.ui.constants.IconType; +import com.google.gwt.core.client.GWT; +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.uibinder.client.UiBinder; +import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.uibinder.client.UiHandler; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.FlexTable; +import com.google.gwt.user.client.ui.HTML; +import com.google.gwt.user.client.ui.Widget; + + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * May 9, 2018 + */ +public class ShowTaskConfigurationsView extends Composite { + + private static ShowTaskConfigurationViewUiBinder uiBinder = + GWT.create(ShowTaskConfigurationViewUiBinder.class); + + interface ShowTaskConfigurationViewUiBinder + extends UiBinder { + } + + @UiField + Button butt_CreateNewConfiguration; + + @UiField + FlexTable flex_table_configurations; + + private WSItem folder; + + + /** + * Because this class has a default constructor, it can + * be used as a binder template. In other words, it can be used in other + * *.ui.xml files as follows: + * + * Hello! + * + * Note that depending on the widget that is used, it may be necessary to + * implement HasHTML instead of HasText. + */ + public ShowTaskConfigurationsView(WSItem folder, List listTaskConfigurations) { + this.folder = folder; + + initWidget(uiBinder.createAndBindUi(this)); + + flex_table_configurations.setCellSpacing(4); + 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("VRE")); + flex_table_configurations.setWidget(0, 2, new HTML("Owner")); + flex_table_configurations.setWidget(0, 3, new HTML("Oper.")); + flex_table_configurations.setWidget(0, 4, new HTML("Oper.")); + //flex_table_configurations.getColumnFormatter().setWidth(0, "10%"); + flex_table_configurations.getColumnFormatter().setWidth(0, "35%"); + flex_table_configurations.getColumnFormatter().setWidth(1, "30%"); + flex_table_configurations.getColumnFormatter().setWidth(2, "20%"); + flex_table_configurations.getColumnFormatter().setWidth(3, "7%"); + flex_table_configurations.getColumnFormatter().setWidth(4, "7%"); + //flex_table_configurations.getColumnFormatter().setWidth(5, "7%"); +// flt.setWidget(0, 1, new HTML("Description")); + for (int i = 0; i + + + + + + + + Create New Configuration + + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css index e89bca5..056821e 100644 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/public/WsTaskExecutorWidget.css @@ -30,7 +30,7 @@ } .my-input-width { - width: 300px !important; + width: 370px !important; } .my-prepend-width .add-on { @@ -39,13 +39,35 @@ } .my-select-width { - width: 312px !important; + width: 382px !important; } .my-external-select-width { - width: 370px !important; + width: 440px !important; } .my-external-input-width { - width: 360px !important; + width: 430px !important; +} + +table.table-fixed { + table-layout: fixed; + width: 100%; + text-align: center; + padding-top: 12px; + padding-bottom: 12px; + overflow-y: scroll; +} + +table.table-fixed tr { + border-bottom: 1px solid #ccc; + text-align: center; +} + +table.table-fixed td { + text-overflow: ellipsis; + white-space: nowrap; + border: 1px solid #ddd; + padding: 2px; + text-align: center; } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/WSItem.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/WSItem.java new file mode 100644 index 0000000..f80f2f8 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/WSItem.java @@ -0,0 +1,101 @@ + +package org.gcube.portlets.widgets.wstaskexecutor.shared; + +import java.io.Serializable; + +import com.google.gwt.user.client.rpc.IsSerializable; + +/** + * The Class WSItem. + * + * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) + * May 9, 2018 + */ +public class WSItem implements Serializable, IsSerializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + private String itemId; + private String itemName; + + /** + * Instantiates a new ws folder. + */ + public WSItem() { + + } + + /** + * Instantiates a new workspace file. + * + * @param itemId + * the item id + * @param itemName + * the item name + */ + public WSItem(String itemId, String itemName) { + + this.itemId = itemId; + this.itemName = itemName; + } + + /** + * Gets the item id. + * + * @return the itemId + */ + public String getItemId() { + + return itemId; + } + + /** + * Gets the item name. + * + * @return the itemName + */ + public String getItemName() { + + return itemName; + } + + /** + * Sets the item id. + * + * @param itemId + * the itemId to set + */ + public void setItemId(String itemId) { + + this.itemId = itemId; + } + + /** + * Sets the item name. + * + * @param itemName + * the itemName to set + */ + public void setItemName(String itemName) { + + this.itemName = itemName; + } + + /* + * (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + + StringBuilder builder = new StringBuilder(); + builder.append("WorkspaceFile [itemId="); + builder.append(itemId); + builder.append(", itemName="); + builder.append(itemName); + builder.append("]"); + return builder.toString(); + } +} diff --git a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/WsFolder.java b/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/WsFolder.java deleted file mode 100644 index 1bdefb1..0000000 --- a/src/main/java/org/gcube/portlets/widgets/wstaskexecutor/shared/WsFolder.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.gcube.portlets.widgets.wstaskexecutor.shared; - -import java.io.Serializable; - -import com.google.gwt.user.client.rpc.IsSerializable; - - - -/** - * The Class WsFolder. - * - * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) - * May 8, 2018 - */ -public class WsFolder implements Serializable, IsSerializable{ - - - /** - * - */ - private static final long serialVersionUID = 1L; - private String folderId; - private String foderName; - private String publicLink; - - - /** - * Instantiates a new ws folder. - */ - public WsFolder() { - } - - - /** - * Instantiates a new ws folder. - * - * @param folderId the folder id - * @param foderName the foder name - * @param publicLink the public link - */ - public WsFolder(String folderId, String foderName, String publicLink) { - this.folderId = folderId; - this.foderName = foderName; - this.publicLink = publicLink; - } - - - - /** - * Gets the folder id. - * - * @return the folder id - */ - public String getFolderId() { - return folderId; - } - - - /** - * Sets the folder id. - * - * @param folderId the new folder id - */ - public void setFolderId(String folderId) { - this.folderId = folderId; - } - - - /** - * Gets the foder name. - * - * @return the foder name - */ - public String getFoderName() { - return foderName; - } - - - /** - * Gets the public link. - * - * @return the public link - */ - public String getPublicLink() { - - return publicLink; - } - - - /** - * Sets the foder name. - * - * @param foderName the new foder name - */ - public void setFoderName(String foderName) { - this.foderName = foderName; - } - - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - builder.append("WsFolder [folderId="); - builder.append(folderId); - builder.append(", foderName="); - builder.append(foderName); - builder.append(", publicLink="); - builder.append(publicLink); - builder.append("]"); - return builder.toString(); - } - - - -}