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
This commit is contained in:
Francesco Mangiacrapa 2018-05-15 16:45:37 +00:00
parent ed03b304ae
commit 81e6c485fe
12 changed files with 255 additions and 137 deletions

View File

@ -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.TaskCompletedNotification.TaskCompletedNotificationListner;
import org.gcube.portlets.widgets.wstaskexecutor.client.dialog.DialogConfirm; 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.dialog.DialogResult;
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.CreateTaskConfigurationEventHandler; 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.DeleteConfigurationEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteConfigurationEventHandler; 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.PerformRunTaskEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.PerformRunTaskEventHandler; 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.ShowCreateTaskConfigurationDialogEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.ShowCreateTaskConfigurationEventHandler; 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.rpc.WsTaskExecutorWidgetServiceAsync;
import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon; 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.WsTaskExecutorWidgetViewManager;
@ -97,7 +98,7 @@ public class WsTaskExecutorWidget {
@Override @Override
public void onRemoveConfiguration(final DeleteConfigurationEvent dcEvent) { public void onRemoveConfiguration(final DeleteConfigurationEvent dcEvent) {
GWT.log("qui remove"); //GWT.log("qui remove");
if(dcEvent.getTaskConf()!=null){ if(dcEvent.getTaskConf()!=null){
@ -143,24 +144,30 @@ public class WsTaskExecutorWidget {
} }
}); });
eventBus.addHandler(ShowCreateTaskConfigurationEvent.TYPE, new ShowCreateTaskConfigurationEventHandler() { eventBus.addHandler(ShowCreateTaskConfigurationDialogEvent.TYPE, new ShowCreateTaskConfigurationDialogEventHandler() {
@Override @Override
public void onShowCreateConfiguration( public void onShowCreateConfiguration(
ShowCreateTaskConfigurationEvent showCreateTaskConfigurationEvent) { ShowCreateTaskConfigurationDialogEvent event) {
if(showCreateTaskConfigurationEvent.getWsItem()!=null) if(event.getWsItem()!=null){
viewManager.showCreateTaskConfigurationForFolder(showCreateTaskConfigurationEvent.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 @Override
public void onCreateConfiguration( public void onCreatedConfiguration(
final CreateTaskConfigurationEvent createTCE) { final CreatedTaskConfigurationEvent createTCE) {
if(createTCE.getWsItem()!=null && createTCE.getConf()!=null){ if(createTCE.getWsItem()!=null && createTCE.getConf()!=null){
GWT.log("Creating the configuration: "+createTCE.getConf()); GWT.log("Creating the configuration: "+createTCE.getConf());
@ -236,7 +243,9 @@ public class WsTaskExecutorWidget {
final Modal box = new Modal(true); final Modal box = new Modal(true);
box.setTitle("Checking configurations..."); 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); box.add(loader);
GWT.log("Performing checkItemTaskConfigurations: "+wsItem.getItemId()); GWT.log("Performing checkItemTaskConfigurations: "+wsItem.getItemId());

View File

@ -7,12 +7,12 @@ package org.gcube.portlets.widgets.wstaskexecutor.client.dialog;
import org.gcube.portlets.widgets.wstaskexecutor.client.resource.Icons; import org.gcube.portlets.widgets.wstaskexecutor.client.resource.Icons;
import com.github.gwtbootstrap.client.ui.Alert; import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.AlertType; import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.resources.client.ImageResource; 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.DockPanel;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasHorizontalAlignment;
@ -83,10 +83,12 @@ public abstract class PanelConfirmBuilder {
}); });
vpContainer = new VerticalPanel(); vpContainer = new VerticalPanel();
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX); vpContainer.getElement().getStyle().setMarginTop(20.0, Unit.PX);
Alert txt = new Alert(text); Alert txt = new Alert(text);
txt.setType(type); txt.setType(type);
txt.setClose(false); txt.setClose(false);
txt.getElement().getStyle().setMarginBottom(2, Unit.PX);
txt.getElement().getStyle().setBackgroundColor("transparent");
vpContainer.add(txt); vpContainer.add(txt);
hpButtons = new HorizontalPanel(); hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER); hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

View File

@ -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);
}

View File

@ -9,17 +9,16 @@ import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
/** /**
* The Class CreateTaskConfigurationEvent. * The Class CreatedTaskConfigurationEvent.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* May 9, 2018 * May 15, 2018
*/ */
public class CreateTaskConfigurationEvent extends GwtEvent<CreateTaskConfigurationEventHandler> { public class CreatedTaskConfigurationEvent extends GwtEvent<CreatedTaskConfigurationEventHandler> {
/** The type. */ /** The type. */
public static Type<CreateTaskConfigurationEventHandler> TYPE = new Type<CreateTaskConfigurationEventHandler>(); public static Type<CreatedTaskConfigurationEventHandler> TYPE = new Type<CreatedTaskConfigurationEventHandler>();
private TaskConfiguration conf; private TaskConfiguration conf;
private WSItem wsItem; private WSItem wsItem;
private boolean isUpdate; private boolean isUpdate;
@ -32,7 +31,7 @@ public class CreateTaskConfigurationEvent extends GwtEvent<CreateTaskConfigurati
* @param conf the conf * @param conf the conf
* @param isUpdate the is update * @param isUpdate the is update
*/ */
public CreateTaskConfigurationEvent(WSItem wsItem, TaskConfiguration conf, boolean isUpdate) { public CreatedTaskConfigurationEvent(WSItem wsItem, TaskConfiguration conf, boolean isUpdate) {
this.wsItem = wsItem; this.wsItem = wsItem;
this.conf = conf; this.conf = conf;
this.isUpdate = isUpdate; this.isUpdate = isUpdate;
@ -43,7 +42,7 @@ public class CreateTaskConfigurationEvent extends GwtEvent<CreateTaskConfigurati
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/ */
@Override @Override
public Type<CreateTaskConfigurationEventHandler> getAssociatedType() { public Type<CreatedTaskConfigurationEventHandler> getAssociatedType() {
return TYPE; return TYPE;
} }
@ -51,12 +50,14 @@ public class CreateTaskConfigurationEvent extends GwtEvent<CreateTaskConfigurati
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/ */
@Override @Override
protected void dispatch(CreateTaskConfigurationEventHandler handler) { protected void dispatch(CreatedTaskConfigurationEventHandler handler) {
handler.onCreateConfiguration(this); handler.onCreatedConfiguration(this);
} }
/** /**
* Checks if is update.
*
* @return the isUpdate * @return the isUpdate
*/ */
public boolean isUpdate() { public boolean isUpdate() {

View File

@ -0,0 +1,23 @@
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface CreatedTaskConfigurationEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* May 15, 2018
*/
public interface CreatedTaskConfigurationEventHandler extends EventHandler {
/**
* On created configuration.
*
* @param createTaskConfigurationEvent the create task configuration event
*/
void onCreatedConfiguration(
CreatedTaskConfigurationEvent createTaskConfigurationEvent);
}

View File

@ -0,0 +1,100 @@
/*
*
*/
package org.gcube.portlets.widgets.wstaskexecutor.client.event;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
import org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowCreateTaskConfigurationDialogEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* May 15, 2018
*/
public class ShowCreateTaskConfigurationDialogEvent extends GwtEvent<ShowCreateTaskConfigurationDialogEventHandler> {
/** The type. */
public static Type<ShowCreateTaskConfigurationDialogEventHandler> TYPE = new Type<ShowCreateTaskConfigurationDialogEventHandler>();
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<ShowCreateTaskConfigurationDialogEventHandler> 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;
}
}

View File

@ -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) * @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. * On show create configuration.
@ -18,5 +18,5 @@ public interface ShowCreateTaskConfigurationEventHandler extends EventHandler {
* @param showCreateTaskConfigurationEvent the show create task configuration event * @param showCreateTaskConfigurationEvent the show create task configuration event
*/ */
void onShowCreateConfiguration( void onShowCreateConfiguration(
ShowCreateTaskConfigurationEvent showCreateTaskConfigurationEvent); ShowCreateTaskConfigurationDialogEvent showCreateTaskConfigurationEvent);
} }

View File

@ -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<ShowCreateTaskConfigurationEventHandler> {
/** The type. */
public static Type<ShowCreateTaskConfigurationEventHandler> TYPE = new Type<ShowCreateTaskConfigurationEventHandler>();
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<ShowCreateTaskConfigurationEventHandler> 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;
}
}

View File

@ -55,4 +55,25 @@ public class FormatUtil {
return "("+gcubeScope.getScopeType()+") "+gcubeScope.getScopeTitle(); 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());
}
} }

View File

@ -10,7 +10,7 @@ import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus; import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskExecutionStatus;
import org.gcube.portlets.widgets.wstaskexecutor.client.TaskCompletedNotification.TaskCompletedNotificationListner; import org.gcube.portlets.widgets.wstaskexecutor.client.TaskCompletedNotification.TaskCompletedNotificationListner;
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget; 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.event.DeleteConfigurationEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.view.binder.AbstractViewDialogBox; 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.CreateTaskConfigurationView;
@ -237,7 +237,7 @@ public class WsTaskExecutorWidgetViewManager {
public void showTaskConfigurationsFolderInfo(WSItem wsItem, final List<TaskConfiguration> listTaskConfigurations, final List<TaskCompletedNotificationListner> taskEventsListeners) { public void showTaskConfigurationsFolderInfo(WSItem wsItem, final List<TaskConfiguration> listTaskConfigurations, final List<TaskCompletedNotificationListner> taskEventsListeners) {
final Modal box = new Modal(true); final Modal box = new Modal(true);
//box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+20+"px"); //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.addStyleName("ws-task-modal-body");
box.setWidth(AbstractViewDialogBox.DEFAULT_WIDTH+50); 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 @Override
public void submitHandler() { public void submitHandler() {
@ -352,7 +352,7 @@ public class WsTaskExecutorWidgetViewManager {
conf.setWorkspaceItemId(wsItem.getItemId()); conf.setWorkspaceItemId(wsItem.getItemId());
conf.setListParameters(getParameters()); conf.setListParameters(getParameters());
WsTaskExecutorWidget.eventBus.fireEvent(new CreateTaskConfigurationEvent(wsItem, conf, false)); WsTaskExecutorWidget.eventBus.fireEvent(new CreatedTaskConfigurationEvent(wsItem, conf, false));
} }
@Override @Override

View File

@ -8,6 +8,7 @@ import java.util.Map;
import org.gcube.common.workspacetaskexecutor.shared.TaskParameter; import org.gcube.common.workspacetaskexecutor.shared.TaskParameter;
import org.gcube.common.workspacetaskexecutor.shared.TaskParameterType; 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.WsTaskExecutorWidget;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEvent; import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEvent;
import org.gcube.portlets.widgets.wstaskexecutor.client.event.DeleteCustomFieldEventHandler; 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 { public abstract class CreateTaskConfigurationView extends Composite {
/** The ui binder. */ /** The ui binder. */
private static CreateTaskConfigurationViewUiBinder uiBinder = private static CreateTaskConfigurationViewUiBinder uiBinder = GWT.create(CreateTaskConfigurationViewUiBinder.class);
GWT.create(CreateTaskConfigurationViewUiBinder.class);
/** /**
* The Interface CreateTaskConfigurationViewUiBinder. * The Interface CreateTaskConfigurationViewUiBinder.
@ -110,6 +110,12 @@ public abstract class CreateTaskConfigurationView extends Composite {
private WSItem folder; private WSItem folder;
private boolean isEditConfiguration;
private TaskConfiguration editConfiguration;
/** /**
* Submit handler. * Submit handler.
*/ */
@ -146,10 +152,16 @@ public abstract class CreateTaskConfigurationView extends Composite {
* implement HasHTML instead of HasText. * implement HasHTML instead of HasText.
* *
* @param folder the folder * @param folder the folder
* @param conf the conf
*/ */
public CreateTaskConfigurationView(WSItem folder) { public CreateTaskConfigurationView(WSItem folder, TaskConfiguration conf) {
this.folder = folder; this.folder = folder;
if(conf!=null)
this.isEditConfiguration = true;
this.editConfiguration = conf;
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
bindEvents(); bindEvents();
@ -183,7 +195,14 @@ public abstract class CreateTaskConfigurationView extends Composite {
} }
if(result.size()>0){ 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.setSelectedIndex(0);
//field_select_vre.fireEvent(DomEvent.fireNativeEvent(nativeEvent, handlerSource);); //field_select_vre.fireEvent(DomEvent.fireNativeEvent(nativeEvent, handlerSource););
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_scope); DomEvent.fireNativeEvent(Document.get().createChangeEvent(), field_select_scope);
@ -197,29 +216,48 @@ public abstract class CreateTaskConfigurationView extends Composite {
} }
}); });
// CustomFieldEntry customFieldEntry; if(isEditConfiguration){
// if(folder.getPublicLink()!=null){
// customFieldEntry = new CustomFieldEntry(eventBus, "publicLink", folder.getPublicLink(), "FILE"); field_task_id.setValue(editConfiguration.getTaskId());
// customFieldEntry.setEnableValue(false); field_task_description.setValue(editConfiguration.getTaskDescription());
// customFieldEntriesList.add(customFieldEntry);
// cg_parameters_control.add(customFieldEntry); List<TaskParameter> params = editConfiguration.getListParameters();
// }else for (TaskParameter taskParameter : params) {
addCustomFieldEvent(null); 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 * @param e the e
*/ */
@UiHandler("addCustomFieldButton") @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); customFieldEntriesList.add(toAdd);
cg_parameters_control.add(toAdd); cg_parameters_control.add(toAdd);
} }
/** /**

View File

@ -7,7 +7,8 @@ import java.util.List;
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration; import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskConfiguration;
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget; 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 org.gcube.portlets.widgets.wstaskexecutor.shared.WSItem;
import com.github.gwtbootstrap.client.ui.Button; 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.getElement().getStyle().setMarginTop(10, Unit.PX);
flex_table_configurations.addStyleName("table-fixed"); flex_table_configurations.addStyleName("table-fixed");
//flex_table_configurations.setWidget(0, 0, new HTML("<b>Config Id<b>")); //flex_table_configurations.setWidget(0, 0, new HTML("<b>Config Id<b>"));
flex_table_configurations.setWidget(0, 0, new HTML("<b>Algorithm Id<b>")); HTML h0 = new HTML("<b>Algorithm Id<b>");
flex_table_configurations.setWidget(0, 1, new HTML("<b>N.Par.<b>")); h0.setTitle("The Algorithm Id");
flex_table_configurations.setWidget(0, 2, new HTML("<b>VRE<b>")); flex_table_configurations.setWidget(0, 0, h0);
HTML h1 = new HTML("<b>N.Par.<b>");
h1.setTitle("Number of parameters used by the Algorithm");
flex_table_configurations.setWidget(0, 1, h1);
HTML h2 = new HTML("<b>VRE<b>");
flex_table_configurations.setWidget(0, 2, h2);
flex_table_configurations.setWidget(0, 3, new HTML("<b>Owner<b>")); flex_table_configurations.setWidget(0, 3, new HTML("<b>Owner<b>"));
flex_table_configurations.setWidget(0, 4, new HTML("<b>Oper.<b>")); flex_table_configurations.setWidget(0, 4, new HTML("<b>Oper.<b>"));
flex_table_configurations.setWidget(0, 5, new HTML("<b>Oper.<b>")); flex_table_configurations.setWidget(0, 5, new HTML("<b>Oper.<b>"));
@ -138,7 +144,7 @@ public abstract class ShowTaskConfigurationsView extends Composite {
@Override @Override
public void onClick(ClickEvent event) { 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 @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
selectedConfiguration = taskConfiguration; selectedConfiguration = taskConfiguration;
setConfirm(true, "Deleting che configuration: <br/>"+taskConfiguration+". <br/>Confirm?"); setConfirm(true, "<div style='font-size:14px; font-weight:bold;'>Deleting che configuration: </div><div><br/>"+taskConfiguration+".<br/><br/><div style='font-size:14px; font-weight:bold;'>Confirm?</div></div>");
} }
}); });
@ -180,7 +186,7 @@ public abstract class ShowTaskConfigurationsView extends Composite {
@UiHandler("butt_CreateNewConfiguration") @UiHandler("butt_CreateNewConfiguration")
void addCustomFieldEvent(ClickEvent e){ void addCustomFieldEvent(ClickEvent e){
WsTaskExecutorWidget.eventBus.fireEvent(new ShowCreateTaskConfigurationEvent(wsItem)); WsTaskExecutorWidget.eventBus.fireEvent(new ShowCreateTaskConfigurationDialogEvent(wsItem, null, Operation.CREATE_NEW));
} }