merged with bug fixes releaed in v1.6.2

This commit is contained in:
Francesco Mangiacrapa 2021-02-11 11:09:41 +01:00
parent 7442e8a671
commit 1395dd63eb
2 changed files with 36 additions and 14 deletions

View File

@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.6.2] - 2021-02-08
**Bug Fixes**
[#20446] Catalogue Publishing Widget: field value unexpectedly added in case of optional field
[#20663] Fixing Time_Interval placeholder
## [v1.6.1] [r4.24.0] - 2020-06-18
**New Features**

View File

@ -309,11 +309,12 @@ public class MetaDataFieldSkeleton extends Composite{
if(field.isMultiSelection())
tempListBox.setTitle(TOOLTIP_MULTISELECTION);
// if it is not mandatory, add a disabled option
if(!field.getMandatory()){
// if it is not mandatory and not multi-selection, add a disabled option (placeholder)
if(!field.getMandatory() && !field.isMultiSelection()){
tempListBox.addItem("Select " + field.getFieldName());
tempListBox.setSelectedValue("Select " + field.getFieldName());
tempListBox.setValue(0, "");
tempListBox.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled", "disabled");
tempListBox.setSelectedValue("Select " + field.getFieldName());
}
// get vocabulary fields
@ -637,13 +638,20 @@ public class MetaDataFieldSkeleton extends Composite{
case Time_Interval:
manipulatedTemp = rangesList.get(0).getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "").replaceAll(DataTimeBox.MISSING_RANGE_VALUE_END, UPPER_RANGE_NOT_SPECIFIED);
if(toReturn.equals(DataTimeBox.RANGE_SEPARATOR_START_END + UPPER_RANGE_NOT_SPECIFIED))
manipulatedTemp = "";
//fixed by Francesco, see #20663#note-12
if(!field.getMandatory()) {
if(manipulatedTemp.equals(DataTimeBox.RANGE_SEPARATOR_START_END + UPPER_RANGE_NOT_SPECIFIED))
manipulatedTemp = "";
}
// split to check if the extreme are equals
String[] temp = manipulatedTemp.split(DataTimeBox.RANGE_SEPARATOR_START_END);
if(temp[0].equals(temp[1]))
manipulatedTemp = temp[0];
//fixed by Francesco
if(!manipulatedTemp.isEmpty()) {
String[] temp = manipulatedTemp.split(DataTimeBox.RANGE_SEPARATOR_START_END);
if(temp[0].equals(temp[1]))
manipulatedTemp = temp[0];
}
toReturn.add(manipulatedTemp);
break;
@ -679,7 +687,7 @@ public class MetaDataFieldSkeleton extends Composite{
toReturn.add(((TextBox)holder).getText());
else{
// handle multiselected case
// handle single and multi-selected case
for(int i = 0; i < ((ListBox)holder).getItemCount(); i++){
if(((ListBox)holder).isItemSelected(i)){
toReturn.add(((ListBox)holder).getItemText(i));
@ -687,11 +695,17 @@ public class MetaDataFieldSkeleton extends Composite{
}
// if it was not mandatory but there was no choice, returning empty string
if(!field.getMandatory())
if(toReturn.equals("Select " + field.getFieldName())){
toReturn.clear();
toReturn.add("");
if(!field.getMandatory()) {
//Task #20446 - bug fix. Ignoring the placeholder
if(toReturn.size()==1) {
String placeholder = "Select " + field.getFieldName();
if(toReturn.get(0).equals(placeholder)){
GWT.log("Skipping placeholder: "+placeholder);
toReturn.clear();
//toReturn.add("");
}
}
}
}
break;