I spent some time trying to get it to work. It works, but the check
for the SDK version in build.xml is not complete (for now it only
checks the SDK's build number, as I couldn't get it to compare
strings: ${flex-sdk-description.version}==4.5.0).
diff -ur graniteds/as3/framework/org/granite/tide/collections/
PagedCollection.as modifiedgraniteds/as3/framework/org/granite/tide/
collections/PagedCollection.as
--- graniteds/as3/framework/org/granite/tide/collections/
PagedCollection.as 2011-06-14 14:50:48.000000000 +0200
+++ modifiedgraniteds/as3/framework/org/granite/tide/collections/
PagedCollection.as 2011-06-17 10:58:47.000000000 +0200
@@ -30,6 +30,7 @@
import mx.collections.IViewCursor;
import mx.collections.ListCollectionView;
import mx.collections.Sort;
+ import mx.collections.ISort;
import mx.collections.SortField;
import mx.collections.errors.ItemPendingError;
import mx.core.IPropertyChangeNotifier;
@@ -505,12 +506,22 @@
}
[Bindable("sortChanged")]
+ CONFIG::flex_sdk_4
public override function get sort():Sort {
if (_tempSort && !_tempSort.sorted)
return _tempSort;
return super.sort;
}
-
+
+ [Bindable("sortChanged")]
+ CONFIG::flex_sdk_45
+ public override function get sort():ISort {
+ if (_tempSort && !_tempSort.sorted)
+ return _tempSort;
+ return super.sort;
+ }
+
+ CONFIG::flex_sdk_4
public override function set sort(newSort:Sort):void {
// Track changes on sort fields
if (sort != null && sort.fields != null) {
@@ -521,6 +532,17 @@
super.sort = newSort;
}
+ CONFIG::flex_sdk_45
+ public override function set sort(newSort:ISort):void
{
+ // Track changes on sort fields
+ if (sort != null && sort.fields != null) {
+ for each (var field:SortField in
sort.fields)
+
field.removeEventListener("descendingChanged",
sortFieldChangeHandler);
+ }
+ _sortFieldListenersSet = 0;
+ super.sort = newSort;
+ }
+
/**
* @private
diff -ur graniteds/as3/framework/org/granite/tide/collections/
PagedQuery.as modifiedgraniteds/as3/framework/org/granite/tide/
collections/PagedQuery.as
--- graniteds/as3/framework/org/granite/tide/collections/
PagedQuery.as 2011-06-14 14:50:34.000000000 +0200
+++ modifiedgraniteds/as3/framework/org/granite/tide/collections/
PagedQuery.as 2011-06-17 11:13:09.000000000 +0200
@@ -27,6 +27,7 @@
import mx.collections.IList;
import mx.collections.ListCollectionView;
import mx.collections.Sort;
+ import mx.collections.ISort;
import mx.collections.SortField;
import mx.collections.errors.ItemPendingError;
import mx.core.IPropertyChangeNotifier;
@@ -173,6 +174,7 @@
doFind(filter, first, max, sort,
findResponder);
}
+ CONFIG::flex_sdk_4
protected function doFind(filter:Object, first:int,
max:int, sort:Sort, findResponder:PagedCollectionResponder):void {
// Force evaluation of max, results and count
var order:* = null;
@@ -200,6 +202,35 @@
findResponder]
);
}
+
+ CONFIG::flex_sdk_45
+ protected function doFind(filter:Object, first:int,
max:int, sort:ISort, findResponder:PagedCollectionResponder):void {
+ // Force evaluation of max, results and count
+ var order:* = null;
+ var desc:* = null;
+ if (this.multipleSort) {
+ if (sort != null) {
+ order = new Array();
+ desc = new Array();
+ for each (var s:SortField in
sort.fields) {
+ order.push(
s.name);
+
desc.push(s.descending);
+ }
+ }
+ }
+ else {
+ order = sort != null &&
sort.fields.length > 0 ? sort.fields[0].name : null;
+ desc = sort != null &&
sort.fields.length > 0 ? sort.fields[0].descending : false;
+ }
+
+ _context.meta_callComponent(_component,
_methodName, [filter,
+ first,
+ max,
+ order,
+ desc,
+ findResponder]
+ );
+ }
protected override function
getResult(event:TideResultEvent, first:int, max:int):Object {
diff -ur graniteds/as3/framework/org/granite/tide/spring/PagedQuery.as
modifiedgraniteds/as3/framework/org/granite/tide/spring/PagedQuery.as
--- graniteds/as3/framework/org/granite/tide/spring/
PagedQuery.as 2011-06-14 14:50:38.000000000 +0200
+++ modifiedgraniteds/as3/framework/org/granite/tide/spring/
PagedQuery.as 2011-06-17 11:13:49.000000000 +0200
@@ -27,6 +27,7 @@
import mx.collections.IList;
import mx.collections.ListCollectionView;
import mx.collections.Sort;
+ import mx.collections.ISort;
import mx.collections.SortField;
import mx.collections.errors.ItemPendingError;
import mx.core.IPropertyChangeNotifier;
@@ -83,7 +84,7 @@
_methodName = "list";
}
-
+ CONFIG::flex_sdk_4
protected override function doFind(filter:Object,
first:int, max:int, sort:Sort,
findResponder:PagedCollectionResponder):void {
var order:* = null;
var desc:* = null;
@@ -129,6 +130,53 @@
super.doFind(filter, first, max, sort,
findResponder);
}
}
+
+ CONFIG::flex_sdk_45
+ protected override function doFind(filter:Object,
first:int, max:int, sort:ISort,
findResponder:PagedCollectionResponder):void {
+ var order:* = null;
+ var desc:* = null;
+ if (this.multipleSort && !
_useGrailsController) {
+ if (sort != null) {
+ order = new Array();
+ desc = new Array();
+ for each (var s:SortField in
sort.fields) {
+ order.push(
s.name);
+
desc.push(s.descending);
+ }
+ }
+ }
+ else {
+ order = sort != null &&
sort.fields.length > 0 ? sort.fields[0].name : null;
+ desc = sort != null &&
sort.fields.length > 0 ? sort.fields[0].descending : false;
+ }
+
+ if (_useGrailsController) {
+
_context.meta_callComponent(_component, _methodName, [{ filter:
filter,
+ offset: first,
+ max: max,
+ sort: order,
+ order: desc ? "desc" :
"asc"
+ },
+ true, // Use local binding
+ findResponder]
+ );
+ return;
+ }
+ else if (_useController) {
+
_context.meta_callComponent(_component, _methodName, [{ filter:
filter,
+ first: first,
+ max: max,
+ order: order,
+ desc: desc
+ },
+ true, // Use local binding
+ findResponder]
+ );
+ }
+ else {
+ super.doFind(filter, first, max, sort,
findResponder);
+ }
+ }
protected override function
getResult(event:TideResultEvent, first:int, max:int):Object {
diff -ur graniteds/build.xml modifiedgraniteds/build.xml
--- graniteds/build.xml 2011-06-14 14:50:34.000000000 +0200
+++ modifiedgraniteds/build.xml 2011-06-17 11:12:18.000000000 +0200
@@ -1243,7 +1243,7 @@
<target name="build.swc" depends="check.swc" unless="skip.compc">
<mkdir dir="build"/>
<mkdir dir="build/META-INF"/>
-
+
<!-- Create Swcs Manifest -->
<tstamp>
<format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss
'GMT'Z"/>
@@ -1267,6 +1267,8 @@
<zip basedir="build" update="true" keepcompression="true"
destfile="build/granite-essentials.swc" includes="META-
INF/MANIFEST.MF"/>
+ <xmlproperty file="${FLEX_HOME}/flex-sdk-
description.xml"/>
+
<compc output="build/granite.swc" use-network="false" warn-
missing-namespace-decl="false">
<source-path path-element="as3/framework"/>
<include-sources dir="as3/framework" includes="**/*.as"/>
@@ -1276,7 +1278,9 @@
<compiler.library-path dir="build" append="true">
<include name="granite-essentials.swc" />
</compiler.library-path>
- <define name="CONFIG::debugging" value="false"/>
+ <define name="CONFIG::debugging" value="false"/
>
+ <define name="CONFIG::flex_sdk_45" value="$
{flex-sdk-description.build} >= 20967"/>
+ <define name="CONFIG::flex_sdk_4" value="!
CONFIG::flex_sdk_45"/>
</compc>
<zip basedir="build" update="true" keepcompression="true"
destfile="build/granite.swc" includes="META-INF/
MANIFEST.MF"/>