gwt bootstrap integrated

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/invite-friends-vre@114385 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2015-04-23 17:44:22 +00:00
parent 208546c1f5
commit 184c47cd73
23 changed files with 348 additions and 119 deletions

View File

@ -39,6 +39,5 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="output" path="target/invite-friends-vre-0.0.1-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -3,5 +3,4 @@ encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding//target/generated-sources/gwt=UTF-8
encoding/<project>=UTF-8

2
distro/INSTALL Normal file
View File

@ -0,0 +1,2 @@

7
distro/LICENSE Normal file
View File

@ -0,0 +1,7 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

6
distro/MAINTAINERS Normal file
View File

@ -0,0 +1,6 @@
Mantainers
-------
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".

35
distro/README Normal file
View File

@ -0,0 +1,35 @@
The gCube System - Social Library
------------------------------------------------------------
This work is partially funded by the European Commission in the
context of the iMarine project (www.i-marine.eu), under the 1st call of FP7 IST priority.
Authors
-------
Massimiliano Assante
*
Version and Release Date
------------------------
Jan 2013
Description
-----------
Social networking Library
Download information
--------------------
Source code is available from SVN:
https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user
Binaries can be downloaded from:
http://software.d4science.research-infrastructures.eu/
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

6
distro/changelog.xml Normal file
View File

@ -0,0 +1,6 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlet.user.invite-friends-vre.1-0-0"
date="2015-04-30">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

48
distro/descriptor.xml Normal file
View File

@ -0,0 +1,48 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>target/apidocs</directory>
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/profile.xml</source>
<outputDirectory>./</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>target/${build.finalName}.war</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

25
distro/profile.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${Description}</Description>
<Class>PortletUser</Class>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>target/${build.finalName}.war</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

1
distro/svnpath.txt Normal file
View File

@ -0,0 +1 @@
${scm.url}

View File

@ -62,6 +62,11 @@
<artifactId>gwt-dev</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@ -184,7 +189,7 @@
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
<!-- <goal>test</goal> -->
<goal>generateAsync</goal>
</goals>
</execution>

View File

@ -2,9 +2,15 @@ package org.gcube.portlets.user.invitefriends.client;
import org.gcube.portlets.user.invitefriends.client.resources.Images;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.ModalFooter;
import com.github.gwtbootstrap.client.ui.TextBox;
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.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasAlignment;
@ -20,40 +26,56 @@ import com.google.gwt.user.client.ui.VerticalPanel;
public class InviteFriendsPanel extends Composite {
private final InviteServiceAsync service = GWT.create(InviteService.class);
public static final String DISPLAY_NAME = "Invite your friends";
public static final String DISPLAY_NAME = "Invite people to this VRE";
private Image loadingImage;
private Image postToImage;
private VerticalPanel mainPanel = new VerticalPanel();
private VerticalPanel mainPanel;
public InviteFriendsPanel() {
super();
mainPanel = new VerticalPanel();
mainPanel.setWidth("100%");
mainPanel.setStyleName("invites-frame");
Images images = GWT.create(Images.class);
loadingImage = new Image(images.membersLoader().getSafeUri());
postToImage = new Image(images.postToIcon().getSafeUri());
HTML name = new HTML(DISPLAY_NAME);
name.setStyleName("invites-title");
HorizontalPanel hp = new HorizontalPanel();
hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
hp.add(name);
postToImage.setStyleName("mail-image");
hp.add(postToImage);
TextBox text = new TextBox();
text.setPlaceholder("e-mail address");
Button send = new Button("Send Invite");
mainPanel.add(hp);
mainPanel.add(text);
mainPanel.add(send);
initWidget(mainPanel);
postToImage.addClickHandler(new ClickHandler() {
send.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
public void onClick(ClickEvent arg0) {
Modal mod = new Modal();
mod.add(new Label("Ciao"));
ModalFooter mf = new ModalFooter();
Button asend = new Button("Send");
mf.add(asend);
mod.setAnimation(true);
mod.show();
mod.add(mf);
}
});
}

View File

@ -0,0 +1,46 @@
package org.gcube.portlets.user.invitefriends.client.ui;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
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.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;
public class Form extends Composite implements HasText {
private static FormUiBinder uiBinder = GWT.create(FormUiBinder.class);
interface FormUiBinder extends UiBinder<Widget, Form> {
}
public Form() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiField
Button button;
public Form(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
button.setText(firstName);
}
@UiHandler("button")
void onClick(ClickEvent e) {
Window.alert("Hello!");
}
public void setText(String text) {
button.setText(text);
}
public String getText() {
return button.getText();
}
}

View File

@ -0,0 +1,13 @@
<!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">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
Hello,
<g:Button styleName="{style.important}" ui:field="button" />
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,30 @@
package org.gcube.portlets.user.invitefriends.server.portlet;
import javax.portlet.GenericPortlet;
import javax.portlet.ActionRequest;
import javax.portlet.RenderRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderResponse;
import javax.portlet.PortletException;
import java.io.IOException;
import javax.portlet.PortletRequestDispatcher;
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
/**
*
* @author Massimiliano Assante, ISTI-CNR - massimiliano.assante@isti.cnr.it
*/
public class InviteFriendsPortlet extends GenericPortlet {
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
response.setContentType("text/html");
ScopeHelper.setContext(request);
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/WEB-INF/jsp/InviteFriends_view.jsp");
dispatcher.include(request, response);
}
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
}
}

