2903: Workspace Explorer: save dialog bug if a folder is selected

Task-Url: https://support.d4science.org/issues/2903

Fixed bug

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-explorer@126052 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-03-22 15:40:09 +00:00
parent e36f4ad145
commit 9f6cf6c0d6
3 changed files with 33 additions and 3 deletions

View File

@ -46,6 +46,7 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
private boolean isSave = false;
private String captionTxt;
private ModalFooter footer = new ModalFooter();
private WorkspaceExplorerSaveDialog INSTANCE = this;
private WorkspaceExplorerController controller;
private List<WorskpaceExplorerSaveNotificationListener> listeners = new ArrayList<WorskpaceExplorerSaveNotificationListener>();
private TextBox fileNameTextBox = new TextBox();
@ -196,9 +197,22 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
Item item = controller.getWsExplorer().getItemSelected();
//A FOLDER IS SELECTED
if (item != null && item.isFolder()) {
GWT.log("folder selected: "+item.getName());
//GO INTO FOLDER
controller.getEventBus().fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(item));
// controller.getEventBus().fireEvent(new org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent(item));
//VALIDATING FILE NAME
String fileName = getFileName();
if(fileName==null || fileName.isEmpty()){
Window.alert("You must insert a valid file name!! It cannot be empty!!");
fileNameTextBox.setFocus(true);
return;
}
notifySaving(item, getFileName());
INSTANCE.hide();
} else {
//VALIDATING FILE NAME
String fileName = getFileName();
@ -209,12 +223,14 @@ public class WorkspaceExplorerSaveDialog extends Modal implements HasWorskpaceEx
}
Item itemB = controller.getBreadcrumbs().getLastParent();
GWT.log("last parent: "+itemB);
if (itemB != null) {
if(itemB.isSpecialFolder()){
Window.alert("Destination folder "+WorkspaceExplorerConstants.WORKSPACE_MY_SPECIAL_FOLDERS_PATH+" is not valid!");
return;
}
notifySaving(itemB, getFileName());
INSTANCE.hide();
isSave = true;
}else
Window.alert("Parent item is null!!");

View File

@ -164,8 +164,19 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
Item item = controller.getWsExplorer().getItemSelected();
if (item != null && item.isFolder()) {
//VALIDATING FILE NAME
String fileName = getFileName();
if(fileName==null || fileName.isEmpty()){
Window.alert("You must insert a valid file name!! It cannot be empty!!");
fileNamePanelTextBox.setFocus(true);
return;
}
notifySaving(item, getFileName());
//GO INTO FOLDER
controller.getEventBus().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();
@ -176,6 +187,7 @@ public class WorkspaceExplorerSavePanel extends ScrollPanel implements HasWorskp
}
Item itemB = controller.getBreadcrumbs().getLastParent();
GWT.log("last parent: "+itemB);
if (itemB != null) {
if(itemB.isSpecialFolder()){
Window.alert("Destination folder "+WorkspaceExplorerConstants.WORKSPACE_MY_SPECIAL_FOLDERS_PATH+" is not valid!");

View File

@ -156,8 +156,10 @@ public abstract class AbstractItemsCellTable {
*/
public void updateItems(List<Item> items, boolean removeOldItems) {
if(removeOldItems)
if(removeOldItems){
dataProvider.getList().clear();
ssm.clear();
}
dataProvider.getList().addAll(items);
dataProvider.flush();