|
|
|
@ -13,17 +13,18 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.FieldA
|
|
|
|
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
|
|
|
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.TaggingGroupingValue;
|
|
|
|
|
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.Alert;
|
|
|
|
|
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;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.InputAddOn;
|
|
|
|
|
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.AlertType;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
|
|
|
|
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
@ -83,6 +84,8 @@ public class MetaDataFieldSkeleton extends Composite{
|
|
|
|
|
// range list
|
|
|
|
|
private List<DataTimeBox> rangesList = new ArrayList<DataTimeBox>();
|
|
|
|
|
|
|
|
|
|
private List<TextArea> geoJsonList = new ArrayList<TextArea>();
|
|
|
|
|
|
|
|
|
|
// save event bus reference
|
|
|
|
|
private HandlerManager eventBus;
|
|
|
|
|
|
|
|
|
@ -124,13 +127,17 @@ public class MetaDataFieldSkeleton extends Composite{
|
|
|
|
|
|
|
|
|
|
case GeoJSON:
|
|
|
|
|
//MANAGED By FRANCESCO
|
|
|
|
|
InputAddOn addOn = new InputAddOn();
|
|
|
|
|
// start and end range date
|
|
|
|
|
final VerticalPanel containerGeoJSON = new VerticalPanel();
|
|
|
|
|
//containerGeoJSON.setWidth("100%");
|
|
|
|
|
|
|
|
|
|
final TextArea textArea = new TextArea();
|
|
|
|
|
textArea.setWidth("100%");
|
|
|
|
|
|
|
|
|
|
if(field.getDefaultValue() != null)
|
|
|
|
|
textArea.setText(field.getDefaultValue());
|
|
|
|
|
|
|
|
|
|
addOn.add(textArea);
|
|
|
|
|
containerGeoJSON.add(textArea);
|
|
|
|
|
Button butt = new Button();
|
|
|
|
|
butt.setIcon(IconType.MAP_MARKER);
|
|
|
|
|
butt.addClickHandler(new ClickHandler() {
|
|
|
|
@ -142,21 +149,23 @@ public class MetaDataFieldSkeleton extends Composite{
|
|
|
|
|
|
|
|
|
|
Command fillGeoJSONArea = new Command() {
|
|
|
|
|
public void execute() {
|
|
|
|
|
textArea.setText(dialog.getWKTToGeoJSON());
|
|
|
|
|
if(dialog.getWKTToGeoJSON()!=null)
|
|
|
|
|
textArea.setText(dialog.getWKTToGeoJSON());
|
|
|
|
|
else{
|
|
|
|
|
textArea.setText("");
|
|
|
|
|
containerGeoJSON.add(new Alert("Error on drawing the Geometry", AlertType.WARNING, true));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dialog.fireCommandOnResponse(fillGeoJSONArea);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dialog.show();
|
|
|
|
|
|
|
|
|
|
dialog.center();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addOn.add(butt);
|
|
|
|
|
holder = addOn;
|
|
|
|
|
geoJsonList.add(textArea);
|
|
|
|
|
containerGeoJSON.add(butt);
|
|
|
|
|
holder = containerGeoJSON;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -396,8 +405,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
case Text:
|
|
|
|
|
case GeoJSON: // validation for geojson will be performed at server side as well TODO
|
|
|
|
|
|
|
|
|
|
case GeoJSON:
|
|
|
|
|
String textAreaValue = getFieldCurrentValue().get(0);
|
|
|
|
|
|
|
|
|
|
if(field.getMandatory()){
|
|
|
|
@ -579,11 +587,13 @@ public class MetaDataFieldSkeleton extends Composite{
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Text:
|
|
|
|
|
case GeoJSON:
|
|
|
|
|
|
|
|
|
|
toReturn.add(((TextArea)holder).getText());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GeoJSON:
|
|
|
|
|
toReturn.add(geoJsonList.get(0).getText());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Time:
|
|
|
|
|
|
|
|
|
|
toReturn.add(((DataTimeBox)holder).getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "")); // it was a noRange metadata
|
|
|
|
|