Fixed bug on breadcrumb
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@172016 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8c6e61254f
commit
a2f5be0a06
|
@ -1,11 +1,6 @@
|
||||||
package org.gcube.portlets.widgets.wsexplorer.client;
|
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.shared.GWT;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerSelectDialog(String captionTxt) {
|
public WorkspaceExplorerSelectDialog(String captionTxt) {
|
||||||
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
|
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
|
||||||
loadExplorer(captionTxt, null);
|
loadExplorer(captionTxt, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerSelectDialog(String captionTxt, FilterCriteria filterCriteria) {
|
public WorkspaceExplorerSelectDialog(String captionTxt, FilterCriteria filterCriteria) {
|
||||||
controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
|
controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
|
||||||
loadExplorer(captionTxt, null);
|
loadExplorer(captionTxt, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +88,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
itemsType = selectableTypes.toArray(itemsType);
|
itemsType = selectableTypes.toArray(itemsType);
|
||||||
setSelectableTypes(selectableTypes.toArray(itemsType));
|
setSelectableTypes(selectableTypes.toArray(itemsType));
|
||||||
}
|
}
|
||||||
loadExplorer(captionTxt, null);
|
loadExplorer(captionTxt, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
setShowableTypes(showableTypes.toArray(itemsType));
|
setShowableTypes(showableTypes.toArray(itemsType));
|
||||||
}
|
}
|
||||||
|
|
||||||
loadExplorer(captionTxt, folderId);
|
loadExplorer(captionTxt, folderId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
setShowableTypes(itemsType);
|
setShowableTypes(itemsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadExplorer(captionTxt, null);
|
loadExplorer(captionTxt, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -151,7 +151,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
* @param showOnlyFolders the show only folders
|
* @param showOnlyFolders the show only folders
|
||||||
* @param baseFolderId the base folder id
|
* @param baseFolderId the base folder id
|
||||||
*/
|
*/
|
||||||
public WorkspaceExplorerSelectDialog(String captionTxt, boolean showOnlyFolders, String baseFolderId) {
|
public WorkspaceExplorerSelectDialog(String captionTxt, boolean showOnlyFolders, String baseFolderId, String baseFolderName) {
|
||||||
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
|
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
|
||||||
if(showOnlyFolders){
|
if(showOnlyFolders){
|
||||||
ItemType[] itemsType = new ItemType[4];
|
ItemType[] itemsType = new ItemType[4];
|
||||||
|
@ -164,7 +164,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
setShowableTypes(itemsType);
|
setShowableTypes(itemsType);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadExplorer(captionTxt, baseFolderId);
|
loadExplorer(captionTxt, baseFolderId, baseFolderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,10 +190,29 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
setShowableTypes(showableTypes.toArray(itemsType));
|
setShowableTypes(showableTypes.toArray(itemsType));
|
||||||
}
|
}
|
||||||
|
|
||||||
loadExplorer(captionTxt, null);
|
loadExplorer(captionTxt, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Load explorer.
|
||||||
|
// * If folder id is null or empty the explorer loads the root element
|
||||||
|
// * Otherwise, it loads the folder id
|
||||||
|
// *
|
||||||
|
// * @param captionTxt the caption txt
|
||||||
|
// * @param folderId the folder id
|
||||||
|
// */
|
||||||
|
// private void loadExplorer(String captionTxt, String folderId){
|
||||||
|
//
|
||||||
|
// if(folderId==null || folderId.isEmpty())
|
||||||
|
// controller.getEventBus().fireEvent(new LoadRootEvent());
|
||||||
|
// else{
|
||||||
|
// Item item = new Item(folderId, "", true);
|
||||||
|
// controller.getEventBus().fireEvent(new LoadFolderEvent<Item>(item));
|
||||||
|
// }
|
||||||
|
// initDialog(captionTxt);
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load explorer.
|
* Load explorer.
|
||||||
* If folder id is null or empty the explorer loads the root element
|
* If folder id is null or empty the explorer loads the root element
|
||||||
|
@ -202,12 +221,12 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
||||||
* @param captionTxt the caption txt
|
* @param captionTxt the caption txt
|
||||||
* @param folderId the folder id
|
* @param folderId the folder id
|
||||||
*/
|
*/
|
||||||
private void loadExplorer(String captionTxt, String folderId){
|
private void loadExplorer(String captionTxt, String folderId, String baseFolderName){
|
||||||
|
|
||||||
if(folderId==null || folderId.isEmpty())
|
if(folderId==null || folderId.isEmpty())
|
||||||
controller.getEventBus().fireEvent(new LoadRootEvent());
|
controller.getEventBus().fireEvent(new LoadRootEvent());
|
||||||
else{
|
else{
|
||||||
Item item = new Item(folderId, "", true);
|
Item item = new Item(folderId, baseFolderName, true);
|
||||||
controller.getEventBus().fireEvent(new LoadFolderEvent<Item>(item));
|
controller.getEventBus().fireEvent(new LoadFolderEvent<Item>(item));
|
||||||
}
|
}
|
||||||
initDialog(captionTxt);
|
initDialog(captionTxt);
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
package org.gcube.portlets.widgets.wsexplorer.client.select;
|
package org.gcube.portlets.widgets.wsexplorer.client.select;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Map;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||||
import org.gcube.common.storagehub.model.Metadata;
|
|
||||||
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
import org.gcube.common.storagehub.model.items.AbstractFileItem;
|
||||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||||
import org.gcube.common.storagehub.model.items.Item;
|
import org.gcube.common.storagehub.model.items.Item;
|
||||||
|
@ -253,7 +252,15 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
||||||
}
|
}
|
||||||
Collections.reverse(toReturn);
|
Collections.reverse(toReturn);
|
||||||
|
|
||||||
String theClickedFolderName = (itemName == null || itemName.equals("")) ? "current folder" : itemName;
|
|
||||||
|
Item theFolder;
|
||||||
|
if(itemName==null || itemName.isEmpty()){
|
||||||
|
theFolder = StorageHubServiceUtil.getItem(getThreadLocalRequest(), itemIdentifier);
|
||||||
|
itemName = theFolder.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
String theClickedFolderName = itemName == null || itemName.equals("") ? "current folder" : itemName;
|
||||||
|
|
||||||
toReturn.add(new org.gcube.portlets.widgets.wsexplorer.shared.Item(itemIdentifier, theClickedFolderName, true)); //this is the last non clickable item on the BC
|
toReturn.add(new org.gcube.portlets.widgets.wsexplorer.shared.Item(itemIdentifier, theClickedFolderName, true)); //this is the last non clickable item on the BC
|
||||||
return toReturn;
|
return toReturn;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -287,11 +294,11 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
||||||
|
|
||||||
Item folderItem = StorageHubServiceUtil.getItem(getThreadLocalRequest(), itemIdentifier);
|
Item folderItem = StorageHubServiceUtil.getItem(getThreadLocalRequest(), itemIdentifier);
|
||||||
String theClickedFolderName = folderItem.getTitle();
|
String theClickedFolderName = folderItem.getTitle();
|
||||||
if((theClickedFolderName.compareTo(WorkspaceExplorerConstants.SPECIAL_FOLDERS_NAME) == 0)){
|
if(theClickedFolderName.compareTo(WorkspaceExplorerConstants.SPECIAL_FOLDERS_NAME) == 0){
|
||||||
theClickedFolderName = WorkspaceExplorerConstants.VRE_FOLDERS_LABEL;
|
theClickedFolderName = WorkspaceExplorerConstants.VRE_FOLDERS_LABEL;
|
||||||
} else {
|
} else {
|
||||||
ItemType type = ItemBuilder.getItemType(folderItem);
|
ItemType type = ItemBuilder.getItemType(folderItem);
|
||||||
boolean isSharedFolder = (type.equals(ItemType.SHARED_FOLDER) || type.equals(ItemType.VRE_FOLDER )) ? true : false;
|
boolean isSharedFolder = type.equals(ItemType.SHARED_FOLDER) || type.equals(ItemType.VRE_FOLDER ) ? true : false;
|
||||||
if(isSharedFolder){
|
if(isSharedFolder){
|
||||||
SharedFolder shared = (SharedFolder) folderItem;
|
SharedFolder shared = (SharedFolder) folderItem;
|
||||||
theClickedFolderName = shared.isVreFolder() ? shared.getDisplayName() : folderItem.getTitle();
|
theClickedFolderName = shared.isVreFolder() ? shared.getDisplayName() : folderItem.getTitle();
|
||||||
|
@ -329,7 +336,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
||||||
_log.debug("get Size By ItemId "+ itemId);
|
_log.debug("get Size By ItemId "+ itemId);
|
||||||
Item wsItem = StorageHubServiceUtil.getItem(getThreadLocalRequest(), itemId);
|
Item wsItem = StorageHubServiceUtil.getItem(getThreadLocalRequest(), itemId);
|
||||||
_log.trace("workspace retrieved item name: "+wsItem.getName());
|
_log.trace("workspace retrieved item name: "+wsItem.getName());
|
||||||
if((wsItem instanceof FolderItem)) //if is a folder no Size
|
if(wsItem instanceof FolderItem) //if is a folder no Size
|
||||||
return 0L;
|
return 0L;
|
||||||
|
|
||||||
AbstractFileItem file = (AbstractFileItem) wsItem;
|
AbstractFileItem file = (AbstractFileItem) wsItem;
|
||||||
|
@ -351,7 +358,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
||||||
_log.debug("get MimeType By ItemId "+ itemId);
|
_log.debug("get MimeType By ItemId "+ itemId);
|
||||||
Item wsItem = StorageHubServiceUtil.getItem(getThreadLocalRequest(), itemId);
|
Item wsItem = StorageHubServiceUtil.getItem(getThreadLocalRequest(), itemId);
|
||||||
_log.trace("workspace retrieved item name: "+wsItem.getName());
|
_log.trace("workspace retrieved item name: "+wsItem.getName());
|
||||||
if((wsItem instanceof FolderItem)) //if is a folder no mime
|
if(wsItem instanceof FolderItem) //if is a folder no mime
|
||||||
return null;
|
return null;
|
||||||
AbstractFileItem file = (AbstractFileItem) wsItem;
|
AbstractFileItem file = (AbstractFileItem) wsItem;
|
||||||
return file.getContent().getMimeType();
|
return file.getContent().getMimeType();
|
||||||
|
|
Loading…
Reference in New Issue