yishayw commented on a change in pull request #1035: URL: https://github.com/apache/royale-asjs/pull/1035#discussion_r671830303
########## File path: frameworks/projects/SparkRoyale/src/main/royale/spark/components/beads/TabBarSelectionUpdateFromSelectableDataProvider.as ########## @@ -0,0 +1,158 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +// +// http://www.apache.org/licenses/LICENSE-2.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 spark.components.beads +{ + import org.apache.royale.core.IBead; + import org.apache.royale.core.IDataProviderModel; + import org.apache.royale.core.IStrand; + import org.apache.royale.core.IViewport; + import org.apache.royale.events.Event; + import org.apache.royale.events.IEventDispatcher; + import mx.core.ISelectableList; + import spark.components.TabBar; + + + /** + * Updates TabBar.selectedIndex when the selectable dataProvider (i.e. ViewStack) + * has a selectedIndex change. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.8 + */ + public class TabBarSelectionUpdateFromSelectableDataProvider implements IBead + { + /** + * Constructor + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.8 + */ + public function TabBarSelectionUpdateFromSelectableDataProvider() + { + } + + protected var _strand:IStrand; + + /** + * @copy org.apache.royale.core.IStrand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.8 + * @royaleignorecoercion org.apache.royale.events.IEventDispatcher + */ + public function set strand(value:IStrand):void + { + _strand = value; + IEventDispatcher(value).addEventListener("initComplete", initComplete); + } + + /** + * finish setup + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.8 + * @royaleignorecoercion org.apache.royale.core.IDataProviderModel + */ + protected function initComplete(event:Event):void + { + IEventDispatcher(_strand).removeEventListener("initComplete", initComplete); Review comment: Using 'as' casting instead of function casting gives you the option of annotating with @royaleignorecoercion which can give a minor boost in performance. Just something to consider. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
