#1244 VREs sorted in alphabetical Order, VRE Name too long cut

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@68877 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-02-06 11:03:41 +00:00
parent 2b182bb828
commit 4c25776deb
4 changed files with 18 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package org.gcube.portlet.user.my_vres.client;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import org.gcube.portlet.user.my_vres.client.widgets.BulletList; import org.gcube.portlet.user.my_vres.client.widgets.BulletList;
@ -142,13 +143,21 @@ public class VresPanel extends Composite {
flowPanel.clear(); flowPanel.clear();
mainPanel.add(changeViewPanel); mainPanel.add(changeViewPanel);
mainPanel.add(flowPanel); mainPanel.add(flowPanel);
ArrayList<VRE> sortedVREs = new ArrayList<VRE>();
for (VO vo: cachedVOs) { for (VO vo: cachedVOs) {
for (VRE vre : vo.getVres()) { for (VRE vre : vo.getVres()) {
ClickableVRE vreButton = new ClickableVRE(vre, myVREsService); sortedVREs.add(vre);
flowPanel.add(vreButton);
hasVres = true; hasVres = true;
} }
} }
Collections.sort(sortedVREs);
for (VRE vre : sortedVREs) {
ClickableVRE vreButton = new ClickableVRE(vre, myVREsService);
flowPanel.add(vreButton);
}
if (!hasVres) { if (!hasVres) {
mainPanel.add(new NoVresPanel()); mainPanel.add(new NoVresPanel());
imagesPanel.clear(); imagesPanel.clear();

View File

@ -37,7 +37,7 @@ public class ClickableVRE extends HTML {
super.setPixelSize(WIDTH, HEIGHT); super.setPixelSize(WIDTH, HEIGHT);
setPixelSize(WIDTH, HEIGHT); setPixelSize(WIDTH, HEIGHT);
imageWidth = WIDTH - 20; imageWidth = WIDTH - 20;
name = vre.getName(); name = (vre.getName().length() > 23) ? vre.getName().substring(0, 23) : vre.getName();
imageUrl = vre.getImageURL(); imageUrl = vre.getImageURL();
this.setTitle("Enter this VRE"); this.setTitle("Enter this VRE");
int imageHeight = 95; int imageHeight = 95;

View File

@ -294,7 +294,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
// //
// //
VRE cool_EM_VRE = new VRE(); VRE cool_EM_VRE = new VRE();
cool_EM_VRE.setName("COOL EM VRE"); cool_EM_VRE.setName("BiodiversityResearchEnvironment");
cool_EM_VRE.setGroupName("/d4science.research-infrastructures.eu/EM/COOLEMVRE"); cool_EM_VRE.setGroupName("/d4science.research-infrastructures.eu/EM/COOLEMVRE");
cool_EM_VRE.setDescription("cool_EM_VRE VRE Description<br />"+ cool_EM_VRE.setDescription("cool_EM_VRE VRE Description<br />"+
"This Virtual Research Environment is for cool authors, managers and researchers who produce reports containing cool data."); "This Virtual Research Environment is for cool authors, managers and researchers who produce reports containing cool data.");

View File

@ -3,7 +3,7 @@ package org.gcube.portlet.user.my_vres.shared;
import java.io.Serializable; import java.io.Serializable;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class VRE extends ResearchEnvironment implements Serializable { public class VRE extends ResearchEnvironment implements Serializable, Comparable<VRE> {
/** /**
* *
@ -27,4 +27,8 @@ public class VRE extends ResearchEnvironment implements Serializable {
UserBelonging userBelonging) { UserBelonging userBelonging) {
super(vreName, description, imageURL, vomsGroupName, friendlyURL, userBelonging); super(vreName, description, imageURL, vomsGroupName, friendlyURL, userBelonging);
} }
public int compareTo(VRE arg0) {
return this.getName().compareTo(arg0.getName());
}
} }