updated icons and breadcrumb
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@167659 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -4,7 +4,7 @@
|
|||
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.resources.old.WorkspaceLightTreeResources;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
|
@ -67,25 +67,29 @@ public class Util {
|
|||
* @param type the item type.
|
||||
* @return the image.
|
||||
*/
|
||||
public static ImageResource getImage(ItemDTO item)
|
||||
{
|
||||
public static ImageResource getImage(Item item) {
|
||||
if(item==null)
|
||||
return null;
|
||||
|
||||
switch (item.getType()) {
|
||||
// case ROOT: return WorkspaceLightTreeResources.INSTANCE.root();
|
||||
case FOLDER: {
|
||||
if (item.isSharedFolder()) return WorkspaceLightTreeResources.INSTANCE.sharedFolder();
|
||||
else return WorkspaceLightTreeResources.INSTANCE.folder();
|
||||
}
|
||||
case FOLDER:
|
||||
case PRIVATE_FOLDER:
|
||||
return WorkspaceLightTreeResources.INSTANCE.folder();
|
||||
case SHARED_FOLDER: return WorkspaceLightTreeResources.INSTANCE.sharedFolder();
|
||||
case VRE_FOLDER: return WorkspaceLightTreeResources.INSTANCE.sharedFolder();
|
||||
case EXTERNAL_IMAGE: return WorkspaceLightTreeResources.INSTANCE.external_image();
|
||||
case EXTERNAL_FILE: return WorkspaceLightTreeResources.INSTANCE.external_file();
|
||||
case EXTERNAL_PDF_FILE: return WorkspaceLightTreeResources.INSTANCE.external_pdf();
|
||||
case CSV: return WorkspaceLightTreeResources.INSTANCE.CSV();
|
||||
case EXTERNAL_URL: return WorkspaceLightTreeResources.INSTANCE.external_url();
|
||||
case REPORT_TEMPLATE: return WorkspaceLightTreeResources.INSTANCE.report_template();
|
||||
case REPORT: return WorkspaceLightTreeResources.INSTANCE.report();
|
||||
case QUERY: return WorkspaceLightTreeResources.INSTANCE.query();
|
||||
case DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.document();
|
||||
case CALENDAR: return WorkspaceLightTreeResources.INSTANCE.CALENDAR();
|
||||
case DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.DOC();
|
||||
case PRESENTATION: return WorkspaceLightTreeResources.INSTANCE.PPT();
|
||||
case SPREADSHEET: return WorkspaceLightTreeResources.INSTANCE.XLS();
|
||||
case METADATA: return WorkspaceLightTreeResources.INSTANCE.metadata();
|
||||
case PDF_DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.pdf_document();
|
||||
case IMAGE_DOCUMENT: return WorkspaceLightTreeResources.INSTANCE.image_document();
|
||||
|
|
|
@ -26,6 +26,8 @@ public class WorkspaceExplorerConstants {
|
|||
public static final String HOME_LABEL = "Home";
|
||||
|
||||
public static final String WORKSPACE_MY_SPECIAL_FOLDERS_PATH = "/Workspace/MySpecialFolders";
|
||||
|
||||
public static final String WORKSPACE_FOLDER_EMPTY_MESSAGE = "This folder is empty";
|
||||
|
||||
// DIALOGS
|
||||
public static final String SAVE = "Save";
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.wsexplorer.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEvent;
|
||||
|
@ -27,7 +28,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.view.CreateFolderForm;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.view.Navigation;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceExplorer;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
|
@ -70,7 +71,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
bindEvents();
|
||||
//As default all items are showable and selectable
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, ItemType.values(), ItemType.values());
|
||||
wsExplorer.initTable(new ListDataProvider<ItemDTO>());
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
initExplorerPanel(heightPanel);
|
||||
}
|
||||
|
||||
|
@ -86,7 +87,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
bindEvents();
|
||||
//As default all items are showable and selectable
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filterCriteria, ItemType.values(), ItemType.values(), null, false, null);
|
||||
wsExplorer.initTable(new ListDataProvider<ItemDTO>());
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
initExplorerPanel(heightPanel);
|
||||
}
|
||||
|
||||
|
@ -105,7 +106,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
bindEvents();
|
||||
//As default all items are showable and selectable
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filterCriteria, ItemType.values(), ItemType.values(), showProperties, false, null);
|
||||
wsExplorer.initTable(new ListDataProvider<ItemDTO>());
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
initExplorerPanel(heightPanel);
|
||||
}
|
||||
|
||||
|
@ -133,13 +134,13 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
|
||||
if(loadFolderEvent.getTargetItem()!=null){
|
||||
|
||||
if(loadFolderEvent.getTargetItem() instanceof ItemDTO){
|
||||
ItemDTO item = (ItemDTO) loadFolderEvent.getTargetItem();
|
||||
if(loadFolderEvent.getTargetItem() instanceof Item){
|
||||
Item item = (Item) loadFolderEvent.getTargetItem();
|
||||
|
||||
if(item.isFolder()){
|
||||
try {
|
||||
wsExplorer.loadFolder(item, false, -1, -1, true);
|
||||
loadParentBreadcrumbByItemId(item.getId(), true);
|
||||
loadParentBreadcrumbByItemId(item.getId(), item.getName(), true);
|
||||
|
||||
if(item.isSpecialFolder())
|
||||
navigation.setVisibleNewFolderFacility(false);
|
||||
|
@ -168,7 +169,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
|
||||
@Override
|
||||
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
||||
eventBus.fireEvent(new LoadFolderEvent<ItemDTO>(breadcrumbClickEvent.getTargetItem()));
|
||||
eventBus.fireEvent(new LoadFolderEvent<Item>(breadcrumbClickEvent.getTargetItem()));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -178,7 +179,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
public void onLoadRoot(LoadRootEvent loadRootEvent) {
|
||||
wsExplorer.loadRoot();
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.HOME, new AsyncCallback<ItemDTO>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.HOME, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -188,7 +189,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ItemDTO result) {
|
||||
public void onSuccess(Item result) {
|
||||
result.setName(WorkspaceExplorerConstants.HOME_LABEL); //FORCE SET NAME LIKE "HOME_LABEL"
|
||||
breadcrumbs.init(result);
|
||||
navigation.setVisibleNewFolderFacility(true);
|
||||
|
@ -212,8 +213,8 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
public <T> void onClick(final ClickItemEvent<T> clickItemEvent) {
|
||||
|
||||
if(clickItemEvent.getItem()!=null){
|
||||
if (clickItemEvent.getItem() instanceof ItemDTO) {
|
||||
ItemDTO item = (ItemDTO) clickItemEvent.getItem();
|
||||
if (clickItemEvent.getItem() instanceof Item) {
|
||||
Item item = (Item) clickItemEvent.getItem();
|
||||
updateMoreInfo(item);
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +227,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
public void onLoadMySpecialFolder(LoadMySpecialFolderEvent loadMySpecialFolderEvent) {
|
||||
wsExplorer.loadMySpecialFolder();
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.VRE_FOLDER, new AsyncCallback<ItemDTO>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.VRE_FOLDER, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -235,7 +236,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ItemDTO result) {
|
||||
public void onSuccess(Item result) {
|
||||
breadcrumbs.init(result);
|
||||
navigation.setVisibleNewFolderFacility(false);
|
||||
clearMoreInfo();
|
||||
|
@ -256,7 +257,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
|
||||
showMessage(AlertType.INFO, "Creating folder \""+folderName+"\"");
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.createFolder(folderName, "", breadcrumbs.getLastParent().getId(), new AsyncCallback<ItemDTO>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.createFolder(folderName, "", breadcrumbs.getLastParent().getId(), new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -267,7 +268,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ItemDTO result) {
|
||||
public void onSuccess(Item result) {
|
||||
hideMessage();
|
||||
if(result!=null){
|
||||
wsExplorer.addItemToExplorer(result);
|
||||
|
@ -296,11 +297,11 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
* @param itemIdentifier the item identifier
|
||||
* @param includeItemAsParent the include item as parent
|
||||
*/
|
||||
protected void loadParentBreadcrumbByItemId(final String itemIdentifier, boolean includeItemAsParent){
|
||||
protected void loadParentBreadcrumbByItemId(final String itemIdentifier, String itemName, boolean includeItemAsParent){
|
||||
|
||||
GWT.log("Reload Parent Breadcrumb: [Item id: "+itemIdentifier+"]");
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifier(itemIdentifier, includeItemAsParent, new AsyncCallback<List<ItemDTO>>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifier(itemIdentifier, itemName, includeItemAsParent, new AsyncCallback<ArrayList<Item>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -309,7 +310,10 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<ItemDTO> result) {
|
||||
public void onSuccess(ArrayList<Item> result) {
|
||||
for (Item item : result) {
|
||||
GWT.log("->"+item.getName());
|
||||
}
|
||||
if(result!=null){
|
||||
breadcrumbs.setPath(result);
|
||||
clearMoreInfo();
|
||||
|
@ -330,7 +334,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
*
|
||||
* @param item the item
|
||||
*/
|
||||
private void updateMoreInfo(ItemDTO item){
|
||||
private void updateMoreInfo(Item item){
|
||||
|
||||
if(item!=null){
|
||||
workspaceExplorerPanel.getSouthPanel().clear();
|
||||
|
@ -469,7 +473,7 @@ public class WorkspaceExplorerController implements EventHandler {
|
|||
* @param item the item
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean itemIsSelectable(ItemDTO item){
|
||||
public boolean itemIsSelectable(Item item){
|
||||
GWT.log("Selectable type: "+wsExplorer.getSelectableTypes());
|
||||
GWT.log("item: "+item);
|
||||
if (item!=null){
|
||||
|
|
|
@ -2,7 +2,7 @@ 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.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
|
@ -23,7 +23,7 @@ public class WorkspaceExplorerEntryPoint implements EntryPoint {
|
|||
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
|
||||
|
||||
@Override
|
||||
public void onSelectedItem(ItemDTO item) {
|
||||
public void onSelectedItem(Item item) {
|
||||
GWT.log("onSelectedItem: "+item);
|
||||
navigator.hide();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.widgets.wsexplorer.client.event;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import com.google.gwt.event.shared.GwtEvent;
|
|||
*/
|
||||
public class BreadcrumbClickEvent extends GwtEvent<BreadcrumbClickEventHandler> {
|
||||
public static Type<BreadcrumbClickEventHandler> TYPE = new Type<BreadcrumbClickEventHandler>();
|
||||
private ItemDTO targetItem;
|
||||
private Item targetItem;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ public class BreadcrumbClickEvent extends GwtEvent<BreadcrumbClickEventHandler>
|
|||
*
|
||||
* @param target the target
|
||||
*/
|
||||
public BreadcrumbClickEvent(ItemDTO target) {
|
||||
public BreadcrumbClickEvent(Item target) {
|
||||
this.targetItem = target;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class BreadcrumbClickEvent extends GwtEvent<BreadcrumbClickEventHandler>
|
|||
*
|
||||
* @return the targetItem
|
||||
*/
|
||||
public ItemDTO getTargetItem() {
|
||||
public Item getTargetItem() {
|
||||
return targetItem;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class BreadcrumbClickEvent extends GwtEvent<BreadcrumbClickEventHandler>
|
|||
*
|
||||
* @param targetItem the targetItem to set
|
||||
*/
|
||||
public void setTargetItem(ItemDTO targetItem) {
|
||||
public void setTargetItem(Item targetItem) {
|
||||
this.targetItem = targetItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.widgets.wsexplorer.client.event;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import com.google.gwt.event.shared.GwtEvent;
|
|||
*/
|
||||
public class BreadcrumbInitEvent extends GwtEvent<BreadcrumbInitEventHandler> {
|
||||
public static Type<BreadcrumbInitEventHandler> TYPE = new Type<BreadcrumbInitEventHandler>();
|
||||
private ItemDTO targetItem;
|
||||
private Item targetItem;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ public class BreadcrumbInitEvent extends GwtEvent<BreadcrumbInitEventHandler> {
|
|||
*
|
||||
* @param target the target
|
||||
*/
|
||||
public BreadcrumbInitEvent(ItemDTO target) {
|
||||
public BreadcrumbInitEvent(Item target) {
|
||||
this.targetItem = target;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public class BreadcrumbInitEvent extends GwtEvent<BreadcrumbInitEventHandler> {
|
|||
*
|
||||
* @return the targetItem
|
||||
*/
|
||||
public ItemDTO getTargetItem() {
|
||||
public Item getTargetItem() {
|
||||
return targetItem;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class BreadcrumbInitEvent extends GwtEvent<BreadcrumbInitEventHandler> {
|
|||
*
|
||||
* @param targetItem the targetItem to set
|
||||
*/
|
||||
public void setTargetItem(ItemDTO targetItem) {
|
||||
public void setTargetItem(Item targetItem) {
|
||||
this.targetItem = targetItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.portlets.widgets.wsexplorer.client.event;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -13,9 +13,9 @@ import com.google.gwt.event.shared.GwtEvent;
|
|||
public class RootLoadedEvent extends GwtEvent<RootLoadedEventHandler> {
|
||||
|
||||
public static Type<RootLoadedEventHandler> TYPE = new Type<RootLoadedEventHandler>();
|
||||
private ItemDTO root;
|
||||
private Item root;
|
||||
|
||||
public RootLoadedEvent(ItemDTO root) {
|
||||
public RootLoadedEvent(Item root) {
|
||||
this.root = root;
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class RootLoadedEvent extends GwtEvent<RootLoadedEventHandler> {
|
|||
/**
|
||||
* @return the root
|
||||
*/
|
||||
public ItemDTO getRoot() {
|
||||
public Item getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.view.Breadcrumbs;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceExplorer;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
|
@ -241,8 +241,8 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
setParameters(folderId, folderName, showProperties, filter);
|
||||
bindEvents();
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,DISPLAY_FIELD.CREATION_DATE});
|
||||
wsExplorer.initTable(new ListDataProvider<ItemDTO>());
|
||||
ItemDTO item = new ItemDTO(folderId, folderName, true);
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
Item item = new Item(folderId, folderName, true);
|
||||
wsExplorer.loadFolder(item, true, -1, -1, false);
|
||||
initPanel("");
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
@Override
|
||||
public <T> void onClick(final ClickItemEvent<T> clickItemEvent) {
|
||||
isSelect = false;
|
||||
ItemDTO item = wsExplorer.getItemSelected();
|
||||
Item item = wsExplorer.getItemSelected();
|
||||
|
||||
//Return if item is not selectable
|
||||
if(!itemIsSelectable(item)){
|
||||
|
@ -294,8 +294,8 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
|
||||
if(loadFolderEvent.getTargetItem()!=null){
|
||||
|
||||
if(loadFolderEvent.getTargetItem() instanceof ItemDTO){
|
||||
ItemDTO item = (ItemDTO) loadFolderEvent.getTargetItem();
|
||||
if(loadFolderEvent.getTargetItem() instanceof Item){
|
||||
Item item = (Item) loadFolderEvent.getTargetItem();
|
||||
if(item.isFolder()){
|
||||
try {
|
||||
wsExplorer.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
|
@ -315,7 +315,7 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
|
||||
@Override
|
||||
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
||||
eventBus.fireEvent(new LoadFolderEvent<ItemDTO>(breadcrumbClickEvent.getTargetItem()));
|
||||
eventBus.fireEvent(new LoadFolderEvent<Item>(breadcrumbClickEvent.getTargetItem()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
|
||||
GWT.log("Reload Parent Breadcrumb: [Item id: "+itemIdentifier+"]");
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(itemIdentifier, folderId, includeItemAsParent, new AsyncCallback<List<ItemDTO>>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(itemIdentifier, folderId, includeItemAsParent, new AsyncCallback<List<Item>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -340,7 +340,7 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<ItemDTO> result) {
|
||||
public void onSuccess(List<Item> result) {
|
||||
if(result!=null){
|
||||
notifyOnBreadcrumbChanged(result.get(result.size()-1));
|
||||
breadcrumbs.setPath(result);
|
||||
|
@ -355,8 +355,8 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
* Refresh root folder view.
|
||||
*/
|
||||
public void refreshRootFolderView(){
|
||||
ItemDTO item = new ItemDTO(folderId, folderName, true);
|
||||
eventBus.fireEvent(new LoadFolderEvent<ItemDTO>(item));
|
||||
Item item = new Item(folderId, folderName, true);
|
||||
eventBus.fireEvent(new LoadFolderEvent<Item>(item));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -395,7 +395,7 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
*
|
||||
* @param selected the selected
|
||||
*/
|
||||
protected void notifySelectedItem(ItemDTO selected){
|
||||
protected void notifySelectedItem(Item selected){
|
||||
|
||||
for (WorskpaceExplorerSelectBNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
||||
|
@ -408,7 +408,7 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
*
|
||||
* @param selected the selected
|
||||
*/
|
||||
protected void notifyOnBreadcrumbChanged(ItemDTO selected){
|
||||
protected void notifyOnBreadcrumbChanged(Item selected){
|
||||
|
||||
for (WorskpaceExplorerSelectBNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||
worskpaceExplorerNotificationListener.onBreadcrumbChanged(selected);
|
||||
|
@ -495,7 +495,7 @@ public class WorkspaceResourcesBExplorerPanel extends DockPanel implements HasWo
|
|||
* @param item the item
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean itemIsSelectable(ItemDTO item){
|
||||
public boolean itemIsSelectable(Item item){
|
||||
//GWT.log("Selectable type: "+wsExplorer.getSelectableTypes());
|
||||
//GWT.log("item: "+item);
|
||||
if (item!=null){
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.view.Breadcrumbs;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceExplorer;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
|
@ -212,8 +212,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
setParameters(folderId, folderName, showProperties, filter);
|
||||
bindEvents();
|
||||
wsExplorer = new WorkspaceExplorer(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,DISPLAY_FIELD.CREATION_DATE});
|
||||
wsExplorer.initTable(new ListDataProvider<ItemDTO>());
|
||||
ItemDTO item = new ItemDTO(folderId, folderName, true);
|
||||
wsExplorer.initTable(new ListDataProvider<Item>());
|
||||
Item item = new Item(folderId, folderName, true);
|
||||
wsExplorer.loadFolder(item, true, -1, -1, false);
|
||||
initPanel("");
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
@Override
|
||||
public <T> void onClick(final ClickItemEvent<T> clickItemEvent) {
|
||||
isSelect = false;
|
||||
ItemDTO item = wsExplorer.getItemSelected();
|
||||
Item item = wsExplorer.getItemSelected();
|
||||
|
||||
//Return if item is not selectable
|
||||
if(!itemIsSelectable(item)){
|
||||
|
@ -265,8 +265,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
|
||||
if(loadFolderEvent.getTargetItem()!=null){
|
||||
|
||||
if(loadFolderEvent.getTargetItem() instanceof ItemDTO){
|
||||
ItemDTO item = (ItemDTO) loadFolderEvent.getTargetItem();
|
||||
if(loadFolderEvent.getTargetItem() instanceof Item){
|
||||
Item item = (Item) loadFolderEvent.getTargetItem();
|
||||
if(item.isFolder()){
|
||||
try {
|
||||
wsExplorer.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
|
@ -286,7 +286,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
|
||||
@Override
|
||||
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
||||
eventBus.fireEvent(new LoadFolderEvent<ItemDTO>(breadcrumbClickEvent.getTargetItem()));
|
||||
eventBus.fireEvent(new LoadFolderEvent<Item>(breadcrumbClickEvent.getTargetItem()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
|
||||
GWT.log("Reload Parent Breadcrumb: [Item id: "+itemIdentifier+"]");
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(itemIdentifier, folderId, includeItemAsParent, new AsyncCallback<List<ItemDTO>>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(itemIdentifier, folderId, includeItemAsParent, new AsyncCallback<List<Item>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -311,7 +311,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<ItemDTO> result) {
|
||||
public void onSuccess(List<Item> result) {
|
||||
if(result!=null){
|
||||
breadcrumbs.setPath(result);
|
||||
clearMoreInfo();
|
||||
|
@ -325,8 +325,8 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
* Refresh root folder view.
|
||||
*/
|
||||
public void refreshRootFolderView(){
|
||||
ItemDTO item = new ItemDTO(folderId, folderName, true);
|
||||
eventBus.fireEvent(new LoadFolderEvent<ItemDTO>(item));
|
||||
Item item = new Item(folderId, folderName, true);
|
||||
eventBus.fireEvent(new LoadFolderEvent<Item>(item));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -365,7 +365,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
*
|
||||
* @param selected the selected
|
||||
*/
|
||||
protected void notifySelectedItem(ItemDTO selected){
|
||||
protected void notifySelectedItem(Item selected){
|
||||
|
||||
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
||||
|
@ -451,7 +451,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|||
* @param item the item
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean itemIsSelectable(ItemDTO item){
|
||||
public boolean itemIsSelectable(Item item){
|
||||
//GWT.log("Selectable type: "+wsExplorer.getSelectableTypes());
|
||||
//GWT.log("item: "+item);
|
||||
if (item!=null){
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEventHandler
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceExplorerPaginated;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
|
@ -125,7 +125,7 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
|
|||
wsExplorerPaginated = new WorkspaceExplorerPaginated(eventBus, filter, showableTypes, selectableTypes, showProperties, showGcubeInfo, sortByColumn, new DISPLAY_FIELD[]{DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME, DISPLAY_FIELD.CREATION_DATE});
|
||||
wsExplorerPaginated.initPagination(ITEMS_PER_PAGE);
|
||||
//wsExplorer.initTable(dataProvider);
|
||||
ItemDTO item = new ItemDTO(folderId, folderName, true);
|
||||
Item item = new Item(folderId, folderName, true);
|
||||
wsExplorerPaginated.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
initPanel("");
|
||||
super.wsExplorer = wsExplorerPaginated;
|
||||
|
@ -159,7 +159,7 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
|
|||
@Override
|
||||
public <T> void onClick(final ClickItemEvent<T> clickItemEvent) {
|
||||
isSelect = false;
|
||||
ItemDTO item = wsExplorerPaginated.getItemSelected();
|
||||
Item item = wsExplorerPaginated.getItemSelected();
|
||||
//Return if item is not selectable
|
||||
if(!itemIsSelectable(item)){
|
||||
notifyNotValidSelection();
|
||||
|
@ -178,8 +178,8 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
|
|||
|
||||
if(loadFolderEvent.getTargetItem()!=null){
|
||||
|
||||
if(loadFolderEvent.getTargetItem() instanceof ItemDTO){
|
||||
ItemDTO item = (ItemDTO) loadFolderEvent.getTargetItem();
|
||||
if(loadFolderEvent.getTargetItem() instanceof Item){
|
||||
Item item = (Item) loadFolderEvent.getTargetItem();
|
||||
if(item.isFolder()){
|
||||
try {
|
||||
wsExplorerPaginated.loadFolder(item, true, ITEM_START_INDEX, ITEMS_PER_PAGE, true);
|
||||
|
@ -199,7 +199,7 @@ public class WorkspaceResourcesExplorerPanelPaginated extends WorkspaceResources
|
|||
|
||||
@Override
|
||||
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
||||
eventBus.fireEvent(new LoadFolderEvent<ItemDTO>(breadcrumbClickEvent.getTargetItem()));
|
||||
eventBus.fireEvent(new LoadFolderEvent<Item>(breadcrumbClickEvent.getTargetItem()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.wsexplorer.client.notification;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ public class WorkspaceExplorerSaveNotification {
|
|||
* @param parent the parent
|
||||
* @param fileName the file name
|
||||
*/
|
||||
void onSaving(ItemDTO parent,String fileName);
|
||||
void onSaving(Item parent,String fileName);
|
||||
|
||||
/**
|
||||
* On aborted.
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.wsexplorer.client.notification;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ public class WorkspaceExplorerSelectBNotification {
|
|||
*
|
||||
* @param item the item
|
||||
*/
|
||||
void onSelectedItem(ItemDTO item);
|
||||
void onSelectedItem(Item item);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ public class WorkspaceExplorerSelectBNotification {
|
|||
*
|
||||
* @param item the item
|
||||
*/
|
||||
void onBreadcrumbChanged(ItemDTO item);
|
||||
void onBreadcrumbChanged(Item item);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.wsexplorer.client.notification;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ public class WorkspaceExplorerSelectNotification {
|
|||
*
|
||||
* @param item the item
|
||||
*/
|
||||
void onSelectedItem(ItemDTO item);
|
||||
void onSelectedItem(Item item);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,13 +26,13 @@ public interface WorkspaceExplorerIcons extends ClientBundle {
|
|||
@Source("loading.gif")
|
||||
ImageResource logo();
|
||||
|
||||
@Source("vre_folder.png")
|
||||
@Source("baseline_folder_special_white_24dp.png")
|
||||
ImageResource vre_folder();
|
||||
|
||||
@Source("new_folder.png")
|
||||
@Source("baseline_create_new_folder_white_24dp.png")
|
||||
ImageResource new_folder();
|
||||
|
||||
@Source("home.png")
|
||||
@Source("baseline_home_white_24dp.png")
|
||||
ImageResource home();
|
||||
|
||||
@Source("info-icon.png")
|
||||
|
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 403 B |
Before Width: | Height: | Size: 823 B |
Before Width: | Height: | Size: 581 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
|
@ -31,15 +31,30 @@ public interface WorkspaceLightTreeResources extends ClientBundle {
|
|||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("folder.png")
|
||||
@Source("FOLDER.png")
|
||||
ImageResource folder();
|
||||
|
||||
@Source("DOC.png")
|
||||
ImageResource DOC();
|
||||
|
||||
@Source("PPTX.png")
|
||||
ImageResource PPT();
|
||||
|
||||
@Source("XLS.png")
|
||||
ImageResource XLS();
|
||||
|
||||
@Source("CSV.png")
|
||||
ImageResource CSV();
|
||||
|
||||
@Source("CALENDAR.png")
|
||||
ImageResource CALENDAR();
|
||||
|
||||
/**
|
||||
* Shared folder.
|
||||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("shared_folder.png")
|
||||
@Source("SHARED_FOLDER.png")
|
||||
ImageResource sharedFolder();
|
||||
|
||||
/**
|
||||
|
@ -47,7 +62,7 @@ public interface WorkspaceLightTreeResources extends ClientBundle {
|
|||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("external_image.gif")
|
||||
@Source("IMAGE.png")
|
||||
ImageResource external_image();
|
||||
|
||||
/**
|
||||
|
@ -55,7 +70,7 @@ public interface WorkspaceLightTreeResources extends ClientBundle {
|
|||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("external_pdf.gif")
|
||||
@Source("PDF.png")
|
||||
ImageResource external_pdf();
|
||||
|
||||
/**
|
||||
|
@ -127,7 +142,7 @@ public interface WorkspaceLightTreeResources extends ClientBundle {
|
|||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("pdf_document.png")
|
||||
@Source("PDF.png")
|
||||
ImageResource pdf_document();
|
||||
|
||||
/**
|
||||
|
@ -135,7 +150,7 @@ public interface WorkspaceLightTreeResources extends ClientBundle {
|
|||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("image_document.png")
|
||||
@Source("IMAGE.png")
|
||||
ImageResource image_document();
|
||||
|
||||
/**
|
||||
|
@ -183,7 +198,7 @@ public interface WorkspaceLightTreeResources extends ClientBundle {
|
|||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("noimage.png")
|
||||
@Source("UNKNOWN.png")
|
||||
ImageResource unknownType();
|
||||
|
||||
/**
|
||||
|
@ -208,7 +223,7 @@ public interface WorkspaceLightTreeResources extends ClientBundle {
|
|||
*
|
||||
* @return the image resource
|
||||
*/
|
||||
@Source("icon-unknown.gif")
|
||||
@Source("UNKNOWN.png")
|
||||
ImageResource unknown();
|
||||
|
||||
/**
|
||||
|
|
After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 537 B |
Before Width: | Height: | Size: 887 B |
Before Width: | Height: | Size: 1.4 KiB |
|
@ -1,11 +1,12 @@
|
|||
|
||||
package org.gcube.portlets.widgets.wsexplorer.client.rpc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemInterface;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
@ -34,8 +35,8 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @throws Exception
|
||||
* the exception
|
||||
*/
|
||||
List<ItemDTO> getBreadcrumbsByItemIdentifier(
|
||||
String itemIdentifier, boolean includeItemAsParent)
|
||||
ArrayList<Item> getBreadcrumbsByItemIdentifier(
|
||||
String itemIdentifier, String itemName, boolean includeItemAsParent)
|
||||
throws Exception;
|
||||
|
||||
/**
|
||||
|
@ -61,7 +62,7 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @return the folder
|
||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||
*/
|
||||
ItemDTO getFolder(
|
||||
Item getFolder(
|
||||
ItemInterface item, List<ItemType> showableTypes,
|
||||
boolean purgeEmpyFolders, FilterCriteria filterCriteria,
|
||||
boolean loadGcubeProperties)
|
||||
|
@ -80,7 +81,7 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @throws WorkspaceNavigatorServiceException
|
||||
* the workspace navigator service exception
|
||||
*/
|
||||
ItemDTO getRoot(
|
||||
Item getRoot(
|
||||
List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria)
|
||||
throws WorkspaceNavigatorServiceException;
|
||||
|
@ -98,7 +99,7 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @throws WorkspaceNavigatorServiceException
|
||||
* the workspace navigator service exception
|
||||
*/
|
||||
ItemDTO getMySpecialFolder(
|
||||
Item getMySpecialFolder(
|
||||
List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria)
|
||||
throws WorkspaceNavigatorServiceException;
|
||||
|
@ -112,7 +113,7 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @throws WorkspaceNavigatorServiceException
|
||||
* the workspace navigator service exception
|
||||
*/
|
||||
ItemDTO getItemByCategory(ItemCategory category)
|
||||
Item getItemByCategory(ItemCategory category)
|
||||
throws WorkspaceNavigatorServiceException;
|
||||
|
||||
/**
|
||||
|
@ -172,7 +173,7 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @return the breadcrumbs by item identifier to parent limit
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
List<ItemDTO> getBreadcrumbsByItemIdentifierToParentLimit(
|
||||
List<Item> getBreadcrumbsByItemIdentifierToParentLimit(
|
||||
String itemIdentifier, String parentLimit, boolean includeItemAsParent)
|
||||
throws Exception;
|
||||
|
||||
|
@ -185,7 +186,7 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @return the item
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ItemDTO createFolder(String nameFolder, String description, String parentId)
|
||||
Item createFolder(String nameFolder, String description, String parentId)
|
||||
throws Exception;
|
||||
|
||||
|
||||
|
@ -215,7 +216,7 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||
*/
|
||||
SearchedFolder getFolder(
|
||||
ItemDTO item, List<ItemType> showableTypesParam, boolean purgeEmpyFolders,
|
||||
Item item, List<ItemType> showableTypesParam, boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria, boolean loadGcubeProperties,
|
||||
int startIndex, int limit, int serverStartIndex) throws WorkspaceNavigatorServiceException;
|
||||
|
||||
|
@ -226,6 +227,6 @@ public interface WorkspaceExplorerService extends RemoteService {
|
|||
* @return the folder children count
|
||||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||
*/
|
||||
int getFolderChildrenCount(ItemDTO item) throws WorkspaceNavigatorServiceException;
|
||||
int getFolderChildrenCount(Item item) throws WorkspaceNavigatorServiceException;
|
||||
|
||||
}
|
||||
|
|
|
@ -4,11 +4,12 @@
|
|||
|
||||
package org.gcube.portlets.widgets.wsexplorer.client.rpc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemInterface;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
@ -38,7 +39,7 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
*/
|
||||
public void getRoot(
|
||||
List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria, AsyncCallback<ItemDTO> callback);
|
||||
FilterCriteria filterCriteria, AsyncCallback<Item> callback);
|
||||
|
||||
/**
|
||||
* Check name.
|
||||
|
@ -64,22 +65,10 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
void getFolder(
|
||||
ItemInterface item, List<ItemType> showableTypes,
|
||||
boolean purgeEmpyFolders, FilterCriteria filterCriteria,
|
||||
boolean loadGcubeProperties, AsyncCallback<ItemDTO> callback);
|
||||
boolean loadGcubeProperties, AsyncCallback<Item> callback);
|
||||
|
||||
/**
|
||||
* Gets the breadcrumbs by item identifier.
|
||||
*
|
||||
* @param itemIdentifier
|
||||
* the item identifier
|
||||
* @param includeItemAsParent
|
||||
* the include item as parent
|
||||
* @param asyncCallback
|
||||
* the async callback
|
||||
* @return the breadcrumbs by item identifier
|
||||
*/
|
||||
public void getBreadcrumbsByItemIdentifier(
|
||||
String itemIdentifier, boolean includeItemAsParent,
|
||||
AsyncCallback<List<ItemDTO>> asyncCallback);
|
||||
void getBreadcrumbsByItemIdentifier(String itemIdentifier, String itemName, boolean includeItemAsParent,
|
||||
AsyncCallback<ArrayList<Item>> asyncCallback);
|
||||
|
||||
/**
|
||||
* Gets the my special folder.
|
||||
|
@ -96,7 +85,7 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
*/
|
||||
public void getMySpecialFolder(
|
||||
List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria, AsyncCallback<ItemDTO> asyncCallback);
|
||||
FilterCriteria filterCriteria, AsyncCallback<Item> asyncCallback);
|
||||
|
||||
/**
|
||||
* Gets the item by category.
|
||||
|
@ -108,7 +97,7 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
* @return the item by category
|
||||
*/
|
||||
public void getItemByCategory(
|
||||
ItemCategory category, AsyncCallback<ItemDTO> asyncCallback);
|
||||
ItemCategory category, AsyncCallback<Item> asyncCallback);
|
||||
|
||||
/**
|
||||
* Gets the size by item id.
|
||||
|
@ -171,7 +160,7 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
*/
|
||||
void getBreadcrumbsByItemIdentifierToParentLimit(
|
||||
String itemIdentifier, String parentLimit, boolean includeItemAsParent,
|
||||
AsyncCallback<List<ItemDTO>> callback);
|
||||
AsyncCallback<List<Item>> callback);
|
||||
|
||||
/**
|
||||
* Creates the folder.
|
||||
|
@ -187,7 +176,7 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
*/
|
||||
void createFolder(
|
||||
String nameFolder, String description, String parentId,
|
||||
AsyncCallback<ItemDTO> callback);
|
||||
AsyncCallback<Item> callback);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -216,7 +205,7 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
* @return the folder
|
||||
*/
|
||||
void getFolder(
|
||||
ItemDTO item, List<ItemType> showableTypesParam, boolean purgeEmpyFolders,
|
||||
Item item, List<ItemType> showableTypesParam, boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria, boolean loadGcubeProperties,
|
||||
int startIndex, int limit, int serverStartIndex, AsyncCallback<SearchedFolder> asyncCallback);
|
||||
|
||||
|
@ -227,6 +216,6 @@ public interface WorkspaceExplorerServiceAsync {
|
|||
* @param asyncCallback the async callback
|
||||
* @return the folder children count
|
||||
*/
|
||||
public void getFolderChildrenCount(ItemDTO item, AsyncCallback<Integer> asyncCallback);
|
||||
public void getFolderChildrenCount(Item item, AsyncCallback<Integer> asyncCallback);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.HasWorskpaceExplorerSaveNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.WorskpaceExplorerSaveNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
|
@ -195,7 +195,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
|||
public void onClick(ClickEvent event) {
|
||||
isSave = false;
|
||||
|
||||
ItemDTO item = controller.getWsExplorer().getItemSelected();
|
||||
Item item = controller.getWsExplorer().getItemSelected();
|
||||
|
||||
//A FOLDER IS SELECTED
|
||||
if (item != null && item.isFolder()) {
|
||||
|
@ -222,7 +222,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
|||
return;
|
||||
}
|
||||
|
||||
ItemDTO itemB = controller.getBreadcrumbs().getLastParent();
|
||||
Item itemB = controller.getBreadcrumbs().getLastParent();
|
||||
GWT.log("last parent: "+itemB);
|
||||
if (itemB != null) {
|
||||
if(itemB.isSpecialFolder()){
|
||||
|
@ -262,8 +262,8 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
|||
public <T> void onClick(final ClickItemEvent<T> clickItemEvent) {
|
||||
|
||||
if(clickItemEvent.getItem()!=null){
|
||||
if (clickItemEvent.getItem() instanceof ItemDTO) {
|
||||
ItemDTO item = (ItemDTO) clickItemEvent.getItem();
|
||||
if (clickItemEvent.getItem() instanceof Item) {
|
||||
Item item = (Item) clickItemEvent.getItem();
|
||||
if(item!=null && !item.isFolder())
|
||||
setFileName("New_"+item.getName());
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
|
|||
* @param parent the parent
|
||||
* @param fileName the file name
|
||||
*/
|
||||
private void notifySaving(ItemDTO parent, String fileName) {
|
||||
private void notifySaving(Item parent, String fileName) {
|
||||
|
||||
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||
worskpaceExplorerNotificationListener.onSaving(parent, fileName);
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.HasWorskpaceExplorerSaveNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSaveNotification.WorskpaceExplorerSaveNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
|
@ -161,7 +161,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
|
|||
public void onClick(ClickEvent event) {
|
||||
isSave = false;
|
||||
|
||||
ItemDTO item = controller.getWsExplorer().getItemSelected();
|
||||
Item item = controller.getWsExplorer().getItemSelected();
|
||||
|
||||
if (item != null && item.isFolder()) {
|
||||
|
||||
|
@ -186,7 +186,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
|
|||
return;
|
||||
}
|
||||
|
||||
ItemDTO itemB = controller.getBreadcrumbs().getLastParent();
|
||||
Item itemB = controller.getBreadcrumbs().getLastParent();
|
||||
GWT.log("last parent: "+itemB);
|
||||
if (itemB != null) {
|
||||
if(itemB.isSpecialFolder()){
|
||||
|
@ -231,8 +231,8 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
|
|||
public <T> void onClick(final ClickItemEvent<T> clickItemEvent) {
|
||||
|
||||
if(clickItemEvent.getItem()!=null){
|
||||
if (clickItemEvent.getItem() instanceof ItemDTO) {
|
||||
ItemDTO item = (ItemDTO) clickItemEvent.getItem();
|
||||
if (clickItemEvent.getItem() instanceof Item) {
|
||||
Item item = (Item) clickItemEvent.getItem();
|
||||
if(item!=null && !item.isFolder())
|
||||
setFileName("New_"+item.getName());
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
|
|||
* @param parent the parent
|
||||
* @param fileName the file name
|
||||
*/
|
||||
private void notifySaving(ItemDTO parent, String fileName) {
|
||||
private void notifySaving(Item parent, String fileName) {
|
||||
|
||||
for (WorskpaceExplorerSaveNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||
worskpaceExplorerNotificationListener.onSaving(parent, fileName);
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.HasWorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
|
@ -180,8 +180,8 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
if(folderId==null || folderId.isEmpty())
|
||||
controller.getEventBus().fireEvent(new LoadRootEvent());
|
||||
else{
|
||||
ItemDTO item = new ItemDTO(folderId, "", true);
|
||||
controller.getEventBus().fireEvent(new LoadFolderEvent<ItemDTO>(item));
|
||||
Item item = new Item(folderId, "", true);
|
||||
controller.getEventBus().fireEvent(new LoadFolderEvent<Item>(item));
|
||||
}
|
||||
initDialog(captionTxt);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
isSelect = false;
|
||||
ItemDTO item = controller.getWsExplorer().getItemSelected();
|
||||
Item item = controller.getWsExplorer().getItemSelected();
|
||||
boolean isSelectable = controller.itemIsSelectable(item);
|
||||
GWT.log("Item is selectable? "+isSelectable);
|
||||
if(item!=null && isSelectable){
|
||||
|
@ -225,7 +225,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
INSTANCE.hide();
|
||||
notifySelectedItem(item);
|
||||
}else if(item==null){ //IGNORING ITEM SELECT, CAN USE BREADCRUMBS?
|
||||
ItemDTO itemB = controller.getBreadcrumbs().getLastParent();
|
||||
Item itemB = controller.getBreadcrumbs().getLastParent();
|
||||
if(itemB!=null){
|
||||
isSelectable = controller.itemIsSelectable(itemB); //BREADCRUMB IS SELECTABLE?
|
||||
if(isSelectable)
|
||||
|
@ -247,7 +247,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
* @param show the show
|
||||
* @param item the item
|
||||
*/
|
||||
private void setAlertConfirm(String html, boolean show, final ItemDTO item){
|
||||
private void setAlertConfirm(String html, boolean show, final Item item){
|
||||
try{
|
||||
footer.remove(alertConfirm);
|
||||
}catch(Exception e){
|
||||
|
@ -292,7 +292,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
|
|||
*
|
||||
* @param selected the selected
|
||||
*/
|
||||
private void notifySelectedItem(ItemDTO selected){
|
||||
private void notifySelectedItem(Item selected){
|
||||
|
||||
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.RootLoadedEventHandler
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.HasWorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
|
@ -172,7 +172,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
|
|||
@Override
|
||||
public void onClick(final ClickItemEvent clickItemEvent) {
|
||||
isSelect = false;
|
||||
ItemDTO item = controller.getWsExplorer().getItemSelected();
|
||||
Item item = controller.getWsExplorer().getItemSelected();
|
||||
|
||||
//Return if item is not selectable
|
||||
if(!controller.itemIsSelectable(item)){
|
||||
|
@ -190,7 +190,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
|
|||
@Override
|
||||
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
||||
isSelect = false;
|
||||
ItemDTO item = breadcrumbClickEvent.getTargetItem();
|
||||
Item item = breadcrumbClickEvent.getTargetItem();
|
||||
GWT.log("BreadcrumbClickEvent: "+item);
|
||||
|
||||
//Return if item is not selectable
|
||||
|
@ -278,8 +278,8 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
|
|||
if(folderId==null || folderId.isEmpty())
|
||||
controller.getEventBus().fireEvent(new LoadRootEvent());
|
||||
else{
|
||||
ItemDTO item = new ItemDTO(folderId, "", true);
|
||||
controller.getEventBus().fireEvent(new LoadFolderEvent<ItemDTO>(item));
|
||||
Item item = new Item(folderId, "", true);
|
||||
controller.getEventBus().fireEvent(new LoadFolderEvent<Item>(item));
|
||||
}
|
||||
bindEvents();
|
||||
initPanel(captionTxt);
|
||||
|
@ -312,7 +312,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
|
|||
* @param show the show
|
||||
* @param item the item
|
||||
*/
|
||||
private void setAlertConfirm(String html, boolean show, final ItemDTO item){
|
||||
private void setAlertConfirm(String html, boolean show, final Item item){
|
||||
try{
|
||||
footerHP.remove(alertConfirm);
|
||||
}catch(Exception e){
|
||||
|
@ -356,7 +356,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
|
|||
*
|
||||
* @param selected the selected
|
||||
*/
|
||||
private void notifySelectedItem(ItemDTO selected){
|
||||
private void notifySelectedItem(Item selected){
|
||||
|
||||
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
||||
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbClickEvent;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.event.BreadcrumbInitEvent;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -28,8 +28,8 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
public class Breadcrumbs extends Composite {
|
||||
|
||||
public static final String DIVIDER = "/";
|
||||
private LinkedHashMap<String, ItemDTO> hashListItems = new LinkedHashMap<String, ItemDTO>();// Ordered-HashMap
|
||||
private ItemDTO lastParent;
|
||||
private LinkedHashMap<String, Item> hashListItems = new LinkedHashMap<String, Item>();// Ordered-HashMap
|
||||
private Item lastParent;
|
||||
private static BreadcrumbsUiBinder uiBinder = GWT.create(BreadcrumbsUiBinder.class);
|
||||
|
||||
@UiField
|
||||
|
@ -82,10 +82,10 @@ public class Breadcrumbs extends Composite {
|
|||
* @param parents
|
||||
* the new path
|
||||
*/
|
||||
public void setPath(List<ItemDTO> parents) {
|
||||
public void setPath(List<Item> parents) {
|
||||
resetBreadcrumbs();
|
||||
if (parents != null && parents.size() > 0) {
|
||||
for (ItemDTO parent : parents) {
|
||||
for (Item parent : parents) {
|
||||
GWT.log("parent is: "+parent);
|
||||
if(parent!=null){
|
||||
addNavigationLink(parent);
|
||||
|
@ -102,7 +102,7 @@ public class Breadcrumbs extends Composite {
|
|||
* @param item the item
|
||||
* @return true, if is root or special folder
|
||||
*/
|
||||
private boolean isRootOrSpecialFolder(ItemDTO item){
|
||||
private boolean isRootOrSpecialFolder(Item item){
|
||||
GWT.log(item.getName() +" is root "+(item.getParent()==null));
|
||||
GWT.log(item.getName() +" is special folder "+item.isSpecialFolder());
|
||||
return item.getParent()==null || item.isSpecialFolder();
|
||||
|
@ -123,7 +123,7 @@ public class Breadcrumbs extends Composite {
|
|||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
private void addNavigationLink(ItemDTO parent) {
|
||||
private void addNavigationLink(Item parent) {
|
||||
if(parent==null)
|
||||
return;
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class Breadcrumbs extends Composite {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
ItemDTO target = hashListItems.get(navLink.getName());
|
||||
Item target = hashListItems.get(navLink.getName());
|
||||
// WorkspaceExplorerController.eventBus.fireEvent(new LoadFolderEvent(target));
|
||||
eventBus.fireEvent(new BreadcrumbClickEvent(target));
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public class Breadcrumbs extends Composite {
|
|||
*
|
||||
* @return the last parent
|
||||
*/
|
||||
public ItemDTO getLastParent() {
|
||||
public Item getLastParent() {
|
||||
return lastParent;
|
||||
}
|
||||
|
||||
|
@ -170,7 +170,7 @@ public class Breadcrumbs extends Composite {
|
|||
*
|
||||
* @param item the item
|
||||
*/
|
||||
public void init(ItemDTO item) {
|
||||
public void init(Item item) {
|
||||
resetBreadcrumbs();
|
||||
addNavigationLink(item);
|
||||
hashListItems.put(item.getId(), item);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package org.gcube.portlets.widgets.wsexplorer.client.view;
|
||||
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -24,5 +24,5 @@ public interface FolderLoader {
|
|||
* @param resetStore the reset store. Used for pagination
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public void loadFolder(final ItemDTO item, boolean loadGcubeProperties, int startIdx, int limit, boolean resetStore) throws Exception;
|
||||
public void loadFolder(final Item item, boolean loadGcubeProperties, int startIdx, int limit, boolean resetStore) throws Exception;
|
||||
}
|
||||
|
|
|
@ -8,11 +8,12 @@ import org.gcube.portlets.widgets.wsexplorer.client.event.CreateFolderClickEvent
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadMySpecialFolderEvent;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.event.LoadRootEvent;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.resources.WorkspaceExplorerResources;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.NavWidget;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.ListStyleType;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
@ -64,11 +65,11 @@ public class Navigation extends Composite{
|
|||
this.eventBus = eventBus;
|
||||
// getElement().getStyle().setMarginLeft(5.0, Unit.PX);
|
||||
home.setActive(true);
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.HOME, new AsyncCallback<ItemDTO>() {
|
||||
getElement().getStyle().setListStyleType(ListStyleType.NONE);
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.HOME, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ItemDTO result) {
|
||||
public void onSuccess(Item result) {
|
||||
home.setText(result.getName());
|
||||
|
||||
}
|
||||
|
@ -93,10 +94,10 @@ public class Navigation extends Composite{
|
|||
vre_folder.setActive(true);
|
||||
vre_folder.setBaseIcon(WorkspaceExplorerResources.CustomIconType.vre_folder);
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.VRE_FOLDER, new AsyncCallback<ItemDTO>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getItemByCategory(ItemCategory.VRE_FOLDER, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ItemDTO result) {
|
||||
public void onSuccess(Item result) {
|
||||
vre_folder.setText(result.getName());
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.resources.WorkspaceExplorerR
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
|
@ -55,16 +55,16 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
protected FilterCriteria filterCriteria = null;
|
||||
protected boolean showEmptyFolders = true;
|
||||
protected ScrollPanel explorerPanel;
|
||||
private ItemsTable<ItemDTO> itTables;
|
||||
private ItemsTable<Item> itTables;
|
||||
private DISPLAY_FIELD[] displayFields;
|
||||
private DISPLAY_FIELD sortByColumn;
|
||||
private HandlerManager eventBus;
|
||||
|
||||
private ItemDTO displayingFolderItem;
|
||||
private Item displayingFolderItem;
|
||||
private boolean showGcubeItemsInfo;
|
||||
private List<String> displayProperties;
|
||||
|
||||
private AbstractDataProvider<ItemDTO> dataProvider;
|
||||
private AbstractDataProvider<Item> dataProvider;
|
||||
|
||||
/**
|
||||
* Instantiates a new workspace explorer - This is the base constructor.
|
||||
|
@ -94,9 +94,9 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @param dataProvider the new data provider table
|
||||
*/
|
||||
public void initTable(AbstractDataProvider<ItemDTO> dataProvider){
|
||||
public void initTable(AbstractDataProvider<Item> dataProvider){
|
||||
this.dataProvider = dataProvider;
|
||||
this.itTables = new ItemsTable<ItemDTO>(eventBus, true, displayFields, displayProperties, showGcubeItemsInfo, sortByColumn);
|
||||
this.itTables = new ItemsTable<Item>(eventBus, true, displayFields, displayProperties, showGcubeItemsInfo, sortByColumn);
|
||||
this.itTables.initTable(null, null, dataProvider);
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
|
||||
GWT.log("loading workspace tree from server");
|
||||
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getRoot(showableTypesParam, purgeEmpyFolders, filterCriteria, new AsyncCallback<ItemDTO>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getRoot(showableTypesParam, purgeEmpyFolders, filterCriteria, new AsyncCallback<Item>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
|
@ -197,7 +197,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
GWT.log("Error loading workspace tree from server",caught);
|
||||
}
|
||||
|
||||
public void onSuccess(ItemDTO item) {
|
||||
public void onSuccess(Item item) {
|
||||
eventBus.fireEvent(new RootLoadedEvent(item));
|
||||
updateExplorer(item.getChildren());
|
||||
|
||||
|
@ -212,7 +212,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @param item the new displaying folder item
|
||||
*/
|
||||
protected void setDisplayingFolderItem(ItemDTO item) {
|
||||
protected void setDisplayingFolderItem(Item item) {
|
||||
this.displayingFolderItem = item;
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
// FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,requiredProperties, allowedFileExtensions);
|
||||
|
||||
GWT.log("loading workspace tree from server");
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getMySpecialFolder(showableTypesParam, purgeEmpyFolders, filterCriteria, new AsyncCallback<ItemDTO>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getMySpecialFolder(showableTypesParam, purgeEmpyFolders, filterCriteria, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -247,7 +247,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ItemDTO item) {
|
||||
public void onSuccess(Item item) {
|
||||
|
||||
updateExplorer(item.getChildren());
|
||||
setDisplayingFolderItem(item);
|
||||
|
@ -261,7 +261,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @param items the items
|
||||
*/
|
||||
protected void updateExplorer(ArrayList<ItemDTO> items){
|
||||
protected void updateExplorer(ArrayList<Item> items){
|
||||
GWT.log("workspace explorer updating..");
|
||||
explorerPanel.clear();
|
||||
// itTables = new ItemsTable(true, displayFields);
|
||||
|
@ -276,7 +276,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @param item the item
|
||||
*/
|
||||
public void addItemToExplorer(ItemDTO item){
|
||||
public void addItemToExplorer(Item item){
|
||||
GWT.log("workspace explorer add item.."+item);
|
||||
// itTables = new ItemsTable(true, displayFields);
|
||||
// explorerPanel.clear();
|
||||
|
@ -321,7 +321,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @return the itTables
|
||||
*/
|
||||
public ItemsTable<ItemDTO> getItTables() {
|
||||
public ItemsTable<Item> getItTables() {
|
||||
return itTables;
|
||||
}
|
||||
|
||||
|
@ -331,7 +331,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @return the item selected
|
||||
*/
|
||||
public ItemDTO getItemSelected(){
|
||||
public Item getItemSelected(){
|
||||
return itTables.getSelectedItem();
|
||||
}
|
||||
|
||||
|
@ -392,7 +392,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @return the displayingFolderItem
|
||||
*/
|
||||
public ItemDTO getDisplayingFolderItem() {
|
||||
public Item getDisplayingFolderItem() {
|
||||
|
||||
return displayingFolderItem;
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*
|
||||
* @return the dataProvider
|
||||
*/
|
||||
public AbstractDataProvider<ItemDTO> getDataProvider() {
|
||||
public AbstractDataProvider<Item> getDataProvider() {
|
||||
|
||||
return dataProvider;
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
*/
|
||||
@Override
|
||||
public void loadFolder(
|
||||
final ItemDTO item, boolean loadGcubeProperties, int startIdx, int limit,
|
||||
final Item item, boolean loadGcubeProperties, int startIdx, int limit,
|
||||
boolean resetStore)
|
||||
throws Exception {
|
||||
|
||||
|
@ -452,7 +452,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
// FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,requiredProperties, allowedFileExtensions);
|
||||
|
||||
GWT.log("loading workspace folder by item id from server: "+item.getId());
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getFolder(item, showableTypesParam, purgeEmpyFolders, filterCriteria, loadGcubeProperties, new AsyncCallback<ItemDTO>() {
|
||||
WorkspaceExplorerConstants.workspaceNavigatorService.getFolder(item, showableTypesParam, purgeEmpyFolders, filterCriteria, loadGcubeProperties, new AsyncCallback<Item>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -462,7 +462,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes, Folder
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ItemDTO result) {
|
||||
public void onSuccess(Item result) {
|
||||
if(item.getName()==null || item.getName().isEmpty())
|
||||
item.setName(result.getName());
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.SortedCellTable;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.SearchedFolder;
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
|
||||
private Boolean newLoading = false;
|
||||
|
||||
private MyCustomDataProvider<ItemDTO> dataProvider = new MyCustomDataProvider<ItemDTO>();
|
||||
private MyCustomDataProvider<Item> dataProvider = new MyCustomDataProvider<Item>();
|
||||
|
||||
protected boolean loadGcubeProperties = false;
|
||||
|
||||
|
@ -87,8 +87,8 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
*
|
||||
* @return the asycn data provider
|
||||
*/
|
||||
public AsyncDataProvider<ItemDTO> getAsycnDataProvider(){
|
||||
return (AsyncDataProvider<ItemDTO>) getCellTable().getDataProvider();
|
||||
public AsyncDataProvider<Item> getAsycnDataProvider(){
|
||||
return (AsyncDataProvider<Item>) getCellTable().getDataProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
*
|
||||
* @return the cell tale
|
||||
*/
|
||||
public SortedCellTable<ItemDTO> getCellTable(){
|
||||
public SortedCellTable<Item> getCellTable(){
|
||||
return getItTables().getCellTable();
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
/* (non-Javadoc)
|
||||
* @see org.gcube.portlets.widgets.wsexplorer.client.view.WorkspaceExplorer#loadFolder(org.gcube.portlets.widgets.wsexplorer.shared.Item, boolean, int, int, boolean)
|
||||
*/
|
||||
public void loadFolder(final ItemDTO item, final boolean loadGcubeProperties, final int startIdx, final int limit, final boolean resetStore) throws Exception {
|
||||
public void loadFolder(final Item item, final boolean loadGcubeProperties, final int startIdx, final int limit, final boolean resetStore) throws Exception {
|
||||
newLoading = resetStore;
|
||||
GWT.log("loading folder data for Item: "+item.getId()+" [startIdx: "+startIdx +", limit: "+limit+", resetStore:"+resetStore+"]");
|
||||
//super.loadFolder(item, loadGcubeProperties);
|
||||
|
@ -182,7 +182,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
* @param purgeEmpyFolders the purge empy folders
|
||||
* @param showableTypesParam the showable types param
|
||||
*/
|
||||
private void perfomGetFolderChildren(final ItemDTO item, boolean loadGcubeProperties, final int startIdx, final int limit, final int serSI, boolean purgeEmpyFolders, List<ItemType> showableTypesParam){
|
||||
private void perfomGetFolderChildren(final Item item, boolean loadGcubeProperties, final int startIdx, final int limit, final int serSI, boolean purgeEmpyFolders, List<ItemType> showableTypesParam){
|
||||
GWT.log("loading workspace folder by item id from server: "+item.getId());
|
||||
|
||||
SearchedFolder page = getCachePage(item, startIdx, limit);
|
||||
|
@ -228,10 +228,10 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
getCellTable().setVisibleRangeAndClearData(new Range(result.getClientStartIndex(), WorkspaceExplorerConstants.ITEMS_PER_PAGE), false);
|
||||
}
|
||||
|
||||
SelectionModel<? super ItemDTO> sm = getCellTable().getSelectionModel();
|
||||
SelectionModel<? super Item> sm = getCellTable().getSelectionModel();
|
||||
|
||||
if(sm instanceof SingleSelectionModel){
|
||||
SingleSelectionModel<ItemDTO> ssm = (SingleSelectionModel<ItemDTO>) sm;
|
||||
SingleSelectionModel<Item> ssm = (SingleSelectionModel<Item>) sm;
|
||||
ssm.clear();
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
* @param item the item
|
||||
* @param result the result
|
||||
*/
|
||||
private void setCachePage(ItemDTO item, SearchedFolder result){
|
||||
private void setCachePage(Item item, SearchedFolder result){
|
||||
|
||||
String key = getCacheKey(item, result.getClientStartIndex(), result.getLimit());
|
||||
|
||||
|
@ -287,7 +287,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
* @param limit the limit
|
||||
* @return the cache page
|
||||
*/
|
||||
private SearchedFolder getCachePage(ItemDTO item, int startIdx, int limit){
|
||||
private SearchedFolder getCachePage(Item item, int startIdx, int limit){
|
||||
|
||||
String key = getCacheKey(item, startIdx, limit);
|
||||
|
||||
|
@ -303,7 +303,7 @@ public class WorkspaceExplorerPaginated extends WorkspaceExplorer{
|
|||
* @param limit the limit
|
||||
* @return the cache key
|
||||
*/
|
||||
private String getCacheKey(ItemDTO item, int startIdx, int limit){
|
||||
private String getCacheKey(Item item, int startIdx, int limit){
|
||||
|
||||
if(item==null || startIdx<0 || limit< 0)
|
||||
return null;
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.Map;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.resources.WorkspaceExplorerResources;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
|
@ -54,7 +54,7 @@ public class DialogShowGcubeItem extends DialogBox implements ClickHandler {
|
|||
* @param item the worksapce item id
|
||||
* @param autoHide the auto hide
|
||||
*/
|
||||
public DialogShowGcubeItem(String caption, String text, ItemDTO item, boolean autoHide) {
|
||||
public DialogShowGcubeItem(String caption, String text, Item item, boolean autoHide) {
|
||||
getElement().setClassName("gwt-DialogBoxNew");
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.resources.WorkspaceExplorerResources;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.SelectionItem;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.view.gcubeitem.DialogShowGcubeItem;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||
import com.google.gwt.cell.client.ButtonCell;
|
||||
|
@ -49,7 +49,7 @@ import com.google.gwt.view.client.ListDataProvider;
|
|||
* Feb 19, 2015
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> implements SelectionItem{
|
||||
public class ItemsTable<T extends Item> extends AbstractItemsCellTable<T> implements SelectionItem{
|
||||
|
||||
private Column<T, ImageResource> icon;
|
||||
private TextColumn<T> name;
|
||||
|
@ -134,7 +134,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
//this.isAsyncronusTable = dataProvider instanceof AbstractDataProvider?true:false;
|
||||
this.isAsyncronusTable = dataProvider instanceof ListDataProvider?false:true;
|
||||
|
||||
sortedCellTable.setEmptyTableWidget(new Label("No data."));
|
||||
sortedCellTable.setEmptyTableWidget(new Label(WorkspaceExplorerConstants.WORKSPACE_FOLDER_EMPTY_MESSAGE));
|
||||
|
||||
if(this.displayFields.contains(DISPLAY_FIELD.ICON)){
|
||||
//ICONS
|
||||
|
@ -162,7 +162,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
};
|
||||
// icon.setSortable(false);
|
||||
sortedCellTable.addColumn(icon, "", false);
|
||||
sortedCellTable.setColumnWidth(icon, 25.0, Unit.PX);
|
||||
sortedCellTable.setColumnWidth(icon, 32.0, Unit.PX);
|
||||
}
|
||||
|
||||
if(this.displayFields.contains(DISPLAY_FIELD.NAME)){
|
||||
|
@ -173,7 +173,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
public String getValue(T object) {
|
||||
if(object==null)
|
||||
return "";
|
||||
return ((ItemDTO) object).getName();
|
||||
return ((Item) object).getName();
|
||||
}
|
||||
|
||||
//ADDING TOOLTIP
|
||||
|
@ -181,7 +181,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||
if(object == null)
|
||||
return;
|
||||
sb.appendHtmlConstant("<div title=\""+((ItemDTO) object).getName()+"\">");
|
||||
sb.appendHtmlConstant("<div title=\""+((Item) object).getName()+"\">");
|
||||
super.render(context, object, sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
};
|
||||
|
@ -193,7 +193,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
return ((ItemDTO) o1).getName().compareTo(((ItemDTO) o2).getName());
|
||||
return ((Item) o1).getName().compareTo(((Item) o2).getName());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
public String getValue(T object) {
|
||||
if(object==null)
|
||||
return "";
|
||||
return ((ItemDTO) object).getOwner() != null ? ((ItemDTO) object).getOwner() : "";
|
||||
return ((Item) object).getOwner() != null ? ((Item) object).getOwner() : "";
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -219,7 +219,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
return ((ItemDTO) o1).getOwner().compareTo(((ItemDTO) o2).getOwner());
|
||||
return ((Item) o1).getOwner().compareTo(((Item) o2).getOwner());
|
||||
}
|
||||
};
|
||||
sortedCellTable.setComparator(owner, c);
|
||||
|
@ -236,7 +236,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
public Date getValue(T object) {
|
||||
if(object==null)
|
||||
return null;
|
||||
return ((ItemDTO) object).getCreationDate();
|
||||
return ((Item) object).getCreationDate();
|
||||
}
|
||||
};
|
||||
sortedCellTable.addColumn(dateColumn, "Created", true);
|
||||
|
@ -251,8 +251,8 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
if(o2 == null || o2.getCreationDate()==null)
|
||||
return 1;
|
||||
|
||||
Date d1 = ((ItemDTO) o1).getCreationDate();
|
||||
Date d2 = ((ItemDTO) o2).getCreationDate();
|
||||
Date d1 = ((Item) o1).getCreationDate();
|
||||
Date d2 = ((Item) o2).getCreationDate();
|
||||
|
||||
// GWT.log(d1.toString() + "is after "+d2.toString() +" ? "+d2.after(d1));
|
||||
|
||||
|
@ -276,9 +276,9 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
TextColumn<T> textColumn = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
ItemDTO extensionItem;
|
||||
Item extensionItem;
|
||||
String value = null;
|
||||
if(object instanceof ItemDTO){
|
||||
if(object instanceof Item){
|
||||
extensionItem = object;
|
||||
value = extensionItem.getGcubeProperties().get(column);
|
||||
}
|
||||
|
@ -292,14 +292,14 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
|
||||
if(!(o1 instanceof ItemDTO))
|
||||
if(!(o1 instanceof Item))
|
||||
return -1;
|
||||
|
||||
if(!(o2 instanceof ItemDTO))
|
||||
if(!(o2 instanceof Item))
|
||||
return 1;
|
||||
|
||||
ItemDTO e1 = o1;
|
||||
ItemDTO e2 = o2;
|
||||
Item e1 = o1;
|
||||
Item e2 = o2;
|
||||
String v1 = e1.getGcubeProperties().get(column);
|
||||
String v2 = e2.getGcubeProperties().get(column);
|
||||
|
||||
|
@ -348,7 +348,7 @@ public class ItemsTable<T extends ItemDTO> extends AbstractItemsCellTable<T> imp
|
|||
Context context, Element elem, T object, NativeEvent event) {
|
||||
super.onBrowserEvent(context, elem, object, event);
|
||||
if ("click".equals(event.getType())) {
|
||||
ItemDTO item = object;
|
||||
Item item = object;
|
||||
DialogShowGcubeItem dg = new DialogShowGcubeItem("Gcube Properties for: "+item.getName(), null, item, true);
|
||||
// dg.setPopupPosition(event.getClientX()-Integer.parseInt(dg.getElement().getStyle().getWidth()), event.getClientY());
|
||||
dg.center();
|
||||
|
|
|
@ -6,3 +6,6 @@
|
|||
* See: org.gcube.portlets.widgets.wsexplorer.resources.BootstrapOverrideResources
|
||||
*
|
||||
**************************************************/
|
||||
div.ExpLeftPanel li {
|
||||
list-style-type: none;
|
||||
}
|
|
@ -21,7 +21,6 @@ import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
|||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||
import org.gcube.portlets.widgets.wsexplorer.server.stohub.Whorespace;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -29,49 +28,12 @@ import org.slf4j.LoggerFactory;
|
|||
/**
|
||||
* The Class ItemBuilder.
|
||||
*
|
||||
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||
* Modified by Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* @author Francesco Mangiacrapa, CNR-ISTI
|
||||
* @author M. Assante, CNR-ISTI
|
||||
*/
|
||||
public class ItemBuilder {
|
||||
|
||||
public static final Logger logger = LoggerFactory.getLogger(ItemBuilder.class);
|
||||
/**
|
||||
* Purge empty folders.
|
||||
*
|
||||
* @param item the item
|
||||
* @return the item
|
||||
*/
|
||||
public static ItemDTO purgeEmptyFolders(ItemDTO item)
|
||||
{
|
||||
//for (Item child:item.getChildren()) purgeEmptyFolders(child); ONLY FIRST LEVEL
|
||||
|
||||
List<ItemDTO> toRemoveList = new LinkedList<ItemDTO>();
|
||||
for (ItemDTO child:item.getChildren()) {
|
||||
boolean toRemove = isAnEmptyFolder(child);
|
||||
if (toRemove) {
|
||||
toRemoveList.add(child);
|
||||
}
|
||||
}
|
||||
for (ItemDTO child:toRemoveList) {
|
||||
item.removeChild(child);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is an empty folder.
|
||||
*
|
||||
* @param item the item
|
||||
* @return true, if is an empty folder
|
||||
*/
|
||||
protected static boolean isAnEmptyFolder(ItemDTO item)
|
||||
{
|
||||
return Util.isFolder(item.getType()) && item.getChildren().size() == 0;
|
||||
}
|
||||
|
||||
|
||||
public static final Logger _log = LoggerFactory.getLogger(ItemBuilder.class);
|
||||
/**
|
||||
* Gets the item.
|
||||
*
|
||||
|
@ -85,7 +47,7 @@ public class ItemBuilder {
|
|||
* @return the item
|
||||
* @throws InternalErrorException the internal error exception
|
||||
*/
|
||||
public static ItemDTO getItem(ItemDTO parent, Item workspaceItem, String workspaceItemPath,
|
||||
public static org.gcube.portlets.widgets.wsexplorer.shared.Item getItem(org.gcube.portlets.widgets.wsexplorer.shared.Item parent, Item workspaceItem, String workspaceItemPath,
|
||||
List<ItemType> showableTypes, FilterCriteria filterCriteria,
|
||||
boolean loadChildren, boolean loadGcubeProperties) {
|
||||
|
||||
|
@ -98,25 +60,22 @@ public class ItemBuilder {
|
|||
return null;
|
||||
}
|
||||
|
||||
// //TODO ADD CONTROL ON THE PATH WHEN WILL BE MORE FAST
|
||||
// if (itemName.equals(WorkspaceExplorerConstants.SPECIAL_FOLDERS_LABEL))
|
||||
// itemName = WorkspaceExplorerConstants.VRE_FOLDERS_LABEL;
|
||||
|
||||
boolean isFolder = type.equals(ItemType.PRIVATE_FOLDER)?true:false;
|
||||
boolean isSharedFolder = (type.equals(ItemType.SHARED_FOLDER) || type.equals(ItemType.VRE_FOLDER )) ? true : false;
|
||||
if (isSharedFolder)
|
||||
isFolder = true;
|
||||
|
||||
String itemName = workspaceItem.getName();
|
||||
|
||||
if(isSharedFolder){
|
||||
logger.info("Is shared folder: "+workspaceItem.getTitle());
|
||||
_log.info("Is shared folder: "+workspaceItem.getTitle());
|
||||
SharedFolder shared = (SharedFolder) workspaceItem;
|
||||
itemName = shared.isVreFolder()?shared.getDisplayName():workspaceItem.getTitle();
|
||||
itemName = shared.isVreFolder() ? shared.getDisplayName() : workspaceItem.getTitle();
|
||||
}
|
||||
|
||||
// _log.debug("Building Item for: "+itemName);
|
||||
ItemDTO item = null;
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item item = null;
|
||||
try{
|
||||
item = new ItemDTO(parent, workspaceItem.getId(), itemName, type, workspaceItemPath, UserUtil.getUserFullName(workspaceItem.getOwner()), toDate(workspaceItem.getCreationTime()), isFolder, false);
|
||||
item = new org.gcube.portlets.widgets.wsexplorer.shared.Item(parent, workspaceItem.getId(), itemName, type, workspaceItemPath, UserUtil.getUserFullName(workspaceItem.getOwner()), toDate(workspaceItem.getCreationTime()), isFolder, false);
|
||||
item.setSharedFolder(isSharedFolder);
|
||||
|
||||
if(loadGcubeProperties){
|
||||
|
@ -124,7 +83,7 @@ public class ItemBuilder {
|
|||
item.setGcubeProperties(itemProperties);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
||||
_log.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -135,8 +94,8 @@ public class ItemBuilder {
|
|||
theChildren = client.getChildren(itemId, Whorespace.ACCOUNTING_HL_NODE_NAME);
|
||||
for (Item child : theChildren) {
|
||||
String itemPath = workspaceItemPath+"/"+child.getName();
|
||||
ItemDTO itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false, loadGcubeProperties);
|
||||
logger.trace("Item: "+child.getName() +" converted!!!");
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false, loadGcubeProperties);
|
||||
_log.trace("Item: "+child.getName() +" converted!!!");
|
||||
if (itemChild!=null){
|
||||
item.addChild(itemChild);
|
||||
}
|
||||
|
@ -163,7 +122,7 @@ public class ItemBuilder {
|
|||
* @return the item
|
||||
* @throws InternalErrorException the internal error exception
|
||||
*/
|
||||
public static ItemDTO getItem(ItemDTO parent, Item workspaceItem, String workspaceItemPath,
|
||||
public static org.gcube.portlets.widgets.wsexplorer.shared.Item getItem(org.gcube.portlets.widgets.wsexplorer.shared.Item parent, Item workspaceItem, String workspaceItemPath,
|
||||
List<ItemType> showableTypes, FilterCriteria filterCriteria,
|
||||
boolean loadChildren, boolean loadGcubeProperties, int startIdx, int limit) {
|
||||
|
||||
|
@ -181,21 +140,23 @@ public class ItemBuilder {
|
|||
String itemName = workspaceItem.getName();
|
||||
|
||||
if(isSharedFolder){
|
||||
logger.info("Is shared folder: "+workspaceItem.getTitle());
|
||||
_log.info("Is shared folder: "+workspaceItem.getTitle());
|
||||
SharedFolder shared = (SharedFolder) workspaceItem;
|
||||
itemName = shared.isVreFolder()?shared.getDisplayName():workspaceItem.getTitle();
|
||||
isFolder = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// _log.debug("Building Item for: "+itemName);
|
||||
ItemDTO item = null;
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item item = null;
|
||||
try{
|
||||
//THIS CALL IS VERY SLOW!!
|
||||
// String storageID = null;
|
||||
// if(workspaceItem instanceof FolderItem){
|
||||
// storageID = workspaceItem.getStorageID();
|
||||
// }
|
||||
item = new ItemDTO(parent, workspaceItem.getId(), itemName, type, workspaceItemPath, UserUtil.getUserFullName(workspaceItem.getOwner()), toDate(workspaceItem.getCreationTime()), isFolder, false);
|
||||
item = new org.gcube.portlets.widgets.wsexplorer.shared.Item(
|
||||
parent, workspaceItem.getId(), itemName, type, workspaceItemPath,
|
||||
UserUtil.getUserFullName(workspaceItem.getOwner()), toDate(workspaceItem.getCreationTime()), isFolder, false);
|
||||
item.setSharedFolder(isSharedFolder);
|
||||
|
||||
if(loadGcubeProperties){
|
||||
|
@ -203,7 +164,7 @@ public class ItemBuilder {
|
|||
item.setGcubeProperties(itemProperties);
|
||||
}
|
||||
}catch(Exception e){
|
||||
logger.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
||||
_log.error("Error on getting item: "+itemName+" with id: "+workspaceItem.getId()+", from HL, so skipping item");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -214,8 +175,8 @@ public class ItemBuilder {
|
|||
theChildren = client.getChildren(itemId, Whorespace.ACCOUNTING_HL_NODE_NAME);
|
||||
for (Item child : theChildren) {
|
||||
String itemPath = workspaceItemPath+"/"+child.getName();
|
||||
ItemDTO itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false, loadGcubeProperties);
|
||||
logger.trace("Item: "+child.getName() +" converted!!!");
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item itemChild = getItem(item, child, itemPath, showableTypes, filterCriteria, false, loadGcubeProperties);
|
||||
_log.trace("Item: "+child.getName() +" converted!!!");
|
||||
if (itemChild!=null){
|
||||
item.addChild(itemChild);
|
||||
}
|
||||
|
@ -234,15 +195,76 @@ public class ItemBuilder {
|
|||
*/
|
||||
protected static ItemType getItemType(Item item) {
|
||||
if (item instanceof AbstractFileItem) {
|
||||
return ItemType.EXTERNAL_FILE;
|
||||
return getFileIconImageType( item);
|
||||
}
|
||||
else if (item instanceof FolderItem) {
|
||||
return getFolderItemType(item);
|
||||
}
|
||||
logger.warn("Item Type non found: ");
|
||||
_log.warn("\n\n\n**** Item Type non found: ");
|
||||
return ItemType.UNKNOWN_TYPE;
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
* @return the item type based on the extension of the file
|
||||
*/
|
||||
private static ItemType getFileIconImageType(Item item) {
|
||||
String[] splits = item.getName().split("\\.");
|
||||
String extension = "";
|
||||
if (splits.length > 0) {
|
||||
extension = splits[splits.length-1];
|
||||
}
|
||||
if (extension == null || extension.compareTo("") == 0)
|
||||
return ItemType.UNKNOWN_TYPE;
|
||||
extension = extension.toLowerCase();
|
||||
switch (extension) {
|
||||
case "doc":
|
||||
case "docx":
|
||||
return ItemType.DOCUMENT;
|
||||
case "rtf":
|
||||
case "txt":
|
||||
return ItemType.TEXT_PLAIN;
|
||||
case "xls":
|
||||
case "xlsx":
|
||||
return ItemType.SPREADSHEET;
|
||||
case "csv":
|
||||
return ItemType.CSV;
|
||||
case "ics":
|
||||
return ItemType.CALENDAR;
|
||||
case "ppt":
|
||||
case "pptx":
|
||||
return ItemType.PRESENTATION;
|
||||
case "pdf":
|
||||
return ItemType.PDF_DOCUMENT;
|
||||
case "jpg":
|
||||
case "jpeg":
|
||||
case "gif":
|
||||
case "bmp":
|
||||
case "png":
|
||||
case "tif":
|
||||
case "tiff":
|
||||
return ItemType.IMAGE_DOCUMENT;
|
||||
case "avi":
|
||||
case "mp4":
|
||||
case "mpeg":
|
||||
return ItemType.MOVIE;
|
||||
case "html":
|
||||
case "htm":
|
||||
case "jsp":
|
||||
return ItemType.HTML;
|
||||
case "rar":
|
||||
return ItemType.RAR;
|
||||
case "zip":
|
||||
case "tar":
|
||||
case "tar.gz":
|
||||
case ".cpgz":
|
||||
case ".gz":
|
||||
return ItemType.ZIP;
|
||||
default:
|
||||
return ItemType.UNKNOWN_TYPE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the folder item type.
|
||||
|
@ -251,16 +273,19 @@ public class ItemBuilder {
|
|||
* @return the folder item type
|
||||
*/
|
||||
protected static ItemType getFolderItemType(Item item){
|
||||
System.out.println("***\n\n\"+getFolderItemType " + item.getTitle());
|
||||
if (item instanceof SharedFolder || item instanceof VreFolder) {
|
||||
SharedFolder folder = (SharedFolder) item;
|
||||
if (folder.isVreFolder())
|
||||
if (folder.isVreFolder())
|
||||
return ItemType.VRE_FOLDER;
|
||||
System.out.println("***" + item.getTitle() + " is a SHARED FOLDER");
|
||||
return ItemType.SHARED_FOLDER;
|
||||
} else if (item instanceof FolderItem) {
|
||||
System.out.println("***" + item.getTitle() + " is a PRIVATE FOLDER");
|
||||
return ItemType.PRIVATE_FOLDER;
|
||||
}
|
||||
logger.warn("Item Type non found: ");
|
||||
return ItemType.UNKNOWN_TYPE;
|
||||
_log.warn("Item Type non found: ");
|
||||
return ItemType.PRIVATE_FOLDER;
|
||||
}
|
||||
|
||||
|
||||
|
@ -335,7 +360,7 @@ public class ItemBuilder {
|
|||
}
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
logger.error("checkAllowedFileExtension, InternalErrorException: ",e);
|
||||
_log.error("checkAllowedFileExtension, InternalErrorException: ",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -357,7 +382,7 @@ public class ItemBuilder {
|
|||
if(dot>=0 && dot+1<=fileName.length()){
|
||||
|
||||
String ext = fileName.substring(dot+1, fileName.length());
|
||||
logger.trace("Extension found: "+ext +" for: "+fileName);
|
||||
_log.trace("Extension found: "+ext +" for: "+fileName);
|
||||
// if(ext.isEmpty())
|
||||
// return false;
|
||||
for (String fe : allowedFileExtension) {
|
||||
|
@ -367,7 +392,7 @@ public class ItemBuilder {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
logger.trace("Extension not found for: "+fileName);
|
||||
_log.trace("Extension not found for: "+fileName);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -434,7 +459,7 @@ public class ItemBuilder {
|
|||
* @return the item
|
||||
* @throws InternalErrorException the internal error exception
|
||||
*/
|
||||
public static ItemDTO buildFolderForBreadcrumbs(FolderItem wsFolder, ItemDTO parent){
|
||||
public static org.gcube.portlets.widgets.wsexplorer.shared.Item buildFolderForBreadcrumbs(FolderItem wsFolder, org.gcube.portlets.widgets.wsexplorer.shared.Item parent){
|
||||
|
||||
String name = "";
|
||||
boolean isSpecialFolder = false;
|
||||
|
@ -457,10 +482,10 @@ public class ItemBuilder {
|
|||
|
||||
//BUILDS A SIMPLE ITEM FOR BREADCRUMB
|
||||
String path = null; //wsFolder.getPath(); FORCED TO NULL BECAUSE IS SLOW CALL
|
||||
ItemDTO item = new ItemDTO(null, wsFolder.getId(), name, ItemType.FOLDER, path, null, null, true, isRoot);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item item = new org.gcube.portlets.widgets.wsexplorer.shared.Item(null, wsFolder.getId(), name, ItemType.FOLDER, path, null, null, true, isRoot);
|
||||
item.setSpecialFolder(isSpecialFolder);
|
||||
|
||||
logger.debug("breadcrumb returning: "+item);
|
||||
_log.debug("breadcrumb returning: "+item);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
@ -481,12 +506,42 @@ public class ItemBuilder {
|
|||
* @param calendar the calendar
|
||||
* @return the date
|
||||
*/
|
||||
public static Date toDate(Calendar calendar)
|
||||
{
|
||||
public static Date toDate(Calendar calendar) {
|
||||
if (calendar == null) return null;
|
||||
return calendar.getTime();
|
||||
|
||||
}
|
||||
/**
|
||||
* Purge empty folders.
|
||||
*
|
||||
* @param item the item
|
||||
* @return the item
|
||||
*/
|
||||
public static org.gcube.portlets.widgets.wsexplorer.shared.Item purgeEmptyFolders(org.gcube.portlets.widgets.wsexplorer.shared.Item item) {
|
||||
List<org.gcube.portlets.widgets.wsexplorer.shared.Item> toRemoveList = new LinkedList<org.gcube.portlets.widgets.wsexplorer.shared.Item>();
|
||||
for (org.gcube.portlets.widgets.wsexplorer.shared.Item child:item.getChildren()) {
|
||||
boolean toRemove = isAnEmptyFolder(child);
|
||||
if (toRemove) {
|
||||
toRemoveList.add(child);
|
||||
}
|
||||
}
|
||||
for (org.gcube.portlets.widgets.wsexplorer.shared.Item child:toRemoveList) {
|
||||
item.removeChild(child);
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is an empty folder.
|
||||
*
|
||||
* @param item the item
|
||||
* @return true, if is an empty folder
|
||||
*/
|
||||
protected static boolean isAnEmptyFolder(org.gcube.portlets.widgets.wsexplorer.shared.Item item) {
|
||||
return Util.isFolder(item.getType()) && item.getChildren().size() == 0;
|
||||
}
|
||||
/*
|
||||
public static void main(String[] args) {
|
||||
List<String> allowedFileExtension = new ArrayList<String>();
|
||||
|
|
|
@ -7,20 +7,20 @@ import java.util.Comparator;
|
|||
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.Util;
|
||||
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
||||
|
||||
|
||||
/**
|
||||
* A comparator that sorts the items first by type, folder up others down, the each group alphabetically on the item name.
|
||||
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||
*/
|
||||
public class ItemComparator implements Comparator<ItemDTO> {
|
||||
public class ItemComparator implements Comparator<Item> {
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int compare(ItemDTO item1, ItemDTO item2) {
|
||||
public int compare(Item item1, Item item2) {
|
||||
|
||||
//if one of the item is folder and the other one not, we move up the folder
|
||||
boolean isItem1Folder = Util.isFolder(item1.getType());
|
||||
|
@ -36,7 +36,7 @@ public class ItemComparator implements Comparator<ItemDTO> {
|
|||
return String.CASE_INSENSITIVE_ORDER.compare(item1.getName(), item2.getName());
|
||||
}
|
||||
|
||||
private boolean isSpecialFolder(ItemDTO item) {
|
||||
private boolean isSpecialFolder(Item item) {
|
||||
// return item.getName().equals(WorkspaceExplorerConstants.VRE_FOLDERS_LABEL) && item.getParent()!=null && item.getParent().isRoot();
|
||||
return item.getName().equals(WorkspaceExplorerConstants.VRE_FOLDERS_LABEL) && item.isSpecialFolder();
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
import org.gcube.common.storagehub.model.items.SharedFolder;
|
||||
|
@ -20,7 +18,6 @@ import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService
|
|||
import org.gcube.portlets.widgets.wsexplorer.server.stohub.Whorespace;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemCategory;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemDTO;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemInterface;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
|
||||
import org.gcube.portlets.widgets.wsexplorer.shared.SearchedFolder;
|
||||
|
@ -45,7 +42,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ItemDTO getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getRoot(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||
logger.trace("getRoot showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+ filterCriteria);
|
||||
|
||||
try {
|
||||
|
@ -62,7 +59,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
long startTime = System.currentTimeMillis();
|
||||
logger.trace("start time - " + startTime);
|
||||
|
||||
ItemDTO rootItem = ItemBuilder.getItem(null, root, root.getPath(), showableTypes, filterCriteria, true, false);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item rootItem = ItemBuilder.getItem(null, root, root.getPath(), showableTypes, filterCriteria, true, false);
|
||||
rootItem.setName(WorkspaceExplorerConstants.HOME_LABEL);
|
||||
rootItem.setIsRoot(true);
|
||||
|
||||
|
@ -89,7 +86,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ItemDTO getFolder(ItemInterface item, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria, boolean loadGcubeProperties) throws WorkspaceNavigatorServiceException {
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getFolder(ItemInterface item, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria, boolean loadGcubeProperties) throws WorkspaceNavigatorServiceException {
|
||||
logger.trace("getFolder folderId: "+item.getId()+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
|
||||
try {
|
||||
|
@ -104,7 +101,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
//TO AVOID SLOW CALL getPATH()
|
||||
String folderPath = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
|
||||
ItemDTO itemFolder = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true, loadGcubeProperties);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item itemFolder = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true, loadGcubeProperties);
|
||||
// _log.trace("Only showable types:");
|
||||
|
||||
if (purgeEmpyFolders) {
|
||||
|
@ -133,7 +130,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
|
||||
*/
|
||||
@Override
|
||||
public ItemDTO getItemByCategory(ItemCategory category) throws WorkspaceNavigatorServiceException{
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getItemByCategory(ItemCategory category) throws WorkspaceNavigatorServiceException{
|
||||
logger.trace("GetItemByCategory category: "+category);
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String userName = pContext.getCurrentUser(getThreadLocalRequest()).getUsername();
|
||||
|
@ -143,7 +140,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
try {
|
||||
|
||||
ItemDTO item = null;
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item item = null;
|
||||
|
||||
switch(category){
|
||||
case HOME:{
|
||||
|
@ -154,13 +151,13 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
}else if(fullName.indexOf(".")>0){
|
||||
fullName = fullName.substring(0, fullName.indexOf("."));
|
||||
}
|
||||
item = new ItemDTO(null, root.getId(), fullName+"'s", ItemType.FOLDER, root.getPath(), root.getOwner(), null, true, true);
|
||||
item = new org.gcube.portlets.widgets.wsexplorer.shared.Item(null, root.getId(), fullName+"'s", ItemType.FOLDER, root.getPath(), root.getOwner(), null, true, true);
|
||||
break;
|
||||
}
|
||||
case VRE_FOLDER:{
|
||||
String vreFolderId = Whorespace.getVREFoldersId(getThreadLocalRequest());
|
||||
Item folder = Whorespace.getItem(getThreadLocalRequest(), vreFolderId);
|
||||
item = new ItemDTO(null, folder.getId(), WorkspaceExplorerConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner(), null, true, false);
|
||||
item = new org.gcube.portlets.widgets.wsexplorer.shared.Item(null, folder.getId(), WorkspaceExplorerConstants.VRE_FOLDERS_LABEL, ItemType.FOLDER, folder.getPath(), folder.getOwner(), null, true, false);
|
||||
//SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
||||
item.setSpecialFolder(true);
|
||||
break;
|
||||
|
@ -177,7 +174,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public ItemDTO getMySpecialFolder(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item getMySpecialFolder(List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
|
||||
logger.trace("GetMySpecialFolder showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
|
||||
|
||||
try {
|
||||
|
@ -192,7 +189,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
long startTime = System.currentTimeMillis();
|
||||
logger.trace("start time - " + startTime);
|
||||
|
||||
ItemDTO itemFolder = ItemBuilder.getItem(null, folder, folder.getPath(), showableTypes, filterCriteria, true, false);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item itemFolder = ItemBuilder.getItem(null, folder, folder.getPath(), showableTypes, filterCriteria, true, false);
|
||||
//OVERRIDING VRE FOLDERS NAME - SET SPECIAL FOLDER /Workspace/MySpecialFolders
|
||||
itemFolder.setName(WorkspaceExplorerConstants.VRE_FOLDERS_LABEL);
|
||||
itemFolder.setSpecialFolder(true);
|
||||
|
@ -249,70 +246,16 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<ItemDTO> getBreadcrumbsByItemIdentifier(String itemIdentifier, boolean includeItemAsParent) throws Exception {
|
||||
public ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item> getBreadcrumbsByItemIdentifier(String itemIdentifier, String itemName, boolean includeItemAsParent) throws Exception {
|
||||
logger.trace("ListParents By Item Identifier "+ itemIdentifier);
|
||||
try {
|
||||
|
||||
Item wsItem = Whorespace.getItem(getThreadLocalRequest(), itemIdentifier);
|
||||
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
List<Item> parents = new ArrayList<>();
|
||||
Item whileItem = wsItem;
|
||||
while (whileItem.getParentId() != null) {
|
||||
parents.add(whileItem);
|
||||
whileItem = Whorespace.getItem(getThreadLocalRequest(), whileItem.getParentId());
|
||||
}
|
||||
// List<Item> parents = workspace.getParentsById(itemIdentifier);
|
||||
logger.trace("parents size: "+parents.size());
|
||||
ItemDTO[] arrayParents;
|
||||
if(includeItemAsParent==true && wsItem instanceof FolderItem){
|
||||
arrayParents = new ItemDTO[parents.size()];
|
||||
arrayParents[parents.size()-1] = ItemBuilder.buildFolderForBreadcrumbs((FolderItem) wsItem, null);
|
||||
}
|
||||
else {
|
||||
arrayParents = new ItemDTO[parents.size()-1];
|
||||
}
|
||||
|
||||
/** HANDLE MY_SPECIAL_FOLDER TO AVOID COMPLETE PATH WORKSPACE/MY_SPECIAL_FOLDER
|
||||
* BUT RETURNING ONLY /MY_SPECIAL_FOLDER
|
||||
*/
|
||||
if(wsItem instanceof FolderItem){
|
||||
if(ItemBuilder.isSpecialFolder((FolderItem) wsItem)){
|
||||
return new ArrayList<ItemDTO>(Arrays.asList(arrayParents));
|
||||
}
|
||||
}
|
||||
|
||||
//CONVERTING PATH
|
||||
logger.trace("converting path from second-last..");
|
||||
for (int i = parents.size()-2; i >= 0; i--) {
|
||||
FolderItem wsParentFolder = (FolderItem) parents.get(i);
|
||||
arrayParents[i] = ItemBuilder.buildFolderForBreadcrumbs(wsParentFolder, null);
|
||||
if(arrayParents[i].isSpecialFolder()){ //SKIP HOME PARENT FOR MY_SPECIAL_FOLDER
|
||||
logger.info("arrayParents index "+i+" is special folder, exit");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//SET PARENTS
|
||||
logger.trace("setting parents..");
|
||||
for(int i=0; i<arrayParents.length-1; i++){
|
||||
|
||||
ItemDTO parent = arrayParents[i];
|
||||
ItemDTO fileModel = arrayParents[i+1];
|
||||
fileModel.setParent(parent);
|
||||
}
|
||||
|
||||
logger.trace("ListParents return size: "+arrayParents.length);
|
||||
if(arrayParents[0]==null){ //EXIT BY BREAK IN CASE OF SPECIAL FOLDER
|
||||
List<ItemDTO> breadcrumbs = new ArrayList<ItemDTO>(arrayParents.length-1);
|
||||
for (int i=1; i<arrayParents.length; i++) {
|
||||
breadcrumbs.add(arrayParents[i]);
|
||||
}
|
||||
return breadcrumbs;
|
||||
}
|
||||
else {
|
||||
return new ArrayList<ItemDTO>(Arrays.asList(arrayParents));
|
||||
}
|
||||
|
||||
List<? extends Item> parents = Whorespace.getParents(getThreadLocalRequest(), itemIdentifier);
|
||||
System.out.println("parents size: "+parents.size() + " follows them in order");
|
||||
ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item> toReturn = new ArrayList<>(parents.size());
|
||||
Collections.reverse(toReturn);
|
||||
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
|
||||
return toReturn;
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in get List Parents By Item Identifier ", e);
|
||||
throw new Exception("Sorry, an error occurred during path retrieving!");
|
||||
|
@ -329,29 +272,27 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<ItemDTO> getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit, boolean includeItemAsParent) throws Exception {
|
||||
public List<org.gcube.portlets.widgets.wsexplorer.shared.Item> getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier, String parentLimit, boolean includeItemAsParent) throws Exception {
|
||||
logger.trace("getBreadcrumbsByItemIdentifierToParentLimit by Item Identifier " + itemIdentifier +" and limit: "+parentLimit);
|
||||
try {
|
||||
|
||||
Item wsItem = Whorespace.getItem(getThreadLocalRequest(), itemIdentifier);
|
||||
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
List<Item> parents = new ArrayList<>();
|
||||
Item whileItem = wsItem;
|
||||
while (whileItem.getParentId() != null) {
|
||||
parents.add(whileItem);
|
||||
whileItem = Whorespace.getItem(getThreadLocalRequest(), whileItem.getParentId());
|
||||
System.out.println("**** workspace retrieved item name: "+wsItem.getName());
|
||||
List<? extends Item> parents = Whorespace.getParents(getThreadLocalRequest(), itemIdentifier);
|
||||
System.out.println("parents size: "+parents.size() + " follows them in order");
|
||||
for (Item item : parents) {
|
||||
System.out.println("parent: "+item.getTitle());
|
||||
}
|
||||
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
//List<WorkspaceItem> parents = workspace.getParentsById(itemIdentifier);
|
||||
System.out.println("parents size: "+parents.size());
|
||||
logger.trace("parents size: "+parents.size());
|
||||
ItemDTO[] arrayParents;
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item[] arrayParents;
|
||||
|
||||
if(includeItemAsParent==true && wsItem instanceof FolderItem){
|
||||
arrayParents = new ItemDTO[parents.size()];
|
||||
arrayParents = new org.gcube.portlets.widgets.wsexplorer.shared.Item[parents.size()];
|
||||
arrayParents[parents.size()-1] = ItemBuilder.buildFolderForBreadcrumbs((FolderItem) wsItem, null);
|
||||
}
|
||||
else {
|
||||
arrayParents = new ItemDTO[parents.size()-1];
|
||||
arrayParents = new org.gcube.portlets.widgets.wsexplorer.shared.Item[parents.size()-1];
|
||||
}
|
||||
|
||||
parentLimit = parentLimit!=null?parentLimit:"";
|
||||
|
@ -362,12 +303,12 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
if( wsItem instanceof FolderItem){
|
||||
if(ItemBuilder.isSpecialFolder((FolderItem) wsItem)){
|
||||
logger.debug("item id is special folder, returning");
|
||||
return new ArrayList<ItemDTO>(Arrays.asList(arrayParents));
|
||||
return new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>(Arrays.asList(arrayParents));
|
||||
}
|
||||
|
||||
if(itemIdentifier.compareTo(parentLimit)==0){
|
||||
logger.debug("item and parent limit are identical element, returning");
|
||||
return new ArrayList<ItemDTO>(Arrays.asList(arrayParents));
|
||||
return new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>(Arrays.asList(arrayParents));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -390,8 +331,8 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
logger.trace("setting parents..");
|
||||
for(int i=0; i<arrayParents.length-1; i++){
|
||||
|
||||
ItemDTO parent = arrayParents[i];
|
||||
ItemDTO fileModel = arrayParents[i+1];
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item parent = arrayParents[i];
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item fileModel = arrayParents[i+1];
|
||||
|
||||
if(fileModel!=null) {
|
||||
fileModel.setParent(parent);
|
||||
|
@ -400,7 +341,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
logger.trace("ListParents return size: "+arrayParents.length);
|
||||
if(arrayParents[0]==null){ //EXIT BY BREAK IN CASE OF SPECIAL FOLDER OR REACHED PARENT LIMIT
|
||||
List<ItemDTO> breadcrumbs = new ArrayList<ItemDTO>();
|
||||
List<org.gcube.portlets.widgets.wsexplorer.shared.Item> breadcrumbs = new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>();
|
||||
for (int i=1; i<arrayParents.length; i++) {
|
||||
if(arrayParents[i]!=null) {
|
||||
breadcrumbs.add(arrayParents[i]);
|
||||
|
@ -409,7 +350,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
return breadcrumbs;
|
||||
}
|
||||
else {
|
||||
return new ArrayList<ItemDTO>(Arrays.asList(arrayParents));
|
||||
return new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>(Arrays.asList(arrayParents));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -470,25 +411,27 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public String getMimeType(String itemId) throws Exception {
|
||||
|
||||
logger.info("get MimeType By ItemId "+ itemId);
|
||||
try {
|
||||
Item wsItem = Whorespace.getItem(getThreadLocalRequest(), itemId);
|
||||
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
|
||||
|
||||
if(! (wsItem instanceof FolderItem)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FolderItem folderItem = (FolderItem) wsItem;
|
||||
//TODO:folderItem.getMimeType();
|
||||
return "unknown";
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("get MimeType By ItemId ", e);
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
return "";
|
||||
//TODO: implement later
|
||||
//
|
||||
// logger.info("get MimeType By ItemId "+ itemId);
|
||||
// try {
|
||||
// Item wsItem = Whorespace.getItem(getThreadLocalRequest(), itemId);
|
||||
// logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
//
|
||||
//
|
||||
// if(! (wsItem instanceof FolderItem)) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// FolderItem folderItem = (FolderItem) wsItem;
|
||||
// //TODO:folderItem.getMimeType();
|
||||
// return "unknown";
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// logger.error("get MimeType By ItemId ", e);
|
||||
// throw new Exception(e.getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@ -501,22 +444,24 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public String getUserACLForFolderId(String folderId) throws Exception{
|
||||
try {
|
||||
logger.info("Get user ACL to FOLDER id: "+folderId);
|
||||
Item wsItem = Whorespace.getItem(getThreadLocalRequest(), folderId);
|
||||
logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
|
||||
if(!isASharedFolder(wsItem, false)) {
|
||||
return "OWNER";
|
||||
}
|
||||
else {
|
||||
return "NOT IMPLEMENTED";//TODO
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in server get UserACLForFolderId", e);
|
||||
String error = "An error occurred when getting ACL rules for selected folder. "+e.getMessage();
|
||||
throw new Exception(error);
|
||||
}
|
||||
//TODO: missing implementation on the back-end
|
||||
return "unknown";
|
||||
// try {
|
||||
// logger.info("Get user ACL to FOLDER id: "+folderId);
|
||||
// Item wsItem = Whorespace.getItem(getThreadLocalRequest(), folderId);
|
||||
// logger.trace("workspace retrieve item name: "+wsItem.getName());
|
||||
//
|
||||
// if(!isASharedFolder(wsItem, false)) {
|
||||
// return "OWNER";
|
||||
// }
|
||||
// else {
|
||||
// return "NOT IMPLEMENTED";//TODO
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// logger.error("Error in server get UserACLForFolderId", e);
|
||||
// String error = "An error occurred when getting ACL rules for selected folder. "+e.getMessage();
|
||||
// throw new Exception(error);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
@ -578,7 +523,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public ItemDTO createFolder(String nameFolder, String description, String parentId) throws Exception {
|
||||
public org.gcube.portlets.widgets.wsexplorer.shared.Item createFolder(String nameFolder, String description, String parentId) throws Exception {
|
||||
|
||||
logger.debug("creating folder: "+nameFolder +", parent id: "+parentId);
|
||||
//TODO
|
||||
|
@ -598,7 +543,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
//
|
||||
// List<ItemType> allTypes = Arrays.asList(ItemType.values());
|
||||
//
|
||||
// ItemDTO parent = null;
|
||||
// org.gcube.portlets.widgets.wsexplorer.shared.Item parent = null;
|
||||
// try{
|
||||
// String parentPath = wsFolder.getParent()!=null?wsFolder.getParent().getPath():"";
|
||||
// parent = ItemBuilder.getItem(null, wsFolder.getParent(), parentPath, allTypes, null, false, false);
|
||||
|
@ -676,7 +621,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
*/
|
||||
@Override
|
||||
public SearchedFolder getFolder(
|
||||
ItemDTO item, List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item item, List<ItemType> showableTypes, boolean purgeEmpyFolders,
|
||||
FilterCriteria filterCriteria, boolean loadGcubeProperties,
|
||||
final int startIndex, final int limit, final int serverStartIndex) throws WorkspaceNavigatorServiceException {
|
||||
|
||||
|
@ -694,7 +639,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
//TO AVOID SLOW CALL getPATH()
|
||||
String folderPath = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
|
||||
ItemDTO itemFolderToReturn = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true, loadGcubeProperties, searchStartIndex, limit);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item itemFolderToReturn = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true, loadGcubeProperties, searchStartIndex, limit);
|
||||
|
||||
SearchedFolder sf = new SearchedFolder(itemFolderToReturn, startIndex, limit, searchStartIndex, false);
|
||||
int currentListCount = sf.getFolder().getChildren().size();
|
||||
|
@ -713,7 +658,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
return sf;
|
||||
}
|
||||
|
||||
ArrayList<ItemDTO> childrenToReturn = new ArrayList<ItemDTO>(limit);
|
||||
ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item> childrenToReturn = new ArrayList<org.gcube.portlets.widgets.wsexplorer.shared.Item>(limit);
|
||||
childrenToReturn.addAll(sf.getFolder().getChildren());
|
||||
|
||||
int offsetStartIndex = searchStartIndex;
|
||||
|
@ -728,7 +673,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
if(newstartIndex < folderChildrenCount){
|
||||
//newLimit = limit - childrenToReturn.size();
|
||||
logger.debug("MyLg getting items with index start: "+newstartIndex + ", limit: "+limit);
|
||||
ItemDTO newItemFolder = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true, loadGcubeProperties, newstartIndex, limit);
|
||||
org.gcube.portlets.widgets.wsexplorer.shared.Item newItemFolder = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true, loadGcubeProperties, newstartIndex, limit);
|
||||
int diff = limit - currentListCount; //How items are remaining
|
||||
//int offset = 0;
|
||||
logger.debug("MyLg new search start: "+newstartIndex + ", diff: "+diff+ ", retrieved: "+newItemFolder.getChildren().size());
|
||||
|
@ -782,7 +727,7 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
|
|||
|
||||
|
||||
@Override
|
||||
public int getFolderChildrenCount(ItemDTO item){
|
||||
public int getFolderChildrenCount(org.gcube.portlets.widgets.wsexplorer.shared.Item item){
|
||||
return Whorespace.getItemChildrenCount(getThreadLocalRequest(), item.getId());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.widgets.wsexplorer.server.stohub;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -10,6 +11,7 @@ import org.gcube.common.scope.api.ScopeProvider;
|
|||
import org.gcube.common.storagehub.client.plugins.AbstractPlugin;
|
||||
import org.gcube.common.storagehub.client.proxies.ItemManagerClient;
|
||||
import org.gcube.common.storagehub.client.proxies.WorkspaceManagerClient;
|
||||
import org.gcube.common.storagehub.model.items.FolderItem;
|
||||
import org.gcube.common.storagehub.model.items.Item;
|
||||
|
||||
import com.liferay.portal.kernel.log.Log;
|
||||
|
@ -44,6 +46,18 @@ public class Whorespace {
|
|||
return toReturn;
|
||||
}
|
||||
|
||||
public static List<? extends Item> getParents(HttpServletRequest request, String itemId) {
|
||||
PortalContext pContext = PortalContext.getConfiguration();
|
||||
String userName = pContext.getCurrentUser(request).getUsername();
|
||||
String scope = pContext.getCurrentScope(request);
|
||||
String authorizationToken = pContext.getCurrentUserToken(scope, userName);
|
||||
ScopeProvider.instance.set(scope);
|
||||
SecurityTokenProvider.instance.set(authorizationToken);
|
||||
ItemManagerClient client = AbstractPlugin.item().build();
|
||||
List<? extends Item> toReturn = client.getAnchestors(itemId, ACCOUNTING_HL_NODE_NAME);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
|
|
|
@ -16,15 +16,15 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
|||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Dec 2, 2015
|
||||
*/
|
||||
public class ItemDTO implements IsSerializable, ItemInterface{
|
||||
public class Item implements IsSerializable, ItemInterface{
|
||||
|
||||
protected ItemDTO parent;
|
||||
protected Item parent;
|
||||
protected String id;
|
||||
|
||||
protected String name;
|
||||
protected ItemType type;
|
||||
protected String path;
|
||||
protected ArrayList<ItemDTO> children;
|
||||
protected ArrayList<Item> children;
|
||||
private String owner;
|
||||
private boolean isFolder;
|
||||
private boolean isSpecialFolder = false;
|
||||
|
@ -37,7 +37,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
/**
|
||||
* Instantiates a new item.
|
||||
*/
|
||||
public ItemDTO() {
|
||||
public Item() {
|
||||
}
|
||||
/**
|
||||
* Instantiates a new item.
|
||||
|
@ -46,12 +46,12 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
* @param name the name
|
||||
* @param isFolder the is folder
|
||||
*/
|
||||
public ItemDTO(String id, String name, boolean isFolder) {
|
||||
public Item(String id, String name, boolean isFolder) {
|
||||
this.id = id;
|
||||
this.isFolder = isFolder;
|
||||
this.name = name;
|
||||
this.type = isFolder?ItemType.FOLDER:ItemType.UNKNOWN_TYPE;
|
||||
this.children = new ArrayList<ItemDTO>();
|
||||
this.children = new ArrayList<Item>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
* @param isFolder the is folder
|
||||
* @param isRoot the is root
|
||||
*/
|
||||
public ItemDTO(ItemDTO parent, String id, String name, ItemType type, String path, String owner, Date creationDate, boolean isFolder, boolean isRoot) {
|
||||
public Item(Item parent, String id, String name, ItemType type, String path, String owner, Date creationDate, boolean isFolder, boolean isRoot) {
|
||||
this(parent, id, name, type, path, owner, isFolder, isRoot);
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
|
@ -86,12 +86,12 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
* @param isFolder the is folder
|
||||
* @param isRoot the is root
|
||||
*/
|
||||
public ItemDTO(ItemDTO parent, String id, String name, ItemType type, String path, String owner, boolean isFolder, boolean isRoot) {
|
||||
public Item(Item parent, String id, String name, ItemType type, String path, String owner, boolean isFolder, boolean isRoot) {
|
||||
this(id, name, isFolder);
|
||||
this.parent = parent;
|
||||
this.type = type;
|
||||
this.path = path;
|
||||
this.children = new ArrayList<ItemDTO>();
|
||||
this.children = new ArrayList<Item>();
|
||||
this.owner = owner;
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
*
|
||||
* @param children the new children
|
||||
*/
|
||||
public void setChildren(ArrayList<ItemDTO> children) {
|
||||
public void setChildren(ArrayList<Item> children) {
|
||||
|
||||
this.children = children;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
*
|
||||
* @return the item parent.
|
||||
*/
|
||||
public ItemDTO getParent() {
|
||||
public Item getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
*
|
||||
* @return the children.
|
||||
*/
|
||||
public ArrayList<ItemDTO> getChildren() {
|
||||
public ArrayList<Item> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
* the index
|
||||
* @return the child at the specific position.
|
||||
*/
|
||||
public ItemDTO getChild(int index) {
|
||||
public Item getChild(int index) {
|
||||
return children.get(index);
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
* @param child
|
||||
* the child to add.
|
||||
*/
|
||||
public void addChild(ItemDTO child) {
|
||||
public void addChild(Item child) {
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
* @param child
|
||||
* the child
|
||||
*/
|
||||
public void removeChild(ItemDTO child) {
|
||||
public void removeChild(Item child) {
|
||||
children.remove(child);
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
ItemDTO other = (ItemDTO) obj;
|
||||
Item other = (Item) obj;
|
||||
if (id == null) {
|
||||
if (other.id != null) {
|
||||
return false;
|
||||
|
@ -375,7 +375,7 @@ public class ItemDTO implements IsSerializable, ItemInterface{
|
|||
* @param parent
|
||||
* the new parent
|
||||
*/
|
||||
public void setParent(ItemDTO parent) {
|
||||
public void setParent(Item parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
/* (non-Javadoc)
|
|
@ -20,9 +20,18 @@ public enum ItemType {
|
|||
EXTERNAL_PDF_FILE,
|
||||
EXTERNAL_URL,
|
||||
QUERY,
|
||||
CALENDAR,
|
||||
REPORT_TEMPLATE,
|
||||
REPORT,
|
||||
CSV,
|
||||
MOVIE,
|
||||
ZIP,
|
||||
RAR,
|
||||
HTML,
|
||||
TEXT_PLAIN,
|
||||
DOCUMENT,
|
||||
PRESENTATION,
|
||||
SPREADSHEET,
|
||||
METADATA,
|
||||
PDF_DOCUMENT,
|
||||
IMAGE_DOCUMENT,
|
||||
|
|
|
@ -15,7 +15,7 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
|||
public class SearchedFolder implements IsSerializable{
|
||||
|
||||
|
||||
private ItemDTO folder;
|
||||
private Item folder;
|
||||
private int clientStartIndex = 0;
|
||||
private int limit;
|
||||
private int serverEndIndex = 0;
|
||||
|
@ -35,7 +35,7 @@ public class SearchedFolder implements IsSerializable{
|
|||
* @param serverEndIndex
|
||||
* @param isServerSearchFinished
|
||||
*/
|
||||
public SearchedFolder(ItemDTO folder, int clientStartIndex, int limit, int serverEndIndex, boolean isServerSearchFinished) {
|
||||
public SearchedFolder(Item folder, int clientStartIndex, int limit, int serverEndIndex, boolean isServerSearchFinished) {
|
||||
|
||||
super();
|
||||
this.folder = folder;
|
||||
|
@ -50,7 +50,7 @@ public class SearchedFolder implements IsSerializable{
|
|||
/**
|
||||
* @return the folder
|
||||
*/
|
||||
public ItemDTO getFolder() {
|
||||
public Item getFolder() {
|
||||
|
||||
return folder;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class SearchedFolder implements IsSerializable{
|
|||
/**
|
||||
* @param folder the folder to set
|
||||
*/
|
||||
public void setFolder(ItemDTO folder) {
|
||||
public void setFolder(Item folder) {
|
||||
|
||||
this.folder = folder;
|
||||
}
|
||||
|
|