You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2020/01/01 17:30:26 UTC
[royale-asjs] 08/08: Use utility functions
This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch feature/bead-base
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 58e5430541f28e0926d62fd5ad921f86be5be640
Author: Harbs <ha...@in-tools.com>
AuthorDate: Wed Jan 1 19:29:53 2020 +0200
Use utility functions
---
.../royale/org/apache/royale/html/beads/PanelView.as | 2 +-
.../html/beads/controllers/MenuBarMouseController.as | 9 ++++++---
.../royale/org/apache/royale/core/ApplicationBase.as | 20 ++++++++++++--------
.../org/apache/royale/core/BrowserOrientation.as | 5 ++++-
.../org/apache/royale/core/BrowserResizeListener.as | 3 ++-
.../org/apache/royale/core/HTMLElementWrapper.as | 4 +++-
.../royale/org/apache/royale/core/ImageViewBase.as | 4 ++--
.../org/apache/royale/core/MXMLDragInitiator.as | 5 +++--
.../org/apache/royale/core/ParentDocumentBead.as | 3 ++-
.../src/main/royale/org/apache/royale/core/Strand.as | 5 +++--
.../org/apache/royale/core/StyleChangeNotifier.as | 3 ++-
.../royale/org/apache/royale/core/TransformModel.as | 3 ++-
12 files changed, 42 insertions(+), 24 deletions(-)
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
index 71358fe..3544836 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/PanelView.as
@@ -31,10 +31,10 @@ package org.apache.royale.html.beads
import org.apache.royale.html.TitleBar;
import org.apache.royale.html.beads.layouts.VerticalFlexLayout;
import org.apache.royale.html.supportClasses.PanelLayoutProxy;
+ import org.apache.royale.utils.sendStrandEvent;
COMPILE::SWF {
import org.apache.royale.core.SimpleCSSStylesWithFlex;
- import org.apache.royale.utils.sendStrandEvent;
}
/**
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/MenuBarMouseController.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/MenuBarMouseController.as
index a5e3d9c..36b6cee 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/MenuBarMouseController.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/controllers/MenuBarMouseController.as
@@ -58,9 +58,7 @@ package org.apache.royale.html.beads.controllers
{
super();
}
-
- protected var _strand:IStrand;
-
+
/**
* @copy org.apache.royale.core.IBead#strand
*
@@ -102,6 +100,11 @@ package org.apache.royale.html.beads.controllers
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9
+ * @royaleignorecoercion org.apache.royale.core.IUIBase
+ * @royaleignorecoercion org.apache.royale.core.UIBase
+ * @royaleignorecoercion org.apache.royale.core.IFactory
+ * @royaleignorecoercion org.apache.royale.core.IMenuBarModel
+ * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
*/
override protected function selectedHandler(event:ItemClickedEvent):void
{
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ApplicationBase.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ApplicationBase.as
index da84081..c4ac38c 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ApplicationBase.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ApplicationBase.as
@@ -28,6 +28,12 @@ package org.apache.royale.core
import org.apache.royale.utils.CSSUtils;
import org.apache.royale.events.Event;
import org.apache.royale.utils.html.getStyle;
+ import org.apache.royale.utils.sendEvent;
+ import org.apache.royale.utils.sendEvent;
+ import org.apache.royale.utils.sendEvent;
+ import org.apache.royale.utils.sendEvent;
+ import org.apache.royale.utils.sendEvent;
+ import org.apache.royale.utils.sendEvent;
}
[DefaultProperty("beads")]
@@ -206,7 +212,7 @@ package org.apache.royale.core
_height = value;
getStyle(this).height = value.toString() + 'px';
if (!noEvent)
- dispatchEvent(new Event("heightChanged"));
+ sendEvent(this,"heightChanged");
}
}
@@ -225,7 +231,7 @@ package org.apache.royale.core
_width = value;
getStyle(this).width = value.toString() + 'px';
if (!noEvent)
- dispatchEvent(new Event("widthChanged"));
+ sendEvent(this,"widthChanged");
}
}
@@ -258,8 +264,7 @@ package org.apache.royale.core
_percentWidth = NaN;
_explicitWidth = value;
-
- dispatchEvent(new Event("explicitWidthChanged"));
+ sendEvent(this,"explicitWidthChanged");
}
private var _explicitHeight:Number;
@@ -291,8 +296,7 @@ package org.apache.royale.core
_percentHeight = NaN;
_explicitHeight = value;
-
- dispatchEvent(new Event("explicitHeightChanged"));
+ sendEvent(this,"explicitHeightChanged");
}
private var _percentWidth:Number;
@@ -323,7 +327,7 @@ package org.apache.royale.core
getStyle(this).width = value.toString() + '%';
if (!isNaN(value))
this._explicitWidth = NaN;
- dispatchEvent(new Event("percentWidthChanged"));
+ sendEvent(this,"percentWidthChanged");
}
private var _percentHeight:Number;
@@ -354,7 +358,7 @@ package org.apache.royale.core
getStyle(this).height = value.toString() + '%';
if (!isNaN(value))
this._explicitHeight = NaN;
- dispatchEvent(new Event("percentHeightChanged"));
+ sendEvent(this,"percentHeightChanged");
}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
index ad09c5a..26359b0 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserOrientation.as
@@ -29,6 +29,7 @@ COMPILE::JS
import org.apache.royale.utils.BrowserInfo;
}
import org.apache.royale.utils.OSUtils;
+ import org.apache.royale.utils.sendStrandEvent;
/**
* The BrowserOrientation class listens for browser
@@ -58,6 +59,7 @@ COMPILE::JS
}
private var host:IUIBase;
+ private var _strand:IStrand;
/**
* @copy org.apache.royale.core.IBead#strand
@@ -70,6 +72,7 @@ COMPILE::JS
*/
public function set strand(value:IStrand):void
{
+ _strand = value;
host = value as IUIBase;
if(OSUtils.getOS() == OSUtils.ANDROID_OS || OSUtils.getOS() == OSUtils.IOS_OS)
{
@@ -99,7 +102,7 @@ COMPILE::JS
public function set orientation(value:String):void
{
_orientation = value;
- host.dispatchEvent(new Event("orientationChanged"));
+ sendStrandEvent(_strand,"orientationChanged");
}
/**
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserResizeListener.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserResizeListener.as
index 139d5af..5d61288 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserResizeListener.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/BrowserResizeListener.as
@@ -27,6 +27,7 @@ COMPILE::SWF
COMPILE::JS
{
import org.apache.royale.utils.html.getStyle;
+ import org.apache.royale.utils.sendStrandEvent;
}
/**
@@ -157,7 +158,7 @@ COMPILE::JS
if (!isNaN(initialView.percentWidth) || !isNaN(initialView.percentHeight)) {
style.height = window.innerHeight + 'px';
style.width = window.innerWidth + 'px';
- initialView.dispatchEvent('sizeChanged'); // kick off layout if % sizes
+ sendStrandEvent(initialView,'sizeChanged'); // kick off layout if % sizes
}
}
}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
index 4bcbe71..7689256 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/HTMLElementWrapper.as
@@ -38,6 +38,7 @@ package org.apache.royale.core
import goog.events.EventTarget;
import goog.DEBUG;
import org.apache.royale.events.utils.EventUtils;
+ import org.apache.royale.utils.sendStrandEvent;
}
COMPILE::SWF
@@ -187,7 +188,8 @@ package org.apache.royale.core
addBead(value as IBead);
else
_model = IBeadModel(value);
- dispatchEvent(new org.apache.royale.events.Event("modelChanged"));
+
+ sendStrandEvent(this,"modelChanged");
}
}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
index b718306..8b7bc68 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ImageViewBase.as
@@ -190,7 +190,7 @@ package org.apache.royale.core
if (host.isWidthSizedToContent())
{
- host.dispatchEvent(new Event("widthChanged"));
+ sendStrandEvent(_strand,"widthChanged");
if (host.parent is IEventDispatcher)
IEventDispatcher(host.parent).dispatchEvent(new Event("layoutNeeded"));
}
@@ -199,7 +199,7 @@ package org.apache.royale.core
if (host.isHeightSizedToContent())
{
- host.dispatchEvent(new Event("heightChanged"));
+ sendStrandEvent(_strand,"heightChanged");
if (host.parent is IEventDispatcher)
IEventDispatcher(host.parent).dispatchEvent(new Event("layoutNeeded"));
}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/MXMLDragInitiator.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/MXMLDragInitiator.as
index dc8b0ab..a91d294 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/MXMLDragInitiator.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/MXMLDragInitiator.as
@@ -22,6 +22,7 @@ package org.apache.royale.core
import org.apache.royale.core.IStrand;
import org.apache.royale.events.Event;
import org.apache.royale.events.EventDispatcher;
+ import org.apache.royale.utils.sendBeadEvent;
/**
* Indicates that acceptingDrop API has been called.
@@ -104,7 +105,7 @@ package org.apache.royale.core
{
this.dropTarget = dropTarget;
dropType = type;
- dispatchEvent(new Event("acceptingDrop"));
+ sendBeadEvent(this,"acceptingDrop")
}
/**
@@ -119,7 +120,7 @@ package org.apache.royale.core
{
this.dropTarget = dropTarget;
dropType = type;
- dispatchEvent(new Event("acceptedDrop"));
+ sendBeadEvent(this,"acceptedDrop")
}
}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ParentDocumentBead.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ParentDocumentBead.as
index eebdd1c..68e0e5a 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ParentDocumentBead.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ParentDocumentBead.as
@@ -24,6 +24,7 @@ package org.apache.royale.core
import org.apache.royale.core.IStrand;
import org.apache.royale.events.Event;
import org.apache.royale.events.EventDispatcher;
+ import org.apache.royale.utils.sendBeadEvent;
/**
* The ParentDocumentBead class looks up the parent
@@ -83,7 +84,7 @@ package org.apache.royale.core
if (_id != value)
{
_id = value;
- dispatchEvent(new org.apache.royale.events.Event("idChanged"));
+ sendBeadEvent(this,"idChanged");
}
}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
index a608762..11ceae1 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/Strand.as
@@ -20,6 +20,7 @@ package org.apache.royale.core
{
import org.apache.royale.events.Event;
import org.apache.royale.events.EventDispatcher;
+ import org.apache.royale.utils.sendStrandEvent;
/**
* The Strand class is the base class for non-display object
@@ -78,7 +79,7 @@ package org.apache.royale.core
if (_model != value)
{
addBead(value as IBead);
- dispatchEvent(new Event("modelChanged"));
+ sendStrandEvent(this,"modelChanged")
}
}
@@ -101,7 +102,7 @@ package org.apache.royale.core
if (_id != value)
{
_id = value;
- dispatchEvent(new Event("idChanged"));
+ sendStrandEvent(this,"idChanged");
}
}
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyleChangeNotifier.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyleChangeNotifier.as
index 783cc6e..00073d8 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyleChangeNotifier.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/StyleChangeNotifier.as
@@ -25,6 +25,7 @@ package org.apache.royale.core
import org.apache.royale.core.IBead;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.IStyleableObject;
+ import org.apache.royale.utils.sendStrandEvent;
COMPILE::JS
{
import org.apache.royale.utils.html.getStyle;
@@ -73,7 +74,7 @@ package org.apache.royale.core
{
COMPILE::SWF {
var styleEvent:StyleChangeEvent = StyleChangeEvent.createChangeEvent(_strand, event.propertyName, event.oldValue, event.newValue);
- IEventDispatcher(_strand).dispatchEvent(styleEvent);
+ sendStrandEvent(_strand,styleEvent);
}
COMPILE::JS {
var host:UIHTMLElementWrapper = UIHTMLElementWrapper(_strand);
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/TransformModel.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/TransformModel.as
index 938b23f..18e1f77 100644
--- a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/TransformModel.as
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/TransformModel.as
@@ -21,6 +21,7 @@ package org.apache.royale.core
import org.apache.royale.events.Event;
import org.apache.royale.events.EventDispatcher;
import org.apache.royale.geom.Matrix;
+ import org.apache.royale.utils.sendStrandEvent;
public class TransformModel extends EventDispatcher implements ITransformModel
{
@@ -41,7 +42,7 @@ package org.apache.royale.core
private function dispatchModelChangeEvent():void
{
- host.dispatchEvent(new Event(CHANGE));
+ sendStrandEvent(_strand,CHANGE);
}
private function get host():ITransformHost