Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@112035 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-02-13 16:29:52 +00:00 committed by Giancarlo Panichi
parent c2abe7dcae
commit ed7ec5b114
2 changed files with 97 additions and 89 deletions

View File

@ -21,6 +21,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredTy
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@ -102,7 +103,7 @@ public class GeometryCreatePointPanel extends FramedPanel implements
storeComboLongitude.commitChanges();
comboLongitude.reset();
comboLongitude.clear();
onResize();
forceLayout();
@ -115,8 +116,7 @@ public class GeometryCreatePointPanel extends FramedPanel implements
setHeaderVisible(false);
setBodyBorder(false);
Log.debug("Create GeometryPointPanel(): ["
+ trId.toString() + "]");
Log.debug("Create GeometryPointPanel(): [" + trId.toString() + "]");
// Column Propierties
ColumnDataPropertiesCombo propsColumnData = GWT
@ -153,16 +153,15 @@ public class GeometryCreatePointPanel extends FramedPanel implements
comboLongitude.setTypeAhead(false);
comboLongitude.setEditable(false);
comboLongitude.setTriggerAction(TriggerAction.ALL);
//Column Label
// Column Label
columnLabelField = new TextField();
columnLabelField.setValue("Points");
FieldLabel columnLab= new FieldLabel(columnLabelField, "Column Label");
FieldLabel columnLab = new FieldLabel(columnLabelField, "Column Label");
// Create
createPointButton = new TextButton("Create");
createPointButton.setIcon(ResourceBundle.INSTANCE
.geometryPoint());
createPointButton.setIcon(ResourceBundle.INSTANCE.geometryPoint());
createPointButton.setIconAlign(IconAlign.RIGHT);
createPointButton.setTitle("Create Point");
@ -184,12 +183,10 @@ 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(columnLab, new VerticalLayoutData(1, -1));
vl.add(createPointButton, new VerticalLayoutData(-1, -1,
new Margins(10, 0, 10, 0)));
vl.add(createPointButton, new VerticalLayoutData(-1, -1, new Margins(
10, 0, 10, 0)));
add(vl);
@ -250,24 +247,20 @@ public class GeometryCreatePointPanel extends FramedPanel implements
}
protected void onGeometryCreatePoint() {
ColumnData latitude = comboLatitude.getCurrentValue();
if (latitude != null) {
ColumnData longitude = comboLongitude.getCurrentValue();
if (longitude != null) {
String columnLab=columnLabelField.getCurrentValue();
if(columnLab!=null && !columnLab.isEmpty()){
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 {
} else {
UtilsGXT3.alert("Attention", "Select Longitude!");
}
} else {
@ -350,14 +343,24 @@ public class GeometryCreatePointPanel extends FramedPanel implements
columns = new ArrayList<ColumnData>();
for (ColumnData column : result) {
ColumnDataType columnDataType = ColumnDataType
.getColumnDataTypeFromId(column
.getDataTypeName());
if (columnDataType
.compareTo(ColumnDataType.Integer) == 0
|| columnDataType
.compareTo(ColumnDataType.Numeric) == 0) {
columns.add(column);
ColumnTypeCode columnTypeCode = ColumnTypeCode
.getColumnTypeCodeFromId(column
.getTypeCode());
if (columnTypeCode
.compareTo(ColumnTypeCode.ATTRIBUTE) == 0
|| columnTypeCode
.compareTo(ColumnTypeCode.MEASURE) == 0) {
ColumnDataType columnDataType = ColumnDataType
.getColumnDataTypeFromId(column
.getDataTypeName());
if (columnDataType
.compareTo(ColumnDataType.Integer) == 0
|| columnDataType
.compareTo(ColumnDataType.Numeric) == 0) {
columns.add(column);
}
}
}
@ -377,7 +380,7 @@ public class GeometryCreatePointPanel extends FramedPanel implements
public void update(TRId trId) {
this.trId = trId;
retrieveColumns();
}
@ -387,7 +390,7 @@ public class GeometryCreatePointPanel extends FramedPanel implements
*/
}
//
//
protected void openMonitorDialog(String taskId) {
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
monitorDialog.addProgressDialogListener(this);

View File

@ -25,6 +25,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestPropertiesPara
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.geospatial.GeospatialCoordinatesType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@ -125,7 +126,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
storeComboLongitude.commitChanges();
comboLongitude.reset();
comboLongitude.clear();
storeComboQuadrant.clear();
storeComboQuadrant.addAll(quadrantColumns);
storeComboQuadrant.commitChanges();
@ -134,12 +135,8 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
updateForCoordinatesType();
}
protected void create() {
setWidth(WIDTH);
@ -208,14 +205,13 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
comboGsCoordinatesType.setTypeAhead(false);
comboGsCoordinatesType.setEditable(false);
comboGsCoordinatesType.setTriggerAction(TriggerAction.ALL);
//Resolution
// Resolution
resolutionField = new TextField();
resolutionField.setValue("0.1");
FieldLabel resolutionLabel= new FieldLabel(resolutionField, "Resolution");
FieldLabel resolutionLabel = new FieldLabel(resolutionField,
"Resolution");
// Has Quadrant
hasQuadrantTrue = new Radio();
hasQuadrantTrue.setBoxLabel("True");
@ -236,16 +232,16 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
ValueChangeEvent<HasValue<Boolean>> event) {
try {
if (hasQuadrantTrue.getValue()) {
if(quadrantColumns==null|| quadrantColumns.size()<1){
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 {
comboQuadrantLabel.setVisible(false);
}
@ -313,9 +309,9 @@ 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(resolutionLabel, new VerticalLayoutData(1, -1));
vl.add(hasQuadrantLabel, new VerticalLayoutData(-1, -1));
vl.add(comboQuadrantLabel, new VerticalLayoutData(1, -1));
@ -327,7 +323,6 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
updateForCoordinatesType();
}
private void addHandlersForComboColumnLatitude(
@ -411,11 +406,11 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
}
protected void updatedComboGsCoordinatesType(GeospatialCoordinatesType type) {
gsCoordinatesType=type;
gsCoordinatesType = type;
updateForCoordinatesType();
}
protected void updateForCoordinatesType() {
switch (gsCoordinatesType) {
case C_SQUARE:
@ -425,10 +420,10 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
resolutionField.setValue("10.0");
createCoordinatesButton.setIcon(ResourceBundle.INSTANCE
.geospatialCSquare());
break;
case OCEAN_AREA:
if(quadrantColumns==null|| quadrantColumns.size()<1){
if (quadrantColumns == null || quadrantColumns.size() < 1) {
hasQuadrantTrue.setValue(false);
hasQuadrantFalse.setValue(true);
comboQuadrantLabel.setVisible(false);
@ -436,7 +431,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
hasQuadrantTrue.setValue(true);
hasQuadrantFalse.setValue(false);
comboQuadrantLabel.setVisible(true);
}
resolutionField.setValue("0.1");
hasQuadrantLabel.setVisible(true);
@ -452,11 +447,10 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
.geospatialCoordinates());
break;
}
onResize();
forceLayout();
}
private void addHandlersForComboQuadrant(
final LabelProvider<ColumnData> labelProvider) {
@ -484,7 +478,7 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
// TODO Auto-generated method stub
}
protected boolean hasQuadrant() {
if (hasQuadrantTrue.getValue()) {
return true;
@ -492,60 +486,62 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
return false;
}
}
protected void onGeospatialCreateCoordinates() {
ColumnData latitude = comboLatitude.getCurrentValue();
if (latitude != null) {
ColumnData longitude = comboLongitude.getCurrentValue();
if (longitude != null) {
String resol=resolutionField.getCurrentValue();
Double resolution=null;
String resol = resolutionField.getCurrentValue();
Double resolution = null;
try {
resolution= new Double(resol);
} catch(NumberFormatException e){
UtilsGXT3.alert("Attention",
"Insert a valid resolution!");
resolution = new Double(resol);
} catch (NumberFormatException e) {
UtilsGXT3.alert("Attention", "Insert a valid resolution!");
return;
}
GeospatialCoordinatesType type = comboGsCoordinatesType
.getCurrentValue();
if (type != null) {
GeospatialCreateCoordinatesSession gsCreateCoordinatesSession;
switch(type){
switch (type) {
case C_SQUARE:
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
trId, latitude, longitude, type, false, null, resolution);
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
trId, latitude, longitude, type, false, null,
resolution);
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
break;
case OCEAN_AREA:
if(hasQuadrant()){
ColumnData quadrant = comboQuadrant.getCurrentValue();
if(quadrant!=null){
if (hasQuadrant()) {
ColumnData quadrant = comboQuadrant
.getCurrentValue();
if (quadrant != null) {
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
trId, latitude, longitude, type, true, quadrant,resolution);
trId, latitude, longitude, type, true,
quadrant, resolution);
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
} else {
UtilsGXT3.alert("Attention",
"Select Quadrant column!");
break;
}
} else {
gsCreateCoordinatesSession = new GeospatialCreateCoordinatesSession(
trId, latitude, longitude, type, false, null, resolution);
trId, latitude, longitude, type, false,
null, resolution);
callGeospatialCreateCoordinates(gsCreateCoordinatesSession);
}
break;
default:
UtilsGXT3.alert("Attention",
"Select valid geospatial coordinates type!");
break;
}
} else {
UtilsGXT3.alert("Attention",
"Invalid Geospatial Coordinates Type!");
@ -633,19 +629,28 @@ public class GeospatialCreateCoordinatesPanel extends FramedPanel implements
Log.trace("loaded " + result.size() + " ColumnData");
columns = new ArrayList<ColumnData>();
quadrantColumns = new ArrayList<ColumnData>();
for (ColumnData column : result) {
ColumnDataType columnDataType = ColumnDataType
.getColumnDataTypeFromId(column
.getDataTypeName());
if (columnDataType
.compareTo(ColumnDataType.Numeric) == 0) {
columns.add(column);
} else {
ColumnTypeCode columnTypeCode = ColumnTypeCode
.getColumnTypeCodeFromId(column
.getTypeCode());
if (columnTypeCode
.compareTo(ColumnTypeCode.ATTRIBUTE) == 0
|| columnTypeCode
.compareTo(ColumnTypeCode.MEASURE) == 0) {
ColumnDataType columnDataType = ColumnDataType
.getColumnDataTypeFromId(column
.getDataTypeName());
if (columnDataType
.compareTo(ColumnDataType.Integer) == 0) {
.compareTo(ColumnDataType.Numeric) == 0) {
columns.add(column);
quadrantColumns.add(column);
} else {
if (columnDataType
.compareTo(ColumnDataType.Integer) == 0) {
columns.add(column);
quadrantColumns.add(column);
}
}
}