royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [royale-asjs] branch develop updated: Finishes up Basic
Date Sat, 28 Oct 2017 22:56:23 GMT
This is an automated email from the ASF dual-hosted git repository.

harbs 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 24f85a9  Finishes up Basic
24f85a9 is described below

commit 24f85a974c4f26bce4f7751e4c0623a2c4e9c85a
Author: Harbs <harbs@in-tools.com>
AuthorDate: Sun Oct 29 01:56:18 2017 +0300

    Finishes up Basic
---
 .../org/apache/royale/html/beads/GroupView.as      | 15 +++---------
 .../org/apache/royale/html/beads/ScrollBarView.as  |  7 ++----
 .../apache/royale/html/beads/SimpleAlertView.as    | 27 ++++++++++++++--------
 3 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/GroupView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/GroupView.as
index 66f3236..acd452f 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/GroupView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/GroupView.as
@@ -31,6 +31,7 @@ package org.apache.royale.html.beads
 	import org.apache.royale.core.ValuesManager;
 	import org.apache.royale.events.Event;
 	import org.apache.royale.events.IEventDispatcher;
+	import org.apache.royale.utils.loadBeadFromValuesManager;
 
 	COMPILE::SWF {
 		import org.apache.royale.geom.Size;
@@ -307,11 +308,7 @@ package org.apache.royale.html.beads
 			var backgroundImage:Object = ValuesManager.valuesImpl.getValue(host, "background-image");
 			if (backgroundColor != null || backgroundImage != null)
 			{
-				if (host.getBeadByType(IBackgroundBead) == null)
-					var c:Class = ValuesManager.valuesImpl.getValue(host, "iBackgroundBead");
-				if (c) {
-					host.addBead( new c() as IBead );
-				}
+				loadBeadFromValuesManager(IBackgroundBead, "iBackgroundBead", _strand);
 			}
 			
 			if (setupForBorder(host, "border")) return;
@@ -338,13 +335,7 @@ package org.apache.royale.html.beads
 			}
 			if (borderStyle != null && borderStyle != "none")
 			{
-				if (host.getBeadByType(IBorderBead) == null) {
-					var c:Class = ValuesManager.valuesImpl.getValue(host, "iBorderBead");
-					if (c) {
-						host.addBead( new c() as IBead );
-						result = true;
-					}
-				}
+				loadBeadFromValuesManager(IBorderBead, "iBorderBead", _strand);
 			}
 			
 			return result;
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ScrollBarView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ScrollBarView.as
index d59330d..6e20bcc 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ScrollBarView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ScrollBarView.as
@@ -33,6 +33,7 @@ package org.apache.royale.html.beads
     import org.apache.royale.events.Event;
 	import org.apache.royale.html.Button;
 	import org.apache.royale.html.beads.controllers.ButtonAutoRepeatController;
