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
This commit is contained in:
Francesco Mangiacrapa 2018-03-09 11:46:50 +00:00
parent f1f1b11294
commit 9733909819
3 changed files with 48 additions and 47 deletions

View File

@ -245,7 +245,9 @@ public class WsThreddsWidgetViewManager {
conf.setFilter(null); conf.setFilter(null);
ThCatalogueBean catalogueSelected = getSelectedCatalogue(); 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.setCatalogName(catalogueSelected.getName());
conf.setTheVRE(getSelectedVRE()); conf.setTheVRE(getSelectedVRE());
WsThreddsWidget.eventBus.fireEvent(new PerformDoSyncEvent(folder, conf)); WsThreddsWidget.eventBus.fireEvent(new PerformDoSyncEvent(folder, conf));
@ -343,7 +345,7 @@ public class WsThreddsWidgetViewManager {
if(isCreateConfiguration) { if(isCreateConfiguration) {
folderInfo.getMainPanel().setVisible(false); 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"); folderInfo.getPager().getLeft().setText("Create Configuration");
}else { }else {
//USER CAN PERFORM DO SYNC //USER CAN PERFORM DO SYNC

View File

@ -216,6 +216,8 @@ public abstract class CreateThreddsConfigurationView extends Composite {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
cg_catalogue_name.setType(ControlGroupType.NONE);
setError(false, "");
if (field_catalogue_name.getValue() == null || field_catalogue_name.getValue().isEmpty()) { if (field_catalogue_name.getValue() == null || field_catalogue_name.getValue().isEmpty()) {
cg_catalogue_name.setType(ControlGroupType.ERROR); cg_catalogue_name.setType(ControlGroupType.ERROR);
@ -223,17 +225,7 @@ public abstract class CreateThreddsConfigurationView extends Composite {
return; return;
} }
if(field_folder_name.getValue() == null || field_folder_name.getValue().isEmpty()){ addCatalogueNameForCurrentScope(field_catalogue_name.getValue());
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());
fieldset_add_catalogue_bean.setVisible(false); fieldset_add_catalogue_bean.setVisible(false);
initFieldCatalogueName(); initFieldCatalogueName();
} }
@ -279,7 +271,7 @@ public abstract class CreateThreddsConfigurationView extends Composite {
* @param catalogueName the catalogue name * @param catalogueName the catalogue name
* @param folderName the folder name. Can be a relative Path * @param folderName the folder name. Can be a relative Path
*/ */
private void addCatalogueNameForCurrentScope(String catalogueName, String folderName) { private void addCatalogueNameForCurrentScope(String catalogueName) {
List<ThCatalogueBean> listCtlgs = mapCatalogueNames.get(currentScope); List<ThCatalogueBean> listCtlgs = mapCatalogueNames.get(currentScope);
@ -287,7 +279,7 @@ public abstract class CreateThreddsConfigurationView extends Composite {
listCtlgs = new ArrayList<ThCatalogueBean>(); listCtlgs = new ArrayList<ThCatalogueBean>();
} }
listCtlgs.add(new ThCatalogueBean(catalogueName, folderName, true)); listCtlgs.add(new ThCatalogueBean(catalogueName, null, true));
fillSelectableCatalogueNames(currentScope, listCtlgs); fillSelectableCatalogueNames(currentScope, listCtlgs);
} }
@ -344,29 +336,24 @@ public abstract class CreateThreddsConfigurationView extends Composite {
*/ */
protected boolean validateSubmit() { protected boolean validateSubmit() {
cg_catalogue_name.setType(ControlGroupType.NONE); cg_catalogue_name.setType(ControlGroupType.NONE);
cg_folder_name.setType(ControlGroupType.NONE);
//cg_remote_path.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){ if(field_select_catalogue_name.getSelectedItemText()==null){
cg_catalogue_name.setType(ControlGroupType.ERROR); cg_catalogue_name.setType(ControlGroupType.ERROR);
setError(true, "Select a Catalogue Name!!!"); setError(true, "You must select a Catalogue!!!");
return false; return false;
} }
// if(field_remote_path.getValue()==null || field_remote_path.getValue().isEmpty()){ if(field_folder_name.getValue() == null || field_folder_name.getValue().isEmpty()){
// cg_remote_path.setType(ControlGroupType.ERROR); cg_folder_name.setType(ControlGroupType.ERROR);
// setError(true, "Remote Path field is required"); setError(true, "The Catalogue Entry is required");
// return false; return false;
// }else if(field_remote_path.getValue().startsWith("/")){ }else if(field_folder_name.getValue().startsWith("/")){
// cg_remote_path.setType(ControlGroupType.ERROR); cg_folder_name.setType(ControlGroupType.ERROR);
// setError(true, "Remote Path must be a relative URL. It does not start with '/'"); setError(true, "The Catalogue Entry must be a relative URL. It does not start with '/'");
// return false; return false;
// } }
return true; 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. * Gets the catalogue name.
* *

View File

@ -21,7 +21,7 @@
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup ui:field="cg_select_catalogue_name"> <b:ControlGroup ui:field="cg_select_catalogue_name">
<b:ControlLabel for="cl_select_catalogue_name">Select Catalogue Name</b:ControlLabel> <b:ControlLabel for="cl_select_catalogue_name">Publish in the Catalogue</b:ControlLabel>
<b:Controls> <b:Controls>
<b:ListBox name="Select a Catalogue Name..." b:id="field_select_catalogue_name" <b:ListBox name="Select a Catalogue Name..." b:id="field_select_catalogue_name"
ui:field="field_select_catalogue_name"> ui:field="field_select_catalogue_name">
@ -29,28 +29,30 @@
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup ui:field="cg_folder_name">
<b:ControlLabel for="cl_folder_name">As Catalogue Entry</b:ControlLabel>
<b:Controls>
<b:TextBox placeholder="Type the Catalogue Entry..."
title="This is the Catalogue Entry" b:id="field_folder_name"
ui:field="field_folder_name"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:Button ui:field="butt_create_new_catalogue" text="Create New Catalogue" <b:Button ui:field="butt_create_new_catalogue" text="Create New Catalogue"
type="LINK"></b:Button> type="LINK"></b:Button>
<b:Fieldset ui:field="fieldset_add_catalogue_bean" visible="false"> <b:Fieldset ui:field="fieldset_add_catalogue_bean"
visible="false">
<b:ControlGroup ui:field="cg_catalogue_name"> <b:ControlGroup ui:field="cg_catalogue_name">
<b:ControlLabel for="cl_catalogue_name">Catalogue Name</b:ControlLabel> <b:ControlLabel for="cl_catalogue_name">Catalogue Name</b:ControlLabel>
<b:Controls> <b:Controls>
<b:TextBox placeholder="Type the Catalogue Name..." <b:InputAddOn>
b:id="field_catalogue_name" ui:field="field_catalogue_name"></b:TextBox> <b:TextBox placeholder="Type the Catalogue Name..."
b:id="field_catalogue_name" ui:field="field_catalogue_name"></b:TextBox>
<b:Button ui:field="butt_add_catalogue">Add Catalogue</b:Button>
</b:InputAddOn>
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<b:ControlGroup ui:field="cg_folder_name">
<b:ControlLabel for="cl_folder_name">Folder Name</b:ControlLabel>
<b:Controls>
<b:TextBox placeholder="Type the Folder Name..."
title="This is the Folder Name" b:id="field_folder_name"
ui:field="field_folder_name"></b:TextBox>
</b:Controls>
</b:ControlGroup>
<b:Button ui:field="butt_add_catalogue">Add Catalogue</b:Button>
</b:Fieldset> </b:Fieldset>
</b:Fieldset> </b:Fieldset>
</b:Form> </b:Form>