Enhancement on Project Activity #11690
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-task-executor-widget@167316 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ea0a365f65
commit
44e796f63f
|
@ -1,12 +1,27 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
||||
|
||||
/**
|
||||
* The client side stub for the RPC service.
|
||||
* The Interface GreetingService.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* May 4, 2018
|
||||
*/
|
||||
@RemoteServiceRelativePath("greet")
|
||||
public interface GreetingService extends RemoteService {
|
||||
String greetServer(String name) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Gets the list of scopes for logged user.
|
||||
*
|
||||
* @return the list of scopes for logged user
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
List<GcubeScope> getListOfScopesForLoggedUser() throws Exception;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,12 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -47,4 +52,10 @@ public interface GreetingServiceAsync {
|
|||
// Utility class should not be instantiated
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param asyncCallback
|
||||
*/
|
||||
void getListOfScopesForLoggedUser(
|
||||
AsyncCallback<List<GcubeScope>> asyncCallback);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
|
@ -19,8 +18,7 @@ public class WsTaskExecutorWidget {
|
|||
* Create a remote service proxy to talk to the server-side Greeting
|
||||
* service.
|
||||
*/
|
||||
private final GreetingServiceAsync greetingService =
|
||||
GWT.create(GreetingService.class);
|
||||
public static final GreetingServiceAsync greetingService = GreetingServiceAsync.Util.getInstance();
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client.dialog;
|
||||
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.resource.Icons;
|
||||
|
||||
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.DialogBox;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* The Class DialogConfirm.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 19, 2015
|
||||
*/
|
||||
public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||
|
||||
private DockPanel dock = new DockPanel();
|
||||
private Button yesButton;
|
||||
private VerticalPanel vpContainer;
|
||||
private ImageResource loading = Icons.ICONS.loading();
|
||||
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||
private Button noButton;
|
||||
/**
|
||||
* Instantiates a new dialog confirm.
|
||||
*
|
||||
* @param img the img
|
||||
* @param caption the caption
|
||||
* @param text the text
|
||||
*/
|
||||
public DialogConfirm(Image img, String caption, String text) {
|
||||
getElement().setClassName("gwt-DialogBoxNew");
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
setText(caption);
|
||||
// setHeading(caption);
|
||||
|
||||
yesButton = new Button("Yes");
|
||||
noButton = new Button("No", this);
|
||||
|
||||
noButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
vpContainer = new VerticalPanel();
|
||||
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
|
||||
vpContainer.add(new HTML(text));
|
||||
hpButtons = new HorizontalPanel();
|
||||
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
|
||||
hpButtons.setSpacing(3);
|
||||
yesButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
|
||||
hpButtons.add(yesButton);
|
||||
hpButtons.add(noButton);
|
||||
|
||||
dock.add(hpButtons, DockPanel.SOUTH);
|
||||
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
|
||||
|
||||
if (img != null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
dock.add(vpContainer, DockPanel.CENTER);
|
||||
setWidget(dock);
|
||||
// add(dock);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
|
||||
* .dom.client.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loader.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public void loader(String message){
|
||||
try{
|
||||
dock.remove(hpButtons);
|
||||
}catch(Exception e){}
|
||||
vpContainer.clear();
|
||||
HorizontalPanel hpMask = new HorizontalPanel();
|
||||
hpMask.add(new Image(loading));
|
||||
HTML html = new HTML(message);
|
||||
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
|
||||
hpMask.add(html);
|
||||
vpContainer.add(hpMask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the to center panel.
|
||||
*
|
||||
* @param w the w
|
||||
*/
|
||||
public void addToCenterPanel(Widget w) {
|
||||
vpContainer.add(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dock.
|
||||
*
|
||||
* @return the dock
|
||||
*/
|
||||
public DockPanel getDock() {
|
||||
return dock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the yes button.
|
||||
*
|
||||
* @return the yes button
|
||||
*/
|
||||
public Button getYesButton() {
|
||||
return yesButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the no button.
|
||||
*
|
||||
* @return the no button
|
||||
*/
|
||||
public Button getNoButton() {
|
||||
return noButton;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client.dialog;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class DialogResult.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jan 19, 2018
|
||||
*/
|
||||
public class DialogResult extends DialogBox implements ClickHandler {
|
||||
|
||||
/** The dock. */
|
||||
private DockPanel dock = new DockPanel();
|
||||
|
||||
/** The close button. */
|
||||
private Button closeButton;
|
||||
|
||||
/**
|
||||
* Instantiates a new dialog result.
|
||||
*
|
||||
* @param img the img
|
||||
* @param title the title
|
||||
* @param msg the msg
|
||||
*/
|
||||
public DialogResult(Image img, String title, String msg) {
|
||||
getElement().setClassName("gwt-DialogBoxNew");
|
||||
setText(title);
|
||||
closeButton = new Button("Close", this);
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
dock.add(new HTML(msg), DockPanel.CENTER);
|
||||
|
||||
dock.add(closeButton, DockPanel.SOUTH);
|
||||
if(img!=null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
dock.setCellHorizontalAlignment(closeButton, DockPanel.ALIGN_RIGHT);
|
||||
setWidget(dock);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the close button.
|
||||
*
|
||||
* @return the closeButton
|
||||
*/
|
||||
public Button getCloseButton() {
|
||||
return closeButton;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event.dom.client.ClickEvent)
|
||||
*/
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hide();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the to center panel.
|
||||
*
|
||||
* @param w the w
|
||||
*/
|
||||
public void addToCenterPanel(Widget w){
|
||||
dock.add(w, DockPanel.CENTER);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,163 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
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.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;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Class PanelConfirmBuilder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Mar 13, 2018
|
||||
*/
|
||||
public abstract class PanelConfirmBuilder {
|
||||
|
||||
private DockPanel dock = new DockPanel();
|
||||
private Button yesButton;
|
||||
private VerticalPanel vpContainer;
|
||||
private ImageResource loading = Icons.ICONS.loading();
|
||||
private HorizontalPanel hpButtons = new HorizontalPanel();
|
||||
private Button noButton;
|
||||
|
||||
/**
|
||||
* On click no button.
|
||||
*/
|
||||
public abstract void onClickNoButton();
|
||||
|
||||
/**
|
||||
* On click yes button.
|
||||
*/
|
||||
public abstract void onClickYesButton();
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new panel confirm builder.
|
||||
*
|
||||
* @param img the img
|
||||
* @param caption the caption
|
||||
* @param text the text
|
||||
*/
|
||||
public PanelConfirmBuilder(Image img, String caption, String text, AlertType type) {
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
// setHeading(caption);
|
||||
|
||||
yesButton = new Button("Yes");
|
||||
|
||||
yesButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
onClickYesButton();
|
||||
}
|
||||
});
|
||||
|
||||
noButton = new Button("No");
|
||||
|
||||
noButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
onClickNoButton();
|
||||
}
|
||||
});
|
||||
|
||||
vpContainer = new VerticalPanel();
|
||||
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
|
||||
Alert txt = new Alert(text);
|
||||
txt.setType(type);
|
||||
txt.setClose(false);
|
||||
vpContainer.add(txt);
|
||||
hpButtons = new HorizontalPanel();
|
||||
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
|
||||
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
|
||||
hpButtons.setSpacing(3);
|
||||
yesButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
|
||||
hpButtons.add(yesButton);
|
||||
hpButtons.add(noButton);
|
||||
|
||||
dock.add(hpButtons, DockPanel.SOUTH);
|
||||
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
|
||||
|
||||
if (img != null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
dock.add(vpContainer, DockPanel.CENTER);
|
||||
// add(dock);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loader.
|
||||
*
|
||||
* @param message the message
|
||||
*/
|
||||
public void loader(String message){
|
||||
try{
|
||||
dock.remove(hpButtons);
|
||||
}catch(Exception e){}
|
||||
vpContainer.clear();
|
||||
HorizontalPanel hpMask = new HorizontalPanel();
|
||||
hpMask.add(new Image(loading));
|
||||
HTML html = new HTML(message);
|
||||
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
|
||||
hpMask.add(html);
|
||||
vpContainer.add(hpMask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the to center panel.
|
||||
*
|
||||
* @param w the w
|
||||
*/
|
||||
public void addToCenterPanel(Widget w) {
|
||||
vpContainer.add(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dock.
|
||||
*
|
||||
* @return the dock
|
||||
*/
|
||||
public DockPanel getPanel() {
|
||||
return dock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the yes button.
|
||||
*
|
||||
* @return the yes button
|
||||
*/
|
||||
public Button getYesButton() {
|
||||
return yesButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the no button.
|
||||
*
|
||||
* @return the no button
|
||||
*/
|
||||
public Button getNoButton() {
|
||||
return noButton;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client.resource;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface Icons.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 7, 2018
|
||||
*/
|
||||
public interface Icons extends ClientBundle {
|
||||
|
||||
/** The Constant ICONS. */
|
||||
public static final Icons ICONS = GWT.create(Icons.class);
|
||||
|
||||
/**
|
||||
* Loading.
|
||||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("loading.gif")
|
||||
ImageResource loading();
|
||||
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -0,0 +1,58 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.client.view;
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class FormatUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 16, 2018
|
||||
*/
|
||||
public class FormatUtil {
|
||||
|
||||
|
||||
/**
|
||||
* Truncate a string and add an ellipsis ('...') to the end if it exceeds the
|
||||
* specified length.
|
||||
*
|
||||
* @param value the string to truncate
|
||||
* @param len the maximum length to allow before truncating
|
||||
* @return the converted text
|
||||
*/
|
||||
public static String ellipse(String value, int len) {
|
||||
if (value != null && value.length() > len) {
|
||||
return value.substring(0, len - 3) + "...";
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the folder title.
|
||||
*
|
||||
* @param folderName the folder name
|
||||
* @param maxSize the max size
|
||||
* @return the folder title
|
||||
*/
|
||||
public static String getFolderTitle(String folderName, int maxSize){
|
||||
String title = folderName!=null&&folderName.length()>0?folderName:"";
|
||||
return FormatUtil.ellipse(title, maxSize);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To scope value.
|
||||
*
|
||||
* @param gcubeScope the gcube scope
|
||||
* @return the string
|
||||
*/
|
||||
public static String toScopeValue(GcubeScope gcubeScope){
|
||||
|
||||
if(gcubeScope==null)
|
||||
return null;
|
||||
|
||||
return "("+gcubeScope.getScopeType()+") "+gcubeScope.getScopeTitle();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.client.view;
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.resource.Icons;
|
||||
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
/**
|
||||
* The Class LoaderIcon.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 19, 2015
|
||||
*/
|
||||
public class LoaderIcon extends HorizontalPanel{
|
||||
|
||||
|
||||
private Image imgLoading = new Image(Icons.ICONS.loading());
|
||||
private HTML txtLoading = new HTML("");
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*
|
||||
* @param txtHTML the txt html
|
||||
*/
|
||||
public LoaderIcon(String txtHTML) {
|
||||
this();
|
||||
setText(txtHTML);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*/
|
||||
public LoaderIcon() {
|
||||
setStyleName("marginTop20");
|
||||
add(imgLoading);
|
||||
add(txtLoading);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text.
|
||||
*
|
||||
* @param txtHTML the new text
|
||||
*/
|
||||
public void setText(String txtHTML){
|
||||
txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Show.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
public void show(boolean bool){
|
||||
this.setVisible(bool);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,258 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.client.view.binder;
|
||||
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.dialog.PanelConfirmBuilder;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.LoaderIcon;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.FluidRow;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
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.user.client.Command;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class AbstractViewDialogBox.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jan 8, 2018
|
||||
*/
|
||||
public abstract class AbstractViewDialogBox extends Composite {
|
||||
|
||||
/** The ui binder. */
|
||||
private static AbstractViewDialogBoxUiBinder uiBinder =
|
||||
GWT.create(AbstractViewDialogBoxUiBinder.class);
|
||||
|
||||
/** The default width. */
|
||||
public static int DEFAULT_WIDTH = 500;
|
||||
|
||||
|
||||
/**
|
||||
* The Enum CONFIRM_VALUE.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Mar 13, 2018
|
||||
*/
|
||||
public static enum CONFIRM_VALUE {YES, NO}
|
||||
/**
|
||||
* The Interface AbstractViewDialogBoxUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Jan 9, 2018
|
||||
*/
|
||||
interface AbstractViewDialogBoxUiBinder
|
||||
extends UiBinder<Widget, AbstractViewDialogBox> {
|
||||
}
|
||||
|
||||
|
||||
/** The button close dialog. */
|
||||
@UiField
|
||||
Button button_close_dialog;
|
||||
|
||||
/** The field root panel. */
|
||||
@UiField
|
||||
HTMLPanel field_root_panel;
|
||||
|
||||
/** The scroll panel. */
|
||||
@UiField
|
||||
ScrollPanel scroll_panel;
|
||||
|
||||
/** The validator field. */
|
||||
@UiField
|
||||
FluidRow validator_field;
|
||||
|
||||
/** The loader icon. */
|
||||
private LoaderIcon loaderIcon = new LoaderIcon();
|
||||
|
||||
/** The alert error. */
|
||||
protected Alert alertError = new Alert();
|
||||
|
||||
|
||||
/** The alert info. */
|
||||
protected Alert alertInfo = new Alert();
|
||||
|
||||
|
||||
protected PanelConfirmBuilder confirmBuilder;
|
||||
|
||||
/**
|
||||
* Close handler.
|
||||
*/
|
||||
public abstract void closeHandler();
|
||||
|
||||
|
||||
/**
|
||||
* Confirm hanlder.
|
||||
*
|
||||
* @param confirm the confirm
|
||||
*/
|
||||
public abstract void confirmHanlder(CONFIRM_VALUE confirm, Command command);
|
||||
|
||||
/**
|
||||
* 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:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
* xmlns:g="urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName>
|
||||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
*/
|
||||
public AbstractViewDialogBox() {
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
//setWidth(DEFAULT_WIDTH+"px");
|
||||
|
||||
alertError.setType(AlertType.ERROR);
|
||||
alertError.setVisible(false);
|
||||
alertError.setClose(false);
|
||||
validator_field.add(alertError);
|
||||
|
||||
alertInfo.setType(AlertType.INFO);
|
||||
alertInfo.setVisible(false);
|
||||
alertInfo.setClose(false);
|
||||
validator_field.add(alertInfo);
|
||||
|
||||
showLoading(false, "");
|
||||
field_root_panel.add(loaderIcon);
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
button_close_dialog.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
closeHandler();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the view as widget.
|
||||
*
|
||||
* @param child the child
|
||||
*/
|
||||
public void addViewAsWidget(Widget child) {
|
||||
|
||||
scroll_panel.add(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show loading.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param text the text
|
||||
*/
|
||||
public void showLoading(boolean visible, String text){
|
||||
|
||||
try{
|
||||
validator_field.remove(loaderIcon);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
loaderIcon.setVisible(visible);
|
||||
loaderIcon.setText(text);
|
||||
|
||||
validator_field.add(loaderIcon);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param error the error
|
||||
*/
|
||||
public void setError(boolean visible, String error) {
|
||||
|
||||
try{
|
||||
validator_field.remove(alertError);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
alertError.setVisible(visible);
|
||||
alertError.setText(error==null?"":error);
|
||||
|
||||
validator_field.add(alertError);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param msg the msg
|
||||
*/
|
||||
public void setInfo(boolean visible, String msg) {
|
||||
|
||||
|
||||
try{
|
||||
validator_field.remove(alertInfo);
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
alertInfo.setVisible(visible);
|
||||
alertInfo.setText(msg==null?"":msg);
|
||||
|
||||
validator_field.add(alertInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the confirm.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param msg the msg
|
||||
*/
|
||||
public void setConfirm(boolean visible, String msg, final Command yes, final Command no){
|
||||
|
||||
try{
|
||||
validator_field.remove(confirmBuilder.getPanel());
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
|
||||
if(visible){
|
||||
|
||||
confirmBuilder = new PanelConfirmBuilder(null, null, msg, AlertType.WARNING) {
|
||||
|
||||
@Override
|
||||
public void onClickYesButton() {
|
||||
|
||||
confirmHanlder(CONFIRM_VALUE.YES, yes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickNoButton() {
|
||||
|
||||
confirmHanlder(CONFIRM_VALUE.NO, no);
|
||||
}
|
||||
};
|
||||
|
||||
validator_field.add(confirmBuilder.getPanel());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="field_root_panel">
|
||||
<g:ScrollPanel ui:field="scroll_panel">
|
||||
</g:ScrollPanel>
|
||||
<b:FluidRow ui:field="validator_field"></b:FluidRow>
|
||||
<g:HorizontalPanel>
|
||||
<b:Button type="LINK" ui:field="button_close_dialog" visible="false">Close</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,246 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.client.view.binder;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.WsTaskExecutorWidget;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.view.FormatUtil;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Pager;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.DomEvent;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* The Class CreateTaskConfigurationView.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* May 4, 2018
|
||||
*/
|
||||
public abstract class CreateTaskConfigurationView extends Composite {
|
||||
|
||||
/** The ui binder. */
|
||||
private static CreateTaskConfigurationViewUiBinder uiBinder =
|
||||
GWT.create(CreateTaskConfigurationViewUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface CreateTaskConfigurationViewUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* May 4, 2018
|
||||
*/
|
||||
interface CreateTaskConfigurationViewUiBinder
|
||||
extends UiBinder<Widget, CreateTaskConfigurationView> {
|
||||
}
|
||||
|
||||
/** The pager. */
|
||||
@UiField
|
||||
Pager pager;
|
||||
|
||||
|
||||
@UiField
|
||||
ListBox field_select_scope;
|
||||
|
||||
@UiField
|
||||
TextBox field_key_param;
|
||||
|
||||
@UiField
|
||||
TextBox field_value_param;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_input_task_id;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_select_vre;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_input_key_param;
|
||||
|
||||
@UiField
|
||||
ControlGroup cg_input_value_param;
|
||||
|
||||
|
||||
|
||||
@UiField
|
||||
TextBox field_task_id;
|
||||
|
||||
|
||||
/** The folder id. */
|
||||
private String folderId;
|
||||
|
||||
/** The map VR es. */
|
||||
private Map<String, GcubeScope> mapScopes = new HashMap<String, GcubeScope>();
|
||||
|
||||
|
||||
|
||||
private String currentScope;
|
||||
|
||||
|
||||
/**
|
||||
* Submit handler.
|
||||
*/
|
||||
public abstract void submitHandler();
|
||||
|
||||
/**
|
||||
* Sets the error.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param error the error
|
||||
*/
|
||||
public abstract void setError(boolean visible, String error);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the confirm.
|
||||
*
|
||||
* @param visible the visible
|
||||
* @param msg the msg
|
||||
*/
|
||||
public abstract void setConfirm(boolean visible, String msg);
|
||||
|
||||
|
||||
/**
|
||||
* 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:
|
||||
* <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
* xmlns:g="urn:import:**user's package**">
|
||||
* <g:**UserClassName**>Hello!</g:**UserClassName>
|
||||
* </ui:UiBinder>
|
||||
* Note that depending on the widget that is used, it may be necessary to
|
||||
* implement HasHTML instead of HasText.
|
||||
*
|
||||
* @param folderId the folder id
|
||||
*/
|
||||
public CreateTaskConfigurationView(String folderId) {
|
||||
this.folderId = folderId;
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
pager.getLeft().setVisible(false);
|
||||
|
||||
pager.getRight().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
setError(false, "");
|
||||
boolean isValid = validateSubmit();
|
||||
if(isValid)
|
||||
submitHandler();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
WsTaskExecutorWidget.greetingService.getListOfScopesForLoggedUser(new AsyncCallback<List<GcubeScope>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<GcubeScope> result) {
|
||||
|
||||
|
||||
for (GcubeScope gcubeScope : result) {
|
||||
String toValue = FormatUtil.toScopeValue(gcubeScope);
|
||||
mapScopes.put(gcubeScope.getScopeName(), gcubeScope);
|
||||
field_select_scope.addItem(toValue, gcubeScope.getScopeName());
|
||||
|
||||
}
|
||||
|
||||
if(result.size()>0){
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inits the field catalogue name.
|
||||
*/
|
||||
private void initFields() {
|
||||
|
||||
field_task_id.setText("");
|
||||
field_key_param.setText("");
|
||||
field_value_param.setText("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate submit.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
protected boolean validateSubmit() {
|
||||
cg_input_task_id.setType(ControlGroupType.NONE);
|
||||
cg_input_key_param.setType(ControlGroupType.NONE);
|
||||
cg_input_value_param.setType(ControlGroupType.NONE);
|
||||
//cg_remote_path.setType(ControlGroupType.NONE);
|
||||
|
||||
if(field_select_scope.getSelectedItemText()==null){
|
||||
cg_select_vre.setType(ControlGroupType.ERROR);
|
||||
setError(true, "You must select a Scope!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(field_task_id.getValue() == null || field_task_id.getValue().isEmpty()){
|
||||
cg_input_task_id.setType(ControlGroupType.ERROR);
|
||||
setError(true, "You must type an Algorithm Identifier!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(field_key_param.getValue() == null || field_key_param.getValue().isEmpty()){
|
||||
cg_input_key_param.setType(ControlGroupType.WARNING);
|
||||
setConfirm(true, "The key of input parameter is empty. Do you want continue anyway?");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(field_value_param.getValue() == null || field_value_param.getValue().isEmpty()){
|
||||
cg_input_key_param.setType(ControlGroupType.WARNING);
|
||||
setConfirm(true, "The value of input parameter is empty. Do you want continue anyway?");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the selected scope.
|
||||
*
|
||||
* @return the selected scope
|
||||
*/
|
||||
public GcubeScope getSelectedScope(){
|
||||
//String item = field_select_scope.getSelectedItemText();
|
||||
String text = field_select_scope.getSelectedValue();
|
||||
return mapScopes.get(text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
.noBorder {
|
||||
border: 0px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="form_unit_fields">
|
||||
<b:Form type="HORIZONTAL">
|
||||
<b:Fieldset styleName="{style.noBorder}">
|
||||
|
||||
<b:ControlGroup ui:field="cg_select_vre">
|
||||
<b:ControlLabel for="cl_select_vre">Execute in the Scope</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox name="Select a VRE..." b:id="field_select_scope"
|
||||
ui:field="field_select_scope">
|
||||
</b:ListBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:ControlGroup ui:field="cg_input_task_id">
|
||||
<b:ControlLabel for="cl_input_task_id">The Algorithm Id</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Type the Algorithm Identifier..."
|
||||
title="This is the Algorithm Identifier..." b:id="field_task_id"
|
||||
ui:field="field_task_id"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<b:Label>With Parameter</b:Label>
|
||||
<b:WellForm type="INLINE">
|
||||
<b:ControlGroup ui:field="cg_input_key_param">
|
||||
<b:ControlLabel for="cl_input_key_param">Parameter Key</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Type the Key Entry..." title="This is the key of Parameter"
|
||||
b:id="field_key_param" ui:field="field_key_param"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cg_input_value_param">
|
||||
<b:ControlLabel for="cl_input_value_param">Parameter Value</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:TextBox placeholder="Type the Value Entry..."
|
||||
title="This is the value of parameter" b:id="field_value_param"
|
||||
ui:field="field_value_param"></b:TextBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</b:WellForm>
|
||||
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
<b:Pager left="Older" right="Create Configuration and Do Sync"
|
||||
aligned="true" ui:field="pager" />
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,30 @@
|
|||
/** Add css rules here for your application. */
|
||||
.ws-thredds-modal-body div.modal-body {
|
||||
position: relative;
|
||||
max-height: 600px !important;
|
||||
padding: 15px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.textAreaWidth {
|
||||
width: 500px !important;
|
||||
}
|
||||
|
||||
.myMarginLeft {
|
||||
margin-left: 180px !important;
|
||||
}
|
||||
|
||||
.myLittleWidth {
|
||||
width: 40px !important;
|
||||
padding-left: 20px !important;
|
||||
}
|
||||
|
||||
.myFormWidth {
|
||||
width: 750px !important;
|
||||
}
|
||||
|
||||
.myLittleMarginLeft{
|
||||
|
||||
margin-left: 25px !important;
|
||||
|
||||
}
|
|
@ -1,7 +1,10 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.server;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.client.GreetingService;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.FieldVerifier;
|
||||
import org.gcube.portlets.widgets.wstaskexecutor.shared.GcubeScope;
|
||||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
|
||||
/**
|
||||
|
@ -11,38 +14,16 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|||
public class GreetingServiceImpl extends RemoteServiceServlet implements
|
||||
GreetingService {
|
||||
|
||||
public String greetServer(String input) throws IllegalArgumentException {
|
||||
// Verify that the input is valid.
|
||||
if (!FieldVerifier.isValidName(input)) {
|
||||
// If the input is not valid, throw an IllegalArgumentException back to
|
||||
// the client.
|
||||
throw new IllegalArgumentException(
|
||||
"Name must be at least 4 characters long");
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wstaskexecutor.client.GreetingService#getListOfScopesForLoggedUser()
|
||||
*/
|
||||
@Override
|
||||
public List<GcubeScope> getListOfScopesForLoggedUser()
|
||||
throws Exception {
|
||||
|
||||
String serverInfo = getServletContext().getServerInfo();
|
||||
String userAgent = getThreadLocalRequest().getHeader("User-Agent");
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
// Escape data from the client to avoid cross-site script vulnerabilities.
|
||||
input = escapeHtml(input);
|
||||
userAgent = escapeHtml(userAgent);
|
||||
|
||||
return "Hello, " + input + "!<br><br>I am running " + serverInfo
|
||||
+ ".<br><br>It looks like you are using:<br>" + userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape an html string. Escaping data received from the client helps to
|
||||
* prevent cross-site script vulnerabilities.
|
||||
*
|
||||
* @param html the html string to escape
|
||||
* @return the escaped string
|
||||
*/
|
||||
private String escapeHtml(String html) {
|
||||
if (html == null) {
|
||||
return null;
|
||||
}
|
||||
return html.replaceAll("&", "&").replaceAll("<", "<").replaceAll(
|
||||
">", ">");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.shared;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* FieldVerifier validates that the name the user enters is valid.
|
||||
* </p>
|
||||
* <p>
|
||||
* This class is in the <code>shared</code> packing because we use it in both
|
||||
* the client code and on the server. On the client, we verify that the name is
|
||||
* valid before sending an RPC request so the user doesn't have to wait for a
|
||||
* network round trip to get feedback. On the server, we verify that the name is
|
||||
* correct to ensure that the input is correct regardless of where the RPC
|
||||
* originates.
|
||||
* </p>
|
||||
* <p>
|
||||
* When creating a class that is used on both the client and the server, be sure
|
||||
* that all code is translatable and does not use native JavaScript. Code that
|
||||
* is note translatable (such as code that interacts with a database or the file
|
||||
* system) cannot be compiled into client side JavaScript. Code that uses native
|
||||
* JavaScript (such as Widgets) cannot be run on the server.
|
||||
* </p>
|
||||
*/
|
||||
public class FieldVerifier {
|
||||
|
||||
/**
|
||||
* Verifies that the specified name is valid for our service.
|
||||
*
|
||||
* In this example, we only require that the name is at least four
|
||||
* characters. In your application, you can use more complex checks to ensure
|
||||
* that usernames, passwords, email addresses, URLs, and other fields have the
|
||||
* proper syntax.
|
||||
*
|
||||
* @param name the name to validate
|
||||
* @return true if valid, false if invalid
|
||||
*/
|
||||
public static boolean isValidName(String name) {
|
||||
if (name == null) {
|
||||
return false;
|
||||
}
|
||||
return name.length() > 3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
package org.gcube.portlets.widgets.wstaskexecutor.shared;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class GcubeVRE.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 14, 2018
|
||||
*/
|
||||
public class GcubeScope implements Serializable, IsSerializable, Comparable<GcubeScope>{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6427520549519606384L;
|
||||
|
||||
|
||||
private GcubeScopeType scopeType;
|
||||
|
||||
|
||||
private String scopeTitle;
|
||||
|
||||
|
||||
private String scopeName;
|
||||
|
||||
/**
|
||||
* Instantiates a new gcube VRE.
|
||||
*/
|
||||
public GcubeScope() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new gcube scope.
|
||||
*
|
||||
* @param scopeTitle the scope title
|
||||
* @param scopeName the scope name
|
||||
* @param scopeType the scope type
|
||||
*/
|
||||
public GcubeScope(String scopeTitle, String scopeName, GcubeScopeType scopeType) {
|
||||
|
||||
super();
|
||||
this.scopeTitle = scopeTitle;
|
||||
this.scopeName = scopeName;
|
||||
this.scopeType = scopeType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the scopeType
|
||||
*/
|
||||
public GcubeScopeType getScopeType() {
|
||||
|
||||
return scopeType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the scopeTitle
|
||||
*/
|
||||
public String getScopeTitle() {
|
||||
|
||||
return scopeTitle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the scopeName
|
||||
*/
|
||||
public String getScopeName() {
|
||||
|
||||
return scopeName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param scopeType the scopeType to set
|
||||
*/
|
||||
public void setScopeType(GcubeScopeType scopeType) {
|
||||
|
||||
this.scopeType = scopeType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param scopeTitle the scopeTitle to set
|
||||
*/
|
||||
public void setScopeTitle(String scopeTitle) {
|
||||
|
||||
this.scopeTitle = scopeTitle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param scopeName the scopeName to set
|
||||
*/
|
||||
public void setScopeName(String scopeName) {
|
||||
|
||||
this.scopeName = scopeName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(GcubeScope o) {
|
||||
|
||||
if(o==null)
|
||||
return -1;
|
||||
|
||||
return this.getScopeName().compareTo(o.getScopeName());
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GcubeScope [scopeType=");
|
||||
builder.append(scopeType);
|
||||
builder.append(", scopeTitle=");
|
||||
builder.append(scopeTitle);
|
||||
builder.append(", scopeName=");
|
||||
builder.append(scopeName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.wstaskexecutor.shared;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Enum GcubeScopeType.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Mar 12, 2018
|
||||
*/
|
||||
public enum GcubeScopeType {
|
||||
|
||||
ROOT,
|
||||
VO,
|
||||
VRE
|
||||
}
|
Loading…
Reference in New Issue