Task 2350: Workspace Light Tree requires longer and longer time to access shared folders

Removed static variable which increments number of calls to server side

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@124629 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-02-26 17:28:40 +00:00
parent 7ef662f3aa
commit 2b5e37338e
12 changed files with 232 additions and 184 deletions

View File

@ -53,7 +53,7 @@ import com.google.gwt.user.client.ui.Label;
*/
public class WorkspaceExplorerController implements EventHandler {
public final static HandlerManager eventBus = new HandlerManager(null);
public HandlerManager eventBus = new HandlerManager(null);
private WorkspaceExplorerPanel workspaceExplorerPanel;
private WorkspaceExplorer wsExplorer;
private Breadcrumbs breadcrumbs = new Breadcrumbs(eventBus);
@ -122,7 +122,7 @@ public class WorkspaceExplorerController implements EventHandler {
@Override
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
WorkspaceExplorerController.eventBus.fireEvent(new LoadFolderEvent(breadcrumbClickEvent.getTargetItem()));
eventBus.fireEvent(new LoadFolderEvent(breadcrumbClickEvent.getTargetItem()));
}
});
@ -432,4 +432,12 @@ public class WorkspaceExplorerController implements EventHandler {
}
return false;
}
/**
* @return the eventBus
*/
public HandlerManager getEventBus() {
return eventBus;
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
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;
import org.gcube.portlets.widgets.wsexplorer.shared.WorkspaceNavigatorServiceException;
@ -43,14 +44,14 @@ public interface WorkspaceExplorerService extends RemoteService {
/**
* Gets the folder.
*
* @param folderId the folder id
* @param item the item
* @param showableTypes the showable types
* @param purgeEmpyFolders the purge empy folders
* @param filterCriteria the filter criteria
* @return the folder
* @throws WorkspaceNavigatorServiceException the workspace navigator service exception
*/
Item getFolder(String folderId, List<ItemType> showableTypes,
Item getFolder(ItemInterface item, List<ItemType> showableTypes,
boolean purgeEmpyFolders, FilterCriteria filterCriteria)
throws WorkspaceNavigatorServiceException;

View File

@ -8,6 +8,7 @@ import java.util.List;
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
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;
import com.google.gwt.user.client.rpc.AsyncCallback;
@ -50,21 +51,17 @@ public interface WorkspaceExplorerServiceAsync {
/**
* Gets the folder.
*
* @param folderId
* the folder id
* @param showableTypes
* the showable types
* @param purgeEmpyFolders
* the purge empy folders
* @param filterCriteria
* the filter criteria
* @param callback
* the callback
* @param item the item
* @param showableTypes the showable types
* @param purgeEmpyFolders the purge empy folders
* @param filterCriteria the filter criteria
* @param callback the callback
* @return the folder
*/
public void getFolder(String folderId, List<ItemType> showableTypes,
boolean purgeEmpyFolders, FilterCriteria filterCriteria,
AsyncCallback<Item> callback);
void getFolder(
ItemInterface item, List<ItemType> showableTypes,
boolean purgeEmpyFolders, FilterCriteria filterCriteria,
AsyncCallback<Item> callback);
/**
@ -136,10 +133,27 @@ public interface WorkspaceExplorerServiceAsync {
public void getUserACLForFolderId(String id,
AsyncCallback<String> asyncCallback);
/**
* Gets the breadcrumbs by item identifier to parent limit.
*
* @param itemIdentifier the item identifier
* @param parentLimit the parent limit
* @param includeItemAsParent the include item as parent
* @param callback the callback
* @return the breadcrumbs by item identifier to parent limit
*/
void getBreadcrumbsByItemIdentifierToParentLimit(String itemIdentifier,
String parentLimit, boolean includeItemAsParent,
AsyncCallback<List<Item>> callback);
/**
* Creates the folder.
*
* @param nameFolder the name folder
* @param description the description
* @param parentId the parent id
* @param callback the callback
*/
void createFolder(
String nameFolder, String description, String parentId,
AsyncCallback<Item> callback);

View File

@ -51,7 +51,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
private TextBox fileNameTextBox = new TextBox();
private int zIndex = -1;
/**
* Instantiates a new workspace explorer save dialog.
*
@ -62,7 +62,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
loadExplorer(captionTxt, fileName);
}
/**
* Instantiates a new workspace explorer save dialog.
*
@ -107,7 +107,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
setSelectableTypes(itemsType);
setShowableTypes(itemsType);
}
loadExplorer(WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION, fileName);
}
@ -126,10 +126,10 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
itemsType = showableTypes.toArray(itemsType);
setShowableTypes(showableTypes.toArray(itemsType));
}
loadExplorer(captionTxt, fileName);
}
/**
* Instantiates a new workspace explorer save dialog.
@ -144,11 +144,11 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
itemsType = showableTypes.toArray(itemsType);
setShowableTypes(showableTypes.toArray(itemsType));
}
loadExplorer(WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION, fileName);
}
/**
* Load explorer.
*
@ -156,7 +156,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param fileName the file name
*/
private void loadExplorer(String captionTxt, String fileName){
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
controller.getEventBus().fireEvent(new LoadRootEvent());
initDialog(captionTxt, fileName);
}
@ -168,7 +168,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
* @param fileName the file name
*/
private void initDialog(String captionTxt, String fileName) {
this.captionTxt = (captionTxt == null || captionTxt.isEmpty()) ? WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION: captionTxt;
this.captionTxt = captionTxt == null || captionTxt.isEmpty() ? WorkspaceExplorerConstants.WORKSPACE_EXPLORER_SAVE_AS_CAPTION: captionTxt;
setAnimation(false);
setCloseVisible(true);
hide(false);
@ -198,7 +198,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
if (item != null && item.isFolder()) {
//GO INTO FOLDER
WorkspaceExplorerController.eventBus.fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(item));
controller.getEventBus().fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(item));
} else {
//VALIDATING FILE NAME
String fileName = getFileName();
@ -207,7 +207,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
fileNameTextBox.setFocus(true);
return;
}
Item itemB = controller.getBreadcrumbs().getLastParent();
if (itemB != null) {
if(itemB.isSpecialFolder()){
@ -221,7 +221,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
}
}
});
fileNameTextBox.addStyleName("fileNameTextBox");
fileNameTextBox.setAlignment(TextAlignment.LEFT);
setFileName(fileName);
@ -231,43 +231,43 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
footer.add(fileNameTextBox);
footer.add(saveButton);
add(footer);
addHandlers();
}
/**
* Adds the handlers.
*/
private void addHandlers() {
WorkspaceExplorerController.eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
controller.getEventBus().addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
@Override
public void onClick(final ClickItemEvent clickItemEvent) {
Item item = clickItemEvent.getItem();
if(item!=null && !item.isFolder())
setFileName("New_"+item.getName());
}
});
addShownHandler(new ShownHandler() {
@Override
public void onShown(ShownEvent shownEvent) {
fileNameTextBox.selectAll();
fileNameTextBox.setFocus(true);
}
});
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand () {
public void execute () {
fileNameTextBox.selectAll();
fileNameTextBox.setFocus(true);
}
});
}
/**
@ -278,11 +278,11 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
private void setFileName(final String txt){
if(txt==null)
return;
fileNameTextBox.setValue(txt);
}
/**
* Gets the file name.
*
@ -349,7 +349,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
/*
* (non-Javadoc)
*
*
* @see com.github.gwtbootstrap.client.ui.Modal#show()
*/
@Override
@ -357,7 +357,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
super.show();
isSave = false;
}
/**
* Gets the save button.
*
@ -369,7 +369,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
/**
* Set which items are selectable.
*
*
* @param selectableTypes
* the selectableTypes to set
*/
@ -388,7 +388,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
/**
* Return the showable items.
*
*
* @return the showableTypes
*/
public List<ItemType> getShowableTypes() {
@ -397,7 +397,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
/**
* Set the showable items. The folders items are show as default.
*
*
* @param showableTypes
* the showableTypes to set
*/
@ -412,7 +412,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
public void addWorkspaceExplorerSaveNotificationListener(WorskpaceExplorerSaveNotificationListener handler) {
if(handler!=null)
listeners.add(handler);
}
/* (non-Javadoc)
@ -424,9 +424,9 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
if(listeners.contains(handler))
listeners.remove(handler);
}
}
/**
* Sets the z-index.
*
@ -436,13 +436,13 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
this.zIndex = zIndex;
configureZindex();
}
/**
* Configure zindex.
*/
private void configureZindex() {
if(zIndex>0){
Element el = null;
try{
@ -452,14 +452,14 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
return;
}
el.getStyle().setZIndex(zIndex+20);
//IS MODAL-BACKDROP
if(el.getNextSiblingElement()!=null)
el.getNextSiblingElement().getStyle().setZIndex(zIndex+10);
}
}
/* (non-Javadoc)
* @see com.github.gwtbootstrap.client.ui.Modal#onShown(com.google.gwt.user.client.Event)
*/

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package org.gcube.portlets.widgets.wsexplorer.client.save;
@ -50,7 +50,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
private TextBox fileNamePanelTextBox = new TextBox();
private VerticalPanel mainVP = new VerticalPanel();
private HorizontalPanel footerPanelHP = new HorizontalPanel();
/**
* Instantiates a new workspace explorer save panel.
@ -61,7 +61,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
loadExplorer(fileName);
}
/**
* Instantiates a new workspace explorer save panel.
*
@ -87,7 +87,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
setSelectableTypes(itemsType);
setShowableTypes(itemsType);
}
loadExplorer(fileName);
}
@ -104,10 +104,10 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
itemsType = showableTypes.toArray(itemsType);
setShowableTypes(showableTypes.toArray(itemsType));
}
loadExplorer(fileName);
}
/* (non-Javadoc)
* @see com.google.gwt.user.client.ui.ScrollPanel#onResize()
*/
@ -117,7 +117,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
GWT.log("on Resize...");
adjustSize();
}
/* (non-Javadoc)
* @see com.google.gwt.user.client.ui.Widget#onLoad()
*/
@ -128,7 +128,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
// adjustSize();
adjustSize();
}
private void adjustSize(){
if(this.getParent()!=null && this.getParent().getElement()!=null)
Util.adjustSize(this.getParent().getElement(), controller.getWsExplorer().getPanel(), 120);
@ -140,7 +140,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
* @param fileName the file name
*/
private void loadExplorer(String fileName){
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
controller.getEventBus().fireEvent(new LoadRootEvent());
initPanel(fileName);
}
@ -154,7 +154,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
saveButton.setType(ButtonType.PRIMARY);
setWidth(WorkspaceExplorerConstants.WIDHT_DIALOG+"px");
addStyleName("savePanel");
saveButton.addClickHandler(new ClickHandler() {
@Override
@ -165,7 +165,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
if (item != null && item.isFolder()) {
//GO INTO FOLDER
WorkspaceExplorerController.eventBus.fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(item));
controller.getEventBus().fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(item));
} else {
//VALIDATING FILE NAME
String fileName = getFileName();
@ -174,7 +174,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
fileNamePanelTextBox.setFocus(true);
return;
}
Item itemB = controller.getBreadcrumbs().getLastParent();
if (itemB != null) {
if(itemB.isSpecialFolder()){
@ -188,11 +188,11 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
}
}
});
fileNamePanelTextBox.addStyleName("fileNamePanelTextBox");
fileNamePanelTextBox.setAlignment(TextAlignment.LEFT);
setFileName(fileName);
HTML name = new HTML("Name:");
name.addStyleName("htmlSaveName");
name.getElement().getStyle().setPaddingTop(7.0, Unit.PX);
@ -200,30 +200,30 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
footerPanelHP.add(fileNamePanelTextBox);
footerPanelHP.add(saveButton);
footerPanelHP.addStyleName("footerPanelHP");
mainVP.add(controller.getWorkspaceExplorerPanel());
mainVP.add(footerPanelHP);
add(mainVP);
addHandlers();
}
/**
* Adds the handlers.
*/
private void addHandlers() {
WorkspaceExplorerController.eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
controller.getEventBus().addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
@Override
public void onClick(final ClickItemEvent clickItemEvent) {
Item item = clickItemEvent.getItem();
if(item!=null && !item.isFolder())
setFileName("New_"+item.getName());
}
});
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand () {
public void execute () {
fileNamePanelTextBox.selectAll();
@ -240,11 +240,11 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
private void setFileName(final String txt){
if(txt==null)
return;
fileNamePanelTextBox.setValue(txt);
}
/**
* Gets the file name.
*
@ -293,7 +293,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
/**
* Set which items are selectable.
*
*
* @param selectableTypes
* the selectableTypes to set
*/
@ -312,7 +312,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
/**
* Return the showable items.
*
*
* @return the showableTypes
*/
public List<ItemType> getShowableTypes() {
@ -321,14 +321,14 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
/**
* Set the showable items. The folders items are show as default.
*
*
* @param showableTypes
* the showableTypes to set
*/
private void setShowableTypes(ItemType... showableTypes) {
controller.setShowableTypes(showableTypes);
}
/**
* Gets the save button.
*
@ -345,7 +345,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
public void addWorkspaceExplorerSaveNotificationListener(WorskpaceExplorerSaveNotificationListener handler) {
if(handler!=null)
listeners.add(handler);
}
/* (non-Javadoc)
@ -357,6 +357,6 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
if(listeners.contains(handler))
listeners.remove(handler);
}
}
}

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package org.gcube.portlets.widgets.wsexplorer.client.select;
@ -47,19 +47,19 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
private WorkspaceExplorerController controller;
private List<WorskpaceExplorerSelectNotificationListener> listeners = new ArrayList<WorskpaceExplorerSelectNotificationListener>();
private int zIndex = -1;
/**
* Instantiates a new workspace explorer select dialog.
* You can implement {@link WorskpaceExplorerSelectNotificationListener} to receive events
* @param captionTxt the caption txt
*
*
*/
public WorkspaceExplorerSelectDialog(String captionTxt) {
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
loadExplorer(captionTxt);
}
/**
* Instantiates a new workspace explorer select dialog.
* You can implement {@link WorskpaceExplorerSelectNotificationListener} to receive events
@ -70,7 +70,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.HEIGHT_EXPLORER_PANEL);
loadExplorer(captionTxt);
}
/**
* Instantiates a new workspace explorer select dialog.
* You can implement {@link WorskpaceExplorerSelectNotificationListener} to receive events
@ -106,14 +106,14 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
}
loadExplorer(captionTxt);
}
/**
* Instantiates a new workspace explorer select dialog.
*
* @param captionTxt captionTxt sets the text inside the caption, if null sets "Workspace Explorer"
* @param selectableTypes the selectable types
* @param showableTypes the showable types
*
*
* You can implement {@link WorskpaceExplorerSelectNotificationListener} to receive events
*/
public WorkspaceExplorerSelectDialog(String captionTxt, List<ItemType> selectableTypes, List<ItemType> showableTypes) {
@ -123,16 +123,16 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
itemsType = selectableTypes.toArray(itemsType);
setSelectableTypes(selectableTypes.toArray(itemsType));
}
if(showableTypes!=null){
ItemType[] itemsType = new ItemType[showableTypes.size()];
itemsType = showableTypes.toArray(itemsType);
setShowableTypes(showableTypes.toArray(itemsType));
}
loadExplorer(captionTxt);
}
/**
* Load explorer.
@ -140,17 +140,17 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* @param captionTxt the caption txt
*/
private void loadExplorer(String captionTxt){
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
controller.getEventBus().fireEvent(new LoadRootEvent());
initDialog(captionTxt);
}
/**
* Inits the dialog.
*
* @param captionTxt the caption txt
*/
private void initDialog(String captionTxt) {
this.captionTxt = (captionTxt==null || captionTxt.isEmpty())?WorkspaceExplorerConstants.WORKSPACE_EXPLORER_CAPTION:captionTxt;
this.captionTxt = captionTxt==null || captionTxt.isEmpty()?WorkspaceExplorerConstants.WORKSPACE_EXPLORER_CAPTION:captionTxt;
setAnimation(false);
setCloseVisible(true);
hide(false);
@ -161,7 +161,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
setMaxHeigth(WorkspaceExplorerConstants.MAX_HEIGHT_DIALOG);
addHideHandler(new HideHandler() {
@Override
public void onHide(HideEvent hideEvent) {
if(!isSelect)
@ -192,12 +192,12 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
}
}
});
setAlertConfirm("", false, null);
footer.add(selectButton);
add(footer);
}
/**
* Sets the alert confirm.
*
@ -211,17 +211,17 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
}catch(Exception e){
//silent
}
alertConfirm = new Alert();
alertConfirm.setText(html);
alertConfirm.setVisible(show);
alertConfirm.setClose(true);
alertConfirm.setType(AlertType.INFO);
Button yes = new Button("Yes");
yes.setType(ButtonType.LINK);
yes.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(item!=null){
@ -231,11 +231,11 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
}
}
});
Button no = new Button("No");
no.setType(ButtonType.LINK);
no.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
alertConfirm.close();
@ -251,32 +251,32 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
* @param selected the selected
*/
private void notifySelectedItem(Item selected){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onSelectedItem(selected);
}
}
/**
* Notify aborted.
*/
private void notifyAborted(){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onAborted();
}
}
/**
* Notify not valid selection.
*/
private void notifyNotValidSelection(){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onNotValidSelection();
}
}
/**
* Notify failed.
*
@ -284,12 +284,12 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
*/
@SuppressWarnings("unused")
private void notifyFailed(Throwable t){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onFailed(t);
}
}
/**
* Gets the caption txt.
*
@ -307,7 +307,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
public boolean isValidHide() {
return isSelect;
}
/* (non-Javadoc)
* @see com.github.gwtbootstrap.client.ui.Modal#show()
*/
@ -317,7 +317,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
isSelect = false;
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
*/
@ -337,7 +337,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
listeners.remove(handler);
}
}
/**
* Set which items are selectable.
* @param selectableTypes the selectableTypes to set
@ -345,7 +345,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
private void setSelectableTypes(ItemType ... selectableTypes) {
controller.setSelectableTypes(selectableTypes);
}
/**
* Gets the selectable types.
@ -355,7 +355,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
public List<ItemType> getSelectableTypes() {
return controller.getSelectableTypes();
}
/**
* Return the showable items.
* @return the showableTypes
@ -371,7 +371,7 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
private void setShowableTypes(ItemType ... showableTypes) {
controller.setShowableTypes(showableTypes);
}
/**
* Sets the z-index.
*
@ -381,13 +381,13 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
this.zIndex = zIndex;
configureZindex();
}
/**
* Configure zindex.
*/
private void configureZindex() {
if(zIndex>0){
Element el = null;
try{
@ -397,14 +397,14 @@ public class WorkspaceExplorerSelectDialog extends Modal implements HasWorskpace
return;
}
el.getStyle().setZIndex(zIndex+20);
//IS MODAL-BACKDROP
if(el.getNextSiblingElement()!=null)
el.getNextSiblingElement().getStyle().setZIndex(zIndex+10);
}
}
/* (non-Javadoc)
* @see com.github.gwtbootstrap.client.ui.Modal#onShown(com.google.gwt.user.client.Event)
*/

