Repository: flex-asjs Updated Branches: refs/heads/develop 863f18f34 -> cb189c4d9
Renamed TextInput to TextField to conform to MDL names Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/cb189c4d Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/cb189c4d Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/cb189c4d Branch: refs/heads/develop Commit: cb189c4d9fa5c482e4e817fd7bbfe439b1293a8c Parents: 863f18f Author: Carlos Rovira <[email protected]> Authored: Tue Nov 22 00:11:05 2016 +0100 Committer: Carlos Rovira <[email protected]> Committed: Tue Nov 22 00:11:05 2016 +0100 ---------------------------------------------------------------------- examples/flexjs/MDLExample/.vscode/launch.json | 4 +- .../flexjs/MDLExample/src/main/flex/App.mxml | 12 +- .../main/flex/org/apache/flex/mdl/TextField.as | 180 +++++++++++++++++++ .../main/flex/org/apache/flex/mdl/TextInput.as | 180 ------------------- .../org/apache/flex/mdl/beads/TextPrompt.as | 6 +- .../src/main/resources/mdl-manifest.xml | 2 +- 6 files changed, 192 insertions(+), 192 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cb189c4d/examples/flexjs/MDLExample/.vscode/launch.json ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/.vscode/launch.json b/examples/flexjs/MDLExample/.vscode/launch.json index 4fec2c2..00e0c2c 100644 --- a/examples/flexjs/MDLExample/.vscode/launch.json +++ b/examples/flexjs/MDLExample/.vscode/launch.json @@ -13,9 +13,9 @@ "name": "Launch Firefox against debug.html, with sourcemaps", "type": "firefox", "request": "launch", - "file": "${workspaceRoot}/debug.html", + "file": "${workspaceRoot}/target/javascript/bin/js-debug/index.html", "sourceMaps": true, - "preLaunchTask": "asconfigc" + "preLaunchTask": "" } ] } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cb189c4d/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 88a4c15..43fbcc9 100644 --- a/examples/flexjs/MDLExample/src/main/flex/App.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml @@ -63,16 +63,16 @@ 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" className="mdlti_example"> + <mdl:TextField id="mdlti" change="mdlchk.text = mdlti.text" className="mdlti_example"> <js:beads> <mdl:TextPrompt prompt="Normal Text Field..."/> </js:beads> - </mdl:TextInput> - <mdl:TextInput floatingLabel= "true"> + </mdl:TextField> + <mdl:TextField floatingLabel= "true"> <js:beads> <mdl:TextPrompt prompt="Floating Label"/> </js:beads> - </mdl:TextInput> + </mdl:TextField> <!-- Toggles :: https://getmdl.io/components/index.html#toggles-section --> <mdl:CheckBox id="mdlchk" text="Disabled at start" className="mdlchk_example"/> @@ -109,7 +109,7 @@ limitations under the License. </js:VContainer> - <mdl:List id="list" width="130" labelField="label"> + <!--<mdl:List id="list" width="130" labelField="label"> <js:dataProvider> <fx:Array> <fx:Object label="Install SIM Card"/> @@ -117,7 +117,7 @@ limitations under the License. <fx:Object label="Install SIM Card 2"/> </fx:Array> </js:dataProvider> - </mdl:List> + </mdl:List>--> <js:HContainer> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cb189c4d/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextField.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextField.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextField.as new file mode 100644 index 0000000..499cef3 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextField.as @@ -0,0 +1,180 @@ +// +// 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.flex.mdl +{ + import org.apache.flex.core.ITextModel; + import org.apache.flex.events.Event; + import org.apache.flex.html.TextInput; + + COMPILE::JS + { + import goog.events; + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The TextField class provides a Material Design Library UI-like appearance for + * a TextInput. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class TextField extends org.apache.flex.html.TextInput + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function TextField() + { + super(); + + className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user; + } + + COMPILE::JS + { + private var _textNode:Text; + + public function get textNode():Text + { + return _textNode; + } + + public function set textNode(value:Text):void + { + _textNode = value; + } + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLDivElement + * @flexjsignorecoercion HTMLInputElement + * @flexjsignorecoercion HTMLLabelElement + * @flexjsignorecoercion Text + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + typeNames = "mdl-textfield mdl-js-textfield"; + + var div:HTMLDivElement = document.createElement('div') as HTMLDivElement; + div.className = typeNames; + + var input:HTMLInputElement = document.createElement('input') as HTMLInputElement; + input.setAttribute('type', 'text'); + input.className = "mdl-textfield__input"; + + //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"; + + textNode = document.createTextNode('') as Text; + label.appendChild(textNode); + + div.appendChild(input); + div.appendChild(label); + + element = input as WrappedHTMLElement; + + positioner = div as WrappedHTMLElement; + (input as WrappedHTMLElement).flexjs_wrapper = this; + (label as WrappedHTMLElement).flexjs_wrapper = this; + element.flexjs_wrapper = this; + + return element; + } + + private var _className:String; + + /** + * since we have a div surronding the main input, we need to + * route the class assignaments to div + */ + override public function set className(value:String):void + { + if (_className != value) + { + COMPILE::JS + { + positioner.className = typeNames ? value + ' ' + typeNames : value; + } + _className = value; + dispatchEvent(new Event("classNameChanged")); + } + } + + private var _floatingLabel:Boolean = false; + /** + * A boolean flag to activate "mdl-textfield--floating-label" effect selector. + * Applies floating label effect. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get floatingLabel():Boolean + { + return _floatingLabel; + } + public function set floatingLabel(value:Boolean):void + { + _floatingLabel = value; + + COMPILE::JS + { + className += (_floatingLabel ? " mdl-textfield--floating-label" : ""); + } + } + + protected var _ripple:Boolean = false; + /** + * A boolean flag to activate "mdl-js-ripple-effect" effect selector. + * Applies ripple click effect. May be used in combination with any other classes + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get ripple():Boolean + { + return _ripple; + } + public function set ripple(value:Boolean):void + { + _ripple = value; + + COMPILE::JS + { + className += (_ripple ? " mdl-js-ripple-effect" : ""); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cb189c4d/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 deleted file mode 100644 index b30e8bb..0000000 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TextInput.as +++ /dev/null @@ -1,180 +0,0 @@ -// -// 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.flex.mdl -{ - import org.apache.flex.core.ITextModel; - import org.apache.flex.events.Event; - import org.apache.flex.html.TextInput; - - COMPILE::JS - { - import goog.events; - import org.apache.flex.core.WrappedHTMLElement; - } - - /** - * The TextInput class provides a Material Design Library UI-like appearance for - * a TextInput. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class TextInput extends org.apache.flex.html.TextInput - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function TextInput() - { - super(); - - className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user; - } - - COMPILE::JS - { - private var _textNode:Text; - - public function get textNode():Text - { - return _textNode; - } - - public function set textNode(value:Text):void - { - _textNode = value; - } - } - - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion HTMLDivElement - * @flexjsignorecoercion HTMLInputElement - * @flexjsignorecoercion HTMLLabelElement - * @flexjsignorecoercion Text - */ - COMPILE::JS - override protected function createElement():WrappedHTMLElement - { - typeNames = "mdl-textfield mdl-js-textfield"; - - var div:HTMLDivElement = document.createElement('div') as HTMLDivElement; - div.className = typeNames; - - var input:HTMLInputElement = document.createElement('input') as HTMLInputElement; - input.setAttribute('type', 'text'); - input.className = "mdl-textfield__input"; - - //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"; - - textNode = document.createTextNode('') as Text; - label.appendChild(textNode); - - div.appendChild(input); - div.appendChild(label); - - element = input as WrappedHTMLElement; - - positioner = div as WrappedHTMLElement; - (input as WrappedHTMLElement).flexjs_wrapper = this; - (label as WrappedHTMLElement).flexjs_wrapper = this; - element.flexjs_wrapper = this; - - return element; - } - - private var _className:String; - - /** - * since we have a div surronding the main input, we need to - * route the class assignaments to div - */ - override public function set className(value:String):void - { - if (_className != value) - { - COMPILE::JS - { - positioner.className = typeNames ? value + ' ' + typeNames : value; - } - _className = value; - dispatchEvent(new Event("classNameChanged")); - } - } - - private var _floatingLabel:Boolean = false; - /** - * A boolean flag to activate "mdl-textfield--floating-label" effect selector. - * Applies floating label effect. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get floatingLabel():Boolean - { - return _floatingLabel; - } - public function set floatingLabel(value:Boolean):void - { - _floatingLabel = value; - - COMPILE::JS - { - className += (_floatingLabel ? " mdl-textfield--floating-label" : ""); - } - } - - protected var _ripple:Boolean = false; - /** - * A boolean flag to activate "mdl-js-ripple-effect" effect selector. - * Applies ripple click effect. May be used in combination with any other classes - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get ripple():Boolean - { - return _ripple; - } - public function set ripple(value:Boolean):void - { - _ripple = value; - - COMPILE::JS - { - className += (_ripple ? " mdl-js-ripple-effect" : ""); - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cb189c4d/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TextPrompt.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TextPrompt.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TextPrompt.as index b9d1a6b..0e5904a 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TextPrompt.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TextPrompt.as @@ -31,11 +31,11 @@ package org.apache.flex.mdl.beads import org.apache.flex.events.Event; import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.mdl.TextInput; + import org.apache.flex.mdl.TextField; /** * The TextPrompt class is a specialty bead that can be used with - * any TextInput control. The bead places a string into the input field + * any TextField control. The bead places a string into the input field * when there is no value associated with the text property. * * @langversion 3.0 @@ -116,7 +116,7 @@ package org.apache.flex.mdl.beads } COMPILE::JS { - var mdlTi:TextInput = value as TextInput; + var mdlTi:TextField = value as TextField; mdlTi.textNode.nodeValue = prompt; //var e:HTMLInputElement = host.element as HTMLInputElement; //e.placeholder = prompt; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/cb189c4d/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml index 53c80e8..c34e902 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -22,7 +22,7 @@ <componentPackage> <component id="Button" class="org.apache.flex.mdl.Button"/> - <component id="TextInput" class="org.apache.flex.mdl.TextInput"/> + <component id="TextField" class="org.apache.flex.mdl.TextField"/> <component id="CheckBox" class="org.apache.flex.mdl.CheckBox"/> <component id="RadioButton" class="org.apache.flex.mdl.RadioButton"/> <component id="Switch" class="org.apache.flex.mdl.Switch"/>
