yishayw commented on a change in pull request #869:
URL: https://github.com/apache/royale-asjs/pull/869#discussion_r441664157
##########
File path:
frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/combobox/ComboBoxItemByField.as
##########
@@ -0,0 +1,71 @@
+package com.iest.winplusweb.beads
+{
+ import org.apache.royale.core.IBead;
+ import org.apache.royale.jewel.ComboBox;
+ import org.apache.royale.core.IStrand;
+ import org.apache.royale.collections.CollectionUtils;
+ import org.apache.royale.collections.ArrayList;
+ import org.apache.royale.events.Event;
+
+ public class ComboBoxItemByField implements IBead{
+
+ protected var comboBox:ComboBox;
+
+
+ public function ComboBoxItemByField()
+ {
+ }
+
+ public function set strand(value:IStrand):void
+ {
+ comboBox = value as ComboBox;
+ comboBox.addEventListener("selectionChanged",
selectionChangedHandler);
+ updateHost();
+ }
+
+ private var _valueField:String;
+
+ public function get valueField():String
+ {
+ return _valueField;
+ }
+ public function set valueField(value:String):void
+ {
+ _valueField = value;
+ updateHost();
+ }
+
+ private var _selectedValue:*;
+
+ public function get selectedValue():*{
+ return _selectedValue;
+ }
+
+ public function set selectedValue(value:*):void{
+ _selectedValue = value;
+ updateHost();
+ }
+
+ protected function updateHost():void
+ {
+ if(comboBox && valueField != "" && selectedValue !=
null){
+ var aux:* =
CollectionUtils.getItemByField(comboBox.dataProvider as
ArrayList,valueField,selectedValue);
Review comment:
CollectionUtils.getItemByField() expects an ICollectionView. It's better
to use an interface rather than a conrete class when possible for better reuse.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]