minor fixes for messages to show just before/after product creation
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@131784 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
175d431b33
commit
96cbd47120
|
@ -166,8 +166,10 @@ public class CreateDatasetForm extends Composite{
|
|||
private static final String REGEX_TITLE_PRODUCT_SUBWORD = "[^a-zA-Z0-9_.-]";
|
||||
private static final String REGEX_MAIL = "\\b[\\w.%-]+@[-.\\w]+\\.[A-Za-z]{2,4}\\b";
|
||||
|
||||
// error message
|
||||
// error/info messages
|
||||
protected static final String ERROR_PRODUCT_CREATION = "There was an error while trying to publish your product, sorry.. Retry later";
|
||||
protected static final String PRODUCT_CREATED_OK = "Product correctly created!";
|
||||
private static final String TRYING_TO_CREATE_PRODUCT = "Trying to create product, please wait";
|
||||
|
||||
// tab panel
|
||||
private TabPanel tabPanel;
|
||||
|
@ -711,7 +713,7 @@ public class CreateDatasetForm extends Composite{
|
|||
|
||||
if(errorMessage != null){
|
||||
|
||||
alertOnCreate("Please check the inserted values and the mandatory fields [" + errorMessage +"]", AlertType.ERROR);
|
||||
alertOnCreate("Please check the inserted values and the mandatory fields [" + errorMessage +"]", AlertType.ERROR, true);
|
||||
|
||||
}
|
||||
else{
|
||||
|
@ -777,7 +779,7 @@ public class CreateDatasetForm extends Composite{
|
|||
receivedBean.setCustomFields(customFieldsMap);
|
||||
|
||||
// alert
|
||||
alertOnCreate("Trying to create product, please wait", AlertType.INFO);
|
||||
alertOnCreate(TRYING_TO_CREATE_PRODUCT, AlertType.INFO, false);
|
||||
|
||||
// invoke the create method
|
||||
createButton.setEnabled(false);
|
||||
|
@ -790,7 +792,7 @@ public class CreateDatasetForm extends Composite{
|
|||
|
||||
if(createdDatasetBean != null){
|
||||
|
||||
alertOnCreate("Product correctly created!", AlertType.SUCCESS);
|
||||
alertOnCreate(PRODUCT_CREATED_OK, AlertType.SUCCESS, false);
|
||||
|
||||
// disable dataset fields
|
||||
disableDatasetFields();
|
||||
|
@ -810,9 +812,7 @@ public class CreateDatasetForm extends Composite{
|
|||
});
|
||||
|
||||
// if we are in the "general case" we need to show a form for adding resources
|
||||
if(isWorkspaceRequest)
|
||||
{
|
||||
|
||||
if(isWorkspaceRequest){
|
||||
// leave to back button, but remove create and add go to dataset
|
||||
createButton.removeFromParent();
|
||||
|
||||
|
@ -869,14 +869,14 @@ public class CreateDatasetForm extends Composite{
|
|||
}
|
||||
|
||||
}else{
|
||||
alertOnCreate(ERROR_PRODUCT_CREATION, AlertType.ERROR);
|
||||
alertOnCreate(ERROR_PRODUCT_CREATION, AlertType.ERROR, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
alertOnCreate(ERROR_PRODUCT_CREATION, AlertType.ERROR);
|
||||
alertOnCreate(ERROR_PRODUCT_CREATION, AlertType.ERROR, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1050,7 +1050,7 @@ public class CreateDatasetForm extends Composite{
|
|||
* @param text
|
||||
* @param type
|
||||
*/
|
||||
private void alertOnCreate(String text, AlertType type){
|
||||
private void alertOnCreate(String text, AlertType type, boolean hideAfterAWhile){
|
||||
|
||||
onCreateAlertBlock.setText(text);
|
||||
onCreateAlertBlock.setType(type);
|
||||
|
@ -1058,6 +1058,7 @@ public class CreateDatasetForm extends Composite{
|
|||
createButton.setEnabled(true);
|
||||
goBackButtonSecondStep.setEnabled(true);
|
||||
|
||||
if(hideAfterAWhile){
|
||||
// hide after some seconds
|
||||
Timer t = new Timer() {
|
||||
|
||||
|
@ -1068,9 +1069,9 @@ public class CreateDatasetForm extends Composite{
|
|||
|
||||
}
|
||||
};
|
||||
|
||||
t.schedule(10000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate data
|
||||
|
|
Loading…
Reference in New Issue