This commit is contained in:
Massimiliano Assante 2015-04-24 15:12:02 +00:00
parent 184c47cd73
commit 2e52ed2606
10 changed files with 118 additions and 151 deletions

View File

@ -30,6 +30,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
@ -38,5 +48,6 @@
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/Users/massi/Documents/workspace/invite-friends-vre/target/invite-friends-vre-0.0.1-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
entryPointModules=

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.invitefriends.client;
import org.gcube.portlets.user.invitefriends.client.ui.InviteWidget;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
@ -13,6 +15,6 @@ public class InviteFriends implements EntryPoint {
* This is the entry point method.
*/
public void onModuleLoad() {
RootPanel.get("invite-friends-DIV").add(new InviteFriendsPanel());
RootPanel.get("invite-friends-DIV").add(new InviteWidget());
}
}

View File

@ -1,89 +0,0 @@
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;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
*
* @author M. Assante, ISTI-CNR
*
*/
public class InviteFriendsPanel extends Composite {
private final InviteServiceAsync service = GWT.create(InviteService.class);
public static final String DISPLAY_NAME = "Invite people to this VRE";
private Image loadingImage;
private VerticalPanel mainPanel;
public InviteFriendsPanel() {
super();
mainPanel = new VerticalPanel();
mainPanel.setWidth("100%");
mainPanel.setStyleName("invites-frame");
HTML name = new HTML(DISPLAY_NAME);
name.setStyleName("invites-title");
HorizontalPanel hp = new HorizontalPanel();
hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
hp.add(name);
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);
send.addClickHandler(new ClickHandler() {
@Override
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);
}
});
}
private void showLoader() {
mainPanel.clear();
mainPanel.setWidth("100%");
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
mainPanel.add(loadingImage);
}
}

View File

@ -1,46 +0,0 @@
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

@ -1,13 +0,0 @@
<!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,57 @@
package org.gcube.portlets.user.invitefriends.client.ui;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Form;
import com.github.gwtbootstrap.client.ui.HelpBlock;
import com.github.gwtbootstrap.client.ui.Modal;
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.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
/**
*
* @author Massimiliano Assante, ISTI-CNR
*
*/
public class InviteWidget extends Composite {
public static final String DISPLAY_NAME = "Invite people to this VRE";
private static InviteWidgetUiBinder uiBinder = GWT
.create(InviteWidgetUiBinder.class);
interface InviteWidgetUiBinder extends UiBinder<Widget, InviteWidget> {
}
@UiField HTML header;
@UiField TextBox emailAddress;
@UiField Button openModal;
@UiField Button cancelInvite;
@UiField Button sendInvite;
@UiField Modal modalWindow;
@UiField Form mainForm;
@UiField HelpBlock helpBlock;
public InviteWidget() {
initWidget(uiBinder.createAndBindUi(this));
header.setText(DISPLAY_NAME);
}
@UiHandler("openModal")
public void onClick(ClickEvent e) {
helpBlock.setText("We will send the invitation email to: "+emailAddress.getText());
modalWindow.show();
}
@UiHandler("cancelInvite")
public void onCancelClick(ClickEvent e) {
modalWindow.hide();
}
}

View File

@ -0,0 +1,35 @@
<!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">
<g:HTMLPanel styleName="invites-frame">
<g:HTML ui:field="header" styleName="invites-title"></g:HTML>
<b:Form type="VERTICAL">
<b:Fieldset>
<b:ControlGroup>
<b:TextBox placeholder="e-mail address" ui:field="emailAddress"></b:TextBox>
</b:ControlGroup>
<b:Button ui:field="openModal">Send Invite</b:Button>
</b:Fieldset>
</b:Form>
<b:Modal ui:field="modalWindow" title="Invite Friend"
backdrop="STATIC" keyboard="true" animation="true">
<b:Form type="VERTICAL" ui:field="mainForm">
<b:Fieldset>
<b:ControlGroup>
<b:HelpBlock styleName="helpFontSize">Please, enter name and lastname of the friend you
wish to invite:</b:HelpBlock>
<b:TextBox placeholder="name"></b:TextBox>
<b:TextBox placeholder="last name"></b:TextBox>
<b:HelpBlock ui:field="helpBlock" styleName="helpFontSize"></b:HelpBlock>
</b:ControlGroup>
</b:Fieldset>
</b:Form>
<b:ModalFooter>
<b:Button ui:field="cancelInvite">Cancel</b:Button>
<b:Button ui:field="sendInvite" type="PRIMARY">Send Invite</b:Button>
</b:ModalFooter>
</b:Modal>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,7 +1,10 @@
#invite-friends-DIV {
margin-right: 10px;
}
.helpFontSize {
font-size: 14px;
}
.invites-title {
display: block;
font-size: 16px;
@ -11,7 +14,8 @@
}
.invites-frame {
padding: 10px;
padding: 10px 10px 0px;
margin-right: 10px;
background-color: #FFF;
border-radius: 6px !important;
-moz-border-radius: 6px !important;