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;
|
||||
|
@ -612,9 +614,9 @@ public class CreateDatasetForm extends Composite{
|
|||
return;
|
||||
|
||||
}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>() {
|
||||
|
||||
|
@ -626,31 +628,31 @@ public class CreateDatasetForm extends Composite{
|
|||
alertOnContinue("Sorry but a product with such title already exists, try to change it", AlertType.WARNING);
|
||||
|
||||
}else{
|
||||
// check what to do
|
||||
if(isWorkspaceRequest){
|
||||
// check what to do
|
||||
if(isWorkspaceRequest){
|
||||
|
||||
// we need to show the page to handle resources one by one from the workspace
|
||||
formFirstStep.setVisible(false);
|
||||
boolean resourcesPresent = receivedBean.getResources() != null && receivedBean.getResources().size() > 0 ? true : false;
|
||||
formSecondStep.setVisible(resourcesPresent);
|
||||
formThirdStep.setVisible(!resourcesPresent);
|
||||
// we need to show the page to handle resources one by one from the workspace
|
||||
formFirstStep.setVisible(false);
|
||||
boolean resourcesPresent = receivedBean.getResources() != null && receivedBean.getResources().size() > 0 ? true : false;
|
||||
formSecondStep.setVisible(resourcesPresent);
|
||||
formThirdStep.setVisible(!resourcesPresent);
|
||||
|
||||
// add the resources to the container panel
|
||||
if(workspaceResourcesContainer.getWidget() == null)
|
||||
workspaceResourcesContainer.add(resourcesTable);
|
||||
// add the resources to the container panel
|
||||
if(workspaceResourcesContainer.getWidget() == null)
|
||||
workspaceResourcesContainer.add(resourcesTable);
|
||||
|
||||
}else{
|
||||
}else{
|
||||
|
||||
// this is not a workspace request
|
||||
formFirstStep.setVisible(false);
|
||||
formThirdStep.setVisible(true);
|
||||
// this is not a workspace request
|
||||
formFirstStep.setVisible(false);
|
||||
formThirdStep.setVisible(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(metadataProfilesFormatListbox.getSelectedItemText().equals("none"))
|
||||
selectedProfile.setText("");
|
||||
else
|
||||
selectedProfile.setText("Selected Profile is " + metadataProfilesFormatListbox.getSelectedItemText());
|
||||
if(metadataProfilesFormatListbox.getSelectedItemText().equals("none"))
|
||||
selectedProfile.setText("");
|
||||
else
|
||||
selectedProfile.setText("Selected Profile is " + metadataProfilesFormatListbox.getSelectedItemText());
|
||||
|
||||
}
|
||||
|
||||
|
@ -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,18 +1058,19 @@ public class CreateDatasetForm extends Composite{
|
|||
createButton.setEnabled(true);
|
||||
goBackButtonSecondStep.setEnabled(true);
|
||||
|
||||
// hide after some seconds
|
||||
Timer t = new Timer() {
|
||||
if(hideAfterAWhile){
|
||||
// hide after some seconds
|
||||
Timer t = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
onCreateAlertBlock.setVisible(false);
|
||||
onCreateAlertBlock.setVisible(false);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
t.schedule(10000);
|
||||
}
|
||||
};
|
||||
t.schedule(10000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue