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.metadata.DataTypeWrapper;
|
||||
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.ListBox;
|
||||
|
@ -60,7 +61,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
@Override
|
||||
public void execute() {
|
||||
GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog();
|
||||
GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog(GeometryType.LineString);
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
@ -112,7 +113,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
// listLeft.add(new ResourceElementBean(null, "File I", false, null, "File I"));
|
||||
//
|
||||
// // test with folder and childs
|
||||
// ArrayList<ResourceElementBean> childrenOfA = new ArrayList<ResourceElementBean>();
|
||||
// ArrayList<ResourceElementBean> childrennameOfA = new ArrayList<ResourceElementBean>();
|
||||
// ArrayList<ResourceElementBean> childrenOfW = new ArrayList<ResourceElementBean>();
|
||||
//
|
||||
// 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.GeometryType;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsonUtils;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
|
@ -27,12 +28,15 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
|||
|
||||
private String wktArea;
|
||||
private Command onResponseCommand;
|
||||
private ListBox geometries;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo json area selection dialog.
|
||||
*
|
||||
* @param geometry the geometry
|
||||
*/
|
||||
public GeoJsonAreaSelectionDialog() {
|
||||
super(GeometryType.Polygon);
|
||||
public GeoJsonAreaSelectionDialog(GeometryType geometry) {
|
||||
super(geometry);
|
||||
|
||||
//THE HANDLER
|
||||
SelectAreaDialogEventHandler handler = new SelectAreaDialogEventHandler() {
|
||||
|
@ -90,7 +94,7 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
|||
var geojson_format = new ol.format.GeoJSON(wkt_options);
|
||||
console.log('geojson_format: '+geojson_format);
|
||||
var geoJsonFeature = geojson_format.writeFeature(wktFeature);
|
||||
//console.log('GeoJSON Feature: '+geoJsonFeature);
|
||||
//console.log('GeoJSON Feature: '+geoJsnameonFeature);
|
||||
return geoJsonFeature;
|
||||
}catch(err) {
|
||||
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) /*-{
|
||||
console.log(txt)
|
||||
}-*/;
|
||||
|
@ -154,4 +164,37 @@ public class GeoJsonAreaSelectionDialog extends AreaSelectionDialog{
|
|||
|
||||
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.FocusPanel;
|
||||
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.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
@ -110,7 +111,7 @@ public class CreateDatasetForm extends Composite{
|
|||
@UiField Button goBackButtonSecondStep;
|
||||
@UiField Paragraph selectedProfile;
|
||||
@UiField Button goToDatasetButton;
|
||||
@UiField FlowPanel goToDatasetButtonPanel;
|
||||
@UiField HorizontalPanel goToDatasetButtonPanel;
|
||||
@UiField Button addResourcesButton;
|
||||
@UiField SimplePanel workspaceResourcesContainer;
|
||||
@UiField Button continueThirdStep;
|
||||
|
@ -1005,18 +1006,26 @@ public class CreateDatasetForm extends Composite{
|
|||
@Override
|
||||
public void onSuccess(final DatasetBean createdDatasetBean) {
|
||||
|
||||
GWT.log("Created the dataset: "+createdDatasetBean);
|
||||
|
||||
if(createdDatasetBean != null){
|
||||
|
||||
final String datasetUrl = createdDatasetBean.getSource();
|
||||
|
||||
alertOnCreate(PRODUCT_CREATED_OK, AlertType.SUCCESS, false);
|
||||
|
||||
try {
|
||||
// disable dataset fields
|
||||
disableDatasetFields();
|
||||
}catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
// disable reset
|
||||
resetButton.setEnabled(false);
|
||||
|
||||
// show the go to dataset button
|
||||
final String datasetUrl = createdDatasetBean.getSource();
|
||||
|
||||
goToDatasetButtonPanel.setVisible(true);
|
||||
goToDatasetButton.setVisible(true);
|
||||
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(isWorkspaceRequest){
|
||||
// leave to back button, but remove create and add go to dataset
|
||||
createButton.removeFromParent();
|
||||
|
||||
}else{
|
||||
|
||||
// remove create button
|
||||
createButton.removeFromParent();
|
||||
if(!isWorkspaceRequest) {
|
||||
|
||||
try {
|
||||
// show the add resources button
|
||||
addResourcesButton.setVisible(true);
|
||||
|
||||
|
@ -1054,7 +1061,7 @@ public class CreateDatasetForm extends Composite{
|
|||
// remove content of the main panel
|
||||
createDatasetMainPanel.clear();
|
||||
|
||||
// TabPanel
|
||||
// TabPanelException
|
||||
tabPanel = new TabPanel(Tabs.ABOVE);
|
||||
tabPanel.setWidth("100%");
|
||||
|
||||
|
@ -1084,6 +1091,9 @@ public class CreateDatasetForm extends Composite{
|
|||
createDatasetMainPanel.add(container);
|
||||
}
|
||||
});
|
||||
}catch (Exception e2) {
|
||||
//silent
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
vertical-align: middle;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.the-margin-left{
|
||||
margin-left: 5px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="createDatasetMainPanel">
|
||||
<b:Form type="HORIZONTAL" styleName="{style.form-main-style}"
|
||||
|
@ -384,11 +388,11 @@
|
|||
visible="false" ui:field="onCreateAlertBlock" styleName="{style.block-alert-style}">
|
||||
</b:AlertBlock>
|
||||
|
||||
<g:FlowPanel ui:field="goToDatasetButtonPanel" visible="false">
|
||||
<g:Label styleName="{style.label-go-to-product}">Go to the Item</g:Label>
|
||||
<g:HorizontalPanel ui:field="goToDatasetButtonPanel" visible="false">
|
||||
<g:Label>Go to the Item</g:Label>
|
||||
<b:Button title="Go to the Item" ui:field="goToDatasetButton"
|
||||
type="LINK" block="false" visible="false"></b:Button>
|
||||
</g:FlowPanel>
|
||||
type="LINK" visible="false" styleName="{style.the-margin-left}"></b:Button>
|
||||
</g:HorizontalPanel>
|
||||
|
||||
<b:Button title="Add resources to the just created item"
|
||||
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.Style.Cursor;
|
||||
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.ClickHandler;
|
||||
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.FocusPanel;
|
||||
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.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
@ -137,14 +140,24 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
textArea.setText(field.getDefaultValue());
|
||||
|
||||
containerGeoJSON.add(textArea);
|
||||
|
||||
HorizontalPanel hp = new HorizontalPanel();
|
||||
hp.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
final ListBox geometries = GeoJsonAreaSelectionDialog.getGeometries();
|
||||
|
||||
|
||||
Button butt = new Button();
|
||||
butt.setIcon(IconType.MAP_MARKER);
|
||||
butt.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
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() {
|
||||
public void execute() {
|
||||
|
@ -169,7 +182,14 @@ public class MetaDataFieldSkeleton extends Composite{
|
|||
});
|
||||
|
||||
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;
|
||||
|
||||
break;
|
||||
|
|
|
@ -10,8 +10,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpSession;
|
||||
|
||||
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.SessionCatalogueAttributes;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.DataCalogueMetadataFormatReader;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.bean.MetadataProfile;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataField;
|
||||
|
|
Loading…
Reference in New Issue