- Open a workspace item with safari and chrome is fixed

- Owner view in the grid was optimized

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@81039 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-09-04 09:26:10 +00:00
parent e62995d5af
commit fd8fc0f647
7 changed files with 88 additions and 20 deletions

View File

@ -2041,7 +2041,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
params+=ConstantsExplorer.REDIRECTONERROR+"="+windowOpenParam.isRedirectOnError();
com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+params, windowOpenParam.getOption(), "");
windowOpenParam.getBrowserWindow().setUrl(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+params);
// com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+params, windowOpenParam.getOption(), "");
}
};

View File

@ -137,8 +137,12 @@ public class FileModel extends BaseModelData implements Serializable {
public void setOwner(InfoContactModel owner){
set(ConstantsExplorer.OWNER, owner);
if(owner!=null)
set(ConstantsExplorer.OWNERFULLNAME, owner.getName());
// if(owner!=null)
// set(ConstantsExplorer.OWNERFULLNAME, owner.getName());
}
public void setOwnerFullName(String fullName){
set(ConstantsExplorer.OWNERFULLNAME, fullName);
}
public void setMarkAsRead(boolean mark){

View File

@ -6,6 +6,7 @@ package org.gcube.portlets.user.workspace.client.util;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplayMessage;
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
import org.gcube.portlets.user.workspace.client.view.windows.NewBrowserWindow;
import com.google.gwt.core.client.GWT;
import com.google.gwt.http.client.Request;
@ -34,14 +35,16 @@ public class RequestBuilderWorkspaceValidateItem {
* @param method
* @param servletName the name of the servlet that must be called
* @param params param=value&param1=value1&...
* @param name the name of the window (e.g. "_blank")
* @param targetWindow the target of the window (e.g. "_blank")
* @param callback
* @throws Exception
*/
public RequestBuilderWorkspaceValidateItem(RequestBuilder.Method method, String servletName, final String params, final String name, final AsyncCallback<WindowOpenParameter> callback) throws Exception{
public RequestBuilderWorkspaceValidateItem(RequestBuilder.Method method, String servletName, final String params, final String targetWindow, final AsyncCallback<WindowOpenParameter> callback) throws Exception{
this.callback = callback;
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open(null, targetWindow, null);
this.parameters = params;
if(servletName==null)
@ -75,24 +78,27 @@ public class RequestBuilderWorkspaceValidateItem {
// System.out.println("status code is "+status);
if(!(status==200) && !(status==202)){ //NOT IS STATUS SC_ACCEPTED
newBrowserWindow.close();
handleError("Sorry, an error occurred on retriving the file. "+response.getText()); //ERROR STATUS
}else{ //OK STATUS
if(callback!=null)
callback.onSuccess(new WindowOpenParameter(name, "", params, true));
callback.onSuccess(new WindowOpenParameter(targetWindow, "", params, true, newBrowserWindow));
}
}
@Override
public void onError(Request request, Throwable exception) {
newBrowserWindow.close();
// System.out.println("exception message is "+exception.getMessage());
handleError(exception.getMessage());
}
});
} catch (RequestException e) {
newBrowserWindow.close();
throw new Exception("Sorry, an error occurred while contacting server, try again");
}
}

View File

@ -3,6 +3,8 @@
*/
package org.gcube.portlets.user.workspace.client.util;
import org.gcube.portlets.user.workspace.client.view.windows.NewBrowserWindow;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Jun 25, 2013
@ -14,6 +16,7 @@ public class WindowOpenParameter {
private String parameters;
private String itemName;
private boolean redirectOnError;
private NewBrowserWindow browserWindow;
/**
*
@ -24,17 +27,19 @@ public class WindowOpenParameter {
/**
*
* @param option the name of the window (e.g. "_blank")
* @param target the target of the window (e.g. "_blank")
* @param itemName
* @param parameters param=value&param1=value1&...
* @param redirectOnError if true execute a redirect on fake URL
* @param browserWindow an instance of NewBrowserWindow
*/
public WindowOpenParameter(String option, String itemName, String parameters, boolean redirectOnError) {
public WindowOpenParameter(String target, String itemName, String parameters, boolean redirectOnError, NewBrowserWindow browserWindow) {
super();
this.option = option;
this.option = target;
this.itemName = itemName;
this.parameters = parameters;
this.redirectOnError = redirectOnError;
this.browserWindow = browserWindow;
}
@ -73,6 +78,16 @@ public class WindowOpenParameter {
public void setRedirectOnError(boolean redirectOnError) {
this.redirectOnError = redirectOnError;
}
public NewBrowserWindow getBrowserWindow() {
return browserWindow;
}
public void setBrowserWindow(NewBrowserWindow browserWindow) {
this.browserWindow = browserWindow;
}

View File

@ -0,0 +1,30 @@
package org.gcube.portlets.user.workspace.client.view.windows;
import com.google.gwt.core.client.JavaScriptObject;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @Sep 4, 2013
*
*/
public final class NewBrowserWindow extends JavaScriptObject {
// All types that extend JavaScriptObject must have a protected,
// no-args constructor.
protected NewBrowserWindow() {
}
public static native NewBrowserWindow open(String url, String target,
String options) /*-{
return $wnd.open(url, target, options);
}-*/;
public native void close() /*-{
this.close();
}-*/;
public native void setUrl(String url) /*-{
if (this.location) {
this.location = url;
}
}-*/;
}

View File

@ -1052,7 +1052,7 @@ public class GWTWorkspaceBuilder {
Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
logger.trace("gxt grid objects getChildren() returning "+listWorkspaceItems.size()+" elements in " + time);
logger.trace("##GRID FILLING: gxt grid objects getChildren() returning "+listWorkspaceItems.size()+" elements in " + time);
return listFileGridModel;
@ -1103,20 +1103,30 @@ public class GWTWorkspaceBuilder {
}
//OWNER
if(item.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED
if(item.getOwner()!=null){
String portalLogin = item.getOwner().getPortalLogin();
if(fileGridModel.isShared()){ //IS READ FROM HL ONLY IF THE ITEM IS SHARED
User owner = item.getOwner();
if(owner!=null){
// System.out.println("++++reading owner");
String portalLogin = owner.getPortalLogin();
// String portalLogin = "puppa";
String fullName = portalLogin;
if(!WsUtil.withoutPortal) //INTO PORTAL
fullName = UserUtil.getUserFullName(portalLogin);
fileGridModel.setOwner(new InfoContactModel(item.getOwner().getId(), portalLogin, fullName));
// fileGridModel.setOwner(new InfoContactModel(item.getOwner().getId(), portalLogin, fullName));
fileGridModel.setOwnerFullName(fullName);
}
}
else{
if(userLogged!=null)
fileGridModel.setOwner(new InfoContactModel(userLogged.getId(), userLogged.getLogin(), userLogged.getName()));
// fileGridModel.setOwner(new InfoContactModel(userLogged.getId(), userLogged.getLogin(), userLogged.getName()));
fileGridModel.setOwnerFullName(userLogged.getName());
}
//// fileGridModel.setShared(item.isShared());
// fileGridModel.setMarkAsRead(item.isMarkedAsRead());

View File

@ -287,11 +287,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Long endTime = System.currentTimeMillis() - startTime;
String time = String.format("%d msc %d sec", endTime, TimeUnit.MILLISECONDS.toSeconds(endTime));
logger.trace("grid getChildren() returning "+listItems.size()+" elements in " + time);
logger.trace("##HL FILLING: grid getChildren() returning "+listItems.size()+" elements in " + time);
listFileGridModels = builder.buildGXTListFileGridModelItem(listItems, folder);
return listFileGridModels;
} catch (Exception e) {