fixed bug happenign with firefox and Chrome when click back browser button (let previous scope set)

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/vre-members@100221 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2014-09-26 13:26:40 +00:00
parent fe282c3abf
commit e7ca38ed56
3 changed files with 34 additions and 15 deletions

View File

@ -23,11 +23,11 @@ public class VREMembersPanel extends Composite {
* Create a remote service proxy to talk to the server-side Greeting service.
*/
private final MembersServiceAsync vreMemberService = GWT.create(MembersService.class);
public static final String loading = GWT.getModuleBaseURL() + "../images/members-loader.gif";
private Image loadingImage;
private VerticalPanel mainPanel = new VerticalPanel();
public VREMembersPanel() {
super();
@ -35,33 +35,37 @@ public class VREMembersPanel extends Composite {
mainPanel.add(loadingImage);
showLoader();
vreMemberService.getOrganizationUsers(new AsyncCallback<ArrayList<BelongingUser>>() {
@Override
public void onSuccess(ArrayList<BelongingUser> users) {
mainPanel.clear();
mainPanel.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);
mainPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
Grid grid = new Grid(users.size()/4+1, 4);
mainPanel.add(grid);
for (int i = 0; i < users.size(); i++) {
grid.setWidget(i/4, i%4, new DisplayBadge(users.get(i)));
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 {
Grid grid = new Grid(users.size()/4+1, 4);
mainPanel.add(grid);
for (int i = 0; i < users.size(); i++) {
grid.setWidget(i/4, i%4, 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%");

View File

@ -44,6 +44,7 @@ public class MembersServiceImpl extends RemoteServiceServlet implements MembersS
user = getDevelopmentUser();
SessionManager.getInstance().getASLSession(sessionID, user).setScope("/gcube");
}
System.out.println("\n\n\n RealPath->" + this.getServletContext().getRealPath(""));
return SessionManager.getInstance().getASLSession(sessionID, user);
}
/**
@ -88,8 +89,10 @@ public class MembersServiceImpl extends RemoteServiceServlet implements MembersS
ScopeBean sb = new ScopeBean(scope);
List<UserModel> users = null;
if (sb.is(Type.INFRASTRUCTURE))
users = um.listUsersByGroup(gm.getRootVO().getGroupId());
if (sb.is(Type.INFRASTRUCTURE)) {
users = new ArrayList<UserModel>();
return new ArrayList<BelongingUser>();
}
else if (sb.is(Type.VRE)) { //must be in VRE
//get the name from the scope
String orgName = scope.substring(scope.lastIndexOf("/")+1, scope.length());
@ -137,4 +140,5 @@ public class MembersServiceImpl extends RemoteServiceServlet implements MembersS
}
}

View File

@ -11,6 +11,17 @@
border: 1px solid #DBDBDB;
}
.frame {
font-family: 'Helvetica Neue', Arial, sans-serif;
padding: 10px;
margin: 10px;
background: #FFF;
border-radius: 6px !important;
-moz-border-radius: 6px !important;
-webkit-border-radius: 6px !important;
border: 1px solid #DBDBDB;
}
.user-photo {
padding: 5px;
border: 1px solid #E6E6E6;