diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/GeospatialCreateCoordinatesPanel.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/GeospatialCreateCoordinatesPanel.java index 206be6e..8eab894 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/GeospatialCreateCoordinatesPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/geospatial/GeospatialCreateCoordinatesPanel.java @@ -52,6 +52,7 @@ 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.Radio; +import com.sencha.gxt.widget.core.client.form.TextField; import com.sencha.gxt.widget.core.client.info.Info; /** @@ -84,8 +85,9 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements private ComboBox comboQuadrant; private Radio hasQuadrantTrue; private Radio hasQuadrantFalse; - private FieldLabel comboQuadrantField; - private FieldLabel hasQuadrantField; + private FieldLabel comboQuadrantLabel; + private FieldLabel hasQuadrantLabel; + private TextField resolutionField; public GeospatialCreateCoordinatesPanel(TRId trId, RequestProperties requestProperties, EventBus eventBus) { @@ -206,7 +208,14 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements comboGsCoordinatesType.setTypeAhead(false); comboGsCoordinatesType.setEditable(false); comboGsCoordinatesType.setTriggerAction(TriggerAction.ALL); - + + + //Resolution + resolutionField = new TextField(); + resolutionField.setValue("0.1"); + FieldLabel resolutionLabel= new FieldLabel(resolutionField, "Resolution"); + + // Has Quadrant hasQuadrantTrue = new Radio(); hasQuadrantTrue.setBoxLabel("True"); @@ -227,9 +236,18 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements ValueChangeEvent> event) { try { if (hasQuadrantTrue.getValue()) { - comboQuadrantField.setVisible(true); + if(quadrantColumns==null|| quadrantColumns.size()<1){ + Log.debug("Attention no Integer column is present in the tabular resource"); + UtilsGXT3 + .alert("Attention", + "No Integer column is present in the tabular resource!"); + + } + comboQuadrantLabel.setVisible(true); + + } else { - comboQuadrantField.setVisible(false); + comboQuadrantLabel.setVisible(false); } forceLayout(); @@ -246,8 +264,8 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements hasQuadrantPanel.add(hasQuadrantTrue); hasQuadrantPanel.add(hasQuadrantFalse); - hasQuadrantField = new FieldLabel(hasQuadrantPanel, "Has Quadrant"); - hasQuadrantField + hasQuadrantLabel = new FieldLabel(hasQuadrantPanel, "Has Quadrant"); + hasQuadrantLabel .setToolTip("Select true if you want select quadrant column"); // Quadrant @@ -266,7 +284,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements comboQuadrant.setEditable(false); comboQuadrant.setTriggerAction(TriggerAction.ALL); - comboQuadrantField = new FieldLabel(comboQuadrant, "Quadrant"); + comboQuadrantLabel = new FieldLabel(comboQuadrant, "Quadrant"); // Create createCoordinatesButton = new TextButton("Create"); @@ -295,10 +313,12 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements vl.add(new FieldLabel(comboGsCoordinatesType, "Type"), new VerticalLayoutData(1, -1)); + + vl.add(resolutionLabel, new VerticalLayoutData(1,-1)); + + vl.add(hasQuadrantLabel, new VerticalLayoutData(-1, -1)); - vl.add(hasQuadrantField, new VerticalLayoutData(-1, -1)); - - vl.add(comboQuadrantField, new VerticalLayoutData(1, -1)); + vl.add(comboQuadrantLabel, new VerticalLayoutData(1, -1)); vl.add(createCoordinatesButton, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0))); @@ -399,19 +419,37 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements protected void updateForCoordinatesType() { switch (gsCoordinatesType) { case C_SQUARE: - hasQuadrantField.setVisible(false); - comboQuadrantField.setVisible(false); + hasQuadrantLabel.setVisible(false); + comboQuadrantLabel.setVisible(false); comboGsCoordinatesType.setValue(gsCoordinatesType); + resolutionField.setValue("10.0"); + createCoordinatesButton.setIcon(ResourceBundle.INSTANCE + .geospatialCSquare32()); + break; case OCEAN_AREA: - hasQuadrantTrue.setValue(true); - hasQuadrantField.setVisible(true); - comboQuadrantField.setVisible(true); + if(quadrantColumns==null|| quadrantColumns.size()<1){ + hasQuadrantTrue.setValue(false); + hasQuadrantFalse.setValue(true); + comboQuadrantLabel.setVisible(false); + } else { + hasQuadrantTrue.setValue(true); + hasQuadrantFalse.setValue(false); + comboQuadrantLabel.setVisible(true); + + } + resolutionField.setValue("0.1"); + hasQuadrantLabel.setVisible(true); comboGsCoordinatesType.setValue(gsCoordinatesType); + createCoordinatesButton.setIcon(ResourceBundle.INSTANCE + .geospatialOceanArea32()); break; default: - hasQuadrantField.setVisible(false); - comboQuadrantField.setVisible(false); + resolutionField.setValue("10.0"); + hasQuadrantLabel.setVisible(false); + comboQuadrantLabel.setVisible(false); + createCoordinatesButton.setIcon(ResourceBundle.INSTANCE + .geospatialCoordinates32()); break; } @@ -460,6 +498,16 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements if (latitude != null) { ColumnData longitude = comboLongitude.getCurrentValue(); if (longitude != null) { + String resol=resolutionField.getCurrentValue(); + Double resolution=null; + try { + resolution= new Double(resol); + } catch(NumberFormatException e){ + UtilsGXT3.alert("Attention", + "Insert a valid resolution!"); + return; + } + GeospatialCoordinatesType type = comboGsCoordinatesType .getCurrentValue(); if (type != null) { @@ -467,7 +515,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements switch(type){ case C_SQUARE: gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession( - trId, latitude, longitude, type, false, null); + trId, latitude, longitude, type, false, null, resolution); callGeospatialCreateCoordinates(gsCreateCoordinatesSession); break; case OCEAN_AREA: @@ -475,7 +523,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements ColumnData quadrant = comboQuadrant.getCurrentValue(); if(quadrant!=null){ gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession( - trId, latitude, longitude, type, true, quadrant); + trId, latitude, longitude, type, true, quadrant,resolution); callGeospatialCreateCoordinates(gsCreateCoordinatesSession); } else { UtilsGXT3.alert("Attention", @@ -485,7 +533,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements } else { gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession( - trId, latitude, longitude, type, false, null); + trId, latitude, longitude, type, false, null, resolution); callGeospatialCreateCoordinates(gsCreateCoordinatesSession); } @@ -584,7 +632,8 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements public void onSuccess(ArrayList result) { Log.trace("loaded " + result.size() + " ColumnData"); columns = new ArrayList(); - + quadrantColumns = new ArrayList(); + for (ColumnData column : result) { ColumnDataType columnDataType = ColumnDataType .getColumnDataTypeFromId(column diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java index 3c59a3a..3400910 100644 --- a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java +++ b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/ResourceBundle.java @@ -4,7 +4,6 @@ package org.gcube.portlets.user.td.tablewidget.client.resources; import com.google.gwt.core.client.GWT; import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ImageResource; -import com.google.gwt.resources.client.ClientBundle.Source; /** * Resource Bundle @@ -156,6 +155,19 @@ public interface ResourceBundle extends ClientBundle { @Source("table-type_32.png") ImageResource tableType32(); + @Source("flag-red_32.png") + ImageResource geospatialCSquare32(); + + @Source("flag-red.png") + ImageResource geospatialCSquare(); + + @Source("flag-blue_32.png") + ImageResource geospatialOceanArea32(); + + @Source("flag-blue.png") + ImageResource geospatialOceanArea(); + + @Source("flag-green_32.png") ImageResource geospatialCoordinates32(); diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue.png b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue.png new file mode 100644 index 0000000..2b13ff4 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue_32.png b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue_32.png new file mode 100644 index 0000000..b0e7e97 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue_32.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red.png b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red.png new file mode 100644 index 0000000..0037ed5 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red.png differ diff --git a/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red_32.png b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red_32.png new file mode 100644 index 0000000..1ffe050 Binary files /dev/null and b/src/main/java/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red_32.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue.png b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue.png new file mode 100644 index 0000000..2b13ff4 Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue_32.png b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue_32.png new file mode 100644 index 0000000..b0e7e97 Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-blue_32.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red.png b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red.png new file mode 100644 index 0000000..0037ed5 Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red.png differ diff --git a/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red_32.png b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red_32.png new file mode 100644 index 0000000..1ffe050 Binary files /dev/null and b/src/main/resources/org/gcube/portlets/user/td/tablewidget/client/resources/flag-red_32.png differ