Updated Geometry Type Support
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@100070 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
64af2a1c83
commit
94d4482581
|
@ -61,14 +61,17 @@ import com.sencha.gxt.widget.core.client.form.DateField;
|
||||||
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.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.validator.RegExValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EditRowPanel extends FramedPanel
|
public class EditRowPanel extends FramedPanel implements MonitorDialogListener {
|
||||||
implements MonitorDialogListener {
|
private static final String GEOMETRY_REGEXPR = "(\\s*POINT\\s*\\(\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*\\)\\s*$)"
|
||||||
|
+ "|(\\s*LINESTRING\\s*\\((\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*,)+\\s*((-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*)\\)\\s*$)";
|
||||||
|
|
||||||
protected String WIDTH = "510px";
|
protected String WIDTH = "510px";
|
||||||
protected String HEIGHT = "370px";
|
protected String HEIGHT = "370px";
|
||||||
protected String FIELDSHEIGHT = "370px";
|
protected String FIELDSHEIGHT = "370px";
|
||||||
|
@ -81,8 +84,6 @@ public class EditRowPanel extends FramedPanel
|
||||||
protected RowRaw rowRaw;
|
protected RowRaw rowRaw;
|
||||||
protected boolean editRow;
|
protected boolean editRow;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected VerticalLayoutContainer v;
|
protected VerticalLayoutContainer v;
|
||||||
private TextButton btnSave;
|
private TextButton btnSave;
|
||||||
private TextButton btnClose;
|
private TextButton btnClose;
|
||||||
|
@ -325,6 +326,9 @@ public class EditRowPanel extends FramedPanel
|
||||||
if (col.getDataTypeName().compareTo(
|
if (col.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Geometry.toString()) == 0) {
|
ColumnDataType.Geometry.toString()) == 0) {
|
||||||
TextField geometry = new TextField();
|
TextField geometry = new TextField();
|
||||||
|
geometry.addValidator(new RegExValidator(
|
||||||
|
GEOMETRY_REGEXPR,
|
||||||
|
"Geometry Type not valid"));
|
||||||
String value = "";
|
String value = "";
|
||||||
if (editRow) {
|
if (editRow) {
|
||||||
value = rowRaw.getMap().get(
|
value = rowRaw.getMap().get(
|
||||||
|
@ -443,7 +447,6 @@ public class EditRowPanel extends FramedPanel
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
String viewColumn = col.getRelationship().getTargetColumnId();
|
String viewColumn = col.getRelationship().getTargetColumnId();
|
||||||
|
|
||||||
String valueOnViewColumn = null;
|
String valueOnViewColumn = null;
|
||||||
|
@ -554,11 +557,20 @@ public class EditRowPanel extends FramedPanel
|
||||||
ColumnDataType.Geometry.toString()) == 0) {
|
ColumnDataType.Geometry.toString()) == 0) {
|
||||||
TextField geometry = (TextField) fieldLabel
|
TextField geometry = (TextField) fieldLabel
|
||||||
.getWidget();
|
.getWidget();
|
||||||
|
if (geometry.isValid()) {
|
||||||
String val = geometry.getCurrentValue();
|
String val = geometry.getCurrentValue();
|
||||||
if (val == null) {
|
if (val == null) {
|
||||||
val = "";
|
val = "";
|
||||||
}
|
}
|
||||||
maps.put(columnId, val);
|
maps.put(columnId, val);
|
||||||
|
} else {
|
||||||
|
UtilsGXT3
|
||||||
|
.alert("Attentions","The value of "+
|
||||||
|
colCurrent.getLabel()
|
||||||
|
+ " is not a valid text representation for geometry type ( e.g. POINT(34 56) or LINESTRING(65 34, 56.43 78.65)!");
|
||||||
|
btnSave.enable();
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (colCurrent.getDataTypeName().compareTo(
|
if (colCurrent.getDataTypeName().compareTo(
|
||||||
ColumnDataType.Integer.toString()) == 0) {
|
ColumnDataType.Integer.toString()) == 0) {
|
||||||
|
@ -638,8 +650,6 @@ public class EditRowPanel extends FramedPanel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void callEditRow(EditRowSession editRowSession) {
|
protected void callEditRow(EditRowSession editRowSession) {
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.startEditRow(editRowSession,
|
TDGWTServiceAsync.INSTANCE.startEditRow(editRowSession,
|
||||||
|
@ -664,7 +674,6 @@ public class EditRowPanel extends FramedPanel
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void close() {
|
protected void close() {
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.close();
|
parent.close();
|
||||||
|
|
Loading…
Reference in New Issue