almost ready

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/questions@101770 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-11-28 14:13:31 +00:00
parent acffbbe418
commit 240cdf5f1b
13 changed files with 235 additions and 63 deletions

View File

@ -1,20 +1,15 @@
package org.gcube.portlets.user.questions.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Questions implements EntryPoint {
/**
* Create a remote service proxy to talk to the server-side Greeting service.
*/
private final QuestionsServiceAsync greetingService = GWT.create(QuestionsService.class);
public void onModuleLoad() {
RootPanel.get("questionsManagersDiv").add(new VREManagersPanel());
}
}

View File

@ -0,0 +1,69 @@
package org.gcube.portlets.user.questions.client;
import java.util.ArrayList;
import org.gcube.portal.databook.shared.UserInfo;
import org.gcube.portlets.user.questions.client.resources.Images;
import org.gcube.portlets.user.questions.client.ui.DisplayBadge;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
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.Image;
import com.google.gwt.user.client.ui.VerticalPanel;
public class VREManagersPanel extends Composite {
private final QuestionsServiceAsync service = GWT.create(QuestionsService.class);
private Image loadingImage;
private VerticalPanel mainPanel = new VerticalPanel();
public VREManagersPanel() {
super();
Images images = GWT.create(Images.class);
loadingImage = new Image(images.membersLoader().getSafeUri());
mainPanel.add(loadingImage);
showLoader();
service.getManagers(new AsyncCallback<ArrayList<UserInfo>>() {
@Override
public void onSuccess(ArrayList<UserInfo> users) {
mainPanel.clear();
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
if (users == null || users.isEmpty()) {
mainPanel.add(new HTML("<div class=\"frame\" style=\"font-size: 16px;\">Ops, something went wrong. Please <a href=\"javascript: location.reload();\">reload<a/> this page.</div>"));
} else {
for (int i = 0; i < users.size(); i++) {
mainPanel.add(new DisplayBadge(users.get(i)));
}
}
}
@Override
public void onFailure(Throwable caught) {
mainPanel.add(new HTML("<div class=\"nofeed-message\">" +
"Sorry, looks like something is broken with the server connection<br> " +
"Please check your connection and try refresh this page.</div>"));
}
});
initWidget(mainPanel);
}
private void showLoader() {
mainPanel.clear();
mainPanel.setWidth("100%");
mainPanel.setHeight("300px");
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
mainPanel.add(loadingImage);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 997 B

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.questions.client.resources;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
public interface Images extends ClientBundle {
@Source("avatarLoader.gif")
ImageResource avatarLoader();
@Source("Avatar_default.png")
ImageResource avatarDefaultImage();
@Source("members-loader.gif")
ImageResource membersLoader();
@Source("post-to.png")
ImageResource postToIcon();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.questions.client.ui;
import org.gcube.portal.databook.shared.UserInfo;
import org.gcube.portlets.user.questions.client.resources.Images;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.AnchorElement;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Widget;
public class DisplayBadge extends Composite {
private static DisplayBadgeUiBinder uiBinder = GWT.create(DisplayBadgeUiBinder.class);
interface DisplayBadgeUiBinder extends UiBinder<Widget, DisplayBadge> { }
@UiField HTMLPanel mainPanel;
@UiField Image avatarImage;
@UiField Image postToImage;
@UiField HTML userFullName;
@UiField HTML headlineLabel;
@UiField HTML institutionLabel;
@UiField AnchorElement imageRedirect;
private UserInfo myUserInfo;
public DisplayBadge(UserInfo user) {
initWidget(uiBinder.createAndBindUi(this));
Images images = GWT.create(Images.class);
postToImage.setUrl(images.postToIcon().getSafeUri());
avatarImage.setUrl(images.avatarLoader().getSafeUri());
mainPanel.addStyleName("profile-section");
myUserInfo = user;
avatarImage.getElement().getParentElement().setAttribute("href", myUserInfo.getAvatarId());
if (myUserInfo.getAvatarId() == null)
avatarImage.setUrl(images.avatarDefaultImage().getSafeUri());
else
avatarImage.setUrl(myUserInfo.getAvatarId());
userFullName.setHTML("<a class=\"manager-person-link\" href=\""+user.getAccountURL()+"\">"+myUserInfo.getFullName()+"</a>");
headlineLabel.setText("Head");
institutionLabel.setText("Isti");
imageRedirect.setHref("");
String title = "See profile of " + myUserInfo.getFullName();
avatarImage.setTitle(title);
userFullName.setTitle(title);
}
}

View File

@ -0,0 +1,31 @@
<!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:m="urn:import:org.gcube.portlets.user.gcubewidgets.client.elements">
<g:HTMLPanel ui:field="mainPanel">
<table>
<tr>
<td>
<div class="manager-photo-details">
<a ui:field="imageRedirect" href="">
<g:Image title="Profile Picture" styleName="manager-user-photo"
url="" ui:field="avatarImage" />
</a>
</div>
</td>
<td>
<div class="manager-user-details">
<g:HTML styleName="manager-fullName" ui:field="userFullName"></g:HTML>
<g:HTML styleName="manager-headline" ui:field="headlineLabel"></g:HTML>
<g:HTML styleName="manager-institution" ui:field="institutionLabel"></g:HTML>
</div>
</td>
<td>
<div class="manager-action">
<g:Image title="Post question to the manager" ui:field="postToImage" styleName="manager-post-image"/>
</div>
</td>
</tr>
</table>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -53,7 +53,7 @@ public class QuestionsServiceImpl extends RemoteServiceServlet implements Questi
*/
public String getDevelopmentUser() {
String user = TEST_USER;
//user = "massimiliano.assante";
user = "massimiliano.assante";
return user;
}
@ -99,11 +99,11 @@ public class QuestionsServiceImpl extends RemoteServiceServlet implements Questi
}
}
} else {
toReturn.add(new UserInfo("pino.pino", "With Photo Third User", "avatarid1", "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("giorgi.giorgi", "Test Fourth User", "avatarid2", "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("pinetti.giorgi", "Test Fifth User", "avatarid3", "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("massimiliano.pinetti", "Test Sixth User", "avatarid3", "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("massimiliano.giorgi", "Eighth Testing User", "avatarid3", "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("pino.pino", "With Photo Third User", null, "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("giorgi.giorgi", "Test Fourth User", null, "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("pinetti.giorgi", "Test Fifth User", null, "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("massimiliano.pinetti", "Test Sixth User", null, "email@email.it", "", true, false, null));
toReturn.add(new UserInfo("massimiliano.giorgi", "Eighth Testing User", null, "email@email.it", "", true, false, null));
}
return toReturn;
}

View File

@ -1,34 +1,62 @@
/** Add css rules here for your application. */
/** Example rules used by the template application (remove for your app) */
h1 {
font-size: 2em;
font-weight: bold;
color: #777777;
margin: 40px 0px 70px;
text-align: center;
.manager-user-photo {
padding: 5px;
border: 1px solid #E6E6E6;
width: 50px;
height: 50px;
}
.sendButton {
display: block;
font-size: 16pt;
.manager-user-details {
min-width: 200px;
padding: 5px;
}
/** Most GWT widgets already have a style name defined */
.gwt-DialogBox {
width: 400px;
.manager-photo-details {
width: 70px;
text-align: center;
}
.dialogVPanel {
margin: 5px;
.manager-action {
width: 32px;
text-align: center;
}
.serverResponseLabelError {
color: red;
.manager-post-image:hover {
cursor: pointer;
cursor: hand;
opacity: 0.7;
}
/** Set ids using widget.getElement().setId("idOfElement") */
#closeButton {
margin: 15px 6px 6px;
a.manager-person-link {
color: #444444;
font-size: 15px;
font-weight: bold;
line-height: 18px;
}
a.manager-person-link,a.manager-person-link:visited {
cursor: pointer;
cursor: hand;
font-size: 16x;
text-decoration: none;
color: #3B5998;
}
a.manager-person-link:hover {
opacity: 0.8;
font-size: 16x;
text-decoration: underline;
}
.manager-headline {
font-size: 13px;
color: #444444;
line-height: 16px;
}
.manager-institution {
font-size: 11px;
color: #444444;
}

View File

@ -34,30 +34,13 @@
<!-- -->
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
<noscript>
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
<h1>Web Application Starter Project</h1>
<table align="center">
<tr>
<td colspan="2" style="font-weight:bold;">Please enter your name:</td>
</tr>
<tr>
<td id="nameFieldContainer"></td>
<td id="sendButtonContainer"></td>
</tr>
<tr>
<td colspan="2" style="color:red;" id="errorLabelContainer"></td>
</tr>
</table>
<div id="questionsManagersDiv"></div>
</body>
</html>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<!-- Inherit our applications main module. -->
<inherits name='org.gcube.portlets.user.questions.Questions' />
<!-- Specify the path to any remote services. -->
<servlet path="/Questions/greet" class="org.gcube.portlets.user.questions.server.GreetingServiceImpl" />
</module>