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
pull/1/head
Francesco Mangiacrapa 6 years ago
parent f1f1b11294
commit 9733909819

@ -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

@ -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<ThCatalogueBean> listCtlgs = mapCatalogueNames.get(currentScope);
@ -287,7 +279,7 @@ public abstract class CreateThreddsConfigurationView extends Composite {
listCtlgs = new ArrayList<ThCatalogueBean>();
}
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.
*

@ -21,7 +21,7 @@
</b:ControlGroup>
<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:ListBox name="Select a Catalogue Name..." b:id="field_select_catalogue_name"
ui:field="field_select_catalogue_name">
@ -29,28 +29,30 @@
</b:Controls>
</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"
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:ControlLabel for="cl_catalogue_name">Catalogue Name</b:ControlLabel>
<b:Controls>
<b:TextBox placeholder="Type the Catalogue Name..."
b:id="field_catalogue_name" ui:field="field_catalogue_name"></b:TextBox>
<b:InputAddOn>
<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: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:Form>

Loading…
Cancel
Save