flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pio...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Finish DeletableChip: Add icon using Yishay's StrandUtils.loadBead to DeletableChip
Date Sat, 03 Dec 2016 10:29:39 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop e6df3721e -> 27ce7e91f


Finish DeletableChip: Add icon using Yishay's StrandUtils.loadBead to DeletableChip


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

Branch: refs/heads/develop
Commit: 27ce7e91fb4ac2b0b186a7f33bc4e850d1975b67
Parents: e6df372
Author: piotrz <piotrz@apache.org>
Authored: Sat Dec 3 11:29:31 2016 +0100
Committer: piotrz <piotrz@apache.org>
Committed: Sat Dec 3 11:29:31 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/Chips.mxml  |  2 ++
 .../org/apache/flex/mdl/beads/DeletableChip.as  | 31 ++++++++++++++++----
 2 files changed, 27 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27ce7e91/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 cafe3b9..b354809 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Chips.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Chips.mxml
@@ -29,6 +29,7 @@ limitations under the License.
         <mdl:GridCell column="3">
             <mdl:Chip text="Deletable Chip">
                 <mdl:beads>
+                    <mdl:MaterialIconCancel />
                     <mdl:DeletableChip />
                 </mdl:beads>
             </mdl:Chip>
@@ -36,6 +37,7 @@ limitations under the License.
         <mdl:GridCell column="4">
             <mdl:ButtonChip text="Deletable Button Chip">
                 <mdl:beads>
+                    <mdl:MaterialIconCancel />
                     <mdl:DeletableChip />
                 </mdl:beads>
             </mdl:ButtonChip>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/27ce7e91/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
index bf75144..c6956a5 100644
--- 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
@@ -22,6 +22,9 @@ package org.apache.flex.mdl.beads
     import org.apache.flex.core.IStrand;
     import org.apache.flex.core.UIBase;
     import org.apache.flex.mdl.Button;
+    import org.apache.flex.mdl.beads.materialIcons.MaterialIconCancel;
+    import org.apache.flex.mdl.supportClasses.MaterialIconBase;
+    import org.apache.flex.utils.StrandUtils;
 
     /**
      *  The DeletableChip bead class is a specialty bead that can be used to add additional
@@ -70,13 +73,9 @@ package org.apache.flex.mdl.beads
                 {
                     element.classList.add("mdl-chip--deletable");
 
-                    var deleteButton:Button = new Button();
-                    deleteButton.icon = true;
+                    var deleteButton:HTMLElement = createDeleteButton();
 
-                    var htmlButton:HTMLElement = (deleteButton.element as HTMLElement)
-                    htmlButton.classList.add("mdl-chip__action");
-
-                    element.appendChild(deleteButton.element as HTMLElement);
+                    element.appendChild(deleteButton);
                 }
                 else
                 {
@@ -84,5 +83,25 @@ package org.apache.flex.mdl.beads
                 }
             }
         }
+
+        /**
+         * @flexjsignorecoercion HTMLElement
+         *
+         * @return Button represents cancel icon
+         */
+        COMPILE::JS
+        private function createDeleteButton():HTMLElement
+        {
+            var iconBead:IBead = StrandUtils.loadBead(MaterialIconBase, "MaterialIconBase",
_strand);
+
+            var deleteButton:Button = new Button();
+            deleteButton.icon = true;
+            deleteButton.addBead(iconBead);
+
+            var htmlButton:HTMLElement = (deleteButton.element as HTMLElement);
+            htmlButton.classList.add("mdl-chip__action");
+
+            return htmlButton;
+        }
     }
 }


Mime
View raw message