This is an automated email from the ASF dual-hosted git repository.

aharui 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 88e9821  allow swapping in of DateField's TextInput.  Fixes #525
88e9821 is described below

commit 88e9821973b313e20e1635aaa4919d926ef797f0
Author: Alex Harui <[email protected]>
AuthorDate: Thu Oct 24 15:51:08 2019 -0700

    allow swapping in of DateField's TextInput.  Fixes #525
---
 .../royale/org/apache/royale/html/TextInput.as     |  3 +-
 .../org/apache/royale/html/beads/DateFieldView.as  |  6 +-
 .../projects/Core/src/main/royale/CoreClasses.as   |  1 +
 .../royale/org/apache/royale/core/ITextInput.as    | 82 ++++++++++++++++++++++
 .../src/main/royale/mx/controls/DateField.as       | 22 ++++--
 .../main/royale/mx/controls/beads/DateFieldView.as | 12 ++++
 .../MXRoyale/src/main/royale/mx/core/ITextInput.as | 51 +-------------
 .../src/main/royale/mx/core/UIComponent.as         |  2 +-
 8 files changed, 122 insertions(+), 57 deletions(-)

diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/TextInput.as 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/TextInput.as
index 3214bd5..eef0c73 100644
--- 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/TextInput.as
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/TextInput.as
@@ -18,6 +18,7 @@
 package org.apache.royale.html
 {
        import org.apache.royale.core.ITextModel;
+    import org.apache.royale.core.ITextInput;
        import org.apache.royale.core.UIBase;
        import org.apache.royale.events.Event;
     COMPILE::JS
@@ -47,7 +48,7 @@ package org.apache.royale.html
      *  @playerversion AIR 2.6
      *  @productversion Royale 0.0
      */
-       public class TextInput extends UIBase
+       public class TextInput extends UIBase implements ITextInput
        {
         /**
          *  Constructor.
diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DateFieldView.as
 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DateFieldView.as
index 8a79872..7ea64d6 100644
--- 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DateFieldView.as
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/DateFieldView.as
@@ -26,6 +26,7 @@ package org.apache.royale.html.beads
        import org.apache.royale.core.IParent;
        import org.apache.royale.core.IPopUpHost;
        import org.apache.royale.core.IStrand;
+    import org.apache.royale.core.ITextInput;
        import org.apache.royale.core.UIBase;
        import org.apache.royale.core.ValuesManager;
        import org.apache.royale.events.Event;
@@ -69,7 +70,7 @@ package org.apache.royale.html.beads
                {
                }
 
-               private var _textInput:TextInput;
+               protected var _textInput:ITextInput;
                private var _button:TextButton;
 
                /**
@@ -118,7 +119,8 @@ package org.apache.royale.html.beads
                {
                        super.strand = value;
 
-                       _textInput = new TextInput();
+            if (!_textInput)
+                       _textInput = new TextInput();
                        getHost().addElement(_textInput);
                        _textInput.width = 100;
                        _textInput.height = 18;
diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as 
b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 650d0c6..ce4785b 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -35,6 +35,7 @@ internal class CoreClasses
        import org.apache.royale.core.IList; IList;
        import org.apache.royale.core.IIcon; IIcon;
        import org.apache.royale.core.IIconSupport; IIconSupport;
+    import org.apache.royale.core.ITextInput; ITextInput;
        import org.apache.royale.html.beads.IListView; IListView;
        import org.apache.royale.events.ItemAddedEvent; ItemAddedEvent;
        import org.apache.royale.events.ItemRemovedEvent; ItemRemovedEvent;
diff --git 
a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ITextInput.as 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ITextInput.as
new file mode 100644
index 0000000..ef738d2
--- /dev/null
+++ 
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/ITextInput.as
@@ -0,0 +1,82 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.core
+{
+    /**
+     *  The IContainer interface is used to mark certain components as 
Containers.
+     *  While most components are containers in the sense that they are 
composited
+     *  from a set of child components, the term Container is commonly used in 
Flex
+     *  to denote components that take an arbitrary set or sets of children 
and do
+     *  not try to abstract away that fact. 
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+     */
+    public interface ITextInput extends IUIBase
+       {       
+        //----------------------------------
+        //  text
+        //----------------------------------
+        
+        /**
+         *  Plain text that appears in the control.
+         *  Its appearance is determined by the CSS styles of this Label 
control.
+         *
+         *  <p>Any HTML tags in the text string are ignored,
+         *  and appear as entered in the string.
+         *  To display text formatted using HTML tags,
+         *  use the <code>htmlText</code> property instead.
+         *  If you set the <code>htmlText</code> property,
+         *  the HTML replaces any text you had set using this propety, and the
+         *  <code>text</code> property returns a plain-text version of the
+         *  HTML text, with all HTML tags stripped out. For more information
+         *  see the <code>htmlText</code> property.</p>
+         *
+         *  <p>To include the special characters left angle  bracket (&lt;),
+         *  right angle bracket (&gt;), or ampersand (&amp;) in the text,
+         *  wrap the text string in the CDATA tag.
+         *  Alternatively, you can use HTML character entities for the
+         *  special characters, for example, <code>&amp;lt;</code>.</p>
+         *
+         *  <p>If you try to set this property to <code>null</code>,
+         *  it is set, instead, to the empty string.
+         *  The <code>text</code> property can temporarily have the value 
<code>null</code>,
+         *  which indicates that the <code>htmlText</code> has been recently 
set
+         *  and the corresponding <code>text</code> value
+         *  has not yet been determined.</p>
+         *
+         *  @default ""
+         *  @tiptext Gets or sets the TextInput content
+         *  @helpid 3190
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10
+         *  @playerversion AIR 1.5
+         *  @productversion Flex 4
+         */
+        function get text():String;
+        
+        /**
+         *  @private
+         */
+        function set text(value:String):void;
+       }
+}
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as
index d482596..e641c5f 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/DateField.as
@@ -49,7 +49,8 @@ import mx.utils.ObjectUtil;
 use namespace mx_internal;
 
 import org.apache.royale.core.IDateChooserModel;
-import org.apache.royale.html.TextInput;
+import org.apache.royale.core.IUIBase;
+import mx.controls.TextInput;
 
 //--------------------------------------
 //  Events
@@ -2224,9 +2225,20 @@ public class DateField extends ComboBase
         super.commitProperties();
     } */
 
