flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [20/36] git commit: [flex-asjs] [refs/heads/feature/mdl] - Text Input with floating text
Date Fri, 04 Nov 2016 23:19:12 GMT
Text Input with floating text


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

Branch: refs/heads/feature/mdl
Commit: 8b993f42dff8db8ed19aaa1dc989690839f5a0de
Parents: 5564852
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Wed Oct 19 02:21:37 2016 +0200
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Sat Nov 5 00:18:33 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/App.mxml    |  5 ++-
 .../main/flex/org/apache/flex/mdl/TextInput.as  | 45 +++++++++++++++++++-
 2 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8b993f42/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 95dad1b..636b72b 100644
--- a/examples/flexjs/MDLExample/src/main/flex/App.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml
@@ -57,7 +57,9 @@ limitations under the License.
                 </js:Container>
 
                 <!-- Text Fields :: https://getmdl.io/components/index.html#textfields-section
-->
-                <mdl:TextInput id="mdlti" text="Something..." change="mdlchk.text = mdlti.text"/>
+                <mdl:TextInput id="mdlti"  change="mdlchk.text = mdlti.text" text="Text..."/>
+
+                <mdl:TextInput  mdlEffect="mdl-textfield--floating-label" text="Floating
Label"/>
 
                 <!-- Toggles :: https://getmdl.io/components/index.html#toggles-section
-->
                 <mdl:CheckBox id="mdlchk" text="This Checks" selected="true"/>
@@ -66,6 +68,7 @@ limitations under the License.
                 <mdl:RadioButton groupName="g1" text="Black"/>
                 <mdl:RadioButton groupName="g1" text="White"/>
                 <mdl:RadioButton groupName="g1" text="Red"/>
+
             </js:Form>
             
         </js:View>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8b993f42/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 4617678..48d71bf 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
@@ -49,8 +49,17 @@ package org.apache.flex.mdl
 			super();
 		}
 		
+        COMPILE::JS
+        {
+            private var _textNode:Text;
+        }
+        
         /**
          * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+         * @flexjsignorecoercion HTMLDivElement
+         * @flexjsignorecoercion HTMLInputElement
+         * @flexjsignorecoercion HTMLLabelElement
+         * @flexjsignorecoercion Text
          */
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
@@ -70,7 +79,7 @@ package org.apache.flex.mdl
             label = document.createElement('label') as HTMLLabelElement;
             label.className = "mdl-textfield__label";
             
-            textNode = document.createTextNode('') as Text;
+            _textNode = textNode = document.createTextNode('') as Text;
             label.appendChild(textNode);
             
             div.appendChild(input);
@@ -94,5 +103,39 @@ package org.apache.flex.mdl
             return element;
         }        
         
+        private var _mdlEffect:String = "";
+
+        public function get mdlEffect():String
+        {
+            return _mdlEffect;
+        }
+        
+        public function set mdlEffect(value:String):void
+        {
+            _mdlEffect = value;
+            COMPILE::JS 
+            {
+                element.className = 'mdl-textfield mdl-js-textfield ' + _mdlEffect;
+            }
+        }
+
+        /**
+         *  @private
+         *  @flexjsignorecoercion HTMLInputElement
+         */
+		override public function set text(value:String):void
+		{
+            COMPILE::SWF
+            {
+                //inSetter = true;
+                //ITextModel(model).text = value;
+                //inSetter = false;                    
+            }
+            COMPILE::JS
+            {
+                _textNode.text = value;
+                dispatchEvent(new Event('textChange'));
+            }
+		}
 	}
 }


Mime
View raw message