From fc0577ba9d12f214503784db6155c247cbf7df00 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Thu, 12 Feb 2015 10:29:25 +0000 Subject: [PATCH] Minor Update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@111926 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../geometry/GeometryCreatePointPanel.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geometry/GeometryCreatePointPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geometry/GeometryCreatePointPanel.java index 70059fe..68105a6 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geometry/GeometryCreatePointPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geometry/GeometryCreatePointPanel.java @@ -7,7 +7,7 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; -import org.gcube.portlets.user.td.gwtservice.shared.geospatial.GeospatialCreateCoordinatesSession; +import org.gcube.portlets.user.td.gwtservice.shared.geometry.GeometryCreatePointSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener; @@ -42,6 +42,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent; import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler; import com.sencha.gxt.widget.core.client.form.ComboBox; import com.sencha.gxt.widget.core.client.form.FieldLabel; +import com.sencha.gxt.widget.core.client.form.TextField; import com.sencha.gxt.widget.core.client.info.Info; /** @@ -67,6 +68,7 @@ public class GeometryCreatePointPanel extends FramedPanel implements private ComboBox comboLongitude; private ListStore storeComboLatitude; private ListStore storeComboLongitude; + private TextField columnLabelField; public GeometryCreatePointPanel(TRId trId, EventBus eventBus) { super(); @@ -151,8 +153,12 @@ public class GeometryCreatePointPanel extends FramedPanel implements comboLongitude.setTypeAhead(false); comboLongitude.setEditable(false); comboLongitude.setTriggerAction(TriggerAction.ALL); - + //Column Label + columnLabelField = new TextField(); + columnLabelField.setValue("Points"); + FieldLabel columnLab= new FieldLabel(columnLabelField, "Column Label"); + // Create createPointButton = new TextButton("Create"); createPointButton.setIcon(ResourceBundle.INSTANCE @@ -178,14 +184,15 @@ public class GeometryCreatePointPanel extends FramedPanel implements vl.add(new FieldLabel(comboLongitude, "Longitude"), new VerticalLayoutData(1, -1)); - + vl.add(columnLab, + new VerticalLayoutData(1, -1)); + + vl.add(createPointButton, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0))); add(vl); - - onResize(); } @@ -252,11 +259,14 @@ public class GeometryCreatePointPanel extends FramedPanel implements if (latitude != null) { ColumnData longitude = comboLongitude.getCurrentValue(); if (longitude != null) { - /*GeospatialCoordinatesType type=null; - GeospatialCreateCoordinatesSession gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession( - trId, latitude, longitude, type, null, null); - callGeometryCreatePoint(gsCreateCoordinatesSession);*/ - + String columnLab=columnLabelField.getCurrentValue(); + if(columnLab!=null && !columnLab.isEmpty()){ + GeometryCreatePointSession geoCreatePointSession = new GeometryCreatePointSession( + trId, latitude, longitude, columnLab); + callGeometryCreatePoint(geoCreatePointSession); + } else { + UtilsGXT3.alert("Attention", "Select a column label!"); + } } else { UtilsGXT3.alert("Attention", "Select Longitude!"); } @@ -266,9 +276,9 @@ public class GeometryCreatePointPanel extends FramedPanel implements } private void callGeometryCreatePoint( - GeospatialCreateCoordinatesSession gsCreateCoordinatesSession) { - TDGWTServiceAsync.INSTANCE.startGeospatialCreateCoordinates( - gsCreateCoordinatesSession, new AsyncCallback() { + GeometryCreatePointSession geometryCreatPointSession) { + TDGWTServiceAsync.INSTANCE.startGeometryCreatePoint( + geometryCreatPointSession, new AsyncCallback() { public void onFailure(Throwable caught) { if (caught instanceof TDGWTSessionExpiredException) { @@ -285,11 +295,11 @@ public class GeometryCreatePointPanel extends FramedPanel implements UtilsGXT3.alert("Error Final", caught.getLocalizedMessage()); } else { - Log.debug("Create Geospatial Coordinates Error: " + Log.debug("Create a Point Error: " + caught.getLocalizedMessage()); UtilsGXT3 - .alert("Error Creating Geospatial Coordinates", - "Error creating geospatial coordinates: " + .alert("Error Creating a point", + "Error creating a point: " + caught.getLocalizedMessage()); } }