-    /**
-     *  @private
-     */
+    override public function get measuredHeight():Number
+    {
+        _measuredHeight = Math.max(((view as DateFieldView).textInputField as 
TextInput).height,
+            ((view as DateFieldView).popupButton as IUIBase).height);
+        return _measuredHeight;
+    }
+    
+    override public function get measuredWidth():Number
+    {
+        _measuredWidth = ((view as DateFieldView).textInputField as 
TextInput).width +
+            ((view as DateFieldView).popupButton as IUIBase).width;        
+        return _measuredWidth;
+    }
+    
     /* override protected function measure():void
     {
         // skip base class, we do our own calculation here
@@ -2869,7 +2881,7 @@ public class DateField extends ComboBase
      */
     override public function get text():String
     {
-        var s:String = ((view as DateFieldView).textInputField as 
org.apache.royale.html.TextInput).text;
+        var s:String = ((view as DateFieldView).textInputField as 
TextInput).text;
         return s == null ? "" : s;
     }
    
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DateFieldView.as
 
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DateFieldView.as
index 2568bff..b61a695 100644
--- 
a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DateFieldView.as
+++ 
b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/DateFieldView.as
@@ -22,8 +22,10 @@ package mx.controls.beads
     {
         import flash.display.Sprite;
     }
+    import org.apache.royale.html.Button;
     import org.apache.royale.core.IStrand;
     import org.apache.royale.html.beads.DateFieldView;
+    import mx.controls.TextInput;
        
     /**
      *  The NumericStepperView class overrides the Basic
@@ -45,6 +47,16 @@ package mx.controls.beads
                 host.stage.focus = host;
             }
         }
+        
+        override public function set strand(value:IStrand):void
+        {
+            _textInput = new TextInput();
+            COMPILE::JS
+            {
+                (_textInput as TextInput).isAbsolute = false;
+            }
+            super.strand = value;
+        }
 
        }
 }
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/ITextInput.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ITextInput.as
index 17e8528..2162b74 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/ITextInput.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ITextInput.as
@@ -19,7 +19,8 @@
 
 package mx.core
 {
-
+    import org.apache.royale.core.ITextInput;
+    
     import mx.managers.IFocusManagerComponent;
 /*
 import mx.controls.listClasses.IDropInListItemRenderer;
@@ -36,7 +37,7 @@ import mx.styles.IStyleClient;
  *  @productversion Flex 4
  */
 public interface ITextInput
-    extends IDataRenderer, IUIComponent, IFocusManagerComponent
+    extends IDataRenderer, IUIComponent, IFocusManagerComponent, 
org.apache.royale.core.ITextInput
 {
     
//--------------------------------------------------------------------------
     //
@@ -271,52 +272,6 @@ public interface ITextInput
      */
     function set selectable(value:Boolean):void;
 
-    //----------------------------------
-    //  text
-    //----------------------------------
-
-    /**
-     *  Plain text that appears in the control.
-     *  Its appearance is determined by the CSS styles of this Label control.
-     *
-     *  <p>Any HTML tags in the text string are ignored,
-     *  and appear as entered in the string.
-     *  To display text formatted using HTML tags,
-     *  use the <code>htmlText</code> property instead.
-     *  If you set the <code>htmlText</code> property,
-     *  the HTML replaces any text you had set using this propety, and the
-     *  <code>text</code> property returns a plain-text version of the
-     *  HTML text, with all HTML tags stripped out. For more information
-     *  see the <code>htmlText</code> property.</p>
-     *
-     *  <p>To include the special characters left angle  bracket (&lt;),
-     *  right angle bracket (&gt;), or ampersand (&amp;) in the text,
-     *  wrap the text string in the CDATA tag.
-     *  Alternatively, you can use HTML character entities for the
-     *  special characters, for example, <code>&amp;lt;</code>.</p>
-     *
-     *  <p>If you try to set this property to <code>null</code>,
-     *  it is set, instead, to the empty string.
-     *  The <code>text</code> property can temporarily have the value 
<code>null</code>,
-     *  which indicates that the <code>htmlText</code> has been recently set
-     *  and the corresponding <code>text</code> value
-     *  has not yet been determined.</p>
-     *
-     *  @default ""
-     *  @tiptext Gets or sets the TextInput content
-     *  @helpid 3190
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
-     */
-    function get text():String;
-
-    /**
-     *  @private
-     */
-    function set text(value:String):void;
 
     
//--------------------------------------------------------------------------
     //
diff --git 
a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as 
b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index 98c7add..225004d 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -1913,7 +1913,7 @@ COMPILE::JS
      * If the component is going to be used in an absolute positioning layout
      */
     COMPILE::JS
-    protected var isAbsolute:Boolean = true;
+    public var isAbsolute:Boolean = true;
     
     override public function addedToParent():void
     {

Reply via email to