Working on [Feature #13074] integration with 'openlayer-basic-widgets'
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@177243 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a2d9c2d8ea
commit
d1ced8f867
|
@ -5,6 +5,7 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidge
|
||||||
|
|
||||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaDialogEvent;
|
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaDialogEvent;
|
||||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaDialogEvent.SelectAreaDialogEventHandler;
|
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaDialogEvent.SelectAreaDialogEventHandler;
|
||||||
|
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaDialogEventType;
|
||||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.AreaSelectionDialog;
|
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.AreaSelectionDialog;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -38,8 +39,13 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(SelectAreaDialogEvent event) {
|
public void onResponse(SelectAreaDialogEvent event) {
|
||||||
GWT.log("SelectAreaDialog Response: "+event);
|
GWT.log("SelectAreaDialog Response: "+event);
|
||||||
wktArea = event.getArea();
|
|
||||||
onResponseCommand.execute();
|
SelectAreaDialogEventType closedType = event.getSelectAreaDialogEventType();
|
||||||
|
wktArea = null;
|
||||||
|
if(closedType.equals(SelectAreaDialogEventType.Completed)){
|
||||||
|
wktArea = event.getArea();
|
||||||
|
onResponseCommand.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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.MetadataFieldWrapper;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.TaggingGroupingValue;
|
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.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||||
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
import com.github.gwtbootstrap.client.ui.ControlLabel;
|
||||||
import com.github.gwtbootstrap.client.ui.Controls;
|
import com.github.gwtbootstrap.client.ui.Controls;
|
||||||
import com.github.gwtbootstrap.client.ui.Icon;
|
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.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.Popover;
|
import com.github.gwtbootstrap.client.ui.Popover;
|
||||||
import com.github.gwtbootstrap.client.ui.TextArea;
|
import com.github.gwtbootstrap.client.ui.TextArea;
|
||||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
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.ControlGroupType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -83,6 +84,8 @@ public class MetaDataFieldSkeleton extends Composite{
|
||||||
// range list
|
// range list
|
||||||
private List<DataTimeBox> rangesList = new ArrayList<DataTimeBox>();
|
private List<DataTimeBox> rangesList = new ArrayList<DataTimeBox>();
|
||||||
|
|
||||||
|
private List<TextArea> geoJsonList = new ArrayList<TextArea>();
|
||||||
|
|
||||||
// save event bus reference
|
// save event bus reference
|
||||||
private HandlerManager eventBus;
|
private HandlerManager eventBus;
|
||||||
|
|
||||||
|
@ -124,13 +127,17 @@ public class MetaDataFieldSkeleton extends Composite{
|
||||||
|
|
||||||
case GeoJSON:
|
case GeoJSON:
|
||||||
//MANAGED By FRANCESCO
|
//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();
|
final TextArea textArea = new TextArea();
|
||||||
|
textArea.setWidth("100%");
|
||||||
|
|
||||||
if(field.getDefaultValue() != null)
|
if(field.getDefaultValue() != null)
|
||||||
textArea.setText(field.getDefaultValue());
|
textArea.setText(field.getDefaultValue());
|
||||||
|
|
||||||
addOn.add(textArea);
|
containerGeoJSON.add(textArea);
|
||||||
Button butt = new Button();
|
Button butt = new Button();
|
||||||
butt.setIcon(IconType.MAP_MARKER);
|
butt.setIcon(IconType.MAP_MARKER);
|
||||||
butt.addClickHandler(new ClickHandler() {
|
butt.addClickHandler(new ClickHandler() {
|
||||||
|
@ -142,21 +149,23 @@ public class MetaDataFieldSkeleton extends Composite{
|
||||||
|
|
||||||
Command fillGeoJSONArea = new Command() {
|
Command fillGeoJSONArea = new Command() {
|
||||||
public void execute() {
|
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.fireCommandOnResponse(fillGeoJSONArea);
|
||||||
|
dialog.center();
|
||||||
|
|
||||||
dialog.show();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
geoJsonList.add(textArea);
|
||||||
addOn.add(butt);
|
containerGeoJSON.add(butt);
|
||||||
holder = addOn;
|
holder = containerGeoJSON;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -396,8 +405,7 @@ public class MetaDataFieldSkeleton extends Composite{
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
case Text:
|
case Text:
|
||||||
case GeoJSON: // validation for geojson will be performed at server side as well TODO
|
case GeoJSON:
|
||||||
|
|
||||||
String textAreaValue = getFieldCurrentValue().get(0);
|
String textAreaValue = getFieldCurrentValue().get(0);
|
||||||
|
|
||||||
if(field.getMandatory()){
|
if(field.getMandatory()){
|
||||||
|
@ -579,11 +587,13 @@ public class MetaDataFieldSkeleton extends Composite{
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Text:
|
case Text:
|
||||||
case GeoJSON:
|
|
||||||
|
|
||||||
toReturn.add(((TextArea)holder).getText());
|
toReturn.add(((TextArea)holder).getText());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GeoJSON:
|
||||||
|
toReturn.add(geoJsonList.get(0).getText());
|
||||||
|
break;
|
||||||
|
|
||||||
case Time:
|
case Time:
|
||||||
|
|
||||||
toReturn.add(((DataTimeBox)holder).getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "")); // it was a noRange metadata
|
toReturn.add(((DataTimeBox)holder).getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "")); // it was a noRange metadata
|
||||||
|
|
|
@ -240,7 +240,13 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
bean.setAuthorEmail("costantino.perciante@isti.cnr.it");
|
bean.setAuthorEmail("costantino.perciante@isti.cnr.it");
|
||||||
bean.setMaintainer("Costantino Perciante");
|
bean.setMaintainer("Costantino Perciante");
|
||||||
bean.setMaintainerEmail("costantino.perciante@isti.cnr.it");
|
bean.setMaintainerEmail("costantino.perciante@isti.cnr.it");
|
||||||
bean.setOrganizationList(Arrays.asList(new OrganizationBean("NextNext", "nextnext", true)));
|
|
||||||
|
//UPDATED By Francesco
|
||||||
|
String scope = GenericUtils.getCurrentContext(this.getThreadLocalRequest(), false);
|
||||||
|
String vreName = scope.substring(scope.lastIndexOf("/")+1,scope.length());
|
||||||
|
logger.debug("In dev mode using the scope: "+scope+" and VRE name: "+vreName);
|
||||||
|
bean.setOrganizationList(Arrays.asList(new OrganizationBean(vreName, vreName.toLowerCase(), true)));
|
||||||
|
|
||||||
bean.setOwnerIdentifier(userName);
|
bean.setOwnerIdentifier(userName);
|
||||||
|
|
||||||
if(folderId != null && !folderId.isEmpty()){
|
if(folderId != null && !folderId.isEmpty()){
|
||||||
|
@ -517,7 +523,8 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
toReturn = "/gcube/devNext/NextNext";
|
//UPDATED By FRANCESCO
|
||||||
|
toReturn = GenericUtils.getCurrentContext(this.getThreadLocalRequest(), false);
|
||||||
mapOrganizationScope.put(orgName, toReturn);
|
mapOrganizationScope.put(orgName, toReturn);
|
||||||
}
|
}
|
||||||
logger.debug("Returning scope " + toReturn);
|
logger.debug("Returning scope " + toReturn);
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class GenericUtils {
|
||||||
/**
|
/**
|
||||||
* Needed to get the url of the client
|
* Needed to get the url of the client
|
||||||
* @param httpServletRequest the httpServletRequest object
|
* @param httpServletRequest the httpServletRequest object
|
||||||
* @return the instance of the user
|
* @return the instance of the user
|
||||||
* @see the url at client side
|
* @see the url at client side
|
||||||
*/
|
*/
|
||||||
public static String getCurrentClientUrl(HttpServletRequest httpServletRequest) {
|
public static String getCurrentClientUrl(HttpServletRequest httpServletRequest) {
|
||||||
|
@ -138,7 +138,7 @@ public class GenericUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the current scope by using the portal manager
|
* Retrieve the current scope by using the portal manager
|
||||||
* @param b
|
* @param b
|
||||||
* @return a GcubeUser object
|
* @return a GcubeUser object
|
||||||
*/
|
*/
|
||||||
public static String getCurrentContext(HttpServletRequest request, boolean setInThread){
|
public static String getCurrentContext(HttpServletRequest request, boolean setInThread){
|
||||||
|
@ -155,10 +155,10 @@ public class GenericUtils {
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the current token by using the portal manager
|
* Retrieve the current token by using the portal manager
|
||||||
* @param b
|
* @param b
|
||||||
* @return a GcubeUser object
|
* @return a GcubeUser object
|
||||||
*/
|
*/
|
||||||
public static String getCurrentToken(HttpServletRequest request, boolean setInThread){
|
public static String getCurrentToken(HttpServletRequest request, boolean setInThread){
|
||||||
|
@ -168,7 +168,7 @@ public class GenericUtils {
|
||||||
|
|
||||||
PortalContext pContext = PortalContext.getConfiguration();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
String token = pContext.getCurrentUserToken(getCurrentContext(request, false), getCurrentUser(request).getUsername());
|
String token = pContext.getCurrentUserToken(getCurrentContext(request, false), getCurrentUser(request).getUsername());
|
||||||
logger.debug("Returning token " + token);
|
logger.debug("Returning token " + token.substring(0, token.length()-7)+"XXXXX");
|
||||||
|
|
||||||
if(token != null && setInThread)
|
if(token != null && setInThread)
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
|
Loading…
Reference in New Issue