onModuleLoad()
.
+ */
+public class InvitesWidget implements EntryPoint {
+ /**
+ * This is the entry point method.
+ */
+ public void onModuleLoad() {
+ RootPanel.get("invite-friends-DIV").add(new InviteWidget());
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/widgets/inviteswidget/client/ui/FormViewImpl.java b/src/main/java/org/gcube/portlets/widgets/inviteswidget/client/ui/FormViewImpl.java
new file mode 100644
index 0000000..3d35dae
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/widgets/inviteswidget/client/ui/FormViewImpl.java
@@ -0,0 +1,164 @@
+/**
+ *
+ */
+package org.gcube.portlets.widgets.inviteswidget.client.ui;
+
+import org.gcube.portal.databook.shared.InviteOperationResult;
+import org.gcube.portlets.widgets.inviteswidget.client.InviteService;
+import org.gcube.portlets.widgets.inviteswidget.client.InviteServiceAsync;
+import org.gcube.portlets.widgets.inviteswidget.client.validation.FormView;
+
+import com.github.gwtbootstrap.client.ui.Button;
+import com.github.gwtbootstrap.client.ui.ControlGroup;
+import com.github.gwtbootstrap.client.ui.HelpBlock;
+import com.github.gwtbootstrap.client.ui.Modal;
+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.editor.client.Editor;
+import com.google.gwt.editor.client.EditorDriver;
+import com.google.gwt.editor.client.SimpleBeanEditorDriver;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+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.Timer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ *
+ * @author Massimiliano Assante, ISTI-CNR
+ *
+ */
+public class FormViewImpl extends Composite implements FormView, Editor+ * FieldVerifier validates that the name the user enters is valid. + *
+ *
+ * This class is in the shared
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.
+ *
+ * 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. + *
+ */ +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; + } +} diff --git a/src/main/resources/org/gcube/portlets/widgets/inviteswidget/InvitesWidget.gwt.xml b/src/main/resources/org/gcube/portlets/widgets/inviteswidget/InvitesWidget.gwt.xml new file mode 100644 index 0000000..fe892e5 --- /dev/null +++ b/src/main/resources/org/gcube/portlets/widgets/inviteswidget/InvitesWidget.gwt.xml @@ -0,0 +1,20 @@ + +