Repository: flex-asjs Updated Branches: refs/heads/develop d159d7ed1 -> 9e3df4a21
- Add Deletable Chip bead without Icon. Need to figure out how add to the Bead missing icon Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/9e3df4a2 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/9e3df4a2 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/9e3df4a2 Branch: refs/heads/develop Commit: 9e3df4a211621cf21715123e549cbc399462938c Parents: d159d7e Author: piotrz <[email protected]> Authored: Mon Nov 28 23:46:34 2016 +0100 Committer: piotrz <[email protected]> Committed: Mon Nov 28 23:46:34 2016 +0100 ---------------------------------------------------------------------- .../flexjs/MDLExample/src/main/flex/Chips.mxml | 14 ++++ .../org/apache/flex/mdl/beads/DeletableChip.as | 82 ++++++++++++++++++++ .../flex/org/apache/flex/mdl/beads/Disabled.as | 2 - .../src/main/resources/mdl-manifest.xml | 1 + 4 files changed, 97 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e3df4a2/examples/flexjs/MDLExample/src/main/flex/Chips.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/Chips.mxml b/examples/flexjs/MDLExample/src/main/flex/Chips.mxml index 41dc406..cafe3b9 100644 --- a/examples/flexjs/MDLExample/src/main/flex/Chips.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/Chips.mxml @@ -26,5 +26,19 @@ limitations under the License. <mdl:GridCell column="2"> <mdl:ButtonChip text="Button Chip" /> </mdl:GridCell> + <mdl:GridCell column="3"> + <mdl:Chip text="Deletable Chip"> + <mdl:beads> + <mdl:DeletableChip /> + </mdl:beads> + </mdl:Chip> + </mdl:GridCell> + <mdl:GridCell column="4"> + <mdl:ButtonChip text="Deletable Button Chip"> + <mdl:beads> + <mdl:DeletableChip /> + </mdl:beads> + </mdl:ButtonChip> + </mdl:GridCell> </mdl:Grid> </mdl:TabBarPanel> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e3df4a2/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableChip.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableChip.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableChip.as new file mode 100644 index 0000000..cc53531 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/DeletableChip.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.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 DeletableChip bead class is a specialty bead that can be used to add additional + * button to Chip MDL control. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class DeletableChip implements IBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function DeletableChip() + { + + } + + private var deleteButton:Button; + + private var _strand:IStrand; + + /** + * @flexjsignorecoercion HTMLElement + * + * @param value + */ + public function set strand(value:IStrand):void + { + _strand = value; + + COMPILE::JS + { + var host:UIBase = value as UIBase; + var element:HTMLElement = host.element as HTMLElement; + var isValidElement:Boolean = element is HTMLSpanElement || element is HTMLButtonElement; + + if (isValidElement && element.className.search("mdl-chip") > -1) + { + host.className += " mdl-chip--deletable"; + + deleteButton = new Button(); + deleteButton.icon = true; + deleteButton.className += " mdl-chip__action"; + + element.appendChild(deleteButton.element as HTMLElement); + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e3df4a2/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as index ee34e27..2c25502 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as @@ -21,8 +21,6 @@ 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.events.Event; - import org.apache.flex.events.IEventDispatcher; /** * The Disabled bead class is a specialty bead that can be used to disable a MDL control. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9e3df4a2/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 848b95d..c7078bf 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -59,4 +59,5 @@ <component id="GridCell" class="org.apache.flex.mdl.GridCell"/> <component id="Chip" class="org.apache.flex.mdl.Chip"/> <component id="ButtonChip" class="org.apache.flex.mdl.ButtonChip"/> + <component id="DeletableChip" class="org.apache.flex.mdl.beads.DeletableChip"/> </componentPackage>
