fixed bug after folder sharing

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@100018 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-09-18 13:29:39 +00:00
parent c087e182e6
commit cf2a2443a3
6 changed files with 54 additions and 48 deletions

View File

@ -236,8 +236,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void handleEvent(MessageBoxEvent be) {
// eventBus.fireEvent(new DeleteItemEvent(sel));
//IF NOT CANCELLED
String clickedButton = be.getButtonClicked().getItemId();
if(clickedButton.equals(Dialog.YES)){
@ -373,7 +371,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
final DialogShareFolder finalDialog = dialogSharedFolder;
final FileModel parentModel = parent;
finalDialog.getButtonById(Dialog.OK).addListener(Events.Select, new Listener<BaseEvent>() {
@Override
@ -437,8 +434,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
else
parentToRefresh = parentFileModel;
GWT.log("share completed refresh folder : "+parentToRefresh.getName() +" get id: "+parentToRefresh.getIdentifier());
eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh, true, false, false));
GWT.log("share completed throwing refresh folder : "+parentToRefresh.getName() +" get id: "+parentToRefresh.getIdentifier());
// eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh, true, false, false));
//TODO UPDATED ID
RefreshFolderEvent refEvent = new RefreshFolderEvent(parentToRefresh, true, true, false);
refEvent.setForceReloadBreadCrumb(true);
eventBus.fireEvent(refEvent);
}
explorerPanel.unmask();
}
@ -545,18 +548,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(getLinkEvent.getSourceFile()!=null){
String currentUrl = portalURL();
int lastChar = currentUrl.lastIndexOf("?");
currentUrl = lastChar>-1?currentUrl.substring(0, lastChar):currentUrl; //IF EXISTS - REMOVE STRING AFTER ? (? INLCUSE)
// int last = currentUrl.lastIndexOf("/");
// String shareLinkUrl = currentUrl.substring(0,last+1) + "?" +ConstantsExplorer.GET_ITEMID_PARAMETER+"="+getLinkEvent.getSourceFile().getIdentifier();
//int last = currentUrl.lastIndexOf("/");
//String shareLinkUrl = currentUrl.substring(0,last+1) + "?" +ConstantsExplorer.GET_ITEMID_PARAMETER+"="+getLinkEvent.getSourceFile().getIdentifier();
String shareLinkUrl = currentUrl+ "?" +ConstantsExplorer.GET_ITEMID_PARAMETER+"="+getLinkEvent.getSourceFile().getIdentifier();
shareLinkUrl+="&"+ConstantsExplorer.GET_OPEARATION_PARAMETER+"="+WsPortletInitOperation.gotofolder;
DialogShareLink dialog = new DialogShareLink("Copy to clipboard Share Link: Ctrl+C", shareLinkUrl);
dialog.show();
}
@ -590,19 +589,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshItemEvent.getFolderTarget().getIdentifier(), refreshItemEvent.isExpandFolder());
notifySubscriber(refreshItemEvent);
}
else{ //Valitaing folder existence - called portlet side
else{ //Validating folder existence - called portlet side
FileModel target = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(refreshItemEvent.getFolderTarget().getIdentifier());
if(target!=null)
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshItemEvent.getFolderTarget().getIdentifier(), refreshItemEvent.isExpandFolder());
}
// notifySubscriber(refreshtemEvent);
}
else
GWT.log("warn: escape refresh because item is null");
}
});
@ -683,7 +677,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(result){
eventBus.fireEvent(new RefreshFolderEvent(fileInTree, false, false, false));
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(event.getTargetParentFileModel(), true); //Expand level drop
//explorerPanel.getAsycTreePanel().setExpandTreeLevel(event.getTargetParentFileModel(), true); //Expand level drop
}
if(fileInTree!=null)
@ -1741,14 +1735,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
String currentUrl = portalURL();
int last = currentUrl.lastIndexOf("/");
String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
// Log.trace("Url: "+reportUrl);
// System.out.println("currentUrl " +currentUrl);
// System.out.println("reportUrl " +reportUrl);
new WindowOpenUrl(reportUrl, "_self", "");
}
else{
String reportUrl = url;
// System.out.println("reportUrl " +reportUrl);
new WindowOpenUrl(reportUrl, "_self", "");
}
@ -1775,8 +1765,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void onSuccess(String url) {
if(url==null || url.isEmpty()){
String currentUrl = portalURL();
int last = currentUrl.lastIndexOf("/");
String templateUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.TEMPLATECREATION;
@ -1784,8 +1772,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
System.out.println("currentUrl " +currentUrl);
System.out.println("reportUrl " +templateUrl);
new WindowOpenUrl(templateUrl, "_self", "");
}else{
String templateUrl = url;
@ -1904,7 +1890,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
RefreshFolderEvent refresh = (RefreshFolderEvent) event;
sub.refreshFolder(refresh.getFolderTarget(), refresh.isForceRefresh());
sub.refreshFolder(refresh.getFolderTarget(), refresh.isForceRefresh(), refresh.isForceReloadBreadCrumb());
}else if(event instanceof SendMessageEvent){

View File

@ -17,6 +17,8 @@ public class RefreshFolderEvent extends GwtEvent<RefreshItemEventHandler> implem
private boolean ifExists = false;
private boolean forceReloadBreadCrumb = false;
/**
*
* @param folderTarget
@ -77,6 +79,15 @@ public class RefreshFolderEvent extends GwtEvent<RefreshItemEventHandler> implem
return ifExists;
}
public boolean isForceReloadBreadCrumb() {
return forceReloadBreadCrumb;
}
public void setForceReloadBreadCrumb(boolean forceReloadBreadCrumb) {
this.forceReloadBreadCrumb = forceReloadBreadCrumb;
}
@Override
public String toString() {
@ -89,7 +100,10 @@ public class RefreshFolderEvent extends GwtEvent<RefreshItemEventHandler> implem
builder.append(forceRefresh);
builder.append(", ifExists=");
builder.append(ifExists);
builder.append(", forceReloadBreadCrumb=");
builder.append(forceReloadBreadCrumb);
builder.append("]");
return builder.toString();
}
}

View File

@ -31,7 +31,7 @@ public interface SubscriberInterface {
void smartFolderSelected(String folderId, String category);
void movedItems(String sourceParentIdentifier, FileModel targetParent);
void switchView(ViewSwitchType type);
void refreshFolder(FileModel fileModel, boolean forced);
void refreshFolder(FileModel fileModel, boolean forceRefreshContent, boolean forceRefreshBreadcrumb);
// void updatePrevieMessage(String fromLogin, String subject, String date, String body, List<FileModel> attachs);
void createNewMessage(HashMap<String, String> hashAttachs);
@ -65,4 +65,11 @@ public interface SubscriberInterface {
*/
void updatedVREPermissions(String vreFolderId);
/**
*
* @param oldId
* @param newId
*/
void changedFileModelId(String oldId, String newId);
}

View File

@ -22,7 +22,7 @@ public class FileModel extends BaseModelData implements Serializable {
*/
private static final long serialVersionUID = 1L;
protected GXTFolderItemTypeEnum test; //TODO remove?
protected GXTFolderItemTypeEnum folderItemType; //It's here to serialization don't remove
protected InfoContactModel infoContacts;
protected boolean isRoot = false;
protected boolean isVreFolder;
@ -345,17 +345,29 @@ public class FileModel extends BaseModelData implements Serializable {
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("FileModel [test=");
builder.append(test);
builder.append(", infoContacts=");
builder.append(infoContacts);
builder.append(", isRoot=");
builder.append("FileModel [isRoot=");
builder.append(isRoot);
builder.append(", isVreFolder=");
builder.append(isVreFolder);
builder.append(", isSpecialFolder=");
builder.append(isSpecialFolder);
builder.append(", isShareable()=");
builder.append(isShareable());
builder.append(", getOwner()=");
builder.append(getOwner());
builder.append(", isShared()=");
builder.append(isShared());
builder.append(", getIdentifier()=");
builder.append(getIdentifier());
builder.append(", getName()=");
builder.append(getName());
// builder.append(", getParentFileModel()=");
// builder.append(getParentFileModel());
builder.append(", isDirectory()=");
builder.append(isDirectory());
builder.append("]");
return builder.toString();
}
}

View File

@ -742,10 +742,6 @@ public class AsyncTreePanel extends LayoutContainer {
private void reloadTreeLevelAndExpandFolder(final FolderModel folder, final boolean expandFolder){
treePanel.mask(ConstantsExplorer.VALIDATINGOPERATION,ConstantsExplorer.LOADINGSTYLE);
// System.out.println("ReloadTreeLevelAndExpandFolder");
// System.out.println("Start RPC - getFolderChildren");
AppControllerExplorer.rpcWorkspaceService.getFolderChildren(folder, new AsyncCallback<List<FileModel>>(){
@Override
@ -756,8 +752,6 @@ public class AsyncTreePanel extends LayoutContainer {
eventBus.fireEvent(new SessionExpiredEvent());
return;
}
// System.out.println("Error in reloadTreeLevelAndExpandFolder "+ caught.getMessage());
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items." +ConstantsExplorer.TRY_AGAIN, null);
removeAllAndRecoveryRoot();
@ -767,16 +761,9 @@ public class AsyncTreePanel extends LayoutContainer {
public void onSuccess(List<FileModel> result) {
treePanel.unmask();
store.removeAll(folder);
addChildrenToFolder(folder.getIdentifier(), result);
setExpandTreeLevel(folder, expandFolder);
// selectItem(folder);
// System.out.println("End RPC - getFolderChildren for uplaod/move");
}
});