From 565b82ba8dc65d29369802f6c355e35155523a33 Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Wed, 23 Mar 2016 15:23:47 +0000 Subject: [PATCH] ready to test git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gcube-loggedin@126132 82a268e6-3cf1-43bd-a215-b396298e98cf --- .tern-project | 1 + .../gcubeloggedin/client/GCubeLoggedin.java | 3 - .../gcubeloggedin/client/ui/AboutView.java | 66 +++++++++-------- .../gcubeloggedin/client/ui/AboutView.ui.xml | 29 ++++---- .../server/LoggedinServiceImpl.java | 14 +++- src/main/webapp/GCubeLoggedin.css | 72 ++----------------- 6 files changed, 70 insertions(+), 115 deletions(-) create mode 100644 .tern-project diff --git a/.tern-project b/.tern-project new file mode 100644 index 0000000..a185ba0 --- /dev/null +++ b/.tern-project @@ -0,0 +1 @@ +{"ide":{"scriptPaths":[]},"plugins":{"aui":{},"liferay":{},"yui":{}},"libs":["ecma5","browser"]} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/GCubeLoggedin.java b/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/GCubeLoggedin.java index d45ef5e..f4d426c 100644 --- a/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/GCubeLoggedin.java +++ b/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; diff --git a/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.java b/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.java index 62710d0..61fb07d 100644 --- a/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.java +++ b/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("" + 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("" + 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() { @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()); } }); diff --git a/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.ui.xml b/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.ui.xml index b6e19a3..69308bd 100644 --- a/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.ui.xml +++ b/src/main/java/org/gcube/portlets/user/gcubeloggedin/client/ui/AboutView.ui.xml @@ -1,19 +1,20 @@ + + + + + Thumbnail label + + - -
-
    -
  • -       -
  • -
  • - Leave Group -
  • -
-
- - See more -
+ + + See more + Leave this group + + +
+
\ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java b/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java index 4e950da..92a7999 100644 --- a/src/main/java/org/gcube/portlets/user/gcubeloggedin/server/LoggedinServiceImpl.java +++ b/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 The FARM Virtual Organisation is the dynamic group of individuals and/or institutions defined around a set of sharing rules in which resource providers and consumers 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 Fisheries and Aquaculture Resources Management. 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:" + - "", "", "", UserBelongingClient.BELONGING, false, true); + return new VREClient("Test VRE Name", "", "" + + "Fishery and Aquaculture Resources Management (FARM) Virtual Organisation The FARM Virtual Organisation is the dynamic group of individuals and/or institutions defined around a set of sharing rules in which resource providers and consumers 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 Fisheries and Aquaculture Resources Management. " + + " 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:" + , "http://placehold.it/300x200", "", UserBelongingClient.BELONGING, false, true); } _log.trace("getting Selected Research Environment"); GroupManager gm = new LiferayGroupManager(); diff --git a/src/main/webapp/GCubeLoggedin.css b/src/main/webapp/GCubeLoggedin.css index 6a384c6..5a36838 100644 --- a/src/main/webapp/GCubeLoggedin.css +++ b/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; -} \ No newline at end of file