This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 52b0648 jewel-searchfilterforlist-bead: add length property
52b0648 is described below
commit 52b0648f306890103988a17330d97a982fe69d64
Author: Carlos Rovira <[email protected]>
AuthorDate: Fri May 10 18:08:55 2019 +0200
jewel-searchfilterforlist-bead: add length property
---
.../src/main/royale/ListPlayGround.mxml | 3 +-
.../controls/textinput/SearchFilterForList.as | 38 +++++++++++++++++++++-
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml
b/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml
index 88a5ced..397c9a2 100644
--- a/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml
@@ -184,10 +184,11 @@ limitations under the License.
<j:Label html="{'Selected
Index: ' + iconList.selectedIndex}"/>
<j:Label html="Selected Item
description:"/>
<j:Label
html="{describeIconItem(iconList.selectedItem)}"/>
+ <j:Label html="{'list filtered
length: ' + filter.length}"/>
<j:TextInput>
<j:beads>
<j:TextPrompt
prompt="filter list..."/>
-
<j:SearchFilterForList list="{iconList}"/>
+
<j:SearchFilterForList id="filter" list="{iconList}"/>
</j:beads>
</j:TextInput>
<!-- <j:Button text="Trace
Collection Labels" click="traceCollectionLabels()"/> -->
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as
index 7ed728f..9c3594b 100644
---
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as
@@ -31,6 +31,10 @@ package org.apache.royale.jewel.beads.controls.textinput
/**
* The SearchFilterForList bead class is a specialty bead that can be
used with
* a Jewel TextInput to filter options in other List component
+ *
+ * Notice that the filtering is only visual, and the underlaying
dataProvider is not
+ * filtered itself. To get a filtered view of the dataProvider you
should use ArrayListView
+ * API.
*
* @langversion 3.0
* @playerversion Flash 10.2
@@ -51,11 +55,25 @@ package org.apache.royale.jewel.beads.controls.textinput
{
}
+ private var _list:List;
/**
* the list to filter
*/
[Bindable]
- public var list:List;
+ public function get list():List
+ {
+ return _list;
+ }
+
+ public function set list(value:List):void
+ {
+ _list = value;
+
+ if(_list != null)
+ {
+ length = list.numElements;
+ }
+ }
/**
* the filter function to use to filter entries in the list
@@ -69,6 +87,22 @@ package org.apache.royale.jewel.beads.controls.textinput
[Bindable]
public var useDecoration:Boolean = true;
+ private var _length:int;
+
+ /**
+ * enables label decoration when filter
+ */
+ [Bindable]
+ public function get length():int
+ {
+ return _length;
+ }
+
+ public function set length(value:int):void
+ {
+ _length = value;
+ }
+
protected var _strand:IStrand;
/**
@@ -157,6 +191,7 @@ package org.apache.royale.jewel.beads.controls.textinput
var ir:ListItemRenderer;
var numElements:int = list.numElements;
var item:Object = null;
+ length = numElements;
while (numElements--)
{
ir = list.getElementAt(numElements) as ListItemRenderer;
@@ -178,6 +213,7 @@ package org.apache.royale.jewel.beads.controls.textinput
}
} else {
ir.visible = false;
+ length--;
}
}