enhancement on copy/paste
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@81304 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
118b29b5e3
commit
012b120035
|
@ -56,7 +56,6 @@ import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PreviewMessageEvent;
|
import org.gcube.portlets.user.workspace.client.event.PreviewMessageEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.PreviewMessageEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.PreviewMessageEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.RefreshFolderEvent;
|
|
||||||
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.RenameItemEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.RenameItemEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.SaveAttachmentsEvent;
|
import org.gcube.portlets.user.workspace.client.event.SaveAttachmentsEvent;
|
||||||
|
@ -138,7 +137,8 @@ public class AppController implements SubscriberInterface {
|
||||||
EventsTypeEnum.REPLY_FORWARD_MESSAGE,
|
EventsTypeEnum.REPLY_FORWARD_MESSAGE,
|
||||||
EventsTypeEnum.FILE_DOWNLAD_EVENT,
|
EventsTypeEnum.FILE_DOWNLAD_EVENT,
|
||||||
EventsTypeEnum.SESSION_EXPIRED,
|
EventsTypeEnum.SESSION_EXPIRED,
|
||||||
EventsTypeEnum.PASTED_EVENT
|
EventsTypeEnum.PASTED_EVENT,
|
||||||
|
EventsTypeEnum.COPY_EVENT
|
||||||
});
|
});
|
||||||
bind();
|
bind();
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,21 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCopyAndPaste(PasteItemEvent pasteItemEvent) {
|
public void onCopyAndPaste(PasteItemEvent pasteItemEvent) {
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new PasteItemEvent(pasteItemEvent.getItemId(), pasteItemEvent.getFolderDestinationId()));
|
|
||||||
|
String folderDestinationId = null;
|
||||||
|
if(pasteItemEvent.getFolderDestinationId()!=null){ //IF FOLDER DESTINATION EXISTS
|
||||||
|
folderDestinationId = pasteItemEvent.getFolderDestinationId();
|
||||||
|
}else{
|
||||||
|
FileModel file = wsPortlet.getToolBarPath().getLastParent();
|
||||||
|
|
||||||
|
if(file.getIdentifier()!=null){ //GET LAST PARENT FROM BREADRUMB
|
||||||
|
folderDestinationId = file.getIdentifier();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(folderDestinationId!=null)
|
||||||
|
AppControllerExplorer.getEventBus().fireEvent(new PasteItemEvent(pasteItemEvent.getItemId(), folderDestinationId));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1257,12 +1271,15 @@ public class AppController implements SubscriberInterface {
|
||||||
@Override
|
@Override
|
||||||
public void refreshFolder(FileModel folderTarget) {
|
public void refreshFolder(FileModel folderTarget) {
|
||||||
|
|
||||||
//REFRESH FOLDER ONLY IF IS DISPLAYED YOUR CHILDREN
|
if(folderTarget!=null){
|
||||||
FileGridModel file = wsPortlet.getGridGroupContainer().getFileGridModelByIdentifier(folderTarget.getIdentifier());
|
|
||||||
|
//REFRESH FOLDER ONLY IF IS DISPLAYED YOUR CHILDREN
|
||||||
|
FileGridModel folder = wsPortlet.getGridGroupContainer().getFileGridModelByIdentifier(folderTarget.getIdentifier());
|
||||||
|
|
||||||
|
GWT.log("refresh folder :" +folder);
|
||||||
|
|
||||||
if(file==null)
|
|
||||||
updateStoreByRpc(folderTarget);
|
updateStoreByRpc(folderTarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -1347,4 +1364,14 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#copyEventIsCompleted()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void copyEventIsCompleted() {
|
||||||
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activePasteButton(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,15 +309,17 @@ public class GxtToolBarItemFunctionality {
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
|
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
|
||||||
|
|
||||||
FileModel parentTarget = getDirectoryOrParent(fileGridModel);
|
FileModel parentTarget = getDirectoryOrParent(fileGridModel);
|
||||||
if(parentTarget!=null){
|
|
||||||
|
|
||||||
AppController.getEventBus().fireEvent(new PasteItemEvent(CopyAndPaste.getCopiedfileModelId(), parentTarget.getIdentifier()));
|
String parentId = null;
|
||||||
CopyAndPaste.setCopiedfileModelId(null);
|
|
||||||
btnPasteItem.setEnabled(false);
|
if(parentTarget!=null)
|
||||||
|
parentId=parentTarget.getIdentifier();
|
||||||
|
|
||||||
|
AppController.getEventBus().fireEvent(new PasteItemEvent(CopyAndPaste.getCopiedfileModelId(), parentId));
|
||||||
|
CopyAndPaste.setCopiedfileModelId(null);
|
||||||
|
btnPasteItem.setEnabled(false);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -510,7 +512,7 @@ public class GxtToolBarItemFunctionality {
|
||||||
* @param fileModel
|
* @param fileModel
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private FileModel getDirectoryOrParent(FileModel fileModel){
|
private FileModel getDirectoryOrParent(FileGridModel fileModel){
|
||||||
|
|
||||||
if(fileModel!=null){
|
if(fileModel!=null){
|
||||||
if(fileModel.isDirectory())
|
if(fileModel.isDirectory())
|
||||||
|
|
Loading…
Reference in New Issue