From 97339098199018bca8020efb424baa0e7dd52430 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 9 Mar 2018 11:46:50 +0000 Subject: [PATCH] Updated Create Configuration Form git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/ws-thredds-sync-widget@164873 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../view/WsThreddsWidgetViewManager.java | 6 +- .../CreateThreddsConfigurationView.java | 55 +++++++++---------- .../CreateThreddsConfigurationView.ui.xml | 34 ++++++------ 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java index f6de943..181aa2d 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/WsThreddsWidgetViewManager.java @@ -245,7 +245,9 @@ public class WsThreddsWidgetViewManager { conf.setFilter(null); ThCatalogueBean catalogueSelected = getSelectedCatalogue(); - conf.setRemotePath(catalogueSelected.getPath()); + String remotePath = catalogueSelected.getPath()!=null?catalogueSelected.getPath():""; + remotePath = remotePath.isEmpty()?getFolderName():remotePath+"/"+getFolderName(); + conf.setRemotePath(remotePath); conf.setCatalogName(catalogueSelected.getName()); conf.setTheVRE(getSelectedVRE()); WsThreddsWidget.eventBus.fireEvent(new PerformDoSyncEvent(folder, conf)); @@ -343,7 +345,7 @@ public class WsThreddsWidgetViewManager { if(isCreateConfiguration) { folderInfo.getMainPanel().setVisible(false); - folderInfo.setError(true, "This Folder is not sychronized. Do you want create a configuration?"); + folderInfo.setError(true, "This Folder is not configured. Do you want create a configuration?"); folderInfo.getPager().getLeft().setText("Create Configuration"); }else { //USER CAN PERFORM DO SYNC diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java index 5f88132..20ce4c1 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.java @@ -216,6 +216,8 @@ public abstract class CreateThreddsConfigurationView extends Composite { @Override public void onClick(ClickEvent event) { + cg_catalogue_name.setType(ControlGroupType.NONE); + setError(false, ""); if (field_catalogue_name.getValue() == null || field_catalogue_name.getValue().isEmpty()) { cg_catalogue_name.setType(ControlGroupType.ERROR); @@ -223,17 +225,7 @@ public abstract class CreateThreddsConfigurationView extends Composite { return; } - if(field_folder_name.getValue() == null || field_folder_name.getValue().isEmpty()){ - cg_folder_name.setType(ControlGroupType.ERROR); - setError(true, "The Folder Name is required"); - return; - }else if(field_folder_name.getValue().startsWith("/")){ - cg_folder_name.setType(ControlGroupType.ERROR); - setError(true, "Folder Name must be a relative URL. It does not start with '/'"); - return; - } - - addCatalogueNameForCurrentScope(field_catalogue_name.getValue(), field_folder_name.getValue()); + addCatalogueNameForCurrentScope(field_catalogue_name.getValue()); fieldset_add_catalogue_bean.setVisible(false); initFieldCatalogueName(); } @@ -279,7 +271,7 @@ public abstract class CreateThreddsConfigurationView extends Composite { * @param catalogueName the catalogue name * @param folderName the folder name. Can be a relative Path */ - private void addCatalogueNameForCurrentScope(String catalogueName, String folderName) { + private void addCatalogueNameForCurrentScope(String catalogueName) { List listCtlgs = mapCatalogueNames.get(currentScope); @@ -287,7 +279,7 @@ public abstract class CreateThreddsConfigurationView extends Composite { listCtlgs = new ArrayList(); } - listCtlgs.add(new ThCatalogueBean(catalogueName, folderName, true)); + listCtlgs.add(new ThCatalogueBean(catalogueName, null, true)); fillSelectableCatalogueNames(currentScope, listCtlgs); } @@ -344,29 +336,24 @@ public abstract class CreateThreddsConfigurationView extends Composite { */ protected boolean validateSubmit() { cg_catalogue_name.setType(ControlGroupType.NONE); + cg_folder_name.setType(ControlGroupType.NONE); //cg_remote_path.setType(ControlGroupType.NONE); -// if(field_catalogue_name.getValue()==null || field_catalogue_name.getValue().isEmpty()){ -// cg_catalogue_name.setType(ControlGroupType.ERROR); -// setError(true, "Catalogue Name is required"); -// return false; -// } - if(field_select_catalogue_name.getSelectedItemText()==null){ cg_catalogue_name.setType(ControlGroupType.ERROR); - setError(true, "Select a Catalogue Name!!!"); + setError(true, "You must select a Catalogue!!!"); return false; } -// if(field_remote_path.getValue()==null || field_remote_path.getValue().isEmpty()){ -// cg_remote_path.setType(ControlGroupType.ERROR); -// setError(true, "Remote Path field is required"); -// return false; -// }else if(field_remote_path.getValue().startsWith("/")){ -// cg_remote_path.setType(ControlGroupType.ERROR); -// setError(true, "Remote Path must be a relative URL. It does not start with '/'"); -// return false; -// } + if(field_folder_name.getValue() == null || field_folder_name.getValue().isEmpty()){ + cg_folder_name.setType(ControlGroupType.ERROR); + setError(true, "The Catalogue Entry is required"); + return false; + }else if(field_folder_name.getValue().startsWith("/")){ + cg_folder_name.setType(ControlGroupType.ERROR); + setError(true, "The Catalogue Entry must be a relative URL. It does not start with '/'"); + return false; + } return true; } @@ -391,6 +378,16 @@ public abstract class CreateThreddsConfigurationView extends Composite { } + /** + * Gets the folder name. + * + * @return the folder name + */ + public String getFolderName(){ + return field_folder_name.getValue(); + } + + /** * Gets the catalogue name. * diff --git a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml index ba46fc8..6909cb2 100644 --- a/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/wsthreddssync/client/view/binder/CreateThreddsConfigurationView.ui.xml @@ -21,7 +21,7 @@ - Select Catalogue Name + Publish in the Catalogue @@ -29,28 +29,30 @@ + + As Catalogue Entry + + + + + + - + Catalogue Name - + + + Add Catalogue + - - - Folder Name - - - - - - Add Catalogue -