added confirm message on unsharing

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@87271 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-12-20 16:05:40 +00:00
parent f6dcb10a5c
commit 35fcf2c995
2 changed files with 38 additions and 19 deletions

View File

@ -201,24 +201,41 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(source!=null)
folderId = source.getIdentifier();
if(folderId!=null){
rpcWorkspaceService.unSharedFolderByFolderSharedId(folderId, new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", caught.getMessage(), null);
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
}
@Override
public void onSuccess(Boolean result) {
if(result) //REFRESH PARENT FOLDER
eventBus.fireEvent(new RefreshFolderEvent(source.getParentFileModel(), true, false));
if(folderId!=null){
String msg = "Unsharing the folder, the files will be removed from your workspace. Continue?";
MessageBoxConfirm mbc = new MessageBoxConfirm("Confirm Unshare?", msg);
final String folderIdentification = folderId;
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {
public void handleEvent(MessageBoxEvent be) {
// eventBus.fireEvent(new DeleteItemEvent(sel));
//IF NOT CANCELLED
String clickedButton = be.getButtonClicked().getItemId();
if(clickedButton.equals(Dialog.YES)){
rpcWorkspaceService.unSharedFolderByFolderSharedId(folderIdentification, new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", caught.getMessage(), null);
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
}
@Override
public void onSuccess(Boolean result) {
if(result) //REFRESH PARENT FOLDER
eventBus.fireEvent(new RefreshFolderEvent(source.getParentFileModel(), true, false));
}
});
}
}
});
});
}
}
@ -1106,7 +1123,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
MessageBoxConfirm mbc = new MessageBoxConfirm(title, msg);
mbc.getMessageBoxConfirm().addCallback(new Listener<MessageBoxEvent>() {

View File

@ -1841,10 +1841,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) wsItem;
WorkspaceFolder unSharedFolder = wsFolder.unShare();
unShared = unSharedFolder==null?false:true;
// WorkspaceFolder unSharedFolder = wsFolder.unShare();
// unShared = unSharedFolder==null?false:true;
//TEMPORARY SOLUTION
wsFolder.unShare();
unShared = true;
// System.out.println("unShared is "+unShared);
workspaceLogger.trace("unShared is "+ unShared);