ButtonEffectBead in place
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/d26f390c Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/d26f390c Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/d26f390c Branch: refs/heads/feature/mdl Commit: d26f390c10b6533c6339fc952152b543416d95c8 Parents: 73770ae Author: Carlos Rovira <carlosrov...@apache.org> Authored: Wed Oct 26 20:03:10 2016 +0200 Committer: Carlos Rovira <carlosrov...@apache.org> Committed: Wed Oct 26 22:48:24 2016 +0200 ---------------------------------------------------------------------- .../flexjs/MDLExample/src/main/flex/App.mxml | 10 +- .../main/flex/org/apache/flex/mdl/CheckBox.as | 12 - .../flex/org/apache/flex/mdl/RadioButton.as | 12 - .../apache/flex/mdl/beads/ButtonEffectBead.as | 253 +++++++++++++++++++ .../org/apache/flex/mdl/beads/EffectBead.as | 9 - .../src/main/resources/defaults.css | 8 +- .../src/main/resources/mdl-manifest.xml | 1 + 7 files changed, 266 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d26f390c/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 82126a4..e618658 100644 --- a/examples/flexjs/MDLExample/src/main/flex/App.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml @@ -39,7 +39,7 @@ limitations under the License. <!-- Fab button --> <mdl:Button> <js:beads> - <mdl:EffectBead mdlEffect="mdl-button--fab mdl-button--colored"/> + <mdl:ButtonEffectBead fab="true" colored="true"/> </js:beads> <i class="material-icons">add</i> </mdl:Button> @@ -47,7 +47,7 @@ limitations under the License. <!-- Fab with Ripple --> <mdl:Button> <js:beads> - <mdl:EffectBead mdlEffect="mdl-button--fab mdl-js-ripple-effect"/> + <mdl:ButtonEffectBead fab="true" ripple="true"/> </js:beads> <i class="material-icons md-48">face</i> </mdl:Button> @@ -55,20 +55,20 @@ limitations under the License. <!-- Raised button --> <mdl:Button text="BUTTON"> <js:beads> - <mdl:EffectBead mdlEffect="mdl-button--raised mdl-button--colored"/> + <mdl:ButtonEffectBead raised="true" colored="true"/> </js:beads> </mdl:Button> <!-- Raised button with ripple --> <mdl:Button text="BUTTON"> <js:beads> - <mdl:EffectBead mdlEffect="mdl-button--raised mdl-js-ripple-effect mdl-button--accent"/> + <mdl:ButtonEffectBead raised="true" ripple="true" accent="true"/> </js:beads> </mdl:Button> <!-- Raised disabled button ... it seems we don't have "disabled" implemented yet--> <mdl:Button text="BUTTON"> <js:beads> - <mdl:EffectBead mdlEffect="mdl-button--raised"/> + <mdl:ButtonEffectBead raised="true"/> </js:beads> </mdl:Button> </js:HContainer> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d26f390c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as index 58d3ba2..4f2bf9e 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/CheckBox.as @@ -53,18 +53,6 @@ package org.apache.flex.mdl { super(); } - - private var _mdlEffect:String = ""; - - public function get mdlEffect():String - { - return _mdlEffect; - } - - public function set mdlEffect(value:String):void - { - _mdlEffect = value; - } } COMPILE::JS http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d26f390c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as index 0f8237d..e0933d2 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/RadioButton.as @@ -53,18 +53,6 @@ package org.apache.flex.mdl { super(); } - - private var _mdlEffect:String = ""; - - public function get mdlEffect():String - { - return _mdlEffect; - } - - public function set mdlEffect(value:String):void - { - _mdlEffect = value; - } } COMPILE::JS http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d26f390c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ButtonEffectBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ButtonEffectBead.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ButtonEffectBead.as new file mode 100644 index 0000000..de999f9 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ButtonEffectBead.as @@ -0,0 +1,253 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.beads +{ + import org.apache.flex.core.IBead; + import org.apache.flex.core.IStrand; + import org.apache.flex.core.UIBase; + + import org.apache.flex.mdl.Button; + + /** + * The ButtonEffectBead class is a specialty bead that can be used with + * an MDL button control to apply some MDL complementary effect. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ButtonEffectBead implements IBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ButtonEffectBead() + { + } + + private var _fab:String = ""; + /** + * A boolean flag to activate "mdl-button--fab" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get fab():Boolean + { + return _fab; + } + public function set fab(value:Boolean):void + { + if(value) { + _fab = " mdl-button--fab"; + } else { + _fab = ""; + } + } + + private var _raised:String = ""; + /** + * A boolean flag to activate "mdl-button--raised" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get raised():Boolean + { + return _raised; + } + public function set raised(value:Boolean):void + { + if(value) { + _raised = " mdl-button--raised"; + } else { + _raised = ""; + } + } + + private var _colored:String = ""; + /** + * A boolean flag to activate "mdl-button--colored" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get colored():Boolean + { + return _colored; + } + public function set colored(value:Boolean):void + { + if(value) { + _colored = " mdl-button--colored"; + } else { + _colored = ""; + } + } + + private var _ripple:String = ""; + /** + * A boolean flag to activate "mdl-js-ripple-effect" effect selector. + * + * @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 + { + if(value) { + _ripple = " mdl-js-ripple-effect"; + } else { + _ripple = ""; + } + } + + private var _accent:String = ""; + /** + * A boolean flag to activate "mdl-button--accent" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get accent():Boolean + { + return _accent; + } + public function set accent(value:Boolean):void + { + if(value) { + _accent = " mdl-button--accent"; + } else { + _accent = ""; + } + } + + private var _primary:String = ""; + /** + * A boolean flag to activate "mdl-button--primary" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get primary():Boolean + { + return _primary; + } + public function set primary(value:Boolean):void + { + if(value) { + _primary = " mdl-button--primary"; + } else { + _primary = ""; + } + } + + private var _minifab:String = ""; + /** + * A boolean flag to activate "mdl-button--mini-fab" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get minifab():Boolean + { + return _minifab; + } + public function set minifab(value:Boolean):void + { + if(value) { + _minifab = " mdl-button--mini-fab"; + } else { + _minifab = ""; + } + } + + private var _icon:String = ""; + /** + * A boolean flag to activate "mdl-button--icon" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get icon():Boolean + { + return _icon; + } + public function set icon(value:Boolean):void + { + if(value) { + _icon = " mdl-button--icon"; + } else { + _icon = ""; + } + } + + private var _strand:IStrand; + + /** + * @copy org.apache.flex.core.IBead#strand + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion HTMLInputElement + * @flexjsignorecoercion org.apache.flex.core.UIBase; + */ + public function set strand(value:IStrand):void + { + _strand = value; + + COMPILE::JS + { + if (value is Button) { + var button:Button = value as Button; + button.className = _fab + _raised + _colored + _ripple + _accent + _primary + _minifab + _icon; + } else { + throw new Error("Host component must be an MDL Button."); + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d26f390c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/EffectBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/EffectBead.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/EffectBead.as index b01538d..d7ddcc0 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/EffectBead.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/EffectBead.as @@ -46,15 +46,6 @@ package org.apache.flex.mdl.beads public function EffectBead() { } - - /*public static const RAISED_EFFECT:String = "mdl-button--raised"; - public static const FAB_EFFECT:String = "mdl-button--fab"; - public static const MINI_FAB_EFFECT:String = "mdl-button--mini-fab"; - public static const ICON_EFFECT:String = "mdl-button--icon"; - public static const COLORED_EFFECT:String = "mdl-button--colored"; - public static const PRIMARY_EFFECT:String = "mdl-button--primary"; - public static const ACCENT_EFFECT:String = "mdl-button--accent"; - public static const RIPPLE_EFFECT:String = "mdl-js-ripple-effect";*/ private var _mdlEffect:String = ""; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d26f390c/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css index f795472..ae61dc6 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css @@ -17,9 +17,15 @@ * */ -@namespace "library://ns.apache.org/flexjs/mdl"; +@namespace "library://ns.apache.org/flexjs/basic"; +@namespace mdl "library://ns.apache.org/flexjs/mdl"; +.flexjs *, . flexjs *:before, . flexjs *:after { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/d26f390c/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 aca9380..a4d62f2 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -27,5 +27,6 @@ <component id="RadioButton" class="org.apache.flex.mdl.RadioButton"/> <component id="TextPromptBead" class="org.apache.flex.mdl.beads.TextPromptBead"/> <component id="EffectBead" class="org.apache.flex.mdl.beads.EffectBead"/> + <component id="ButtonEffectBead" class="org.apache.flex.mdl.beads.ButtonEffectBead"/> </componentPackage>