- enhancement on copy and paste

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@81298 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-09-12 10:27:18 +00:00
parent 2184d1e95c
commit f9682ba221
9 changed files with 92 additions and 12 deletions

View File

@ -513,6 +513,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onCopyAndPaste(PasteItemEvent pasteItemEvent) {
GWT.log("PasteItemEvent is fired on itemId: "+pasteItemEvent.getItemId()+", DestinationId: "+pasteItemEvent.getFolderDestinationId());
doCopyAndPaste(pasteItemEvent);
}
@ -530,9 +532,11 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onSuccess(Boolean result) {
if(result)
eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId())));
notifySubscriber(pasteItemEvent);
}
});
@ -1659,8 +1663,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
MessageModel message = messageEvent.getMessage();
}else if(event instanceof FileDownloadEvent){
FileDownloadEvent messageEvent = (FileDownloadEvent) event;
@ -1669,10 +1672,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}else if(event instanceof SessionExpiredEvent){
SessionExpiredEvent sessionEvent = (SessionExpiredEvent) event;
sub.viewSessionExpiredPanel();
}else if(event instanceof PasteItemEvent){
sub.pasteEventIsCompleted();
}

View File

@ -1,8 +1,11 @@
package org.gcube.portlets.user.workspace.client.event;
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
import com.google.gwt.event.shared.GwtEvent;
public class PasteItemEvent extends GwtEvent<PasteItemEventHandler> {
public class PasteItemEvent extends GwtEvent<PasteItemEventHandler> implements GuiEventInterface{
public static Type<PasteItemEventHandler> TYPE = new Type<PasteItemEventHandler>();
private String itemId = null;
@ -32,4 +35,12 @@ public class PasteItemEvent extends GwtEvent<PasteItemEventHandler> {
return folderDestinationId;
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
*/
@Override
public EventsTypeEnum getKey() {
return EventsTypeEnum.PASTED_EVENT;
}
}

View File

@ -27,5 +27,6 @@ public enum EventsTypeEnum
CREATE_NEW_MESSAGE,
REPLY_FORWARD_MESSAGE,
FILE_DOWNLAD_EVENT,
SESSION_EXPIRED
SESSION_EXPIRED,
PASTED_EVENT
}

View File

@ -42,5 +42,9 @@ public interface SubscriberInterface {
*
*/
void viewSessionExpiredPanel();
/**
*
*/
void pasteEventIsCompleted();
}

View File

@ -112,7 +112,7 @@ public interface GWTWorkspaceService extends RemoteService{
public boolean unSharedFolderByFolderSharedId(String folderSharedId) throws Exception;
public List<FileModel> getListParentsByItemIdentifier(String itemIdentifier) throws Exception;
public List<FileModel> getListParentsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception;
public String getURLFromApplicationProfile(String oid) throws Exception;

View File

@ -117,7 +117,7 @@ public interface GWTWorkspaceServiceAsync {
AsyncCallback<Boolean> callback);
void getListParentsByItemIdentifier(String itemIdentifier,
AsyncCallback<List<FileModel>> callback);
boolean includeItemAsParent, AsyncCallback<List<FileModel>> callback);
void getURLFromApplicationProfile(String oid, AsyncCallback<String> callback);

View File

@ -306,7 +306,7 @@ public class DialogGetInfo extends Dialog {
private void loadLocation(String itemId){
txtLocation.mask();
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemId, new AsyncCallback<List<FileModel>>() {
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemId, false, new AsyncCallback<List<FileModel>>() {
@Override
public void onFailure(Throwable caught) {

View File

@ -1955,8 +1955,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return unShared;
}
/**
*
* @param itemIdentifier
* @param includeItemAsParent - if parameter is true and item passed in input is a folder, the folder is included in path returned as last parent
* @return
* @throws Exception
*/
@Override
public List<FileModel> getListParentsByItemIdentifier(String itemIdentifier) throws Exception {
public List<FileModel> getListParentsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception {
List<FileModel> listParents = new ArrayList<FileModel>();
workspaceLogger.trace("get List Parents By Item Identifier "+ itemIdentifier);
try {
@ -1968,6 +1975,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
if(includeItemAsParent==true && wsItem.getType().equals(WorkspaceItemType.FOLDER)){
listParents.add(builder.buildGXTFolderModelItem((WorkspaceFolder) wsItem, null));
}
while(wsItem!=null && wsItem.getParent()!=null){
WorkspaceFolder wsFolder = wsItem.getParent();
@ -2319,4 +2330,52 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
return false;
}
// @Override
// public List<FileModel> getFullPathByItemIdentifier(String itemIdentifier) throws Exception {
// List<FileModel> listParents = new ArrayList<FileModel>();
// workspaceLogger.trace("get Full Path Parents By Item Identifier "+ itemIdentifier);
// try {
// Workspace workspace = getWorkspace();
//
// WorkspaceItem wsItem = workspace.getItem(itemIdentifier);
//
// workspaceLogger.trace("workspace retrieve item name: "+wsItem.getName());
//
// GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
//
// if(wsItem.getType().equals(WorkspaceItemType.FOLDER)){
// listParents.add(builder.buildGXTFolderModelItem((WorkspaceFolder) wsItem, null));
// }
//
//
// while(wsItem!=null && wsItem.getParent()!=null){
//
// WorkspaceFolder wsFolder = wsItem.getParent();
//
// listParents.add(builder.buildGXTFolderModelItem(wsFolder, null));
// wsItem = wsFolder;
// }
//
// Collections.reverse(listParents);
//
// //SET PARENTS
// for(int i=0; i<listParents.size()-1; i++){
//
// FileModel parent = listParents.get(i);
// FileModel fileModel = listParents.get(i+1);
//
// fileModel.setParentFileModel(parent);
// }
//
// workspaceLogger.trace("list parents return size: "+listParents.size());
//
// } catch (Exception e) {
// workspaceLogger.error("Error in get List Parents By Item Identifier ", e);
// e.printStackTrace();
// throw new Exception(e.getMessage());
// }
//
// return listParents;
// }
}

View File

@ -74,10 +74,10 @@ public class WsUtil {
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
user=TEST_USER;
// user=TEST_USER;
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
// user = "francesco.mangiacrapa";
user = "francesco.mangiacrapa";
defaultLogger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
defaultLogger.warn("session id: "+sessionID);