[Commits] r2074 - in core/trunk/geoext: examples examples/data lib/GeoExt/data tests tests/lib/GeoExt/data
commits at geoext.org
commits at geoext.org
Wed Apr 7 11:59:38 CEST 2010
Author: elemoine
Date: 2010-04-07 11:59:38 +0200 (Wed, 07 Apr 2010)
New Revision: 2074
Added:
core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html
Modified:
core/trunk/geoext/examples/attribute-form.html
core/trunk/geoext/examples/data/describe_feature_type.xml
core/trunk/geoext/lib/GeoExt/data/AttributeStore.js
core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.html
core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.js
core/trunk/geoext/tests/list-tests.html
Log:
AttributeStore - add field "restriction" in the default record type, r=bartvde (#252)
Modified: core/trunk/geoext/examples/attribute-form.html
===================================================================
--- core/trunk/geoext/examples/attribute-form.html 2010-04-03 18:06:14 UTC (rev 2073)
+++ core/trunk/geoext/examples/attribute-form.html 2010-04-07 09:59:38 UTC (rev 2074)
@@ -18,6 +18,11 @@
attributes read from a WFS DescribeFeatureType response. This can be
useful when doing feature editing with WFS-T.</p>
+ <p>Note that validation is activated based on the restriction
+ information read from the DescribeFeatureType document. For example the
+ "STATE_NAME", "STATE_FIPS", "SUB_REGION", and "STATE_ABBR" text fields
+ indicate errors if more than 5 characters are entered.</p>
+
<p>Note that the js is not minified so it is readable.
See <a href="attribute-form.js">attribute-form.js</a>.</p>
Modified: core/trunk/geoext/examples/data/describe_feature_type.xml
===================================================================
--- core/trunk/geoext/examples/data/describe_feature_type.xml 2010-04-03 18:06:14 UTC (rev 2073)
+++ core/trunk/geoext/examples/data/describe_feature_type.xml 2010-04-07 09:59:38 UTC (rev 2074)
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://www.openplans.org/topp" xmlns:topp="http://www.openplans.org/topp" xmlns:gml="http://www.opengis.net/gml" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"><xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/2.1.2.1/feature.xsd"/><xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" name="states_Type"><xs:complexContent><xs:extension base="gml:AbstractFeatureType"><xs:sequence><xs:element name="the_geom" minOccurs="0" nillable="true" type="gml:MultiPolygonPropertyType"/><xs:element name="STATE_NAME" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="2147483647"/></xs:restriction></xs:simpleType></xs:element><xs:element name="STATE_FIPS" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="2147483647"/></xs:restriction></xs:simpleType></xs:element><xs:element name="SUB_REGION" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="2147483647"/></xs:restriction></xs:simpleType></xs:element><xs:element name="STATE_ABBR" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="2147483647"/></xs:restriction></xs:simpleType></xs:element><xs:element name="LAND_KM" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="WATER_KM" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="PERSONS" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="FAMILIES" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="HOUSHOLD" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="MALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="FEMALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="WORKERS" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="DRVALONE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="CARPOOL" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="PUBTRANS" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="EMPLOYED" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="UNEMPLOY" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="SERVICE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="MANUAL" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="P_MALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="P_FEMALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="SAMP_POP" minOccurs="0" nillable="true" type="xs:double"/></xs:sequence></xs:extension></xs:complexContent></xs:complexType><xs:element name="states" type="topp:states_Type" substitutionGroup="gml:_Feature"/></xs:schema>
+<?xml version="1.0" encoding="UTF-8"?><xs:schema targetNamespace="http://www.openplans.org/topp" xmlns:topp="http://www.openplans.org/topp" xmlns:gml="http://www.opengis.net/gml" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"><xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://localhost:8080/geoserver/schemas/gml/2.1.2.1/feature.xsd"/><xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" name="states_Type"><xs:complexContent><xs:extension base="gml:AbstractFeatureType"><xs:sequence><xs:element name="the_geom" minOccurs="0" nillable="true" type="gml:MultiPolygonPropertyType"/><xs:element name="STATE_NAME" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="5"/></xs:restriction></xs:simpleType></xs:element><xs:element name="STATE_FIPS" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="5"/></xs:restriction></xs:simpleType></xs:element><xs:element name="SUB_REGION" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="5"/></xs:restriction></xs:simpleType></xs:element><xs:element name="STATE_ABBR" minOccurs="0" nillable="true"><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="5"/></xs:restriction></xs:simpleType></xs:element><xs:element name="LAND_KM" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="WATER_KM" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="PERSONS" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="FAMILIES" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="HOUSHOLD" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="MALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="FEMALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="WORKERS" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="DRVALONE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="CARPOOL" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="PUBTRANS" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="EMPLOYED" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="UNEMPLOY" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="SERVICE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="MANUAL" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="P_MALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="P_FEMALE" minOccurs="0" nillable="true" type="xs:double"/><xs:element name="SAMP_POP" minOccurs="0" nillable="true" type="xs:double"/></xs:sequence></xs:extension></xs:complexContent></xs:complexType><xs:element name="states" type="topp:states_Type" substitutionGroup="gml:_Feature"/></xs:schema>
Modified: core/trunk/geoext/lib/GeoExt/data/AttributeStore.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/AttributeStore.js 2010-04-03 18:06:14 UTC (rev 2073)
+++ core/trunk/geoext/lib/GeoExt/data/AttributeStore.js 2010-04-07 09:59:38 UTC (rev 2074)
@@ -40,7 +40,7 @@
* ``Array or Function``
* Either an array of field definition objects as passed to
* ``Ext.data.Record.create``, or a record constructor created using
- * ``Ext.data.Record.create``. Defaults to ``["name", "type"]``.
+ * ``Ext.data.Record.create``. Defaults to ``["name", "type", "restriction"]``.
*/
GeoExt.data.AttributeStore = function(c) {
c = c || {};
@@ -52,7 +52,7 @@
undefined
),
reader: new GeoExt.data.AttributeReader(
- c, c.fields || ["name", "type"]
+ c, c.fields || ["name", "type", "restriction"]
)
})
);
Modified: core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.html 2010-04-03 18:06:14 UTC (rev 2073)
+++ core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.html 2010-04-07 09:59:38 UTC (rev 2074)
@@ -11,11 +11,12 @@
<script type="text/javascript">
function test_read(t) {
- t.plan(3);
+ t.plan(4);
var reader = new GeoExt.data.AttributeReader({}, [
"name",
- "type"
+ "type",
+ "restriction"
]);
var records = reader.read({responseXML : doc});
@@ -26,9 +27,9 @@
var record = records.records[2];
//2 tests -- testing the fields of a record
- t.eq(record.get("name"), "STATE_FIPS", "[2] correct attribute name");
+ t.eq(record.get("name"), "STATE_FIPS", "[1] correct attribute name");
t.eq(record.get("type"), "xsd:string", "[2] correct attribute type name");
-
+ t.eq(record.get("restriction").maxLength, "2", "[3] correct attribute restriction");
}
function test_ignoreString(t) {
Modified: core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.js
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.js 2010-04-03 18:06:14 UTC (rev 2073)
+++ core/trunk/geoext/tests/lib/GeoExt/data/AttributeReader.js 2010-04-07 09:59:38 UTC (rev 2074)
@@ -8,7 +8,13 @@
'<xsd:sequence>' +
'<xsd:element maxOccurs="1" minOccurs="0" name="the_geom" nillable="true" type="gml:MultiSurfacePropertyType"/>' +
'<xsd:element maxOccurs="1" minOccurs="0" name="STATE_NAME" nillable="true" type="xsd:string"/>' +
- '<xsd:element maxOccurs="1" minOccurs="0" name="STATE_FIPS" nillable="true" type="xsd:string"/>' +
+ '<xsd:element maxOccurs="1" minOccurs="0" name="STATE_FIPS" nillable="true">' +
+ '<xsd:simpleType>' +
+ '<xsd:restriction base="xsd:string">' +
+ '<xsd:maxLength value="2"/>' +
+ '</xsd:restriction>' +
+ '</xsd:simpleType>' +
+ '</xsd:element>' +
'<xsd:element maxOccurs="1" minOccurs="0" name="SUB_REGION" nillable="true" type="xsd:string"/>' +
'<xsd:element maxOccurs="1" minOccurs="0" name="STATE_ABBR" nillable="true" type="xsd:string"/>' +
'<xsd:element maxOccurs="1" minOccurs="0" name="LAND_KM" nillable="true" type="xsd:double"/>' +
Added: core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html (rev 0)
+++ core/trunk/geoext/tests/lib/GeoExt/data/AttributeStore.html 2010-04-07 09:59:38 UTC (rev 2074)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html debug="true">
+ <head>
+ <script type="text/javascript" src="../../../../../ext/adapter/ext/ext-base.js"></script>
+ <script type="text/javascript" src="../../../../../ext/ext-all-debug.js"></script>
+
+ <script type="text/javascript" src="../../../../../openlayers/lib/OpenLayers.js"></script>
+ <script type="text/javascript" src="../../../../lib/GeoExt.js"></script>
+ <script type="text/javascript" src="AttributeReader.js"></script>
+
+ <script type="text/javascript">
+
+ function test_ctor(t) {
+ t.plan(4);
+
+ var store = new GeoExt.data.AttributeStore();
+ t.ok(store instanceof GeoExt.data.AttributeStore,
+ "ctor creates a GeoExt.data.AttributeStore");
+ t.ok(store instanceof Ext.data.Store,
+ "ctor creates an Ext.data.Store");
+ t.ok(store.reader instanceof GeoExt.data.AttributeReader,
+ "ctor sets an GeoExt.data.AttributeReader in the store");
+ t.ok(store.proxy instanceof Ext.data.HttpProxy,
+ "ctor sets an Ext.data.HttpProxy in the store");
+ }
+
+ </script>
+ <body>
+ <div id="map"></div>
+ </body>
+</html>
Modified: core/trunk/geoext/tests/list-tests.html
===================================================================
--- core/trunk/geoext/tests/list-tests.html 2010-04-03 18:06:14 UTC (rev 2073)
+++ core/trunk/geoext/tests/list-tests.html 2010-04-07 09:59:38 UTC (rev 2074)
@@ -1,6 +1,7 @@
<ul id="testlist">
<li>lib/overrides/override-ext-ajax.html</li>
<li>lib/GeoExt/data/AttributeReader.html</li>
+ <li>lib/GeoExt/data/AttributeStore.html</li>
<li>lib/GeoExt/data/FeatureRecord.html</li>
<li>lib/GeoExt/data/FeatureReader.html</li>
<li>lib/GeoExt/data/FeatureStore.html</li>
More information about the Commits
mailing list