fixed reload item on upload file

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@76934 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-06-10 14:34:52 +00:00
parent f0603d0c58
commit 563e181d26
2 changed files with 51 additions and 11 deletions

View File

@ -440,7 +440,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void onRefreshItem(RefreshFolderEvent refreshtemEvent) {
if(refreshtemEvent.getFolderTarget()!=null){
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshtemEvent.getFolderTarget().getIdentifier());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshtemEvent.getFolderTarget().getIdentifier(), true);
notifySubscriber(refreshtemEvent);
}
else
@ -818,10 +818,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private void doCompletedFileUploadEvent(CompletedFileUploadEvent completedFileUploadEvent) {
// explorerPanel.getAsycTreePanel().reloadAndSelectTreeLevelFromWorkspaceForUplaod(completedFileUploadEvent.getParentFileModel().getIdentifier());
boolean isLevelExpanded = treeLevelIsExpanded(completedFileUploadEvent.getTargetFolderModel().getIdentifier());
//REFRESH TREE ONLY IF FOLDER PARENT EXISTS IN TREE
if(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(completedFileUploadEvent.getTargetFolderModel().getIdentifier())!=null){
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(completedFileUploadEvent.getTargetFolderModel().getIdentifier());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(completedFileUploadEvent.getTargetFolderModel().getIdentifier(), isLevelExpanded);
}
notifySubscriber(completedFileUploadEvent);
@ -1196,15 +1196,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", caught.getMessage()+"." , null);
System.out.println(caught.getMessage());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getFileSourceModel().getParentFileModel().getIdentifier());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier(), false);
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getFileSourceModel().getParentFileModel().getIdentifier(), true);
}
@Override
public void onSuccess(Boolean result) {
if(result){
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(event.getTargetParentFileModel().getIdentifier(), true);
notifySubscriber(event);
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(event.getTargetParentFileModel(), true); //Expand level drop
@ -1227,6 +1227,11 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
else
doClickPreview(imagePreviewEvent, 50, 50);
// if(imagePreviewEvent.getSourceFileModel()!=null){ //FILE CAN NOT LOADED IN TREE
// imagePreviewEvent.getSourceFileModel().setMarkAsRead(true);
// }
}
private void doClickPreview(ImagePreviewEvent imagePreviewEvent, final int positionX, final int positionY) {
@ -1583,6 +1588,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}
/**
*
* @param folderId
* @return
*/
public boolean treeLevelIsExpanded(String folderId){
return explorerPanel.getAsycTreePanel().isExpanded(folderId);
}
private List<FileModel> getListParents(List<FileModel> listParentModel, FileModel item){
getParents(listParentModel, item);

View File

@ -686,13 +686,13 @@ private static final String TREE_MESSAGE_PANEL_ASYNC = "treeMessagePanelAsync";
}
public void reloadTreeLevelAndExpandFolder(String folderIdentifier){
public void reloadTreeLevelAndExpandFolder(String folderIdentifier, boolean expandFolder){
final FolderModel folder = (FolderModel) getFileModelByIdentifier(folderIdentifier);
reloadTreeLevelAndExpandFolder(folder);
reloadTreeLevelAndExpandFolder(folder, expandFolder);
}
private void reloadTreeLevelAndExpandFolder(final FolderModel folder){
private void reloadTreeLevelAndExpandFolder(final FolderModel folder, final boolean expandFolder){
treePanel.mask(ConstantsExplorer.VALIDATINGOPERATION,ConstantsExplorer.LOADINGSTYLE);
@ -716,7 +716,9 @@ private static final String TREE_MESSAGE_PANEL_ASYNC = "treeMessagePanelAsync";
addChildrenToFolder(folder.getIdentifier(), result);
setExpandTreeLevel(folder, true);
setExpandTreeLevel(folder, expandFolder);
// selectItem(folder);
System.out.println("End RPC - getFolderChildren for uplaod/move");
}
@ -958,6 +960,26 @@ private static final String TREE_MESSAGE_PANEL_ASYNC = "treeMessagePanelAsync";
*/
private void setExpandTreeLevel(FileModel parent, boolean bool) {
treePanel.setExpanded(parent, bool);
}
/**
*
* @param identifier
* @return
*/
public boolean isExpanded(String identifier){
if(identifier==null)
return false;
FileModel fileTarget = getFileModelByIdentifier(identifier);
if(fileTarget==null)
return false;
return treePanel.isExpanded(fileTarget);
}
public void setExpandTreeLevel(String identifier, boolean bool) {
@ -966,7 +988,11 @@ private static final String TREE_MESSAGE_PANEL_ASYNC = "treeMessagePanelAsync";
treePanel.setExpanded(item, bool);
}
/**
*
* @param identifier
* @return
*/
public boolean selectItem(String identifier){
FileModel fileTarget = getFileModelByIdentifier(identifier);