View File

@ -1,5 +1,5 @@
/**
*
*
*/
package org.gcube.portlets.widgets.wsexplorer.client.select;
@ -53,7 +53,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
private List<WorskpaceExplorerSelectNotificationListener> listeners = new ArrayList<WorskpaceExplorerSelectNotificationListener>();
private VerticalPanel mainVP = new VerticalPanel();
private HorizontalPanel footerHP = new HorizontalPanel();
/**
* Instantiates a new workspace explorer select panel.
*
@ -63,7 +63,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
controller = new WorkspaceExplorerController(WorkspaceExplorerConstants.AUTO);
loadExplorer(captionTxt);
}
/**
* Instantiates a new workspace explorer select panel.
*
@ -74,7 +74,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
controller = new WorkspaceExplorerController(filterCriteria, WorkspaceExplorerConstants.AUTO);
loadExplorer(captionTxt);
}
/**
* Instantiates a new workspace explorer select panel.
@ -109,7 +109,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
}
loadExplorer(captionTxt);
}
/**
* Instantiates a new workspace explorer select panel.
@ -125,23 +125,23 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
itemsType = selectableTypes.toArray(itemsType);
setSelectableTypes(selectableTypes.toArray(itemsType));
}
if(showableTypes!=null){
ItemType[] itemsType = new ItemType[showableTypes.size()];
itemsType = showableTypes.toArray(itemsType);
setShowableTypes(showableTypes.toArray(itemsType));
}
loadExplorer(captionTxt);
}
/**
* Bind events.
*/
private void bindEvents(){
WorkspaceExplorerController.eventBus.addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
controller.getEventBus().addHandler(ClickItemEvent.TYPE, new ClickItemEventHandler() {
@Override
public void onClick(final ClickItemEvent clickItemEvent) {
isSelect = false;
@ -152,52 +152,52 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
notifyNotValidSelection();
return;
}
notifySelectedItem(controller.getWsExplorer().getItemSelected());
isSelect = true;
}
});
WorkspaceExplorerController.eventBus.addHandler(BreadcrumbClickEvent.TYPE, new BreadcrumbClickEventHandler() {
controller.getEventBus().addHandler(BreadcrumbClickEvent.TYPE, new BreadcrumbClickEventHandler() {
@Override
public void onBreadcrumbClick(BreadcrumbClickEvent breadcrumbClickEvent) {
isSelect = false;
Item item = breadcrumbClickEvent.getTargetItem();
GWT.log("BreadcrumbClickEvent: "+item);
//Return if item is not selectable
if(!controller.itemIsSelectable(item)){
notifyNotValidSelection();
return;
}
notifySelectedItem(item);
isSelect = true;
}
});
WorkspaceExplorerController.eventBus.addHandler(RootLoadedEvent.TYPE, new RootLoadedEventHandler() {
controller.getEventBus().addHandler(RootLoadedEvent.TYPE, new RootLoadedEventHandler() {
@Override
public void onRootLoaded(RootLoadedEvent rootLoadedEvent) {
isSelect = false;
if(rootLoadedEvent.getRoot()!=null){
GWT.log("RootLoadedEvent: "+rootLoadedEvent.getRoot());
if(!controller.itemIsSelectable(rootLoadedEvent.getRoot())){
notifyNotValidSelection();
return;
}
notifySelectedItem(rootLoadedEvent.getRoot());
isSelect = true;
}
}
});
WorkspaceExplorerController.eventBus.addHandler(LoadMySpecialFolderEvent.TYPE, new LoadMySpecialFolderEventHandler() {
controller.getEventBus().addHandler(LoadMySpecialFolderEvent.TYPE, new LoadMySpecialFolderEventHandler() {
@Override
public void onLoadMySpecialFolder(LoadMySpecialFolderEvent loadMySpecialFolderEvent) {
isSelect = false;
@ -206,14 +206,14 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
}
});
}
@Override
public void onResize() {
super.onResize();
GWT.log("on Resize...");
adjustSize();
}
/* (non-Javadoc)
* @see com.google.gwt.user.client.ui.Widget#onLoad()
*/
@ -224,12 +224,12 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
// adjustSize();
adjustSize();
}
private void adjustSize(){
if(this.getParent()!=null && this.getParent().getElement()!=null)
Util.adjustSize(this.getParent().getElement(), controller.getWsExplorer().getPanel(), 85);
}
/**
@ -238,7 +238,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
* @param captionTxt the caption txt
*/
private void loadExplorer(String captionTxt){
WorkspaceExplorerController.eventBus.fireEvent(new LoadRootEvent());
controller.getEventBus().fireEvent(new LoadRootEvent());
bindEvents();
initPanel(captionTxt);
}
@ -253,7 +253,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
this.captionTxt = captionTxt;
if(this.captionTxt!=null && !this.captionTxt.isEmpty())
setTitle(this.captionTxt);
setWidth(WorkspaceExplorerConstants.WIDHT_DIALOG+"px");
add(controller.getWorkspaceExplorerPanel());
setAlertConfirm("", false, null);
@ -261,8 +261,8 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
mainVP.add(footerHP);
add(mainVP);
}
/**
* Sets the alert confirm.
*
@ -276,17 +276,17 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
}catch(Exception e){
//silent
}
alertConfirm = new Alert();
alertConfirm.setText(html);
alertConfirm.setVisible(show);
alertConfirm.setClose(true);
alertConfirm.setType(AlertType.INFO);
Button yes = new Button("Yes");
yes.setType(ButtonType.LINK);
yes.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(item!=null){
@ -295,11 +295,11 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
}
}
});
Button no = new Button("No");
no.setType(ButtonType.LINK);
no.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
alertConfirm.close();
@ -315,33 +315,33 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
* @param selected the selected
*/
private void notifySelectedItem(Item selected){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onSelectedItem(selected);
}
}
/**
* Notify aborted.
*/
private void notifyAborted(){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onAborted();
}
}
/**
* Notify not valid selection.
*/
private void notifyNotValidSelection(){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onNotValidSelection();
}
}
/**
* Notify failed.
*
@ -349,12 +349,12 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
*/
@SuppressWarnings("unused")
private void notifyFailed(Throwable t){
for (WorskpaceExplorerSelectNotificationListener worskpaceExplorerNotificationListener : listeners) {
worskpaceExplorerNotificationListener.onFailed(t);
}
}
/**
* Gets the caption txt.
*
@ -372,7 +372,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
public boolean isValidHide() {
return isSelect;
}
/* (non-Javadoc)
* @see org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.HasWorskpaceExplorerNotificationListener#addWorkspaceExplorerNotificationListener(org.gcube.portlets.widgets.wsexplorer.client.notification.WorskpaceExplorerNotification.WorskpaceExplorerNotificationListener)
*/
@ -392,7 +392,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
listeners.remove(handler);
}
}
/**
* Set which items are selectable.
* @param selectableTypes the selectableTypes to set
@ -400,7 +400,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
private void setSelectableTypes(ItemType ... selectableTypes) {
controller.setSelectableTypes(selectableTypes);
}
/**
* Gets the selectable types.
@ -410,7 +410,7 @@ public class WorkspaceExplorerSelectPanel extends ScrollPanel implements HasWors
public List<ItemType> getSelectableTypes() {
return controller.getSelectableTypes();
}
/**
* Return the showable items.
* @return the showableTypes

View File

@ -178,7 +178,7 @@ public class WorkspaceExplorer implements ShowableTypes, SelectableTypes{
// FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,requiredProperties, allowedFileExtensions);
GWT.log("loading workspace folder by item id from server: "+item.getId());
WorkspaceExplorerConstants.workspaceNavigatorService.getFolder(item.getId(), showableTypesParam, purgeEmpyFolders, filterCriteria, new AsyncCallback<Item>() {
WorkspaceExplorerConstants.workspaceNavigatorService.getFolder(item, showableTypesParam, purgeEmpyFolders, filterCriteria, new AsyncCallback<Item>() {
@Override
public void onFailure(Throwable caught) {

View File

@ -103,7 +103,7 @@ public class ItemBuilder {
String itemName = workspaceItem.getName();
if(isSharedFolder){
_log.debug("Is shared folder");
_log.debug("Is shared folder: "+workspaceItem.getName());
WorkspaceSharedFolder shared = (WorkspaceSharedFolder) workspaceItem;
itemName = shared.isVreFolder()?shared.getDisplayName():workspaceItem.getName();
}

View File

@ -28,6 +28,7 @@ import org.gcube.portlets.widgets.wsexplorer.client.rpc.WorkspaceExplorerService
import org.gcube.portlets.widgets.wsexplorer.shared.FilterCriteria;
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;
import org.gcube.portlets.widgets.wsexplorer.shared.WorkspaceNavigatorServiceException;
import org.slf4j.Logger;
@ -153,19 +154,26 @@ public class WorkspaceExplorerServiceImpl extends RemoteServiceServlet implement
* {@inheritDoc}
*/
@Override
public Item getFolder(String folderId, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
_log.trace("getFolder folderId: "+folderId+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
public Item getFolder(ItemInterface item, List<ItemType> showableTypes, boolean purgeEmpyFolders, FilterCriteria filterCriteria) throws WorkspaceNavigatorServiceException {
_log.trace("getFolder folderId: "+item.getId()+" showableTypes: "+showableTypes+" purgeEmpyFolders: "+purgeEmpyFolders+" filterCriteria: "+filterCriteria);
try {
Workspace workspace = getWorkspace();
WorkspaceItem folder = workspace.getItem(folderId);
WorkspaceItem folder = workspace.getItem(item.getId());
Item itemCast = (Item) item;
System.out.println("itemCast" +itemCast);
_log.trace("GetFolder - Replyiing folder");
long startTime = System.currentTimeMillis();
_log.trace("start time - " + startTime);
Item itemFolder = ItemBuilder.getItem(null, folder, folder.getPath(), showableTypes, filterCriteria, true);
//TO AVOID SLOW CALL getPATH()
String folderPath = item.getPath()!=null && !item.getPath().isEmpty()?item.getPath():folder.getPath();
Item itemFolder = ItemBuilder.getItem(null, folder, folderPath, showableTypes, filterCriteria, true);
// _log.trace("Only showable types:");
if (purgeEmpyFolders) {

View File

@ -14,7 +14,7 @@ import com.google.gwt.user.client.rpc.IsSerializable;
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Dec 2, 2015
*/
public class Item implements IsSerializable {
public class Item implements IsSerializable, ItemInterface{
protected Item parent;
protected String id;

View File

@ -0,0 +1,17 @@
/**
*
*/
package org.gcube.portlets.widgets.wsexplorer.shared;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 26, 2016
*/
public interface ItemInterface {
public String getId();
public String getName();
public String getPath();
}