Massimiliano Assante 6 years ago
parent
commit
565b82ba8d
  1. 1
      .tern-project
  2. 3
      src/main/java/org/gcube/portlets/user/gcubeloggedin/client/GCubeLoggedin.java
  3. 66
      src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.java
  4. 29
      src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.ui.xml
  5. 14
      src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java
  6. 72
      src/main/webapp/GCubeLoggedin.css

1
.tern-project

@ -0,0 +1 @@
{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]}

3
src/main/java/org/gcube/portlets/user/gcubeloggedin/client/GCubeLoggedin.java

@ -1,11 +1,8 @@
package org.gcube.portlets.user.gcubeloggedin.client;
import org.gcube.portlets.user.gcubeloggedin.client.ui.AboutView;
import org.gcube.portlets.user.gcubeloggedin.client.ui.LoadingText;
import org.gcube.portlets.user.gcubeloggedin.shared.VObject;
import com.github.gwtbootstrap.client.ui.Hero;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window.Location;

66
src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.java

@ -6,6 +6,10 @@ import org.gcube.portlets.user.gcubeloggedin.shared.VREClient;
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.Hero;
import com.github.gwtbootstrap.client.ui.Image;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.event.dom.client.ClickEvent;
@ -17,16 +21,16 @@ import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Anchor;
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.Widget;
public class AboutView extends Composite {
private static int MAX_CHAR_DESC = 700;
private static int MAX_CHAR_DESC = 400;
private static String SEE_LESS = "See less";
private static String SEE_MORE = "See more";
private static AboutViewUiBinder uiBinder = GWT
.create(AboutViewUiBinder.class);
@ -38,31 +42,33 @@ public class AboutView extends Composite {
}
private WarningAlert wa;
private String vreDescription;
private String vreImage;
@UiField HTMLPanel htmlPanel;
@UiField Image vreImage;
@UiField Heading vreName;
@UiField HTML description;
@UiField Anchor backButton;
@UiField Anchor leaveButton;
@UiField Button seeMore;
@UiField Button leaveButton;
@UiField Hero mainPanel;
private LoggedinServiceAsync loggedinService;
public AboutView(VObject vobj, LoggedinServiceAsync loggedinService) {
initWidget(uiBinder.createAndBindUi(this));
this.loggedinService = loggedinService;
vreImage = vobj.getImageURL();
this.vreDescription = vobj.getDescription();
vreName.setText(vobj.getName());
vreImage.setUrl(vobj.getImageURL());
String desc = vreDescription = vobj.getDescription();
if (desc.length() > MAX_CHAR_DESC) {
desc = desc.substring(0, MAX_CHAR_DESC) + " ...";
//description.getElement().setInnerHTML(desc);
description.setHTML(desc);
description.addStyleName("vre-description");
seeMore.setVisible(true);
seeMore.setText(SEE_MORE);
}
description.setHTML("<img class=\"imageVRE\" src=\"" + vreImage + "\" />" + desc);
leaveButton.setStyleName("leave-group");
if (vobj instanceof VREClient && !vobj.isMandatory()) {
leaveButton.setVisible(true);
wa = new WarningAlert("Are you sure you want to leave this group? "
+ "By leaving this group you will no longer receive updates and lose the workspace folder related to the group.", this);
}
@ -76,30 +82,32 @@ public class AboutView extends Composite {
}
}
}
boolean open = false;
@UiHandler("seeMore")
void onSeeMoreClick(ClickEvent e) {
description.setHTML("<img class=\"imageVRE\" src=\"" + vreImage + "\" />" + vreDescription);
seeMore.removeFromParent();
}
@UiHandler("backButton")
void onClick(ClickEvent e) {
void onSeemore(ClickEvent e) {
GWT.log(seeMore.getText());
if (!open) {
description.setHTML(vreDescription);
seeMore.setText(SEE_LESS);
open = true;
} else {
description.setHTML(vreDescription.substring(0, MAX_CHAR_DESC) + " ...");
seeMore.setText(SEE_MORE);
open = false;
}
}
@UiHandler("leaveButton")
void onUnsubscribe(ClickEvent e) {
htmlPanel.add(wa);
mainPanel.add(wa);
}
protected void abandonGroup() {
htmlPanel.remove(wa);
mainPanel.remove(wa);
final Widget loading = getLoadingHTML();
htmlPanel.add(loading);
mainPanel.add(loading);
loggedinService.removeUserFromVRE(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
@ -111,7 +119,7 @@ public class AboutView extends Composite {
}
@Override
public void onFailure(Throwable caught) {
htmlPanel.remove(loading);
mainPanel.remove(loading);
Window.alert("We're sorry we couldn't reach the server, try again later ... " + caught.getMessage());
}
});

29
src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.ui.xml

@ -1,19 +1,20 @@
<!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">
<b:Hero ui:field="mainPanel">
<b:Image ui:field="vreImage" />
<!-- The Caption is optional -->
<b:Caption>
<b:Heading size="3" ui:field="vreName">Thumbnail label</b:Heading>
<g:HTML ui:field="description">
</g:HTML>
<g:HTMLPanel ui:field="htmlPanel" styleName="envhome-frame">
<div id="vre-header-container">
<ul id="vre-header">
<li>
<g:Anchor ui:field="backButton" href="#"><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></g:Anchor>
</li>
<li id="removable-item-li">
<g:Anchor ui:field="leaveButton" href="#">Leave Group</g:Anchor>
</li>
</ul>
</div>
<g:HTML ui:field="description" styleName="description"></g:HTML>
<b:Button ui:field="seeMore" type="LINK" visible="false" >See more</b:Button>
</g:HTMLPanel>
<b:ControlGroup>
<b:Paragraph>
<b:Button type="LINK" visible="false" ui:field="seeMore">See more</b:Button>
<b:Button type="LINK" visible="false" ui:field="leaveButton">Leave this group</b:Button>
</b:Paragraph>
</b:ControlGroup>
</b:Caption>
</b:Hero>
</ui:UiBinder>

14
src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java

@ -79,9 +79,17 @@ public class LoggedinServiceImpl extends RemoteServiceServlet implements Loggedi
String friendlyURL = ScopeServiceImpl.extractOrgFriendlyURL(portalURL);
if (friendlyURL == null) {//the URL is not a portal URL, we are in devmode.
return new VREClient("Test", "", "" +
"Fishery and Aquaculture Resources Management (FARM) Virtual Organisation</b> The FARM Virtual Organisation is the <b><i>dynamic group of individuals</i></b> and/or <b><i>institutions</i></b> defined around a set of <b><i>sharing rules</i></b> in which <b><i>resource providers</i></b> and <b><i>consumers</i></b> specify clearly and carefully just what is shared, who is allowed to share, and the conditions under which sharing occurs to serve the needs of the <b><i>Fisheries and Aquaculture Resources Management</i></b>. This VO is conceived to support various application scenarios arising in the FARM Community including the production of Fisheries and Aquaculture Country Profiles, the management of catch statistics including harmonisation, the dynamic generation of biodiversity maps and species distribution maps. This Virtual Organisation currently consists of:<ul> <li> approximately <b><i>13 gCube nodes</i></b>, i.e. machines dedicated to run the gCube system;</li> <li> approximately <b><i>89 running instances</i></b>, i.e. running gCube services supporting the operation of the infrastructure;</li> <li> approximately <b><i>25 collections</i></b>, i.e. set of D4Science Information Objects including Earth images, AquaMaps, Graphs on catch statistics;</li> <li> approximately <b><i>66 metadata collections</i></b>, i.e. set of Metadata Objects describing the Information Objects through various features and schemas;</li> <li> approximately <b><i>58 other resources</i></b> including transformation programs, index types, etc.</li></ul></div>" +
"", "", "", UserBelongingClient.BELONGING, false, true);
return new VREClient("Test VRE Name", "", "" +
"Fishery and Aquaculture Resources Management (FARM) Virtual Organisation</b> The FARM Virtual Organisation is the <b><i>dynamic group of individuals</i></b> and/or <b><i>institutions</i></b> defined around a set of <b><i>sharing rules</i></b> in which <b><i>resource providers</i></b> and <b><i>consumers</i></b> specify clearly and carefully just what is shared, who is allowed to share, and the conditions under which sharing occurs to serve the needs of the <b><i>Fisheries and Aquaculture Resources Management</i></b>. "
+ " This VO is conceived to support various application scenarios arising in the FARM Community including the production of Fisheries and Aquaculture Country Profiles, "
+ "the management of catch statistics including harmonisation, the dynamic generation of biodiversity maps and species distribution maps."
+ " This Virtual Organisation currently consists of:<ul> <li> approximately <b><i>13 gCube nodes</i></b>, "
+ "i.e. machines dedicated to run the gCube system;</li> "
+ " <li> approximately <b><i>89 running instances</i></b>, i.e. running gCube services supporting the operation of the infrastructure;</li> "
+ " <li> approximately <b><i>25 collections</i></b>, i.e. set of D4Science Information Objects including Earth images, AquaMaps, Graphs on catch statistics;</li> "
+ " <li> approximately <b><i>66 metadata collections</i></b>, i.e. set of Metadata Objects describing the Information Objects through various features and schemas;</li> "
+ " <li> approximately <b><i>58 other resources</i></b> including transformation programs, index types, etc.</li></ul></div>"
, "http://placehold.it/300x200", "", UserBelongingClient.BELONGING, false, true);
}
_log.trace("getting Selected Research Environment");
GroupManager gm = new LiferayGroupManager();

72
src/main/webapp/GCubeLoggedin.css

@ -1,70 +1,10 @@
/** Add css rules here for your application. */
#vre-header-container {
border-bottom: 1px solid #ccc;
}
#vre-header-container ul {
margin: 6px 2px 0px;
padding: 1px;
height: 23px;
}
#vre-header li {
display: inline;
list-style-type: none;
border-right: 1px solid #ccc;
padding: 7px 20px 4px;
#LoggedinDiv div.hero-unit {
padding: 0 10px;
background-color: #fff;
margin: 0;
}
#vre-header li a {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
div.gwt-HTML.vre-description {
font-size: 14px;
color: #666;
text-decoration: none;
line-height: 22px;
}
#vre-header li a span {
background-image: url('images/home.png');
background-repeat: no-repeat;
background-position: 50% 80%;
}
#vre-header li a:hover {
color: #A94440;
opacity: 0.8;
}
.description {
padding: 10px;
}
table {
border-collapse: separate !important;
border-spacing: 0;
}
.envhome-frame {
background: #FFF;
border-radius: 6px !important;
-moz-border-radius: 6px !important;
-webkit-border-radius: 6px !important;
border: 1px solid #DBDBDB;
}
.imageVRE {
float: left;
width: 150px;
margin-right: 5px;
}
.leaveButton {
border: 1px solid #EBCCD1;
border-radius: 4px;
margin: 20px;
padding: 15px;
background-color: #F2DEDE;
color: #A94440;
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 14px;
}
Loading…
Cancel
Save