flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [23/50] git commit: [flex-asjs] [refs/heads/develop] - Changes in TextInput
Date Thu, 10 Nov 2016 08:49:18 GMT
Changes in TextInput


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

Branch: refs/heads/develop
Commit: 911901bfcba11285bcc8902fb081eb95b97f4924
Parents: 99a6abd
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Tue Oct 25 19:02:37 2016 +0200
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Sun Nov 6 13:15:38 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/App.mxml    | 13 +++--
 .../main/flex/org/apache/flex/mdl/TextInput.as  | 55 ++++++--------------
 2 files changed, 21 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/911901bf/examples/flexjs/MDLExample/src/main/flex/App.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/App.mxml b/examples/flexjs/MDLExample/src/main/flex/App.mxml
index a50dbeb..3924dba 100644
--- a/examples/flexjs/MDLExample/src/main/flex/App.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml
@@ -55,16 +55,15 @@ limitations under the License.
                 </js:HContainer>
 
                 <!-- Text Fields :: https://getmdl.io/components/index.html#textfields-section
-->
-                <mdl:TextInput id="mdlti" change="mdlchk.text = mdlti.text" text="Text..."/>
-
-                <mdl:TextInput  mdlEffect="mdl-textfield--floating-label" text="Floating
Label"/>
+                <mdl:TextInput id="mdlti" text="Normal Text Field..." change="mdlchk.text
= mdlti.text"/>
+                <mdl:TextInput text="Floating Label" mdlEffect="mdl-textfield--floating-label"
/>
 
                 <!-- Toggles :: https://getmdl.io/components/index.html#toggles-section
-->
-                <mdl:CheckBox id="mdlchk" text="This Checks" selected="true" mdlEffect="mdl-js-ripple-effect"/>
-                <mdl:CheckBox id="mdlchk1" text="This is disabled at start" />
+                <mdl:CheckBox id="mdlchk" text="Disabled at start" />
+                <mdl:CheckBox id="mdlchk1" text="Selected and with Ripple" selected="true"
mdlEffect="mdl-js-ripple-effect"/>
                 
-                <mdl:RadioButton groupName="g1" text="Black" mdlEffect="mdl-js-ripple-effect"/>
-                <mdl:RadioButton groupName="g1" text="White"/>
+                <mdl:RadioButton groupName="g1" text="Black"/>
+                <mdl:RadioButton groupName="g1" text="Ripple" mdlEffect="mdl-js-ripple-effect"/>
                 <mdl:RadioButton groupName="g1" text="Red"/>
 
             </js:Form>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/911901bf/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
index b387b81..87f9c5a 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as
@@ -64,41 +64,34 @@ package org.apache.flex.mdl
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
-            var div:HTMLDivElement;
-            var input:HTMLInputElement;
-            var label:HTMLLabelElement;
-            var textNode:Text;
-            
-            div = document.createElement('div') as HTMLDivElement;
+            var div:HTMLDivElement = document.createElement('div') as HTMLDivElement;
+            div.className = "mdl-textfield mdl-js-textfield";
 
-            input = document.createElement('input') as HTMLInputElement;
+            var input:HTMLInputElement = document.createElement('input') as HTMLInputElement;
             input.setAttribute('type', 'text');
             input.className = 'mdl-textfield__input';
-
-            label = document.createElement('label') as HTMLLabelElement;
-            label.className = "mdl-textfield__label";
             
-            _textNode = textNode = document.createTextNode('') as Text;
+            //attach input handler to dispatch flexjs change event when user write in textinput
+            //goog.events.listen(element, 'change', killChangeHandler);
+            goog.events.listen(input, 'input', textChangeHandler);
+            
+            var label:HTMLLabelElement = document.createElement('label') as HTMLLabelElement;
+            label.className = "mdl-textfield__label";
+
+            var textNode:Text = document.createTextNode('') as Text;
             label.appendChild(textNode);
             
             div.appendChild(input);
             div.appendChild(label);
 
-            element = div as WrappedHTMLElement;
-            
-            //attach input handler to dispatch flexjs change event when user write in textinput
-            //goog.events.listen(element, 'change', killChangeHandler);
-            goog.events.listen(input, 'input', textChangeHandler);
-            
-            positioner = element;
+            element = input as WrappedHTMLElement;
+
+            positioner = div as WrappedHTMLElement;
             positioner.style.position = 'relative';
-            (div as WrappedHTMLElement).flexjs_wrapper = this;
             (input as WrappedHTMLElement).flexjs_wrapper = this;
             (label as WrappedHTMLElement).flexjs_wrapper = this;
             element.flexjs_wrapper = this;
             
-            className = typeNames = "mdl-textfield mdl-js-textfield";
-
             return element;
         }        
         
@@ -114,26 +107,8 @@ package org.apache.flex.mdl
             _mdlEffect = value;
             COMPILE::JS 
             {
-                className = _mdlEffect;
+                positioner.className = positioner.className + " " + _mdlEffect;
             }
         }
-
-        /**
-         *  @private
-         */
-		override public function set text(value:String):void
-		{
-            //COMPILE::SWF
-            //{
-                //inSetter = true;
-                //ITextModel(model).text = value;
-                //inSetter = false;                    
-            //}
-            COMPILE::JS
-            {
-                _textNode.nodeValue = value;
-                dispatchEvent(new Event('textChange'));
-            }
-		}
 	}
 }


Mime
View raw message