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.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<ColumnData> 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<HasValue<Boolean>> 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<ColumnData> result) {
Log.trace("loaded " + result.size() + " ColumnData");
columns = new ArrayList<ColumnData>();
quadrantColumns = new ArrayList<ColumnData>();
for (ColumnData column : result) {
ColumnDataType columnDataType = ColumnDataType
.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.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();

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