bug fixed Ticket #2692

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@92344 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-02-26 16:35:20 +00:00
parent 653ae71aff
commit 84c824d283
3 changed files with 41 additions and 49 deletions

View File

@ -294,10 +294,11 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
String parentDirectoryName = null; String parentDirectoryName = null;
FileModel parent = null; FileModel parent = null;
if(parentFileModel==null){ //PARENT IS ROOT //COMMENTED 26/02/2014
parent = explorerPanel.getAsycTreePanel().getRootItem(); // if(parentFileModel==null){ //PARENT IS ROOT
sourceFileModel.setParentFileModel(parent); // parent = explorerPanel.getAsycTreePanel().getRootItem();
} // sourceFileModel.setParentFileModel(parent);
// }
if(sourceFileModel.isDirectory()){ if(sourceFileModel.isDirectory()){
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(sourceFileModel.getIdentifier(), true); // explorerPanel.getAsycTreePanel().setExpandTreeLevel(sourceFileModel.getIdentifier(), true);
@ -369,6 +370,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
new MessageBoxAlert("Error", caught.getMessage(), null); new MessageBoxAlert("Error", caught.getMessage(), null);
explorerPanel.unmask(); explorerPanel.unmask();
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
} }
@Override @Override
@ -381,8 +383,9 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
else else
parentToRefresh = parentFileModel; parentToRefresh = parentFileModel;
GWT.log("share completed refresh folder : "+parentToRefresh.getName() +" get id: "+parentToRefresh.getIdentifier());
eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh, true, false, false)); eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh, true, false, false));
GWT.log("share completed refresh folder : "+parentModel.getName());
} }
explorerPanel.unmask(); explorerPanel.unmask();
} }
@ -618,7 +621,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} }
new MessageBoxAlert("Error", caught.getMessage()+"." , null); new MessageBoxAlert("Error", caught.getMessage()+"." , null);
System.out.println(caught.getMessage()); // System.out.println(caught.getMessage());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(pasteItemEvent.getFolderDestinationId(), false); explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(pasteItemEvent.getFolderDestinationId(), false);
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(pasteItemEvent.getFolderSourceId(), true); explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(pasteItemEvent.getFolderSourceId(), true);
} }
@ -970,29 +973,9 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot(); explorerPanel.getAsycTreePanel().removeAllAndRecoveryRoot();
} }
} }
// com.google.gwt.user.client.Window.open(ConstantsExplorer.DOWNLOAD_WORKSPACE_SERVICE+"?id="+fileDownloadEvent.getItemIdentifier(), "_self", "");
// if(fileDownloadEvent.getDownloadType().equals(DownloadType.SHOW)){
// if(fileDownloadEvent.getItemName()!= null){
//
// new DialogDownload(fileDownloadEvent.getItemName(), "_blank", fileDownloadEvent.getItemIdentifier(), true).submitForm();
// }
//
// }else{
//
// new DialogDownload("", "_self", fileDownloadEvent.getItemIdentifier(), false).submitForm();
// }
//
markItemInTreeAsRead(fileDownloadEvent.getItemIdentifier(), true); markItemInTreeAsRead(fileDownloadEvent.getItemIdentifier(), true);
// FileModel file = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(fileDownloadEvent.getItemIdentifier());
//
// if(file!=null){ //FILE CAN NOT LOADED IN TREE
// file.setMarkAsRead(true);
// }
notifySubscriber(fileDownloadEvent); notifySubscriber(fileDownloadEvent);
} }
@ -1216,7 +1199,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onSuccess(SmartFolderModel smart) { public void onSuccess(SmartFolderModel smart) {
System.out.println("In client: " + smart.getIdentifier()); // System.out.println("In client: " + smart.getIdentifier());
explorerPanel.getShortuctsPanel().loadSmartFolder(smart); explorerPanel.getShortuctsPanel().loadSmartFolder(smart);
@ -1236,7 +1219,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onSmartFolderSelected(SmartFolderSelectedEvent smartFolderSelectedEvent) { public void onSmartFolderSelected(SmartFolderSelectedEvent smartFolderSelectedEvent) {
searching(true); searching(true);
System.out.println("Click smart folder : " + smartFolderSelectedEvent.getSmartFolderName()); // System.out.println("Click smart folder : " + smartFolderSelectedEvent.getSmartFolderName());
doSmartFolderSelected(smartFolderSelectedEvent); doSmartFolderSelected(smartFolderSelectedEvent);
} }
@ -1511,7 +1494,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} }
new MessageBoxAlert("Error", caught.getMessage()+"." , null); new MessageBoxAlert("Error", caught.getMessage()+"." , null);
System.out.println(caught.getMessage()); // System.out.println(caught.getMessage());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier(), false); explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier(), false);
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getFileSourceModel().getParentFileModel().getIdentifier(), true); explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getFileSourceModel().getParentFileModel().getIdentifier(), true);
} }
@ -1712,13 +1695,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
int last = currentUrl.lastIndexOf("/"); int last = currentUrl.lastIndexOf("/");
String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION; String reportUrl = currentUrl.substring(0,last+1) + ConstantsExplorer.REPORTGENERATION;
// Log.trace("Url: "+reportUrl); // Log.trace("Url: "+reportUrl);
System.out.println("currentUrl " +currentUrl); // System.out.println("currentUrl " +currentUrl);
System.out.println("reportUrl " +reportUrl); // System.out.println("reportUrl " +reportUrl);
new WindowOpenUrl(reportUrl, "_self", ""); new WindowOpenUrl(reportUrl, "_self", "");
} }
else{ else{
String reportUrl = url; String reportUrl = url;
System.out.println("reportUrl " +reportUrl); // System.out.println("reportUrl " +reportUrl);
new WindowOpenUrl(reportUrl, "_self", ""); new WindowOpenUrl(reportUrl, "_self", "");
} }
@ -1805,6 +1788,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
FileModel item = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(selectedEvent.getFileTarget().getIdentifier()); FileModel item = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(selectedEvent.getFileTarget().getIdentifier());
// System.out.println("selected item is "+item);
listFileModel = getListParents(listFileModel,item); //used for update path bar listFileModel = getListParents(listFileModel,item); //used for update path bar
sub.selectedItem(selectedEvent.getFileTarget(), listFileModel); sub.selectedItem(selectedEvent.getFileTarget(), listFileModel);
@ -1946,15 +1930,19 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private void getParents(List<FileModel> listParents, FileModel item){ private void getParents(List<FileModel> listParents, FileModel item){
// System.out.println("item is: "+item);
// System.out.println("parent is: "+item.getParentFileModel());
if(item==null || item.getParentFileModel()==null){ if(item==null || item.getParentFileModel()==null){
// listParents.add(item);
return; return;
} }
if(item.getParentFileModel().isRoot()){
listParents.add(item.getParentFileModel());
return;
}
listParents.add(item.getParentFileModel()); listParents.add(item.getParentFileModel());
getParents(listParents, item.getParentFileModel()); getParents(listParents, item.getParentFileModel());
} }
public void subscribe(SubscriberInterface subscriber, EventsTypeEnum[] keys) public void subscribe(SubscriberInterface subscriber, EventsTypeEnum[] keys)

View File

@ -274,7 +274,7 @@ public class FileModel extends BaseModelData implements Serializable {
} }
public FileModel getParentFileModel(){ public FileModel getParentFileModel(){
return get(ConstantsExplorer.PARENT); return (FileModel) get(ConstantsExplorer.PARENT);
} }
public boolean isDirectory(){ public boolean isDirectory(){
@ -328,14 +328,18 @@ public class FileModel extends BaseModelData implements Serializable {
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("FileModel [test="); builder.append("FileModel [isShareable()=");
builder.append(test); builder.append(isShareable());
builder.append(", infoContacts="); builder.append(", isShared()=");
builder.append(infoContacts); builder.append(isShared());
builder.append(", isRoot="); builder.append(", getIdentifier()=");
builder.append(isRoot); builder.append(getIdentifier());
builder.append(", isVreFolder="); builder.append(", getName()=");
builder.append(isVreFolder); builder.append(getName());
builder.append(", isDirectory()=");
builder.append(isDirectory());
builder.append(", isRoot()=");
builder.append(isRoot());
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }

View File

@ -281,7 +281,7 @@ public class ContextMenuTree {
createShareFolder.addSelectionListener(new SelectionListener<MenuEvent>() { createShareFolder.addSelectionListener(new SelectionListener<MenuEvent>() {
public void componentSelected(MenuEvent ce) { public void componentSelected(MenuEvent ce) {
final FileModel sourceFileModel = listSelectedItems.get(0); FileModel sourceFileModel = listSelectedItems.get(0);
if (sourceFileModel != null) { if (sourceFileModel != null) {
eventBus.fireEvent(new CreateSharedFolderEvent(sourceFileModel, sourceFileModel.getParentFileModel(), true)); eventBus.fireEvent(new CreateSharedFolderEvent(sourceFileModel, sourceFileModel.getParentFileModel(), true));
@ -373,11 +373,11 @@ public class ContextMenuTree {
share.addSelectionListener(new SelectionListener<MenuEvent>() { share.addSelectionListener(new SelectionListener<MenuEvent>() {
public void componentSelected(MenuEvent ce) { public void componentSelected(MenuEvent ce) {
for (FileModel target : listSelectedItems) {
FileModel sourceFileModel = listSelectedItems.get(0);
if(target.getIdentifier()!=null){ if (sourceFileModel != null) {
eventBus.fireEvent(new CreateSharedFolderEvent(target, target.getParentFileModel(),false)); eventBus.fireEvent(new CreateSharedFolderEvent(sourceFileModel, sourceFileModel.getParentFileModel(),false));
}
} }
} }