bug fixed: path panel

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@69212 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-02-13 17:43:50 +00:00
parent 0a1567cf8f
commit eb6414f5f1
2 changed files with 62 additions and 14 deletions

View File

@ -472,25 +472,55 @@ public class AppController implements SubscriberInterface {
if(isSelected){
ArrayList<FileModel> listParents = appContrExplorer.getListParentsByIdentifier(target.getIdentifier());
FileModel lastParent = this.wsPortlet.getToolBarPath().getLastParent();
setPathInView(listParents); //Set file path in tab panel on current item selected
boolean parentChanged = lastParent.getIdentifier().compareTo(target.getParentFileModel().getIdentifier())==0?false:true;
//RELOAD breadcrumb only if last parent id is changed
if(parentChanged)
loadBreadcrumbById(target.getIdentifier());
// if(!(lastParent.getIdentifier().compareTo(target.getIdentifier())==0))
// loadBreadcrumbById(target.getIdentifier());
// List<FileModel> listParents = appContrExplorer.getListParentsByIdentifierFromTree(target.getIdentifier());
if(isSearchActive){ //COMMENTED 30-01-12 - syncronization only if search is active
wsPortlet.getSearchAndFilterContainer().setSearchActive(true);
appContrExplorer.searching(true);
appContrExplorer.findItemAndSelectItemInTree(target.getIdentifier());
}
// if(isSearchActive){ //COMMENTED 30-01-12 - syncronization only if search is active
//
// wsPortlet.getSearchAndFilterContainer().setSearchActive(true);
//
// appContrExplorer.searching(true);
//
// appContrExplorer.findItemAndSelectItemInTree(target.getIdentifier());
// }
}
}
private void setPathInView(ArrayList<FileModel> parents){
private void loadBreadcrumbById(String itemIdentifier){
System.out.println("Reload Breadcrumb...");
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(itemIdentifier, new AsyncCallback<List<FileModel>>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("failure get list parents by item identifier "+caught);
}
@Override
public void onSuccess(List<FileModel> result) {
setPathInView(result); //Set file path in tab panel on current item selected
}
});
}
private void setPathInView(List<FileModel> parents){
//this.wsPortlet.getBasicTabContainer().setLabelPath(path); //Set path in tab view panel
@ -649,7 +679,7 @@ public class AppController implements SubscriberInterface {
}
@Override
public void selectedItem(FileModel item, ArrayList<FileModel> parents) {
public void selectedItem(FileModel item, List<FileModel> parents) {
FileModel currentFolder = wsPortlet.getGridGroupContainer().getCurrentFolderView();

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.workspace.client.view.toolbars;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.portlets.user.workspace.client.AppController;
import org.gcube.portlets.user.workspace.client.event.PathElementSelectedEvent;
@ -27,10 +28,12 @@ public class GxtPathPanel {
private HorizontalPanel toolBar = new HorizontalPanel();
private Text txtPath = new Text("PATH ");
private LinkedHashMap<String, FileModel> hashFileModel; // Ordered-HashMap
private LinkedHashMap<String, FileModel> hashFileModel = new LinkedHashMap<String, FileModel>();// Ordered-HashMap
boolean rootAdded = false;
WidgetComponent hardDiskIcon = new WidgetComponent(new Image (Resources.getImageHardDisk()));
private FileModel lastParent;
public GxtPathPanel() {
toolBar = new HorizontalPanel();
toolBar.setHeight("25px");
@ -41,7 +44,7 @@ public class GxtPathPanel {
return toolBar;
}
public void setPath(ArrayList<FileModel> parents) {
public void setPath(List<FileModel> parents) {
initToolbarWithoutFakeRoot();
@ -91,11 +94,26 @@ public class GxtPathPanel {
}
lastParent = parents.get(parents.size()-1);
toolBar.add(listButtons.get(size - 1)); // Add last element
toolBar.layout(true);
}
}
public boolean breadcrumbIsEmpty(){
if(hashFileModel.size() == 0)
return true;
return false;
}
public FileModel getLastParent(){
return lastParent;
}
private void initToolbar() {
toolBar.removeAll();
toolBar.setStyleName("myToolbar");