addded license info icon, improved suggestions on error form

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@130402 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-14 14:47:17 +00:00
parent d0623da531
commit 624199e9aa
4 changed files with 39 additions and 14 deletions

View File

@ -130,6 +130,9 @@ public class CreateDatasetForm extends Composite{
@UiField Icon infoIconTags;
@UiField FocusPanel focusPanelTags;
@UiField Popover popoverTags;
@UiField Icon infoIconLicenses;
@UiField FocusPanel focusPanelLicenses;
@UiField Popover popoverLicenses;
@UiField Icon infoIconVisibility;
@UiField FocusPanel focusPanelVisibility;
@UiField Popover popoverVisibility;
@ -808,6 +811,16 @@ public class CreateDatasetForm extends Composite{
popoverTags,
focusPanelTags
);
// licenses
preparePopupPanelAndPopover(
InfoIconsLabels.LICENSES_INFO_ID_POPUP,
InfoIconsLabels.LICENSES_INFO_TEXT,
InfoIconsLabels.LICENSES_INFO_CAPTION,
infoIconLicenses,
popoverLicenses,
focusPanelLicenses
);
// visibility
preparePopupPanelAndPopover(
@ -899,8 +912,10 @@ public class CreateDatasetForm extends Composite{
for (MetaDataFieldSkeleton field : listOfMetadataFields) {
if(!field.isFieldValueValid())
return field.getFieldName() + " is not valid";
String error = field.isFieldValueValid();
if(error != null){
return field.getFieldName() + " is not valid. Suggestion: " + error;
}
}
return null;
@ -957,7 +972,7 @@ public class CreateDatasetForm extends Composite{
}
};
t.schedule(4000);
t.schedule(10000);
}
/**

View File

@ -109,6 +109,14 @@
<b:ListBox b:id="licenses" title="Product license"
width="91%" ui:field="licenseListbox">
</b:ListBox>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverLicenses" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelLicenses">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconLicenses" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>

View File

@ -213,32 +213,29 @@ public class MetaDataFieldSkeleton extends Composite{
/**
* Check if this field has a valid values
* @return
* @return a string with the occurred error on error, null otherwise
*/
public boolean isFieldValueValid(){
GWT.log("Validator is " + field.getValidator());
GWT.log("Is mandatory? " + field.getMandatory());
public String isFieldValueValid(){
if(field.getMandatory()){
if(holder.getClass().equals(TextBox.class)){
if(!getFieldCurrentValue().isEmpty())
if(field.getValidator() == null || field.getValidator().isEmpty())
return true;
else return checkValidator(holder, field);
return null;
else return checkValidator(holder, field) ? null : " the inserted value has a wrong format";
else
return false;
return " a mandatory attribute cannot be empty";
}else
return true;
return null;
}else{
if(holder.getClass().equals(TextBox.class) && getFieldCurrentValue().isEmpty())
return true;
return null;
return checkValidator(holder, field);
return checkValidator(holder, field) ? null : " please select a different value for this field";
}
}

View File

@ -13,6 +13,11 @@ public class InfoIconsLabels {
+ "product and by means of them it can be retrieved. A tag can contain only alphanumeric characters. "
+ "If the tag is composed by a single word it must have a size of at least two characters."
+ "Examples of good tags: \"This is a sample tag\", \"tagY\". Example of bad tag: \"c\".";
// LICENSES
public static final String LICENSES_INFO_ID_POPUP = "licenses-popup-panel-info";
public static final String LICENSES_INFO_CAPTION = "Licenses";
public static final String LICENSES_INFO_TEXT = "License definitions and additional information can be found at <a href=\"http://opendefinition.org/licenses/\" target=\"_blank\">opendefinition.org</a>";
// VISIBILITY
public static final String VISIBILITY_INFO_ID_POPUP = "visibility-popup-panel-info";