bug fixing issue on Go to the Item
Added list box for selecting the geometry git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@178989 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
afa89e9b4c
commit
3a3ecfa66a
|
@ -10,6 +10,7 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.Met
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||||
|
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.GeometryType;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
|
@ -60,7 +61,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog();
|
GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog(GeometryType.LineString);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -112,7 +113,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
||||||
// listLeft.add(new ResourceElementBean(null, "File I", false, null, "File I"));
|
// listLeft.add(new ResourceElementBean(null, "File I", false, null, "File I"));
|
||||||
//
|
//
|
||||||
// // test with folder and childs
|
// // test with folder and childs
|
||||||
// ArrayList<ResourceElementBean> childrenOfA = new ArrayList<ResourceElementBean>();
|
// ArrayList<ResourceElementBean> childrennameOfA = new ArrayList<ResourceElementBean>();
|
||||||
// ArrayList<ResourceElementBean> childrenOfW = new ArrayList<ResourceElementBean>();
|
// ArrayList<ResourceElementBean> childrenOfW = new ArrayList<ResourceElementBean>();
|
||||||
//
|
//
|
||||||
// ResourceElementBean elementA = new ResourceElementBean(null, "Folder A", true, childrenOfA, "Folder A");
|
// ResourceElementBean elementA = new ResourceElementBean(null, "Folder A", true, childrenOfA, "Folder A");
|
||||||
|
|
|
@ -9,6 +9,7 @@ import org.gcube.portlets.widgets.openlayerbasicwidgets.client.event.SelectAreaD
|
||||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.AreaSelectionDialog;
|
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.AreaSelectionDialog;
|
||||||
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.GeometryType;
|
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.GeometryType;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.google.gwt.core.client.JavaScriptObject;
|
import com.google.gwt.core.client.JavaScriptObject;
|
||||||
import com.google.gwt.core.client.JsonUtils;
|
import com.google.gwt.core.client.JsonUtils;
|
||||||
import com.google.gwt.json.client.JSONObject;
|
import com.google.gwt.json.client.JSONObject;
|
||||||
|
@ -27,12 +28,15 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
||||||
|
|
||||||
private String wktArea;
|
private String wktArea;
|
||||||
private Command onResponseCommand;
|
private Command onResponseCommand;
|
||||||
|
private ListBox geometries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geo json area selection dialog.
|
* Instantiates a new geo json area selection dialog.
|
||||||
|
*
|
||||||
|
* @param geometry the geometry
|
||||||
*/
|
*/
|
||||||
public GeoJsonAreaSelectionDialog() {
|
public GeoJsonAreaSelectionDialog(GeometryType geometry) {
|
||||||
super(GeometryType.Polygon);
|
super(geometry);
|
||||||
|
|
||||||
//THE HANDLER
|
//THE HANDLER
|
||||||
SelectAreaDialogEventHandler handler = new SelectAreaDialogEventHandler() {
|
SelectAreaDialogEventHandler handler = new SelectAreaDialogEventHandler() {
|
||||||
|
@ -90,7 +94,7 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
||||||
var geojson_format = new ol.format.GeoJSON(wkt_options);
|
var geojson_format = new ol.format.GeoJSON(wkt_options);
|
||||||
console.log('geojson_format: '+geojson_format);
|
console.log('geojson_format: '+geojson_format);
|
||||||
var geoJsonFeature = geojson_format.writeFeature(wktFeature);
|
var geoJsonFeature = geojson_format.writeFeature(wktFeature);
|
||||||
//console.log('GeoJSON Feature: '+geoJsonFeature);
|
//console.log('GeoJSON Feature: '+geoJsnameonFeature);
|
||||||
return geoJsonFeature;
|
return geoJsonFeature;
|
||||||
}catch(err) {
|
}catch(err) {
|
||||||
console.log(err.message);
|
console.log(err.message);
|
||||||
|
@ -98,6 +102,12 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
||||||
}
|
}
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the.
|
||||||
|
*
|
||||||
|
* @param txt the txt
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
public static native String print(String txt) /*-{
|
public static native String print(String txt) /*-{
|
||||||
console.log(txt)
|
console.log(txt)
|
||||||
}-*/;
|
}-*/;
|
||||||
|
@ -154,4 +164,37 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
||||||
|
|
||||||
return wktArea;
|
return wktArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the geometries.
|
||||||
|
*
|
||||||
|
* @return the geometries
|
||||||
|
*/
|
||||||
|
public static ListBox getGeometries() {
|
||||||
|
ListBox geometries = new ListBox();
|
||||||
|
for (GeometryType geometry : GeometryType.values()) {
|
||||||
|
geometries.addItem(geometry.name(),geometry.name());
|
||||||
|
}
|
||||||
|
return geometries;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To geometry.
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
* @return the geometry type
|
||||||
|
*/
|
||||||
|
public static GeometryType toGeometry(String name){
|
||||||
|
|
||||||
|
GeometryType theGeom = null;
|
||||||
|
try {
|
||||||
|
theGeom = GeometryType.valueOf(name);
|
||||||
|
}catch (Exception e) {
|
||||||
|
//silent
|
||||||
|
}
|
||||||
|
|
||||||
|
return theGeom;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.FocusPanel;
|
import com.google.gwt.user.client.ui.FocusPanel;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -110,7 +111,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
@UiField Button goBackButtonSecondStep;
|
@UiField Button goBackButtonSecondStep;
|
||||||
@UiField Paragraph selectedProfile;
|
@UiField Paragraph selectedProfile;
|
||||||
@UiField Button goToDatasetButton;
|
@UiField Button goToDatasetButton;
|
||||||
@UiField FlowPanel goToDatasetButtonPanel;
|
@UiField HorizontalPanel goToDatasetButtonPanel;
|
||||||
@UiField Button addResourcesButton;
|
@UiField Button addResourcesButton;
|
||||||
@UiField SimplePanel workspaceResourcesContainer;
|
@UiField SimplePanel workspaceResourcesContainer;
|
||||||
@UiField Button continueThirdStep;
|
@UiField Button continueThirdStep;
|
||||||
|
@ -1005,18 +1006,26 @@ public class CreateDatasetForm extends Composite{
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(final DatasetBean createdDatasetBean) {
|
public void onSuccess(final DatasetBean createdDatasetBean) {
|
||||||
|
|
||||||
|
GWT.log("Created the dataset: "+createdDatasetBean);
|
||||||
|
|
||||||
if(createdDatasetBean != null){
|
if(createdDatasetBean != null){
|
||||||
|
|
||||||
|
final String datasetUrl = createdDatasetBean.getSource();
|
||||||
|
|
||||||
alertOnCreate(PRODUCT_CREATED_OK, AlertType.SUCCESS, false);
|
alertOnCreate(PRODUCT_CREATED_OK, AlertType.SUCCESS, false);
|
||||||
|
|
||||||
|
try {
|
||||||
// disable dataset fields
|
// disable dataset fields
|
||||||
disableDatasetFields();
|
disableDatasetFields();
|
||||||
|
}catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
// disable reset
|
// disable reset
|
||||||
resetButton.setEnabled(false);
|
resetButton.setEnabled(false);
|
||||||
|
|
||||||
// show the go to dataset button
|
// show the go to dataset button
|
||||||
final String datasetUrl = createdDatasetBean.getSource();
|
|
||||||
goToDatasetButtonPanel.setVisible(true);
|
goToDatasetButtonPanel.setVisible(true);
|
||||||
goToDatasetButton.setVisible(true);
|
goToDatasetButton.setVisible(true);
|
||||||
goToDatasetButton.setText(
|
goToDatasetButton.setText(
|
||||||
|
@ -1033,16 +1042,14 @@ public class CreateDatasetForm extends Composite{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// set hidden the create button
|
||||||
|
createButton.setVisible(false);
|
||||||
|
|
||||||
// if we are in the "general case" we need to show a form for adding resources
|
// if we are in the "general case" we need to show a form for adding resources
|
||||||
if(isWorkspaceRequest){
|
if(!isWorkspaceRequest) {
|
||||||
// leave to back button, but remove create and add go to dataset
|
|
||||||
createButton.removeFromParent();
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
// remove create button
|
|
||||||
createButton.removeFromParent();
|
|
||||||
|
|
||||||
|
try {
|
||||||
// show the add resources button
|
// show the add resources button
|
||||||
addResourcesButton.setVisible(true);
|
addResourcesButton.setVisible(true);
|
||||||
|
|
||||||
|
@ -1054,7 +1061,7 @@ public class CreateDatasetForm extends Composite{
|
||||||
// remove content of the main panel
|
// remove content of the main panel
|
||||||
createDatasetMainPanel.clear();
|
createDatasetMainPanel.clear();
|
||||||
|
|
||||||
// TabPanel
|
// TabPanelException
|
||||||
tabPanel = new TabPanel(Tabs.ABOVE);
|
tabPanel = new TabPanel(Tabs.ABOVE);
|
||||||
tabPanel.setWidth("100%");
|
tabPanel.setWidth("100%");
|
||||||
|
|
||||||
|
@ -1084,6 +1091,9 @@ public class CreateDatasetForm extends Composite{
|
||||||
createDatasetMainPanel.add(container);
|
createDatasetMainPanel.add(container);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}catch (Exception e2) {
|
||||||
|
//silent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.the-margin-left{
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
<g:HTMLPanel ui:field="createDatasetMainPanel">
|
<g:HTMLPanel ui:field="createDatasetMainPanel">
|
||||||
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||||
|
@ -384,11 +388,11 @@
|
||||||
visible="false" ui:field="onCreateAlertBlock" styleName="{style.block-alert-style}">
|
visible="false" ui:field="onCreateAlertBlock" styleName="{style.block-alert-style}">
|
||||||
</b:AlertBlock>
|
</b:AlertBlock>
|
||||||
|
|
||||||
<g:FlowPanel ui:field="goToDatasetButtonPanel" visible="false">
|
<g:HorizontalPanel ui:field="goToDatasetButtonPanel" visible="false">
|
||||||
<g:Label styleName="{style.label-go-to-product}">Go to the Item</g:Label>
|
<g:Label>Go to the Item</g:Label>
|
||||||
<b:Button title="Go to the Item" ui:field="goToDatasetButton"
|
<b:Button title="Go to the Item" ui:field="goToDatasetButton"
|
||||||
type="LINK" block="false" visible="false"></b:Button>
|
type="LINK" visible="false" styleName="{style.the-margin-left}"></b:Button>
|
||||||
</g:FlowPanel>
|
</g:HorizontalPanel>
|
||||||
|
|
||||||
<b:Button title="Add resources to the just created item"
|
<b:Button title="Add resources to the just created item"
|
||||||
block="true" type="PRIMARY" visible="false" ui:field="addResourcesButton">Add Resources</b:Button>
|
block="true" type="PRIMARY" visible="false" ui:field="addResourcesButton">Add Resources</b:Button>
|
||||||
|
|
|
@ -32,6 +32,7 @@ import com.google.gwt.dom.client.Element;
|
||||||
import com.google.gwt.dom.client.SpanElement;
|
import com.google.gwt.dom.client.SpanElement;
|
||||||
import com.google.gwt.dom.client.Style.Cursor;
|
import com.google.gwt.dom.client.Style.Cursor;
|
||||||
import com.google.gwt.dom.client.Style.Display;
|
import com.google.gwt.dom.client.Style.Display;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
|
@ -46,6 +47,8 @@ import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.FocusPanel;
|
import com.google.gwt.user.client.ui.FocusPanel;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Label;
|
||||||
import com.google.gwt.user.client.ui.SimplePanel;
|
import com.google.gwt.user.client.ui.SimplePanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
@ -137,14 +140,24 @@ public class MetaDataFieldSkeleton extends Composite{
|
||||||
textArea.setText(field.getDefaultValue());
|
textArea.setText(field.getDefaultValue());
|
||||||
|
|
||||||
containerGeoJSON.add(textArea);
|
containerGeoJSON.add(textArea);
|
||||||
|
|
||||||
|
HorizontalPanel hp = new HorizontalPanel();
|
||||||
|
hp.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||||
|
final ListBox geometries = GeoJsonAreaSelectionDialog.getGeometries();
|
||||||
|
|
||||||
|
|
||||||
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() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
String geometrySelected = geometries.getSelectedItemText();
|
||||||
|
if(geometrySelected==null) {
|
||||||
|
containerGeoJSON.add(new Alert("Please, select one geometry", AlertType.WARNING, true));
|
||||||
|
}
|
||||||
|
|
||||||
final GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog();
|
final GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog(GeoJsonAreaSelectionDialog.toGeometry(geometrySelected));
|
||||||
|
|
||||||
Command fillGeoJSONArea = new Command() {
|
Command fillGeoJSONArea = new Command() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
@ -169,7 +182,14 @@ public class MetaDataFieldSkeleton extends Composite{
|
||||||
});
|
});
|
||||||
|
|
||||||
geoJsonList.add(textArea);
|
geoJsonList.add(textArea);
|
||||||
containerGeoJSON.add(butt);
|
Label label = new Label("Draw a");
|
||||||
|
label.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||||
|
hp.add(label);
|
||||||
|
geometries.getElement().getStyle().setMarginRight(5, Unit.PX);
|
||||||
|
hp.add(geometries);
|
||||||
|
hp.add(butt);
|
||||||
|
geometries.setItemSelected(0, true);
|
||||||
|
containerGeoJSON.add(hp);
|
||||||
holder = containerGeoJSON;
|
holder = containerGeoJSON;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -10,8 +10,8 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes;
|
|
||||||
import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods;
|
import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods;
|
||||||
|
import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes;
|
||||||
import org.gcube.datacatalogue.metadatadiscovery.DataCalogueMetadataFormatReader;
|
import org.gcube.datacatalogue.metadatadiscovery.DataCalogueMetadataFormatReader;
|
||||||
import org.gcube.datacatalogue.metadatadiscovery.bean.MetadataProfile;
|
import org.gcube.datacatalogue.metadatadiscovery.bean.MetadataProfile;
|
||||||
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataField;
|
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataField;
|
||||||
|
|
Loading…
Reference in New Issue