diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java
index 2a93b3f..de4d2c8 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.java
@@ -40,6 +40,7 @@ import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.base.ListItem;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
+import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
import com.github.gwtbootstrap.client.ui.resources.Bootstrap.Tabs;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
@@ -159,6 +160,10 @@ public class CreateDatasetForm extends Composite{
@UiField FocusPanel focusPanelResources;
@UiField Popover popoverResources;
@UiField ControlGroup metadataProfilesControlGroup;
+ @UiField ControlGroup productTitleGroup;
+ @UiField ControlGroup maintainerControlGroup;
+ @UiField ControlGroup versionControlGroup;
+ @UiField ControlGroup organizationsGroup;
// error message
protected static final String ERROR_PRODUCT_CREATION = "There was an error while trying to publish your product, sorry.. Retry later";
@@ -966,9 +971,12 @@ public class CreateDatasetForm extends Composite{
private String areProfileDataValid() {
for (MetaDataFieldSkeleton field : listOfMetadataFields) {
+
+ field.removeError();
String error = field.isFieldValueValid();
if(error != null){
+ field.showError();
return field.getFieldName() + " is not valid. Suggestion: " + error;
}
}
@@ -1037,9 +1045,17 @@ public class CreateDatasetForm extends Composite{
private String validateDataOnContinue() {
String errorMessage = null;
+
+ // remove errors
+ productTitleGroup.setType(ControlGroupType.NONE);
+ maintainerControlGroup.setType(ControlGroupType.NONE);
+ versionControlGroup.setType(ControlGroupType.NONE);
+ metadataProfilesControlGroup.setType(ControlGroupType.NONE);
+ organizationsGroup.setType(ControlGroupType.NONE);
if(titleTextBox.getText().isEmpty()){
errorMessage = "Missing title";
+ productTitleGroup.setType(ControlGroupType.ERROR);
return errorMessage;
}
@@ -1049,8 +1065,10 @@ public class CreateDatasetForm extends Composite{
for (String word : splittedTitle) {
- if(!word.matches(regexTitleSubWord))
+ if(!word.matches(regexTitleSubWord)){
+ productTitleGroup.setType(ControlGroupType.ERROR);
return "Please note that only alphanumeric characters are allowed for the title";
+ }
}
@@ -1058,6 +1076,7 @@ public class CreateDatasetForm extends Composite{
String regexMail = "\\b[\\w.%-]+@[-.\\w]+\\.[A-Za-z]{2,4}\\b";
if(!validateByRegExpression(maintainerEmailTextbox.getText(), regexMail)){
errorMessage = "Not valid maintainer email";
+ maintainerControlGroup.setType(ControlGroupType.ERROR);
return errorMessage;
}
@@ -1065,15 +1084,18 @@ public class CreateDatasetForm extends Composite{
try{
Integer.valueOf(versionTextbox.getText());
}catch(Exception e){
+ versionControlGroup.setType(ControlGroupType.ERROR);
return errorMessage = "Version must be a natural number";
}
// check if metadata profile is different from none and its mandatory fields have been fulfilled
if(checkSelectedMetaDataProfile()){
errorMessage = "You must select a metadata profile different frome none";
+ metadataProfilesControlGroup.setType(ControlGroupType.ERROR);
}
if(organizationsListbox.getSelectedItemText() == null){
+ organizationsGroup.setType(ControlGroupType.ERROR);
errorMessage = "You must select an organization in which you want to publish";
}
diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.ui.xml
index c687fa7..18b1307 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.ui.xml
+++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/CreateDatasetForm.ui.xml
@@ -55,7 +55,7 @@
-
+
*
Title :
@@ -151,7 +151,7 @@
-
+
Publish in:
@@ -162,7 +162,7 @@
-
+
Version:
@@ -193,7 +193,7 @@
-
+
*
Author Email:
@@ -232,7 +232,7 @@
-
+
Maintainer Email:
diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.java
index 8fbc215..5ef0f46 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.java
@@ -10,6 +10,7 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.MetadataFieldWr
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
+import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.ControlLabel;
import com.github.gwtbootstrap.client.ui.Controls;
import com.github.gwtbootstrap.client.ui.Icon;
@@ -17,6 +18,7 @@ import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.Popover;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.github.gwtbootstrap.client.ui.TextBox;
+import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.datetimepicker.client.ui.DateTimeBox;
import com.google.gwt.core.client.GWT;
@@ -61,6 +63,7 @@ public class MetaDataFieldSkeleton extends Composite{
@UiField Controls controls;
@UiField Icon infoIcon;
@UiField FocusPanel focusPanelIconContainer;
+ @UiField ControlGroup metafieldControlGroup;
private static final String REGEX_IS_NUMBER = "[0-9]+[.]?[0-9]+";
@@ -848,4 +851,16 @@ public class MetaDataFieldSkeleton extends Composite{
return field;
}
+ public void removeError() {
+
+ metafieldControlGroup.setType(ControlGroupType.NONE);
+
+ }
+
+ public void showError() {
+
+ metafieldControlGroup.setType(ControlGroupType.ERROR);
+
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.ui.xml
index 6458c26..0a06b68 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.ui.xml
+++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/MetaDataFieldSkeleton.ui.xml
@@ -23,7 +23,7 @@
}
-
+
*
diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/Utils.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/Utils.java
index e75af48..9769e12 100644
--- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/Utils.java
+++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/Utils.java
@@ -348,7 +348,7 @@ public class Utils {
for(MetadataField metadataField: toWrap){
MetadataFieldWrapper wrapperObj = new MetadataFieldWrapper();
- wrapperObj.setDefaultValue(metadataField.getDefaulValue());
+ wrapperObj.setDefaultValue(metadataField.getDefaultValue());
wrapperObj.setFieldName(metadataField.getFieldName());
wrapperObj.setType(DataType.valueOf(metadataField.getDataType().toString()));
wrapperObj.setMandatory(metadataField.getMandatory());