This is an automated email from the ASF dual-hosted git repository. piotrz 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 e7094edaae Jewel: Add manual implementation of IEventDispatcher to Tile layouts e7094edaae is described below commit e7094edaae64bccf9fc532715537779da3507628 Author: Piotr Zarzycki <piotrzarzyck...@gmail.com> AuthorDate: Tue May 16 14:43:34 2023 +0200 Jewel: Add manual implementation of IEventDispatcher to Tile layouts - Compiler generates automatically IEventDispatcher implementation based on [Bindable] tag on some properties - unfortunately for some reason it was only SWF implementation which is not needed in JS only version of framework --- .../jewel/beads/layouts/TileHorizontalLayout.as | 74 ++++++++++++++++++++- .../jewel/beads/layouts/TileVerticalLayout.as | 77 ++++++++++++++++++++-- 2 files changed, 144 insertions(+), 7 deletions(-) diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileHorizontalLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileHorizontalLayout.as index 53c8d555e2..13455eb670 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileHorizontalLayout.as +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileHorizontalLayout.as @@ -20,16 +20,19 @@ package org.apache.royale.jewel.beads.layouts { COMPILE::SWF { - import org.apache.royale.core.IUIBase; + import org.apache.royale.core.IUIBase; + import flash.events.Event; } + import org.apache.royale.core.IBorderPaddingMarginValuesImpl; import org.apache.royale.core.ILayoutView; import org.apache.royale.core.UIBase; import org.apache.royale.core.ValuesManager; import org.apache.royale.core.layout.EdgeData; - import org.apache.royale.core.layout.ILayoutStyleProperties; import org.apache.royale.events.Event; import org.apache.royale.utils.OSUtils; + import org.apache.royale.events.EventDispatcher; + import org.apache.royale.events.IEventDispatcher; import org.apache.royale.utils.observeElementSize; /** @@ -43,7 +46,7 @@ package org.apache.royale.jewel.beads.layouts * @playerversion AIR 2.6 * @productversion Royale 0.9.8 */ - public class TileHorizontalLayout extends SimpleHorizontalLayout implements ILayoutStyleProperties + public class TileHorizontalLayout extends SimpleHorizontalLayout implements IEventDispatcher { /** * constructor. @@ -60,6 +63,71 @@ package org.apache.royale.jewel.beads.layouts public static const LAYOUT_TYPE_NAMES:String = "layout horizontal tile"; + private var _dispatcher:IEventDispatcher; + /** + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.11 + */ + public function get dispatcher():IEventDispatcher + { + if (!_dispatcher) + { + _dispatcher = new EventDispatcher(this) as IEventDispatcher; + } + + return _dispatcher; + } + + public function set dispatcher(value:IEventDispatcher):void + { + _dispatcher = value; + } + + //IEventDispatcher JS + COMPILE::JS + public function addEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void + { + dispatcher.addEventListener(type, handler, opt_capture, opt_handlerScope); + } + + COMPILE::JS + public function removeEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void + { + dispatcher.removeEventListener(type, handler, opt_capture, opt_handlerScope); + } + + COMPILE::JS + public function dispatchEvent(event:Object):Boolean + { + return dispatcher.dispatchEvent(event); + } + + //IEventDispatcher SWF + COMPILE::SWF + public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void + { + dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference); + } + COMPILE::SWF + public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void + { + dispatcher.removeEventListener(type, listener, useCapture); + } + + COMPILE::SWF + public function dispatchEvent(event:flash.events.Event):Boolean + { + return dispatcher.dispatchEvent(event); + } + + //IEventDispatcher (shared) + public function hasEventListener(type:String):Boolean + { + return dispatcher.hasEventListener(type); + } + /** * Add class selectors when the component is addedToParent * Otherwise component will not get the class selectors when diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileVerticalLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileVerticalLayout.as index 7662a5d241..37f7f33909 100644 --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileVerticalLayout.as +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/TileVerticalLayout.as @@ -20,15 +20,18 @@ package org.apache.royale.jewel.beads.layouts { COMPILE::SWF { - import org.apache.royale.core.IUIBase; + import org.apache.royale.core.IUIBase; + import flash.events.Event; } + import org.apache.royale.core.IBorderPaddingMarginValuesImpl; import org.apache.royale.core.ILayoutView; import org.apache.royale.core.UIBase; import org.apache.royale.core.ValuesManager; import org.apache.royale.core.layout.EdgeData; - import org.apache.royale.core.layout.ILayoutStyleProperties; import org.apache.royale.events.Event; + import org.apache.royale.events.EventDispatcher; + import org.apache.royale.events.IEventDispatcher; /** * The TileVerticalLayout class bead sizes and positions the elements it manages into rows and columns. @@ -46,7 +49,7 @@ package org.apache.royale.jewel.beads.layouts * @playerversion AIR 2.6 * @productversion Royale 0.9.8 */ - public class TileVerticalLayout extends SimpleVerticalLayout implements ILayoutStyleProperties + public class TileVerticalLayout extends SimpleVerticalLayout implements IEventDispatcher { /** * constructor. @@ -62,7 +65,73 @@ package org.apache.royale.jewel.beads.layouts } public static const LAYOUT_TYPE_NAMES:String = "layout vertical tile"; - + + private var _dispatcher:IEventDispatcher; + + /** + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.11 + */ + public function get dispatcher():IEventDispatcher + { + if (!_dispatcher) + { + _dispatcher = new EventDispatcher(this) as IEventDispatcher; + } + + return _dispatcher; + } + + public function set dispatcher(value:IEventDispatcher):void + { + _dispatcher = value; + } + + //IEventDispatcher JS + COMPILE::JS + public function addEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void + { + dispatcher.addEventListener(type, handler, opt_capture, opt_handlerScope); + } + + COMPILE::JS + public function removeEventListener(type:String, handler:Function, opt_capture:Boolean = false, opt_handlerScope:Object = null):void + { + dispatcher.removeEventListener(type, handler, opt_capture, opt_handlerScope); + } + + COMPILE::JS + public function dispatchEvent(event:Object):Boolean + { + return dispatcher.dispatchEvent(event); + } + + //IEventDispatcher SWF + COMPILE::SWF + public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void + { + dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference); + } + COMPILE::SWF + public function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void + { + dispatcher.removeEventListener(type, listener, useCapture); + } + + COMPILE::SWF + public function dispatchEvent(event:flash.events.Event):Boolean + { + return dispatcher.dispatchEvent(event); + } + + //IEventDispatcher (shared) + public function hasEventListener(type:String):Boolean + { + return dispatcher.hasEventListener(type); + } + /** * Add class selectors when the component is addedToParent * Otherwise component will not get the class selectors when