View File

@ -1,22 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='InviteFriends'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<module rename-to='invitefriends'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<entry-point
class='org.gcube.portlets.user.invitefriends.client.InviteFriends' />
<!-- Specify the app entry point class. -->
<entry-point class='org.gcube.portlets.user.invitefriends.client.InviteFriends' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
</module>

View File

@ -9,22 +9,14 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!-- -->
<!-- Consider inlining CSS to reduce the number of requested files -->
<!-- -->
<link type="text/css" rel="stylesheet" href="InviteFriends.css">
<!-- -->
<!-- Any title is fine -->
<!-- -->
<link type="text/css" rel="stylesheet" href="InviteFriends.css">
<title>Web Application Starter Project</title>
<!-- -->
<!-- This script loads your compiled module. -->
<!-- If you add any GWT meta tags, they must -->
<!-- be added before this line. -->
<!-- -->
<script type="text/javascript" language="javascript" src="InviteFriends/InviteFriends.nocache.js"></script>
<script type="text/javascript" src="invitefriends/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="invitefriends/js/bootstrap.min.js"></script>
<script type="text/javascript" language="javascript" src="invitefriends/invitefriends.nocache.js"></script>
</head>
<!-- -->

View File

@ -0,0 +1,22 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%-- Uncomment below lines to add portlet taglibs to jsp
<%@ page import="javax.portlet.*"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />
--%>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript"
src="<%=request.getContextPath()%>/invitefriends/js/jquery-1.10.1.min.js"></script>
<script type="text/javascript"
src="<%=request.getContextPath()%>/invitefriends/js/bootstrap.min.js"></script>
<script type="text/javascript"
src='<%=request.getContextPath()%>/invitefriends/invitefriends.nocache.js'></script>
<div id="invite-friends-DIV"></div>

View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
<display>
<category name="gCube Social Apps">
<portlet id="InviteFriends" />
</category>
</display>

View File

@ -0,0 +1,9 @@
name=InviteFriends
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
change-log=
page-url=http://www.d4science.org
author=D4Science Org.
licenses=EUPL

View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>InviteFriends</portlet-name>
<layout-cacheable>false</layout-cacheable>
<instanceable>false</instanceable>
<ajaxable>false</ajaxable>
<!-- LOCATION CSS HERE -->
<header-portlet-css>/InviteFriends.css</header-portlet-css>
</portlet>
</liferay-portlet-app>

View File

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
version="2.0">
<portlet>
<portlet-name>InviteFriends</portlet-name>
<display-name>gCube Invite Friends</display-name>
<portlet-class>org.gcube.portlets.user.invitefriends.server.portlet.InviteFriendsPortlet</portlet-class>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
</supports>
<portlet-info>
<title>Invite Friends</title>
<short-title>Invite Friends</short-title>
<keywords>Invite Friends</keywords>
</portlet-info>
</portlet>
</portlet-app>

View File

@ -1,75 +0,0 @@
package org.gcube.portlets.user.invitefriends.client;
import org.gcube.portlets.user.invitefriends.shared.FieldVerifier;
import com.google.gwt.core.client.GWT;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
/**
* GWT JUnit <b>integration</b> tests must extend GWTTestCase.
* Using <code>"GwtTest*"</code> naming pattern exclude them from running with
* surefire during the test phase.
*
* If you run the tests using the Maven command line, you will have to
* navigate with your browser to a specific url given by Maven.
* See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html
* for details.
*/
public class GwtTestInviteFriends extends GWTTestCase {
/**
* Must refer to a valid module that sources this class.
*/
public String getModuleName() {
return "org.gcube.portlets.user.invitefriends.InviteFriendsJUnit";
}
/**
* Tests the FieldVerifier.
*/
public void testFieldVerifier() {
assertFalse(FieldVerifier.isValidName(null));
assertFalse(FieldVerifier.isValidName(""));
assertFalse(FieldVerifier.isValidName("a"));
assertFalse(FieldVerifier.isValidName("ab"));
assertFalse(FieldVerifier.isValidName("abc"));
assertTrue(FieldVerifier.isValidName("abcd"));
}
/**
* This test will send a request to the server using the greetServer method in
* InviteService and verify the response.
*/
public void testGreetingService() {
// Create the service that we will test.
GreetingServiceAsync greetingService = GWT.create(InviteService.class);
ServiceDefTarget target = (ServiceDefTarget) greetingService;
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "InviteFriends/greet");
// Since RPC calls are asynchronous, we will need to wait for a response
// after this test method returns. This line tells the test runner to wait
// up to 10 seconds before timing out.
delayTestFinish(10000);
// Send a request to the server.
greetingService.greetServer("GWT User", new AsyncCallback<String>() {
public void onFailure(Throwable caught) {
// The request resulted in an unexpected error.
fail("Request failure: " + caught.getMessage());
}
public void onSuccess(String result) {
// Verify that the response is correct.
assertTrue(result.startsWith("Hello, GWT User!"));
// Now that we have received a response, we need to tell the test runner
// that the test is complete. You must call finishTest() after an
// asynchronous test finishes successfully, or the test will time out.
finishTest();
}
});
}
}