Updated Geospatial Coordinates

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@111921 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-02-11 17:57:22 +00:00 committed by Giancarlo Panichi
parent 68a1c4724e
commit 56b2244a48
10 changed files with 84 additions and 23 deletions

View File

@ -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.ComboBox;
import com.sencha.gxt.widget.core.client.form.FieldLabel; 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.Radio;
import com.sencha.gxt.widget.core.client.form.TextField;
import com.sencha.gxt.widget.core.client.info.Info; import com.sencha.gxt.widget.core.client.info.Info;
/** /**
@ -84,8 +85,9 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
private ComboBox<ColumnData> comboQuadrant; private ComboBox<ColumnData> comboQuadrant;
private Radio hasQuadrantTrue; private Radio hasQuadrantTrue;
private Radio hasQuadrantFalse; private Radio hasQuadrantFalse;
private FieldLabel comboQuadrantField; private FieldLabel comboQuadrantLabel;
private FieldLabel hasQuadrantField; private FieldLabel hasQuadrantLabel;
private TextField resolutionField;
public GeospatialCreateCoordinatesPanel(TRId trId, public GeospatialCreateCoordinatesPanel(TRId trId,
RequestProperties requestProperties, EventBus eventBus) { RequestProperties requestProperties, EventBus eventBus) {
@ -206,7 +208,14 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
comboGsCoordinatesType.setTypeAhead(false); comboGsCoordinatesType.setTypeAhead(false);
comboGsCoordinatesType.setEditable(false); comboGsCoordinatesType.setEditable(false);
comboGsCoordinatesType.setTriggerAction(TriggerAction.ALL); comboGsCoordinatesType.setTriggerAction(TriggerAction.ALL);
//Resolution
resolutionField = new TextField();
resolutionField.setValue("0.1");
FieldLabel resolutionLabel= new FieldLabel(resolutionField, "Resolution");
// Has Quadrant // Has Quadrant
hasQuadrantTrue = new Radio(); hasQuadrantTrue = new Radio();
hasQuadrantTrue.setBoxLabel("True"); hasQuadrantTrue.setBoxLabel("True");
@ -227,9 +236,18 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
ValueChangeEvent<HasValue<Boolean>> event) { ValueChangeEvent<HasValue<Boolean>> event) {
try { try {
if (hasQuadrantTrue.getValue()) { 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 { } else {
comboQuadrantField.setVisible(false); comboQuadrantLabel.setVisible(false);
} }
forceLayout(); forceLayout();
@ -246,8 +264,8 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
hasQuadrantPanel.add(hasQuadrantTrue); hasQuadrantPanel.add(hasQuadrantTrue);
hasQuadrantPanel.add(hasQuadrantFalse); hasQuadrantPanel.add(hasQuadrantFalse);
hasQuadrantField = new FieldLabel(hasQuadrantPanel, "Has Quadrant"); hasQuadrantLabel = new FieldLabel(hasQuadrantPanel, "Has Quadrant");
hasQuadrantField hasQuadrantLabel
.setToolTip("Select true if you want select quadrant column"); .setToolTip("Select true if you want select quadrant column");
// Quadrant // Quadrant
@ -266,7 +284,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
comboQuadrant.setEditable(false); comboQuadrant.setEditable(false);
comboQuadrant.setTriggerAction(TriggerAction.ALL); comboQuadrant.setTriggerAction(TriggerAction.ALL);
comboQuadrantField = new FieldLabel(comboQuadrant, "Quadrant"); comboQuadrantLabel = new FieldLabel(comboQuadrant, "Quadrant");
// Create // Create
createCoordinatesButton = new TextButton("Create"); createCoordinatesButton = new TextButton("Create");
@ -295,10 +313,12 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
vl.add(new FieldLabel(comboGsCoordinatesType, "Type"), vl.add(new FieldLabel(comboGsCoordinatesType, "Type"),
new VerticalLayoutData(1, -1)); 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(comboQuadrantLabel, new VerticalLayoutData(1, -1));
vl.add(comboQuadrantField, new VerticalLayoutData(1, -1));
vl.add(createCoordinatesButton, new VerticalLayoutData(-1, -1, vl.add(createCoordinatesButton, new VerticalLayoutData(-1, -1,
new Margins(10, 0, 10, 0))); new Margins(10, 0, 10, 0)));
@ -399,19 +419,37 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
protected void updateForCoordinatesType() { protected void updateForCoordinatesType() {
switch (gsCoordinatesType) { switch (gsCoordinatesType) {
case C_SQUARE: case C_SQUARE:
hasQuadrantField.setVisible(false); hasQuadrantLabel.setVisible(false);
comboQuadrantField.setVisible(false); comboQuadrantLabel.setVisible(false);
comboGsCoordinatesType.setValue(gsCoordinatesType); comboGsCoordinatesType.setValue(gsCoordinatesType);
resolutionField.setValue("10.0");
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
.geospatialCSquare32());
break; break;
case OCEAN_AREA: case OCEAN_AREA:
hasQuadrantTrue.setValue(true); if(quadrantColumns==null|| quadrantColumns.size()<1){
hasQuadrantField.setVisible(true); hasQuadrantTrue.setValue(false);
comboQuadrantField.setVisible(true); 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); comboGsCoordinatesType.setValue(gsCoordinatesType);
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
.geospatialOceanArea32());
break; break;
default: default:
hasQuadrantField.setVisible(false); resolutionField.setValue("10.0");
comboQuadrantField.setVisible(false); hasQuadrantLabel.setVisible(false);
comboQuadrantLabel.setVisible(false);
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
.geospatialCoordinates32());
break; break;
} }
@ -460,6 +498,16 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
if (latitude != null) { if (latitude != null) {
ColumnData longitude = comboLongitude.getCurrentValue(); ColumnData longitude = comboLongitude.getCurrentValue();
if (longitude != null) { 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 GeospatialCoordinatesType type = comboGsCoordinatesType
.getCurrentValue(); .getCurrentValue();
if (type != null) { if (type != null) {
@ -467,7 +515,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
switch(type){ switch(type){
case C_SQUARE: case C_SQUARE:
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession( gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
trId, latitude, longitude, type, false, null); trId, latitude, longitude, type, false, null, resolution);
callGeospatialCreateCoordinates(gsCreateCoordinatesSession); callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
break; break;
case OCEAN_AREA: case OCEAN_AREA:
@ -475,7 +523,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
ColumnData quadrant = comboQuadrant.getCurrentValue(); ColumnData quadrant = comboQuadrant.getCurrentValue();
if(quadrant!=null){ if(quadrant!=null){
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession( gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
trId, latitude, longitude, type, true, quadrant); trId, latitude, longitude, type, true, quadrant,resolution);
callGeospatialCreateCoordinates(gsCreateCoordinatesSession); callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
} else { } else {
UtilsGXT3.alert("Attention", UtilsGXT3.alert("Attention",
@ -485,7 +533,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
} else { } else {
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession( gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
trId, latitude, longitude, type, false, null); trId, latitude, longitude, type, false, null, resolution);
callGeospatialCreateCoordinates(gsCreateCoordinatesSession); callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
} }
@ -584,7 +632,8 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
public void onSuccess(ArrayList<ColumnData> result) { public void onSuccess(ArrayList<ColumnData> result) {
Log.trace("loaded " + result.size() + " ColumnData"); Log.trace("loaded " + result.size() + " ColumnData");
columns = new ArrayList<ColumnData>(); columns = new ArrayList<ColumnData>();
quadrantColumns = new ArrayList<ColumnData>();
for (ColumnData column : result) { for (ColumnData column : result) {
ColumnDataType columnDataType = ColumnDataType ColumnDataType columnDataType = ColumnDataType
.getColumnDataTypeFromId(column .getColumnDataTypeFromId(column

View File

@ -4,7 +4,6 @@ package org.gcube.portlets.user.td.tablewidget.client.resources;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle; import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ClientBundle.Source;
/** /**
* Resource Bundle * Resource Bundle
@ -156,6 +155,19 @@ public interface ResourceBundle extends ClientBundle {
@Source("table-type_32.png") @Source("table-type_32.png")
ImageResource tableType32(); 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") @Source("flag-green_32.png")
ImageResource geospatialCoordinates32(); ImageResource geospatialCoordinates32();

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB