flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [2/2] git commit: [flex-asjs] [refs/heads/develop] - FLEX-35354 - Rename TabsItemRendererFactoryForArrayListData to TabsDynamicItemsRendererFactoryForArrayListData - Update TabsDynamicItemsRendererFactoryForArrayListData with new implementation of ...
Date Sun, 27 Aug 2017 07:40:36 GMT
Is there a list of all these options somewhere? My understanding was that only “as” coercions
are skipped and not function-style coercions. (or whatever it’s called)

My point is that multiple calls to Language.as is wasteful.

For example:

It might be a good idea to have a coercion in the strand setter to make sure that the Strand
is an IEventDispatcher. However, once it’s set, there’s no reason to have further Language.as
calls every time the _strand is accessed as an IEventDispatcher.

The same goes for multiple calls to UIBase() in the same function. In the case of UIBase,
I don’t see how the result can be anything other than a UIBase considering it’s the factory
creating it. If so, the Language.as call should probably be avoided completely.

> On Aug 27, 2017, at 8:33 AM, Alex Harui <aharui@adobe.com.INVALID> wrote:
> 
> I'm not sure I understand.  Why is this not what's needed?  Just because
> you are trying to get the compiler to not complain?  There is a
> skipFunctionCoercions option that turns off all calls to Language.is.  We
> don't have a directive per occurrence, but I suppose we could.
> 
> -Alex
> 
> On 8/26/17, 9:41 PM, "Harbs" <harbs.lists@gmail.com> wrote:
> 
>> FYI:
>> 
>> The pattern of MyClass(myObject) will always produce JS code which calls
>> Language.as which throws an RTE if the object cannot be coerced as the
>> class. Using compiler options to ignore coercion has no effect on this
>> case.
>> 
>> Most of the time, this is not what’s needed.
>> 
>> Generally a better pattern is (myObject as MyClass). This will produce JS
>> code which calls Language.as unless coercion is ignored in which case the
>> cast is simply dropped and more efficient JS code is used.
>> 
>> There are a  number of casts to IEventDispatcher and UIBase which should
>> probably be redone.
>> 
>> Thanks,
>> Harbs
>> 
>>> On Aug 24, 2017, at 12:53 AM, piotrz@apache.org wrote:
>>> 
>>> FLEX-35354 - Rename TabsItemRendererFactoryForArrayListData  to
>>> TabsDynamicItemsRendererFactoryForArrayListData
>>> - Update TabsDynamicItemsRendererFactoryForArrayListData with new
>>> implementation of DynamicItemsRendererFactoryForArrayListData
>>> - Update example MDLDynamicTabsExample
>>> 
>>> 
>>> Project: 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Frepo&data=02%7C01%7C%7C468a0ef52
>>> 6744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6363
>>> 94056917929660&sdata=ywP24lHiNv9U2%2FYYts%2FExMJf3XjnY%2BUJZ%2FW5BekcEFo%
>>> 3D&reserved=0
>>> Commit: 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fcommit%2F5b8f1c58&data=02%7C01%7
>>> C%7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7
>>> C0%7C0%7C636394056917929660&sdata=yieFxBWlW9k%2ByWpzlHwaFRt71MWQAAbyh9uGm
>>> klciVQ%3D&reserved=0
>>> Tree: 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Ftree%2F5b8f1c58&data=02%7C01%7C%
>>> 7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0
>>> %7C0%7C636394056917929660&sdata=lx5%2F2Bchvdta6%2B3GLNbsU1QxjOo3XVCU9w0Jb
>>> fhiGf0%3D&reserved=0
>>> Diff: 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fdiff%2F5b8f1c58&data=02%7C01%7C%
>>> 7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0
>>> %7C0%7C636394056917929660&sdata=8kjuuPIDmkRV77SkM8P3vTzOQw9eVM3wicCZ6deva
>>> Cg%3D&reserved=0
>>> 
>>> Branch: refs/heads/develop
>>> Commit: 5b8f1c5898c776eb7470e855073833e68e794a6d
>>> Parents: 56e467a
>>> Author: piotrz <piotrz@apache.org>
>>> Authored: Wed Aug 23 23:53:09 2017 +0200
>>> Committer: piotrz <piotrz@apache.org>
>>> Committed: Wed Aug 23 23:53:09 2017 +0200
>>> 
>>> ----------------------------------------------------------------------
>>> .../src/main/flex/views/InitialView.mxml        |  24 ++-
>>> .../src/main/resources/mdl-styles.css           |   2 +-
>>> .../src/main/flex/MDLClasses.as                 |   2 +-
>>> ...namicItemsRendererFactoryForArrayListData.as | 108 ++++++++++
>>> .../TabsItemRendererFactoryForArrayListData.as  | 206
>>> -------------------
>>> .../org/apache/flex/mdl/beads/views/TabsView.as |   6 +-
>>> .../src/main/resources/defaults.css             |   4 +-
>>> 7 files changed, 129 insertions(+), 223 deletions(-)
>>> ----------------------------------------------------------------------
>>> 
>>> 
>>> 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F5b8f1c58%2Fexamples%2Ffle
>>> xjs%2FMDLDynamicTabsExample%2Fsrc%2Fmain%2Fflex%2Fviews%2FInitialView.mxm
>>> l&data=02%7C01%7C%7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794
>>> aed2c178decee1%7C0%7C0%7C636394056917929660&sdata=6UIGaZ%2FWGyCUrbpACPlAW
>>> bOsjRpPyTOXU%2FfYQ6pGe%2Fs%3D&reserved=0
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/examples/flexjs/MDLDynamicTabsExample/src/main/flex/views/InitialView.m
>>> xml 
>>> b/examples/flexjs/MDLDynamicTabsExample/src/main/flex/views/InitialView.m
>>> xml
>>> index 5523b6f..1482982 100644
>>> --- 
>>> a/examples/flexjs/MDLDynamicTabsExample/src/main/flex/views/InitialView.m
>>> xml
>>> +++ 
>>> b/examples/flexjs/MDLDynamicTabsExample/src/main/flex/views/InitialView.m
>>> xml
>>> @@ -39,14 +39,18 @@ limitations under the License.
>>> 	<mdl:model>
>>> 		<models:TabsModel id="tabsModel"/>
>>> 	</mdl:model>
>>> -	<mdl:Tabs id="myTabs" selectedIndex="1" tabIdField="tabId"
>>> labelField="label" className="customTabs"
>>> -			  dataProvider="{tabsModel.tabs}" width="500">
>>> -		<mdl:beads>
>>> -			<js:DataProviderCollectionChangeNotifier sourceID="tabsModel"
>>> propertyName="tabs"
>>> -													 destinationPropertyName="dataProvider"
>>> changeEventName="dataProviderChanged"  />
>>> -			<js:DataProviderItemsChangeNotifier sourceID="tabsModel"
>>> propertyName="tabs"
>>> -												destinationPropertyName="dataProvider"
>>> changeEventName="dataProviderChanged"  />
>>> -		</mdl:beads>
>>> -	</mdl:Tabs>
>>> -	<mdl:Button text="Add new Tab" click="onAddNewTabClick(event)"/>
>>> +	<mdl:GridCell column="6">
>>> +		<mdl:Tabs id="myTabs" selectedIndex="1" tabIdField="tabId"
>>> labelField="label" className="customTabs"
>>> +				  dataProvider="{tabsModel.tabs}" width="500">
>>> +			<mdl:beads>
>>> +				<js:DataProviderCollectionChangeNotifier sourceID="tabsModel"
>>> propertyName="tabs"
>>> +														 destinationPropertyName="dataProvider"
>>> changeEventName="dataProviderChanged"  />
>>> +				<js:DataProviderItemsChangeNotifier sourceID="tabsModel"
>>> propertyName="tabs"
>>> +													destinationPropertyName="dataProvider"
>>> changeEventName="dataProviderChanged"  />
>>> +			</mdl:beads>
>>> +		</mdl:Tabs>
>>> +	</mdl:GridCell>
>>> +	<mdl:GridCell>
>>> +		<mdl:Button text="Add new Tab" click="onAddNewTabClick(event)"/>
>>> +	</mdl:GridCell>
>>> </mdl:Grid>
>>> \ No newline at end of file
>>> 
>>> 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F5b8f1c58%2Fexamples%2Ffle
>>> xjs%2FMDLDynamicTabsExample%2Fsrc%2Fmain%2Fresources%2Fmdl-styles.css&dat
>>> a=02%7C01%7C%7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c
>>> 178decee1%7C0%7C0%7C636394056917929660&sdata=nEVi%2BuNLD%2Bo5kGBb7oLC3XmW
>>> gUYbuPO7RD3S919OZdA%3D&reserved=0
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/examples/flexjs/MDLDynamicTabsExample/src/main/resources/mdl-styles.css
>>> 
>>> b/examples/flexjs/MDLDynamicTabsExample/src/main/resources/mdl-styles.css
>>> index 8d52a54..e713389 100644
>>> --- 
>>> a/examples/flexjs/MDLDynamicTabsExample/src/main/resources/mdl-styles.css
>>> +++ 
>>> b/examples/flexjs/MDLDynamicTabsExample/src/main/resources/mdl-styles.css
>>> @@ -27,5 +27,5 @@
>>> {
>>>  IItemRenderer:
>>> ClassReference("itemRenderers.CustomTabBarPanelItemRenderer");
>>>  IBeadModel: 
>>> ClassReference("org.apache.flex.mdl.beads.models.TabArrayListModel");
>>> -  IDataProviderItemRendererMapper:
>>> ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArray
>>> ListData");
>>> +  IDataProviderItemRendererMapper:
>>> ClassReference("org.apache.flex.mdl.beads.TabsDynamicItemsRendererFactory
>>> ForArrayListData");
>>> }
>>> \ No newline at end of file
>>> 
>>> 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F5b8f1c58%2Fframeworks%2Fp
>>> rojects%2FMaterialDesignLite%2Fsrc%2Fmain%2Fflex%2FMDLClasses.as&data=02%
>>> 7C01%7C%7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C0%7C636394056917929660&sdata=RMYR%2BVdF6xwn%2FTckqgg2cLec5J8nm
>>> N9rXekVroqa7lc%3D&reserved=0
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
>>> b/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
>>> index d9ac1ac..00ffe9d 100644
>>> --- a/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
>>> +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
>>> @@ -28,7 +28,7 @@ package
>>> 	internal class MDLClasses
>>> 	{
>>> 		import org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayData;
>>> TabsItemRendererFactoryForArrayData;
>>> -		import 
>>> org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayListData;
>>> TabsItemRendererFactoryForArrayListData;
>>> +		import 
>>> org.apache.flex.mdl.beads.TabsDynamicItemsRendererFactoryForArrayListData
>>> ; TabsDynamicItemsRendererFactoryForArrayListData;
>>> 		import org.apache.flex.mdl.beads.models.TabArrayModel; TabArrayModel;
>>> 		import org.apache.flex.mdl.beads.models.TabArrayListModel;
>>> TabArrayListModel;
>>> 		import org.apache.flex.mdl.beads.models.ToastModel; ToastModel;
>>> 
>>> 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F5b8f1c58%2Fframeworks%2Fp
>>> rojects%2FMaterialDesignLite%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2F
>>> mdl%2Fbeads%2FTabsDynamicItemsRendererFactoryForArrayListData.as&data=02%
>>> 7C01%7C%7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C0%7C636394056917929660&sdata=%2BapbeLMt3Jv2PIDUOvAjWptKCMWp%2B
>>> mTKXx06sbZMn80%3D&reserved=0
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/TabsDynamicItemsRendererFactoryForArrayListData.as
>>> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/TabsDynamicItemsRendererFactoryForArrayListData.as
>>> new file mode 100644
>>> index 0000000..371f79b
>>> --- /dev/null
>>> +++ 
>>> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/TabsDynamicItemsRendererFactoryForArrayListData.as
>>> @@ -0,0 +1,108 @@
>>> 
>>> +////////////////////////////////////////////////////////////////////////
>>> ////////
>>> +//
>>> +//  Licensed to the Apache Software Foundation (ASF) under one or more
>>> +//  contributor license agreements.  See the NOTICE file distributed
>>> with
>>> +//  this work for additional information regarding copyright ownership.
>>> +//  The ASF licenses this file to You under the Apache License,
>>> Version 2.0
>>> +//  (the "License"); you may not use this file except in compliance
>>> with
>>> +//  the License.  You may obtain a copy of the License at
>>> +//
>>> +//      
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>> e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7C%7C468a0ef526744f407ac408d4
>>> ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636394056917929660&
>>> sdata=eby%2BNBek4IgNDs2RDn%2F%2F4Gf62h70N7cAe0zfQbmRRqY%3D&reserved=0
>>> +//
>>> +//  Unless required by applicable law or agreed to in writing, software
>>> +//  distributed under the License is distributed on an "AS IS" BASIS,
>>> +//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>> implied.
>>> +//  See the License for the specific language governing permissions and
>>> +//  limitations under the License.
>>> +//
>>> 
>>> +////////////////////////////////////////////////////////////////////////
>>> ////////
>>> +package org.apache.flex.mdl.beads
>>> +{
>>> +    import org.apache.flex.collections.IArrayList;
>>> +    import org.apache.flex.core.IListPresentationModel;
>>> +    import org.apache.flex.events.CollectionEvent;
>>> +
>>> +    import org.apache.flex.events.IEventDispatcher;
>>> +    import 
>>> org.apache.flex.html.beads.DynamicItemsRendererFactoryForArrayListData;
>>> +    import org.apache.flex.mdl.beads.models.ITabModel;
>>> +    import org.apache.flex.mdl.supportClasses.ITabItemRenderer;
>>> +    import org.apache.flex.events.Event;
>>> +
>>> +    
>>> [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRender
>>> erEvent")]
>>> +
>>> +    /**
>>> +     *  The TabsDynamicItemsRendererFactoryForArrayListData class
>>> reads an
>>> +     *  array of data and creates an item renderer for every
>>> +     *  ITabItemRenderer in the array.
>>> +     *
>>> +     *  @langversion 3.0
>>> +     *  @playerversion Flash 10.2
>>> +     *  @playerversion AIR 2.6
>>> +     *  @productversion FlexJS 0.8
>>> +     */
>>> +    public class TabsDynamicItemsRendererFactoryForArrayListData
>>> extends DynamicItemsRendererFactoryForArrayListData
>>> +    {
>>> +        public function
>>> TabsDynamicItemsRendererFactoryForArrayListData(target:Object = null)
>>> +        {
>>> +            super(target);
>>> +        }
>>> +
>>> +        protected var tabsIdField:String;
>>> +
>>> +        /**
>>> +         *  finish setup
>>> +         *
>>> +         *  @langversion 3.0
>>> +         *  @playerversion Flash 10.2
>>> +         *  @playerversion AIR 2.6
>>> +         *  @productversion FlexJS 0.8
>>> +         */
>>> +        override protected function initComplete(event:Event):void
>>> +        {
>>> +            var model:ITabModel = _strand.getBeadByType(ITabModel) as
>>> ITabModel;
>>> +            tabsIdField = model.tabIdField;
>>> +
>>> +            super.initComplete(event);
>>> +        }
>>> +
>>> +        override protected function
>>> dataProviderChangeHandler(event:Event):void
>>> +        {
>>> +            var dp:IArrayList = dataProviderModel.dataProvider as
>>> IArrayList;
>>> +            if (!dp)
>>> +                return;
>>> +
>>> +            dataGroup.removeAllItemRenderers();
>>> +
>>> +            var presentationModel:IListPresentationModel =
>>> _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
>>> +
>>> +            var n:int = dp.length;
>>> +            for (var i:int = 0; i < n; i++)
>>> +            {
>>> +                var ir:ITabItemRenderer =
>>> itemRendererFactory.createItemRenderer(dataGroup) as ITabItemRenderer;
>>> +                ir.tabIdField = tabsIdField;
>>> +
>>> +                var item:Object = dp.getItemAt(i);
>>> +                fillRenderer(i, item, ir, presentationModel);
>>> +            }
>>> +
>>> +            IEventDispatcher(_strand).dispatchEvent(new
>>> Event("itemsCreated"));
>>> +        }
>>> +
>>> +        override protected function
>>> itemAddedHandler(event:CollectionEvent):void
>>> +        {
>>> +            var dp:IArrayList = dataProviderModel.dataProvider as
>>> IArrayList;
>>> +            if (!dp)
>>> +                return;
>>> +
>>> +            var presentationModel:IListPresentationModel =
>>> _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
>>> +
>>> +            var ir:ITabItemRenderer =
>>> itemRendererFactory.createItemRenderer(dataGroup) as ITabItemRenderer;
>>> +            ir.tabIdField = tabsIdField;
>>> +
>>> +            var index:int = dp.length - 1;
>>> +            fillRenderer(index, event.item, ir, presentationModel);
>>> +
>>> +            IEventDispatcher(_strand).dispatchEvent(new
>>> Event("itemsCreated"));
>>> +        }
>>> +    }
>>> +}
>>> 
>>> 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F5b8f1c58%2Fframeworks%2Fp
>>> rojects%2FMaterialDesignLite%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2F
>>> mdl%2Fbeads%2FTabsItemRendererFactoryForArrayListData.as&data=02%7C01%7C%
>>> 7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0
>>> %7C0%7C636394056917929660&sdata=ed9O6dzBKiMa5HKK7MQuoOfOuyFksehYMp3ZokvwH
>>> vc%3D&reserved=0
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/TabsItemRendererFactoryForArrayListData.as
>>> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/TabsItemRendererFactoryForArrayListData.as
>>> deleted file mode 100644
>>> index c323332..0000000
>>> --- 
>>> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/TabsItemRendererFactoryForArrayListData.as
>>> +++ /dev/null
>>> @@ -1,206 +0,0 @@
>>> 
>>> -////////////////////////////////////////////////////////////////////////
>>> ////////
>>> -//
>>> -//  Licensed to the Apache Software Foundation (ASF) under one or more
>>> -//  contributor license agreements.  See the NOTICE file distributed
>>> with
>>> -//  this work for additional information regarding copyright ownership.
>>> -//  The ASF licenses this file to You under the Apache License,
>>> Version 2.0
>>> -//  (the "License"); you may not use this file except in compliance
>>> with
>>> -//  the License.  You may obtain a copy of the License at
>>> -//
>>> -//      
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apach
>>> e.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7C%7C468a0ef526744f407ac408d4
>>> ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636394056917929660&
>>> sdata=eby%2BNBek4IgNDs2RDn%2F%2F4Gf62h70N7cAe0zfQbmRRqY%3D&reserved=0
>>> -//
>>> -//  Unless required by applicable law or agreed to in writing, software
>>> -//  distributed under the License is distributed on an "AS IS" BASIS,
>>> -//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>>> implied.
>>> -//  See the License for the specific language governing permissions and
>>> -//  limitations under the License.
>>> -//
>>> 
>>> -////////////////////////////////////////////////////////////////////////
>>> ////////
>>> -package org.apache.flex.mdl.beads
>>> -{
>>> -    import org.apache.flex.collections.IArrayList;
>>> -    import org.apache.flex.core.IBead;
>>> -    import org.apache.flex.core.IDataProviderItemRendererMapper;
>>> -    import org.apache.flex.core.IItemRendererClassFactory;
>>> -    import org.apache.flex.core.IItemRendererParent;
>>> -    import org.apache.flex.core.IListPresentationModel;
>>> -    import org.apache.flex.core.IStrand;
>>> -    import org.apache.flex.core.SimpleCSSStyles;
>>> -    import org.apache.flex.core.UIBase;
>>> -    import org.apache.flex.core.ValuesManager;
>>> -    import org.apache.flex.events.CollectionEvent;
>>> -
>>> -    import org.apache.flex.events.EventDispatcher;
>>> -    import org.apache.flex.events.IEventDispatcher;
>>> -    import org.apache.flex.html.beads.IListView;
>>> -    import org.apache.flex.mdl.beads.models.ITabModel;
>>> -    import org.apache.flex.mdl.supportClasses.ITabItemRenderer;
>>> -    import org.apache.flex.events.Event;
>>> -
>>> -    
>>> [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRender
>>> erEvent")]
>>> -
>>> -    /**
>>> -     *  The TabsItemRendererFactoryForArrayListData class reads an
>>> -     *  array of data and creates an item renderer for every
>>> -     *  ITabItemRenderer in the array.
>>> -     *
>>> -     *  @langversion 3.0
>>> -     *  @playerversion Flash 10.2
>>> -     *  @playerversion AIR 2.6
>>> -     *  @productversion FlexJS 0.8
>>> -     */
>>> -    public class TabsItemRendererFactoryForArrayListData extends
>>> EventDispatcher implements IBead, IDataProviderItemRendererMapper
>>> -    {
>>> -        public function
>>> TabsItemRendererFactoryForArrayListData(target:Object = null)
>>> -        {
>>> -            super(target);
>>> -        }
>>> -
>>> -        protected var dataProviderModel:ITabModel;
>>> -
>>> -        protected var labelField:String;
>>> -        protected var tabsIdField:String;
>>> -
>>> -        private var _strand:IStrand;
>>> -
>>> -        /**
>>> -         *  @copy org.apache.flex.core.IBead#strand
>>> -         *
>>> -         *  @langversion 3.0
>>> -         *  @playerversion Flash 10.2
>>> -         *  @playerversion AIR 2.6
>>> -         *  @productversion FlexJS 0.8
>>> -         */
>>> -        public function set strand(value:IStrand):void
>>> -        {
>>> -            _strand = value;
>>> -            
>>> IEventDispatcher(value).addEventListener("initComplete",finishSetup);
>>> -        }
>>> -
>>> -        /**
>>> -         *  finish setup
>>> -         *
>>> -         *  @langversion 3.0
>>> -         *  @playerversion Flash 10.2
>>> -         *  @playerversion AIR 2.6
>>> -         *  @productversion FlexJS 0.8
>>> -         */
>>> -        private function finishSetup(event:Event):void
>>> -        {
>>> -            
>>> IEventDispatcher(_strand).removeEventListener("initComplete",finishSetup)
>>> ;
>>> -
>>> -            dataProviderModel = _strand.getBeadByType(ITabModel) as
>>> ITabModel;
>>> -            var listView:IListView = _strand.getBeadByType(IListView)
>>> as IListView;
>>> -            dataGroup = listView.dataGroup;
>>> -            dataProviderModel.addEventListener("dataProviderChanged",
>>> dataProviderChangeHandler);
>>> -            
>>> dataProviderModel.addEventListener(CollectionEvent.ITEM_ADDED,
>>> itemAddedHandler);
>>> -
>>> -            tabsIdField = dataProviderModel.tabIdField;
>>> -            labelField = dataProviderModel.labelField;
>>> -
>>> -            dataProviderChangeHandler(null);
>>> -        }
>>> -
>>> -        private var _itemRendererFactory:IItemRendererClassFactory;
>>> -
>>> -        /**
>>> -         *  The org.apache.flex.core.IItemRendererClassFactory used
>>> -         *  to generate instances of item renderers.
>>> -         *
>>> -         *  @langversion 3.0
>>> -         *  @playerversion Flash 10.2
>>> -         *  @playerversion AIR 2.6
>>> -         *  @productversion FlexJS 0.8
>>> -         */
>>> -        public function get
>>> itemRendererFactory():IItemRendererClassFactory
>>> -        {
>>> -			if (_itemRendererFactory == null) {
>>> -				var factory:IItemRendererClassFactory =
>>> _strand.getBeadByType(IItemRendererClassFactory) as
>>> IItemRendererClassFactory;
>>> -				if (factory == null) {
>>> -					factory = new (ValuesManager.valuesImpl.getValue(_strand,
>>> "iItemRendererClassFactory")) as IItemRendererClassFactory;
>>> -					_strand.addBead(factory);
>>> -				}
>>> -				_itemRendererFactory = factory;
>>> -			}
>>> -            return _itemRendererFactory;
>>> -        }
>>> -
>>> -        /**
>>> -         *  @private
>>> -         */
>>> -        public function set
>>> itemRendererFactory(value:IItemRendererClassFactory):void
>>> -        {
>>> -            _itemRendererFactory = value;
>>> -        }
>>> -
>>> -        /**
>>> -         *  The org.apache.flex.core.IItemRendererParent that will
>>> -         *  parent the item renderers.
>>> -         *
>>> -         *  @langversion 3.0
>>> -         *  @playerversion Flash 10.2
>>> -         *  @playerversion AIR 2.6
>>> -         *  @productversion FlexJS 0.8
>>> -         */
>>> -        protected var dataGroup:IItemRendererParent;
>>> -
>>> -        protected function dataProviderChangeHandler(event:Event):void
>>> -        {
>>> -            var dp:IArrayList = dataProviderModel.dataProvider as
>>> IArrayList;
>>> -            if (!dp)
>>> -                return;
>>> -
>>> -            dataGroup.removeAllItemRenderers();
>>> -
>>> -            var presentationModel:IListPresentationModel =
>>> _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
>>> -
>>> -            var n:int = dp.length;
>>> -            for (var i:int = 0; i < n; i++)
>>> -            {
>>> -                var ir:ITabItemRenderer =
>>> itemRendererFactory.createItemRenderer(dataGroup) as ITabItemRenderer;
>>> -                dataGroup.addItemRenderer(ir);
>>> -                ir.index = i;
>>> -                ir.labelField = labelField;
>>> -                ir.tabIdField = tabsIdField;
>>> -
>>> -                if (presentationModel) {
>>> -                    var style:SimpleCSSStyles = new SimpleCSSStyles();
>>> -                    style.marginBottom =
>>> presentationModel.separatorThickness;
>>> -                    UIBase(ir).style = style;
>>> -                    UIBase(ir).height = presentationModel.rowHeight;
>>> -                    UIBase(ir).percentWidth = 100;
>>> -                }
>>> -                ir.data = dp.getItemAt(i);
>>> -            }
>>> -
>>> -            IEventDispatcher(_strand).dispatchEvent(new
>>> Event("itemsCreated"));
>>> -        }
>>> -
>>> -        private function itemAddedHandler(event:CollectionEvent):void
>>> -        {
>>> -            var dp:IArrayList = dataProviderModel.dataProvider as
>>> IArrayList;
>>> -            if (!dp)
>>> -                return;
>>> -
>>> -            var presentationModel:IListPresentationModel =
>>> _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
>>> -
>>> -            var ir:ITabItemRenderer =
>>> itemRendererFactory.createItemRenderer(dataGroup) as ITabItemRenderer;
>>> -            dataGroup.addItemRenderer(ir);
>>> -            
>>> -            ir.index = dp.length - 1;
>>> -            ir.labelField = labelField;
>>> -            ir.tabIdField = tabsIdField;
>>> -
>>> -            if (presentationModel) {
>>> -                var style:SimpleCSSStyles = new SimpleCSSStyles();
>>> -                style.marginBottom =
>>> presentationModel.separatorThickness;
>>> -                UIBase(ir).style = style;
>>> -                UIBase(ir).height = presentationModel.rowHeight;
>>> -                UIBase(ir).percentWidth = 100;
>>> -            }
>>> -            ir.data = event.item;
>>> -
>>> -            IEventDispatcher(_strand).dispatchEvent(new
>>> Event("itemsCreated"));
>>> -        }
>>> -    }
>>> -}
>>> 
>>> 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F5b8f1c58%2Fframeworks%2Fp
>>> rojects%2FMaterialDesignLite%2Fsrc%2Fmain%2Fflex%2Forg%2Fapache%2Fflex%2F
>>> mdl%2Fbeads%2Fviews%2FTabsView.as&data=02%7C01%7C%7C468a0ef526744f407ac40
>>> 8d4ed05e30c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6363940569179296
>>> 60&sdata=664hX%2BBKf1rJvAy0khpJSiCJk4fe9hkbkvYCzVf6iTA%3D&reserved=0
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/views/TabsView.as
>>> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/views/TabsView.as
>>> index ffe291a..34c09f2 100644
>>> --- 
>>> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/views/TabsView.as
>>> +++ 
>>> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/md
>>> l/beads/views/TabsView.as
>>> @@ -26,7 +26,7 @@ package org.apache.flex.mdl.beads.views
>>>    import org.apache.flex.core.IStrand;
>>>    import org.apache.flex.mdl.TabBar;
>>>    import org.apache.flex.mdl.TabBarPanel;
>>> -    import 
>>> org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayListData;
>>> +    import 
>>> org.apache.flex.mdl.beads.TabsDynamicItemsRendererFactoryForArrayListData
>>> ;
>>>    import org.apache.flex.mdl.supportClasses.ITabItemRenderer;
>>> 
>>>    /**
>>> @@ -166,8 +166,8 @@ package org.apache.flex.mdl.beads.views
>>> 
>>>        public function isTabsDynamic():Boolean
>>>        {
>>> -            var
>>> arrayListMapper:TabsItemRendererFactoryForArrayListData =
>>> -               
>>> _strand.getBeadByType(IDataProviderItemRendererMapper) as
>>> TabsItemRendererFactoryForArrayListData;
>>> +            var
>>> arrayListMapper:TabsDynamicItemsRendererFactoryForArrayListData =
>>> +               
>>> _strand.getBeadByType(IDataProviderItemRendererMapper) as
>>> TabsDynamicItemsRendererFactoryForArrayListData;
>>>            return arrayListMapper != null;
>>>        }
>>>    }
>>> 
>>> 
>>> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgit-wip-u
>>> s.apache.org%2Frepos%2Fasf%2Fflex-asjs%2Fblob%2F5b8f1c58%2Fframeworks%2Fp
>>> rojects%2FMaterialDesignLite%2Fsrc%2Fmain%2Fresources%2Fdefaults.css&data
>>> =02%7C01%7C%7C468a0ef526744f407ac408d4ed05e30c%7Cfa7b1b5a7b34438794aed2c1
>>> 78decee1%7C0%7C0%7C636394056917929660&sdata=yM%2Bu3tP0EamD3bb7vDTMQqkqNqv
>>> W4LrFU8c3JJ0jocY%3D&reserved=0
>>> ----------------------------------------------------------------------
>>> diff --git 
>>> a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
>>> b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
>>> index f8b3b05..9e5ece7 100644
>>> --- 
>>> a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
>>> +++ 
>>> b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
>>> @@ -122,7 +122,7 @@ Tabs
>>>    IBeadView: 
>>> ClassReference("org.apache.flex.mdl.beads.views.TabsView");
>>>    IBeadModel: 
>>> ClassReference("org.apache.flex.mdl.beads.models.TabArrayModel");
>>>    IBeadLayout: ClassReference(null);
>>> -    IDataProviderItemRendererMapper:
>>> ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArray
>>> ListData");
>>> +    IDataProviderItemRendererMapper:
>>> ClassReference("org.apache.flex.mdl.beads.TabsDynamicItemsRendererFactory
>>> ForArrayListData");
>>>    IItemRendererClassFactory:
>>> ClassReference("org.apache.flex.core.ItemRendererClassFactory");
>>>    IItemRenderer:
>>> ClassReference("org.apache.flex.mdl.itemRenderers.TabBarPanelItemRenderer
>>> ");
>>> }
>>> @@ -132,7 +132,7 @@ TabBar
>>>    IBeadView: 
>>> ClassReference("org.apache.flex.mdl.beads.views.TabBarView");
>>>    IBeadModel: 
>>> ClassReference("org.apache.flex.mdl.beads.models.TabArrayModel");
>>>    IBeadLayout: ClassReference(null);
>>> -    IDataProviderItemRendererMapper:
>>> ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArray
>>> ListData");
>>> +    IDataProviderItemRendererMapper:
>>> ClassReference("org.apache.flex.mdl.beads.TabsDynamicItemsRendererFactory
>>> ForArrayListData");
>>>    IItemRendererClassFactory:
>>> ClassReference("org.apache.flex.core.ItemRendererClassFactory");
>>>    IItemRenderer:
>>> ClassReference("org.apache.flex.mdl.itemRenderers.TabBarButtonTabsItemRen
>>> derer");
>>> }
>>> 
>> 
> 


Mime
View raw message