Working on move operation

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@171990 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-10-05 16:08:41 +00:00
parent e6588d916a
commit 08b321cf87
4 changed files with 47 additions and 30 deletions

View File

@ -307,7 +307,11 @@ public class AppController implements SubscriberInterface {
if(moveItemsEvent.getIds()!=null && moveItemsEvent.getIds().size()>0){
AppControllerExplorer.getEventBus().fireEvent(new MoveItemsEvent(moveItemsEvent.getIds(), null));
//THE SOURCE PARENT IS A VALID FROM THE EVENT OR READ FROM BREADCRUMB
FileModel sourceParent = moveItemsEvent.getSourceParentFolder()!=null?
moveItemsEvent.getSourceParentFolder():wsPortlet.getToolBarPath().getLastParent();
//wsPortlet.getGridGroupContainer().mask("Moving",ConstantsExplorer.LOADINGSTYLE);
AppControllerExplorer.getEventBus().fireEvent(new MoveItemsEvent(moveItemsEvent.getIds(), null, sourceParent));
}
}
@ -1941,6 +1945,8 @@ public class AppController implements SubscriberInterface {
@Override
public void moveEventIsCompleted(boolean isTreeRefreshable, String parentId) {
wsPortlet.getGridGroupContainer().unmask();
if(isTreeRefreshable){
wsPortlet.getGridGroupContainer().unmask();
}else{ //FORCE GRID REFRESH

View File

@ -2,26 +2,37 @@ package org.gcube.portlets.user.workspace.client.gridevent;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* The Class GridRefreshEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Oct 5, 2018
*/
public class GridRefreshEvent extends GwtEvent<GridRefreshEventHandler> {
public static Type<GridRefreshEventHandler> TYPE = new Type<GridRefreshEventHandler>();
/**
* Instantiates a new grid refresh event.
*/
public GridRefreshEvent() {
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<GridRefreshEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(GridRefreshEventHandler handler) {
handler.onGridRefresh(this);
}
}

View File

@ -4,15 +4,17 @@ import java.util.List;
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class MoveItemsEvent.
* The Class MoveItemsGEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Oct 4, 2018
* Oct 5, 2018
*/
public class MoveItemsGEvent extends GwtEvent<MoveItemsGEventHandler> implements GuiEventInterface{
public static Type<MoveItemsGEventHandler> TYPE = new Type<MoveItemsGEventHandler>();
@ -21,20 +23,21 @@ public class MoveItemsGEvent extends GwtEvent<MoveItemsGEventHandler> implements
private List<String> ids;
private String folderSourceId; //Used to move
private FileModel sourceParentFolder; //Used to move
private boolean treeRefreshable;
/**
* Instantiates a new move items event.
* Instantiates a new move items g event.
*
* @param ids the ids
* @param folderDestinationId the folder destination id
* @param sourceParentFolder the source parent folder
*/
public MoveItemsGEvent(List<String> ids, String folderDestinationId) {
public MoveItemsGEvent(List<String> ids, String folderDestinationId, FileModel sourceParentFolder) {
this.ids = ids;
this.folderDestinationId = folderDestinationId;
this.sourceParentFolder = sourceParentFolder;
}
/* (non-Javadoc)
@ -89,24 +92,6 @@ public class MoveItemsGEvent extends GwtEvent<MoveItemsGEventHandler> implements
this.ids = ids;
}
/**
* Gets the folder source id.
*
* @return the folder source id
*/
public String getFolderSourceId() {
return folderSourceId;
}
/**
* Sets the folder source id.
*
* @param folderSourceId the new folder source id
*/
public void setFolderSourceId(String folderSourceId) {
this.folderSourceId = folderSourceId;
}
/**
* Sets the tree refreshable.
*
@ -125,4 +110,17 @@ public class MoveItemsGEvent extends GwtEvent<MoveItemsGEventHandler> implements
return treeRefreshable;
}
/**
* Gets the source parent folder.
*
* @return the sourceParentFolder
*/
public FileModel getSourceParentFolder() {
return sourceParentFolder;
}
}

View File

@ -329,7 +329,9 @@ public class GxtToolBarItemFunctionality {
List<String> listTarget = gridGroupViewContainer.getIdsSelectedItems();
if(listTarget!=null && listTarget.size()>0){
AppController.getEventBus().fireEvent(new MoveItemsGEvent(listTarget, null));
//using the parent of the first item
FileModel sourceParentModel = gridGroupViewContainer.getSelectedItems().get(0).getParentFileModel();
AppController.getEventBus().fireEvent(new MoveItemsGEvent(listTarget, null, sourceParentModel));
}
}