minor fix for actions allowed after product creation

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@132575 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-10-04 12:58:26 +00:00
parent adfc7a1e77
commit 169974e09b
2 changed files with 73 additions and 48 deletions

View File

@ -608,9 +608,12 @@ public class CreateDatasetForm extends Composite{
}else{
// better check for title (only if the dataset was not created.. if it is the case, fields are not frozen)
if(!titleTextBox.isEnabled())
actionsAfterOnContinue();
else{
alertOnContinue("Checking if a product with such title already exists, please wait...", AlertType.INFO);
// better check for title
ckanServices.datasetIdAlreadyExists(titleTextBox.getText(), new AsyncCallback<Boolean>() {
@Override
@ -621,6 +624,28 @@ public class CreateDatasetForm extends Composite{
alertOnContinue("Sorry but a product with such title already exists, try to change it", AlertType.WARNING);
}else{
actionsAfterOnContinue();
}
}
@Override
public void onFailure(Throwable caught) {
alertOnContinue("Sorry but there was a problem while checking if the inserted data are correct", AlertType.ERROR);
}
});
}
}
}
/**
* After onContinue ...
*/
private void actionsAfterOnContinue(){
// check what to do
if(isWorkspaceRequest){
@ -649,18 +674,6 @@ public class CreateDatasetForm extends Composite{
}
}
@Override
public void onFailure(Throwable caught) {
alertOnContinue("Sorry but there was a problem while checking if the inserted data are correct", AlertType.ERROR);
}
});
}
}
@UiHandler("goBackButtonFirstStep")
void onGoBackButtonFirstStep(ClickEvent e){
@ -850,7 +863,6 @@ public class CreateDatasetForm extends Composite{
// add tabs to resources panel
tabPanel.selectTab(0);
// form container
AddResourceContainer container = new AddResourceContainer(datasetUrl);
container.add(tabPanel);
@ -1173,6 +1185,10 @@ public class CreateDatasetForm extends Composite{
licenseListbox.setEnabled(false);
organizationsListbox.setEnabled(false);
addCustomFieldButton.setEnabled(false);
metadataProfilesFormatListbox.setEnabled(false);
for(CustomFieldEntry ce: customFieldEntriesList)
ce.freeze();
// disable profile fields
for (MetaDataFieldSkeleton field : listOfMetadataFields) {

View File

@ -95,4 +95,13 @@ public class CustomFieldEntry extends Composite {
}
/**
* Remove delete button
*/
public void freeze() {
removeCustomField.setEnabled(false);
}
}