+	import org.apache.royale.utils.loadBeadFromValuesManager;
 
     /**
      *  The ScrollBarView class is the default view for
@@ -109,7 +110,6 @@ package org.apache.royale.html.beads
                 addBead(bead);
                         
 			sbModel = value.getBeadByType(IScrollBarModel) as IScrollBarModel;
-            sbModel = _strand.getBeadByType(IScrollBarModel) as IScrollBarModel;
             sbModel.addEventListener("maximumChange", changeHandler);
             sbModel.addEventListener("minimumChange", changeHandler);
             sbModel.addEventListener("snapIntervalChange", changeHandler);
@@ -117,10 +117,7 @@ package org.apache.royale.html.beads
             sbModel.addEventListener("pageSizeChange", changeHandler);
             sbModel.addEventListener("valueChange", changeHandler);
             
-            if( _strand.getBeadByType(IBeadLayout) == null ) {
-                layout = new (ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout"))
as IBeadLayout;
-                _strand.addBead(layout);
-            }
+			loadBeadFromValuesManager(IBeadLayout, "iBeadLayout", _strand);
 		}
 						
         protected function changeHandler(event:Event):void
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SimpleAlertView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SimpleAlertView.as
index ef8737b..93f9ac4 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SimpleAlertView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/SimpleAlertView.as
@@ -34,6 +34,7 @@ package org.apache.royale.html.beads
     import org.apache.royale.html.Label;
     import org.apache.royale.html.TextButton;
     import org.apache.royale.utils.CSSContainerUtils;
+	import org.apache.royale.utils.loadBeadFromValuesManager;
 	
 	/**
 	 *  The SimpleAlertView class creates the visual elements of the 
@@ -60,6 +61,14 @@ package org.apache.royale.html.beads
 		
 		private var messageLabel:Label;
 		private var okButton:TextButton;
+
+		/**
+		 * @royaleignorecoercion org.apache.royale.core.UIBase
+		 */
+		private function get host():UIBase
+		{
+			return _strand as UIBase;
+		}
 		
 		/**
 		 *  @copy org.apache.royale.core.IBead#strand
@@ -77,8 +86,7 @@ package org.apache.royale.html.beads
 			var backgroundImage:Object = ValuesManager.valuesImpl.getValue(value, "background-image");
 			if (backgroundColor != null || backgroundImage != null)
 			{
-				if (value.getBeadByType(IBackgroundBead) == null)
-					value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead")) as IBead);
				
+				loadBeadFromValuesManager(IBackgroundBead, "iBackgroundBead", value);
 			}
 			
 			var borderStyle:String;
@@ -93,8 +101,7 @@ package org.apache.royale.html.beads
 			}
 			if (borderStyle != null && borderStyle != "none")
 			{
-				if (value.getBeadByType(IBorderBead) == null)
-					value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);

+				loadBeadFromValuesManager(IBorderBead, "iBorderBead", value);
 			}
 			
 			var model:IAlertModel = _strand.getBeadByType(IAlertModel) as IAlertModel;
@@ -104,11 +111,11 @@ package org.apache.royale.html.beads
             messageLabel = new Label();
 			messageLabel.text = model.message;
 			messageLabel.html = model.htmlMessage;
-			IParent(_strand).addElement(messageLabel);
+			host.addElement(messageLabel);
 			
 			okButton = new TextButton();
 			okButton.text = model.okLabel;
-			IParent(_strand).addElement(okButton);
+			host.addElement(okButton);
 			okButton.addEventListener("click",handleOK);
 			
 			handleMessageChange(null);
@@ -123,7 +130,7 @@ package org.apache.royale.html.beads
 			if( ruler == null ) {
 				messageLabel.addBead(ruler = new (ValuesManager.valuesImpl.getValue(messageLabel, "iMeasurementBead"))
as IMeasurementBead);
 			}
-			var maxWidth:Number = Math.max(UIBase(_strand).width,ruler.measuredWidth);
+			var maxWidth:Number = Math.max(host.width,ruler.measuredWidth);
 			
 			var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand);
 			
@@ -134,8 +141,8 @@ package org.apache.royale.html.beads
 			okButton.x = (maxWidth - okButton.width)/2;
 			okButton.y = messageLabel.y + messageLabel.height + 20;
 			
-			UIBase(_strand).width = maxWidth + metrics.left + metrics.right;
-			UIBase(_strand).height = okButton.y + okButton.height + metrics.bottom;
+			host.width = maxWidth + metrics.left + metrics.right;
+			host.height = okButton.y + okButton.height + metrics.bottom;
 		}
 		
 		/**
@@ -144,7 +151,7 @@ package org.apache.royale.html.beads
 		private function handleOK(event:MouseEvent):void
 		{
 			var newEvent:Event = new Event("close");
-			IEventDispatcher(_strand).dispatchEvent(newEvent);
+			host.dispatchEvent(newEvent);
 		}
 	}
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <commits@royale.apache.org>'].

Mime
View raw message