flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [06/15] git commit: [flex-asjs] [refs/heads/develop] - use border and background beads directly instead of through border class
Date Wed, 05 Aug 2015 21:20:50 GMT
use border and background beads directly instead of through border class


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a7f3a72a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a7f3a72a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a7f3a72a

Branch: refs/heads/develop
Commit: a7f3a72a990a8a30ae75b3a9b2052c064b75297f
Parents: d1d9cde
Author: Alex Harui <aharui@apache.org>
Authored: Tue Aug 4 21:38:06 2015 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Aug 5 12:28:49 2015 -0700

----------------------------------------------------------------------
 frameworks/projects/HTML/as/defaults.css        |  2 +-
 .../apache/flex/html/beads/TextFieldViewBase.as | 75 +++++++++++++++++--
 .../flex/html/beads/TextInputWithBorderView.as  | 77 ++++++++++++++------
 3 files changed, 125 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a7f3a72a/frameworks/projects/HTML/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/defaults.css b/frameworks/projects/HTML/as/defaults.css
index 54700ab..4b44c15 100644
--- a/frameworks/projects/HTML/as/defaults.css
+++ b/frameworks/projects/HTML/as/defaults.css
@@ -508,7 +508,7 @@ TextInput
     IBeadView: ClassReference("org.apache.flex.html.beads.TextInputWithBorderView");
     IBeadController: ClassReference("org.apache.flex.html.beads.controllers.EditableTextKeyboardController");
     iBorderBead: ClassReference('org.apache.flex.html.beads.SingleLineBorderBead');
-    iBorderModel: ClassReference('org.apache.flex.html.beads.models.SingleLineBorderModel');
+    iBackgroundBead: ClassReference('org.apache.flex.html.beads.SolidBackgroundBead');
     border-style: solid;
     border-color: #000000;
     border-width: 1px;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a7f3a72a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
index ed3d309..0d8aeaa 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextFieldViewBase.as
@@ -157,7 +157,17 @@ package org.apache.flex.html.beads
             autoSizeIfNeeded();
 		}
 
-        private function autoSizeIfNeeded():void
+        /**
+         *  Handle autosizing.  The built-in player algorithm
+         *  doesn't work the way we would like, especially
+         *  when it collapses Textfields with empty strings.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected function autoSizeIfNeeded():void
         {
             var host:UIBase = UIBase(_strand);
             if (autoHeight)
@@ -281,12 +291,55 @@ package org.apache.flex.html.beads
 			html = _textModel.html;
 		}
 		
-        private var autoHeight:Boolean;
-        private var autoWidth:Boolean;
-        private var inHeightChange:Boolean = false;
-        private var inWidthChange:Boolean = false;
+        /**
+         *  Whether we are autosizing the height.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected var autoHeight:Boolean;
+
+        /**
+         *  Whether we are autosizing the width.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected var autoWidth:Boolean;
+        
+        /**
+         *  A flag to prevent looping.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected var inHeightChange:Boolean = false;
         
-		private function widthChangeHandler(event:Event):void
+        /**
+         *  A flag to prevent looping.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected var inWidthChange:Boolean = false;
+        
+        /**
+         *  Determine the width of the TextField.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		protected function widthChangeHandler(event:Event):void
 		{
             if (!inWidthChange)
             {
@@ -300,7 +353,15 @@ package org.apache.flex.html.beads
             }
 		}
 
-        private function heightChangeHandler(event:Event):void
+        /**
+         *  Determine the height of the TextField.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        protected function heightChangeHandler(event:Event):void
         {
             if (!inHeightChange)
             {

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a7f3a72a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
index 9ca0aed..16cc7a2 100644
--- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
+++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/TextInputWithBorderView.as
@@ -47,8 +47,6 @@ package org.apache.flex.html.beads
 			super();
 		}
 		
-		private var _border:Border;
-				
         /**
          *  @private
          */        
@@ -56,24 +54,61 @@ package org.apache.flex.html.beads
 		{
 			super.strand = value;
 			
-			// add a border to this
-			_border = new Border();
-			_border.model = new (ValuesManager.valuesImpl.getValue(value, "iBorderModel")) as IBeadModel;
-			_border.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
-            IParent(host).addElement(_border);
-			
-			IEventDispatcher(host).addEventListener("widthChanged", sizeChangedHandler);
-			IEventDispatcher(host).addEventListener("heightChanged", sizeChangedHandler);
-			sizeChangedHandler(null);
-		}
-		
-		private function sizeChangedHandler(event:Event):void
-		{
-			var ww:Number = DisplayObject(host).width;
-			_border.width = ww;
-			
-			var hh:Number = DisplayObject(host).height;
-			_border.height = hh;
+            value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBackgroundBead"))
as IBead);
+			value.addBead(new (ValuesManager.valuesImpl.getValue(value, "iBorderBead")) as IBead);
 		}
-	}
+
+        /**
+         *  Determine the width of the TextField.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        override protected function widthChangeHandler(event:Event):void
+        {
+            if (!inWidthChange)
+            {
+                textField.autoSize = "none";
+                autoWidth = false;
+                textField.width = host.width - 2;
+                textField.x = 1;
+                if (autoHeight)
+                    autoSizeIfNeeded()
+                else 
+                {
+                    textField.height = host.height - 2;
+                    textField.y = 1;
+                }
+            }
+        }
+        
+        /**
+         *  Determine the height of the TextField.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        override protected function heightChangeHandler(event:Event):void
+        {
+            if (!inHeightChange)
+            {
+                textField.autoSize = "none";
+                autoHeight = false;
+                textField.height = host.height - 2;
+                textField.y = 1;
+                if (autoWidth)
+                    autoSizeIfNeeded();
+                else
+                {
+                    textField.width = host.width;
+                    textField.x = 1;
+                }
+            }
+        }
+
+    }
 }


Mime
View raw message