|
|
|
@ -30,7 +30,6 @@ import org.gcube.portlets.user.workspaceexplorerapp.client.view.WorkspaceExplore
|
|
|
|
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.Item;
|
|
|
|
|
import org.gcube.portlets.user.workspaceexplorerapp.shared.ItemType;
|
|
|
|
|
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
|
|
|
|
import com.google.gwt.core.shared.GWT;
|
|
|
|
|
import com.google.gwt.event.shared.HandlerManager;
|
|
|
|
|
import com.google.gwt.http.client.RequestBuilder;
|
|
|
|
@ -46,49 +45,51 @@ import gwt.material.design.client.ui.MaterialToast;
|
|
|
|
|
/**
|
|
|
|
|
* The Class WorkspaceResourcesExplorerPanel.
|
|
|
|
|
*
|
|
|
|
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
* Dec 3, 2015
|
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
*
|
|
|
|
|
* Dec 3, 2021
|
|
|
|
|
*/
|
|
|
|
|
public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWorskpaceExplorerSelectNotificationListener{
|
|
|
|
|
public class WorkspaceResourcesExplorerPanel extends DockPanel
|
|
|
|
|
implements HasWorskpaceExplorerSelectNotificationListener {
|
|
|
|
|
|
|
|
|
|
public HandlerManager eventBus;
|
|
|
|
|
private Breadcrumbs breadcrumbs;
|
|
|
|
|
private boolean isSelect = false;
|
|
|
|
|
private String captionTxt;
|
|
|
|
|
// private WorkspaceExplorerController controller;
|
|
|
|
|
private List<WorskpaceExplorerSelectNotificationListener> listeners = new ArrayList<WorskpaceExplorerSelectNotificationListener>();
|
|
|
|
|
private VerticalPanel mainVP = new VerticalPanel();
|
|
|
|
|
// private HorizontalPanel footerHP = new HorizontalPanel();
|
|
|
|
|
private WorkspaceExplorer wsExplorer;
|
|
|
|
|
private ScrollPanel centerScrollable = new ScrollPanel();
|
|
|
|
|
// private ScrollPanel southPanel = new ScrollPanel();
|
|
|
|
|
private String folderName;
|
|
|
|
|
private Item baseFolder;
|
|
|
|
|
public static final DisplayField[] displayFields = new DisplayField[]{DisplayField.ICON, DisplayField.NAME, DisplayField.OWNER, DisplayField.CREATION_DATE};
|
|
|
|
|
public static final DisplayField[] displayFields = new DisplayField[] { DisplayField.ICON, DisplayField.NAME,
|
|
|
|
|
DisplayField.OWNER, DisplayField.CREATION_DATE };
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Instantiates a new workspace folder explorer select panel.
|
|
|
|
|
*
|
|
|
|
|
* @param eventBus the event bus
|
|
|
|
|
* @param folderId the folder id like root folder to explore
|
|
|
|
|
* @param eventBus the event bus
|
|
|
|
|
* @param folderId the folder id like root folder to explore
|
|
|
|
|
* @param folderName the folder name
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, String folderName) throws Exception {
|
|
|
|
|
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, String folderName)
|
|
|
|
|
throws Exception {
|
|
|
|
|
initExplorer(eventBus, folderId, folderName, ItemType.values(), ItemType.values());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Inits the explorer.
|
|
|
|
|
*
|
|
|
|
|
* @param eventBus the event bus
|
|
|
|
|
* @param folderId the folder id
|
|
|
|
|
* @param folderName the folder name
|
|
|
|
|
* @param eventBus the event bus
|
|
|
|
|
* @param folderId the folder id
|
|
|
|
|
* @param folderName the folder name
|
|
|
|
|
* @param selectableTypes the selectable types
|
|
|
|
|
* @param showableTypes the showable types
|
|
|
|
|
* @param showableTypes the showable types
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
private void initExplorer(HandlerManager eventBus, String folderId, String folderName, ItemType[] selectableTypes, ItemType[] showableTypes) throws Exception{
|
|
|
|
|
private void initExplorer(HandlerManager eventBus, String folderId, String folderName, ItemType[] selectableTypes,
|
|
|
|
|
ItemType[] showableTypes) throws Exception {
|
|
|
|
|
this.folderName = folderName;
|
|
|
|
|
this.eventBus = eventBus;
|
|
|
|
|
this.breadcrumbs = new Breadcrumbs(eventBus);
|
|
|
|
@ -98,7 +99,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
Item item = new Item(folderId, folderName, true);
|
|
|
|
|
this.baseFolder = item;
|
|
|
|
|
wsExplorer.setBaseFolder(item);
|
|
|
|
|
if(folderId!=null && !folderId.isEmpty())
|
|
|
|
|
if (folderId != null && !folderId.isEmpty())
|
|
|
|
|
wsExplorer.loadFolder(item);
|
|
|
|
|
initPanel("");
|
|
|
|
|
}
|
|
|
|
@ -106,26 +107,27 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
/**
|
|
|
|
|
* Instantiates a new workspace explorer select panel.
|
|
|
|
|
*
|
|
|
|
|
* @param folderId the folder id
|
|
|
|
|
* @param eventBus the event bus
|
|
|
|
|
* @param folderId the folder id
|
|
|
|
|
* @param showOnlyFolders the show only folders
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, boolean showOnlyFolders) throws Exception {
|
|
|
|
|
public WorkspaceResourcesExplorerPanel(HandlerManager eventBus, String folderId, boolean showOnlyFolders)
|
|
|
|
|
throws Exception {
|
|
|
|
|
|
|
|
|
|
if(showOnlyFolders){
|
|
|
|
|
if (showOnlyFolders) {
|
|
|
|
|
ItemType[] itemsType = new ItemType[1];
|
|
|
|
|
itemsType[0] = ItemType.FOLDER;
|
|
|
|
|
initExplorer(eventBus, folderId, "", itemsType, itemsType);
|
|
|
|
|
}else{
|
|
|
|
|
} else {
|
|
|
|
|
initExplorer(eventBus, folderId, "", ItemType.values(), ItemType.values());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bind events.
|
|
|
|
|
*/
|
|
|
|
|
private void bindEvents(){
|
|
|
|
|
private void bindEvents() {
|
|
|
|
|
|
|
|
|
|
eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
|
|
|
|
|
|
|
|
|
@ -150,12 +152,12 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onLoadFolder(LoadFolderEvent loadFolderEvent) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GWT.log("LoadFolderEvent fired");
|
|
|
|
|
|
|
|
|
|
Item item = loadFolderEvent.getTargetFolder()==null?baseFolder:loadFolderEvent.getTargetFolder();
|
|
|
|
|
Item item = loadFolderEvent.getTargetFolder() == null ? baseFolder : loadFolderEvent.getTargetFolder();
|
|
|
|
|
|
|
|
|
|
if(item.isFolder()){
|
|
|
|
|
if (item.isFolder()) {
|
|
|
|
|
try {
|
|
|
|
|
wsExplorer.loadFolder(item);
|
|
|
|
|
loadParentBreadcrumbByItemId(item.getId(), true);
|
|
|
|
@ -171,7 +173,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
|
|
|
|
|
if(breadcrumbClickEvent.getTargetItem()!=null)
|
|
|
|
|
if (breadcrumbClickEvent.getTargetItem() != null)
|
|
|
|
|
eventBus.fireEvent(new LoadFolderEvent(breadcrumbClickEvent.getTargetItem()));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -182,22 +184,19 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
public void onOrderDataBy(OrderDataByEvent orderDataByEvent) {
|
|
|
|
|
|
|
|
|
|
wsExplorer.getItTables().sortDataBy(orderDataByEvent.getLabel());
|
|
|
|
|
|
|
|
|
|
/*ArrayList<Item> items = ItemComparatorUtility.sortItems(DisplayField.NAME, true, wsExplorer.getItTables().getDataProvider().getList());
|
|
|
|
|
wsExplorer.updateExplorer(items);*/
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
eventBus.addHandler(RightClickItemEvent.TYPE, new RightClickItemEventHandler() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(RightClickItemEvent rightClickItemEvent) {
|
|
|
|
|
|
|
|
|
|
if(rightClickItemEvent.getItem()!=null && rightClickItemEvent.getItem().getId()!=null){
|
|
|
|
|
if (rightClickItemEvent.getItem() != null && rightClickItemEvent.getItem().getId() != null) {
|
|
|
|
|
|
|
|
|
|
PopupContextMenu popupCM = new PopupContextMenu(true, eventBus, rightClickItemEvent.getItem());
|
|
|
|
|
popupCM.showPopup(rightClickItemEvent.getXPos(), Window.getScrollTop()+rightClickItemEvent.getYPos());
|
|
|
|
|
popupCM.showPopup(rightClickItemEvent.getXPos(),
|
|
|
|
|
Window.getScrollTop() + rightClickItemEvent.getYPos());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
@ -208,24 +207,27 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
public void onDownloadItem(DownloadItemEvent downloadItemEvent) {
|
|
|
|
|
GWT.log("Fired event DownloadItemEvent");
|
|
|
|
|
String itemIds = "";
|
|
|
|
|
if(downloadItemEvent.getItem()!=null)
|
|
|
|
|
itemIds = downloadItemEvent.getItem().getId()+WorkspaceExplorerAppConstants.IDS_SEPARATOR;
|
|
|
|
|
else{
|
|
|
|
|
if (downloadItemEvent.getItem() != null)
|
|
|
|
|
itemIds = downloadItemEvent.getItem().getId() + WorkspaceExplorerAppConstants.IDS_SEPARATOR;
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
List<Item> lstItems = toList(wsExplorer.getItemsSelected());
|
|
|
|
|
for (Item item : lstItems) {
|
|
|
|
|
itemIds +=item.getId()+WorkspaceExplorerAppConstants.IDS_SEPARATOR;
|
|
|
|
|
itemIds += item.getId() + WorkspaceExplorerAppConstants.IDS_SEPARATOR;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GWT.log("itemIds: "+itemIds);
|
|
|
|
|
if(!itemIds.isEmpty()){
|
|
|
|
|
GWT.log("itemIds: " + itemIds);
|
|
|
|
|
if (!itemIds.isEmpty()) {
|
|
|
|
|
// MaterialToast.fireToast("Download...");
|
|
|
|
|
|
|
|
|
|
switch (downloadItemEvent.getType()) {
|
|
|
|
|
case DOWNLOAD:
|
|
|
|
|
MaterialToast.fireToast("Download...");
|
|
|
|
|
try {
|
|
|
|
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE, WorkspaceExplorerAppConstants.IDS+"="+itemIds, "_self", downloadHandlerCallback);
|
|
|
|
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,
|
|
|
|
|
WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE,
|
|
|
|
|
WorkspaceExplorerAppConstants.IDS + "=" + itemIds, "_self",
|
|
|
|
|
downloadHandlerCallback);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Window.alert("Sorry, an error occurred while contacting server, try again");
|
|
|
|
|
}
|
|
|
|
@ -234,8 +236,45 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
// break;
|
|
|
|
|
case OPEN:
|
|
|
|
|
MaterialToast.fireToast("Showing...");
|
|
|
|
|
|
|
|
|
|
if (downloadItemEvent.getItem().getType().equals(ItemType.URL_DOCUMENT)) {
|
|
|
|
|
|
|
|
|
|
final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_blank", "");
|
|
|
|
|
|
|
|
|
|
final String theItemIds = itemIds;
|
|
|
|
|
|
|
|
|
|
WorkspaceExplorerAppConstants.workspaceNavigatorService
|
|
|
|
|
.getUrlById(downloadItemEvent.getItem().getId(), new AsyncCallback<String>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(String result) {
|
|
|
|
|
newBrowserWindow.setUrl(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
try {
|
|
|
|
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,
|
|
|
|
|
WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE,
|
|
|
|
|
WorkspaceExplorerAppConstants.IDS + "=" + theItemIds
|
|
|
|
|
+ "&viewContent=true",
|
|
|
|
|
"_blank", downloadHandlerCallback);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Window.alert(
|
|
|
|
|
"Sorry, an error occurred while contacting server, try again");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET, WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE, WorkspaceExplorerAppConstants.IDS+"="+itemIds+"&viewContent=true", "_blank", downloadHandlerCallback);
|
|
|
|
|
new RequestBuilderWorkspaceValidateItem(RequestBuilder.GET,
|
|
|
|
|
WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE,
|
|
|
|
|
WorkspaceExplorerAppConstants.IDS + "=" + itemIds + "&viewContent=true", "_blank",
|
|
|
|
|
downloadHandlerCallback);
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Window.alert("Sorry, an error occurred while contacting server, try again");
|
|
|
|
@ -249,64 +288,61 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To list.
|
|
|
|
|
*
|
|
|
|
|
* @param items the items
|
|
|
|
|
* @return the list
|
|
|
|
|
*/
|
|
|
|
|
private List<Item> toList(Set<Item> items){
|
|
|
|
|
if(items!=null && items.size()>0){
|
|
|
|
|
List<Item> lstItems = new ArrayList<Item> (items.size());
|
|
|
|
|
private List<Item> toList(Set<Item> items) {
|
|
|
|
|
if (items != null && items.size() > 0) {
|
|
|
|
|
List<Item> lstItems = new ArrayList<Item>(items.size());
|
|
|
|
|
lstItems.addAll(items);
|
|
|
|
|
return lstItems;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Load parent breadcrumb by item id.
|
|
|
|
|
*
|
|
|
|
|
* @param itemIdentifier the item identifier
|
|
|
|
|
* @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, boolean includeItemAsParent) {
|
|
|
|
|
|
|
|
|
|
GWT.log("Reload Parent Breadcrumb: [Item id: "+itemIdentifier+"]");
|
|
|
|
|
GWT.log("Reload Parent Breadcrumb: [Item id: " + itemIdentifier + "]");
|
|
|
|
|
|
|
|
|
|
WorkspaceExplorerAppConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(itemIdentifier, baseFolder.getId(), includeItemAsParent, new AsyncCallback<List<Item>>() {
|
|
|
|
|
WorkspaceExplorerAppConstants.workspaceNavigatorService.getBreadcrumbsByItemIdentifierToParentLimit(
|
|
|
|
|
itemIdentifier, baseFolder.getId(), includeItemAsParent, new AsyncCallback<List<Item>>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
GWT.log(caught.getMessage());
|
|
|
|
|
Item goToBaseFolder = null;
|
|
|
|
|
//I'm adding go to folder only if is a sub-folder of baseFolder
|
|
|
|
|
if(itemIdentifier!=baseFolder.getId())
|
|
|
|
|
goToBaseFolder = baseFolder;
|
|
|
|
|
|
|
|
|
|
//wsExplorer.setAlert(caught.getMessage(), AlertType.ERROR, goToBaseFolder);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
GWT.log(caught.getMessage());
|
|
|
|
|
Item goToBaseFolder = null;
|
|
|
|
|
// I'm adding go to folder only if is a sub-folder of baseFolder
|
|
|
|
|
if (itemIdentifier != baseFolder.getId())
|
|
|
|
|
goToBaseFolder = baseFolder;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(List<Item> result) {
|
|
|
|
|
if(result!=null){
|
|
|
|
|
breadcrumbs.setPath(result);
|
|
|
|
|
// clearMoreInfo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// wsExplorer.setAlert(caught.getMessage(), AlertType.ERROR, goToBaseFolder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(List<Item> result) {
|
|
|
|
|
if (result != null) {
|
|
|
|
|
breadcrumbs.setPath(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Refresh root folder view.
|
|
|
|
|
*/
|
|
|
|
|
public void refreshRootFolderView(){
|
|
|
|
|
//Item item = new Item(baseFolder.getId(), folderName, true);
|
|
|
|
|
public void refreshRootFolderView() {
|
|
|
|
|
// Item item = new Item(baseFolder.getId(), folderName, true);
|
|
|
|
|
eventBus.fireEvent(new LoadFolderEvent(baseFolder));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Inits the panel.
|
|
|
|
@ -319,14 +355,14 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
this.getElement().setAttribute("id", "WorkspaceExplorerContainer");
|
|
|
|
|
this.getElement().addClassName("workspace-explorer-container");
|
|
|
|
|
|
|
|
|
|
if(this.captionTxt!=null && !this.captionTxt.isEmpty())
|
|
|
|
|
if (this.captionTxt != null && !this.captionTxt.isEmpty())
|
|
|
|
|
setTitle(this.captionTxt);
|
|
|
|
|
|
|
|
|
|
setWidth("100%");
|
|
|
|
|
add(breadcrumbs, DockPanel.NORTH);
|
|
|
|
|
setWidth("100%");
|
|
|
|
|
add(breadcrumbs, DockPanel.NORTH);
|
|
|
|
|
mainVP.add(wsExplorer.getPanel());
|
|
|
|
|
centerScrollable.add(mainVP);
|
|
|
|
|
add(centerScrollable, DockPanel.CENTER);
|
|
|
|
|
centerScrollable.add(mainVP);
|
|
|
|
|
add(centerScrollable, DockPanel.CENTER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -334,7 +370,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
*
|
|
|
|
|
* @param selected the selected
|
|
|
|
|
*/
|
|
|
|
|
private void notifySelectedItem(Item selected){
|
|
|
|
|
private void notifySelectedItem(Item selected) {
|
|
|
|
|
|
|
|
|
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
|
|
|
|
worskpaceExplorerNotificationListener.onSelectedItem(selected);
|
|
|
|
@ -344,18 +380,17 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
/**
|
|
|
|
|
* Notify aborted.
|
|
|
|
|
*/
|
|
|
|
|
private void notifyAborted(){
|
|
|
|
|
private void notifyAborted() {
|
|
|
|
|
|
|
|
|
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
|
|
|
|
worskpaceExplorerNotificationListener.onAborted();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Notify not valid selection.
|
|
|
|
|
*/
|
|
|
|
|
private void notifyNotValidSelection(){
|
|
|
|
|
private void notifyNotValidSelection() {
|
|
|
|
|
|
|
|
|
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
|
|
|
|
worskpaceExplorerNotificationListener.onNotValidSelection();
|
|
|
|
@ -368,7 +403,7 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
* @param t the t
|
|
|
|
|
*/
|
|
|
|
|
@SuppressWarnings("unused")
|
|
|
|
|
private void notifyFailed(Throwable t){
|
|
|
|
|
private void notifyFailed(Throwable t) {
|
|
|
|
|
|
|
|
|
|
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
|
|
|
|
|
worskpaceExplorerNotificationListener.onFailed(t);
|
|
|
|
@ -393,22 +428,44 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
return isSelect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc)
|
|
|
|
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
|
|
|
|
/**
|
|
|
|
|
* Adds the workspace explorer select notification listener.
|
|
|
|
|
*
|
|
|
|
|
* @param handler the handler
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
* (non-Javadoc)
|
|
|
|
|
*
|
|
|
|
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.
|
|
|
|
|
* WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#
|
|
|
|
|
* addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.
|
|
|
|
|
* wsexplorer.client.notification.WorskpaceExplorerNotification.
|
|
|
|
|
* WorskpaceExplorerNotificationListener)
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void addWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
|
|
|
|
if(handler!=null)
|
|
|
|
|
if (handler != null)
|
|
|
|
|
listeners.add(handler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (non-Javadoc)
|
|
|
|
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#removeWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
|
|
|
|
|
/**
|
|
|
|
|
* Removes the workspace explorer select notification listener.
|
|
|
|
|
*
|
|
|
|
|
* @param handler the handler
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
* (non-Javadoc)
|
|
|
|
|
*
|
|
|
|
|
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.
|
|
|
|
|
* WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#
|
|
|
|
|
* removeWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.
|
|
|
|
|
* wsexplorer.client.notification.WorskpaceExplorerNotification.
|
|
|
|
|
* WorskpaceExplorerNotificationListener)
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void removeWorkspaceExplorerSelectNotificationListener(WorskpaceExplorerSelectNotificationListener handler) {
|
|
|
|
|
if(handler!=null){
|
|
|
|
|
if(listeners.contains(handler))
|
|
|
|
|
if (handler != null) {
|
|
|
|
|
if (listeners.contains(handler))
|
|
|
|
|
listeners.remove(handler);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -419,18 +476,19 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
* @param item the item
|
|
|
|
|
* @return true, if successful
|
|
|
|
|
*/
|
|
|
|
|
public boolean itemIsSelectable(Item item){
|
|
|
|
|
GWT.log("Selectable type: "+wsExplorer.getSelectableTypes());
|
|
|
|
|
GWT.log("item: "+item);
|
|
|
|
|
if (item!=null){
|
|
|
|
|
public boolean itemIsSelectable(Item item) {
|
|
|
|
|
GWT.log("Selectable type: " + wsExplorer.getSelectableTypes());
|
|
|
|
|
GWT.log("item: " + item);
|
|
|
|
|
if (item != null) {
|
|
|
|
|
boolean selectable = wsExplorer.getSelectableTypes().contains(item.getType());
|
|
|
|
|
return selectable?true:false;
|
|
|
|
|
return selectable ? true : false;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the ws explorer.
|
|
|
|
|
*
|
|
|
|
|
* @return the wsExplorer
|
|
|
|
|
*/
|
|
|
|
|
public WorkspaceExplorer getWsExplorer() {
|
|
|
|
@ -456,11 +514,12 @@ public class WorkspaceResourcesExplorerPanel extends DockPanel implements HasWor
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(WindowOpenParameter windowOpenParam) {
|
|
|
|
|
String params = "?"+windowOpenParam.getParameters();
|
|
|
|
|
if(params.length()>1)
|
|
|
|
|
params+="&";
|
|
|
|
|
params+=WorkspaceExplorerAppConstants.REDIRECTONERROR+"="+windowOpenParam.isRedirectOnError();
|
|
|
|
|
windowOpenParam.getBrowserWindow().setUrl(WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE+params);
|
|
|
|
|
String params = "?" + windowOpenParam.getParameters();
|
|
|
|
|
if (params.length() > 1)
|
|
|
|
|
params += "&";
|
|
|
|
|
params += WorkspaceExplorerAppConstants.REDIRECTONERROR + "=" + windowOpenParam.isRedirectOnError();
|
|
|
|
|
windowOpenParam.getBrowserWindow()
|
|
|
|
|
.setUrl(WorkspaceExplorerAppConstants.DOWNLOAD_WORKSPACE_SERVICE + params);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|