From f5b0a01ac0ee07895ad271dd3cbcdf1dcea1a54f Mon Sep 17 00:00:00 2001 From: "massimiliano.assante" Date: Wed, 7 Dec 2016 14:34:34 +0000 Subject: [PATCH] added limit to 9 images show git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@139784 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/my_vres/client/VresPanel.java | 8 +++- .../my_vres/client/widgets/ClickableVRE.java | 43 +++++++++++++----- .../my_vres/server/MyVREsServiceImpl.java | 15 ++++++ src/main/webapp/MyVREs.css | 4 ++ src/main/webapp/images/vlab.png | Bin 0 -> 3210 bytes 5 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 src/main/webapp/images/vlab.png diff --git a/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java b/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java index d4c0a80..c4569de 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/client/VresPanel.java @@ -25,6 +25,7 @@ import com.google.gwt.user.client.ui.VerticalPanel; */ public class VresPanel extends Composite { public static final String loading = GWT.getModuleBaseURL() + "../images/loading.gif"; + private static final int LOAD_MAX_IMAGE_NO = 10; private final MyVREsServiceAsync myVREsService = GWT.create(MyVREsService.class); private FlowPanel flowPanel; private VerticalPanel mainPanel = new VerticalPanel(); @@ -32,6 +33,8 @@ public class VresPanel extends Composite { private HorizontalPanel imagesPanel = new HorizontalPanel(); private Image loadingImage = new Image(loading); private LinkedHashMap> cachedVREs = null; + + boolean hasVres = false; @@ -73,6 +76,7 @@ public class VresPanel extends Composite { boolean hasVREs = false; mainPanel.clear(); mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT); + int i = 0; for (String cat : cachedVREs.keySet()) { if (! cachedVREs.get(cat).isEmpty()) { SimplePanel catPanel = new SimplePanel(); @@ -87,13 +91,15 @@ public class VresPanel extends Composite { for (VRE vre: cachedVREs.get(cat)) { if (vre.getName().compareTo("")!= 0) hasVREs = true; - ClickableVRE vreButton = new ClickableVRE(vre); + ClickableVRE vreButton = new ClickableVRE(vre, (i < LOAD_MAX_IMAGE_NO)); flowPanel.add(vreButton); + i++; } mainPanel.add(flowPanel); } } + GWT.log("i="+i); if (! hasVREs) { mainPanel.clear(); diff --git a/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java b/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java index 392f420..99cb2eb 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/client/widgets/ClickableVRE.java @@ -5,10 +5,11 @@ import org.gcube.portlet.user.my_vres.shared.VRE; 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.event.dom.client.MouseOverEvent; +import com.google.gwt.event.dom.client.MouseOverHandler; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window.Location; import com.google.gwt.user.client.ui.HTML; -import com.google.gwt.user.client.ui.Image; /** * @@ -25,30 +26,34 @@ public class ClickableVRE extends HTML { private int imageWidth = 0; public static final String LOADING_IMAGE = GWT.getModuleBaseURL() + "../images/loading.gif"; - public static final String MORE_IMAGE = GWT.getModuleBaseURL() + "../images/More.png"; - Image img = new Image(LOADING_IMAGE); + public static final String VLAB_IMAGE = GWT.getModuleBaseURL() + "../images/vlab.png"; + private String html = ""; + public ClickableVRE() { super(); } - public ClickableVRE(final VRE vre) { + public ClickableVRE(final VRE vre, final boolean showImage) { super.setPixelSize(WIDTH, HEIGHT); setPixelSize(WIDTH, HEIGHT); - String html = ""; if (vre.getName() == null || vre.getName().compareTo("") == 0) { html = "
"; } else { imageWidth = WIDTH - 12; - imageUrl = vre.getImageURL(); name = (vre.getName().length() > 15) ? vre.getName().substring(0, 13) + ".." : vre.getName(); + imageUrl = vre.getImageURL(); html = "
" +name + "
"; - html += "
" + - "" + - "
"; + if (showImage) { + html += "
" + + "" + + "
"; + } else { + html += "
"; + } } this.setTitle("Enter"); - + setHTML(html); setStyleName("vreButton"); @@ -66,7 +71,23 @@ public class ClickableVRE extends HTML { }; timer.schedule(50); } - }); + }); + + addMouseOverHandler(new MouseOverHandler() { + @Override + public void onMouseOver(MouseOverEvent event) { + imageWidth = WIDTH - 12; + name = (vre.getName().length() > 15) ? vre.getName().substring(0, 13) + ".." : vre.getName(); + imageUrl = vre.getImageURL(); + html = "
" +name + "
"; + if (!showImage) { + html += "
" + + "" + + "
"; + } + setHTML(html); + } + }); } } diff --git a/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java b/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java index 6d432a5..4ce096e 100644 --- a/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java +++ b/src/main/java/org/gcube/portlet/user/my_vres/server/MyVREsServiceImpl.java @@ -163,6 +163,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer final String categoryNameOne = "gCubeApps"; final String categoryNameTwo = "BlueBRIDGE"; + final String categoryNameThree = "GEMex"; // VRE cool_EM_VRE = new VRE(); cool_EM_VRE.setName("BiodiversityResearchEnvironment"); @@ -220,9 +221,23 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer ArrayList toAdd2 = new ArrayList(); toAdd2.add(demo); toAdd2.add(vreGCM); + toAdd2.add(cool_EM_VRE3); + toAdd2.add(cool_EM_VRE); + toAdd2.add(cool_EM_VRE2); + toAdd2.add(cool_EM_VRE3); + + ArrayList toAdd3 = new ArrayList(); + toAdd3.add(demo); + toAdd3.add(vreGCM); + toAdd3.add(cool_EM_VRE2); + toAdd3.add(cool_EM_VRE3); + toAdd3.add(cool_EM_VRE); + toAdd3.add(cool_EM_VRE2); + toAdd3.add(cool_EM_VRE3); toReturn.put(categoryNameOne, toAdd); toReturn.put(categoryNameTwo, toAdd2); + toReturn.put(categoryNameThree, toAdd3); return toReturn; } diff --git a/src/main/webapp/MyVREs.css b/src/main/webapp/MyVREs.css index d512c52..2fc8106 100644 --- a/src/main/webapp/MyVREs.css +++ b/src/main/webapp/MyVREs.css @@ -98,6 +98,10 @@ a.vrelink:hover { background: url(images/More.png) 50% 50% no-repeat; } +.vlab-default { + background: url("images/vlab.png") 50% 50% no-repeat; +} + .item-vre { background-image: url("images/vres.png"); } diff --git a/src/main/webapp/images/vlab.png b/src/main/webapp/images/vlab.png new file mode 100644 index 0000000000000000000000000000000000000000..0147ead79f13f047705407ed83d213fcda8dae56 GIT binary patch literal 3210 zcmaJ^c|4SB8)hsS6(vjPFpaImEHsvh#0)jI?7K3?U@(iBk$opi6b_Ot#8D~RXFE(G zN|J=okSP0ytl2r==v3$XGi@U;n&uCdL;J^NR7Zv9TS-Ttb_% zRt?sx%)`z4c0BYfW-X$0T^qVN*_G~#rQ+GNUC7RO5Qd0#!<*r;F8DL__*%g1_k^S^NECC>Zn&Lif}J|6P=g zkqHPzrs6>e2uu+NQ-Oh0;1Ia-Syfe41&|U94uis!pl~HcxGGXv2?>LNzCU1AHmZv& z(hRNlJr^s|1iRDe6eJYt>+1{gRfdqMZcwStjnG+gQI4=$RF^C99%^dDT8f4I88pD!*R`O2$%V3tf$k6XzXtu|h~=LB?N8gXf}h66lUQ!2vTUtb;+n+9#f3NUYB)>`&}o z)`@jL+w7@XDI+YK+1K+-x%HSfFbd@~F2?PeF>_~TcHUD!NYH^h24HZd&%&p1fUzFB zdv|2y2+v8s6mH<<_tSt6Ty+O2BBN~{ZxhKXUPkP*O~BnwMgbHc?c>@E1e!8z?FpS~ zsqJ`20iL4ea5uG^k<-)eHgyy%E$nFF)N&-bzQmXSjPO5Er3*ve*R-y@@8Pz*m7XiA z;$>qH2IRQ|d+h5U9&LK&e%mvR)6Wh%{B^n_kI6dne>>> zjH}J*<7t+6KZHJNek~P>J0x+QApD>^Md;3*?csr2HoLqTt)?(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