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] - Fix null pointer exception in ContactChip bead
Date Sun, 04 Dec 2016 20:25:06 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop d7a3778a6 -> ff87745d7


Fix null pointer exception in ContactChip bead


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

Branch: refs/heads/develop
Commit: ff87745d7d2b1bd8ff6f699253cc36d2f29bc7d0
Parents: d7a3778
Author: piotrz <piotrz@apache.org>
Authored: Sun Dec 4 21:24:58 2016 +0100
Committer: piotrz <piotrz@apache.org>
Committed: Sun Dec 4 21:24:58 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/Chips.mxml  |  8 +--
 .../org/apache/flex/mdl/beads/ContactChip.as    | 52 ++++++++------------
 2 files changed, 25 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff87745d/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 d55a0d7..8375ba4 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Chips.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Chips.mxml
@@ -23,10 +23,10 @@ limitations under the License.
         <mdl:GridCell column="1">
             <mdl:Chip text="Basic Chip" />
         </mdl:GridCell>
-        <mdl:GridCell column="1">
+        <mdl:GridCell column="2">
             <mdl:ButtonChip text="Button Chip" />
         </mdl:GridCell>
-        <mdl:GridCell column="1">
+        <mdl:GridCell column="3">
             <mdl:Chip text="Deletable Chip">
                 <mdl:beads>
                     <mdl:MaterialIconCancel />
@@ -34,7 +34,7 @@ limitations under the License.
                 </mdl:beads>
             </mdl:Chip>
         </mdl:GridCell>
-        <mdl:GridCell column="1">
+        <mdl:GridCell column="4">
             <mdl:ButtonChip text="Deletable Button Chip">
                 <mdl:beads>
                     <mdl:MaterialIconCancel />
@@ -42,7 +42,7 @@ limitations under the License.
                 </mdl:beads>
             </mdl:ButtonChip>
         </mdl:GridCell>
-        <mdl:GridCell column="1">
+        <mdl:GridCell column="5">
             <mdl:Chip text="Contact Chip">
                 <mdl:beads>
                     <mdl:ContactChip contactText="A"/>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ff87745d/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ContactChip.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ContactChip.as
b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ContactChip.as
index 7af8703..b119c51 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ContactChip.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/ContactChip.as
@@ -22,6 +22,7 @@ package org.apache.flex.mdl.beads
     import org.apache.flex.core.IStrand;
     import org.apache.flex.core.UIBase;
 
+
     /**
      *  The ContactChip bead class is a specialty bead that can be used to add additional
      *  button to Chip MDL control.
@@ -31,6 +32,23 @@ package org.apache.flex.mdl.beads
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
+    COMPILE::SWF
+    public class ContactChip
+    {
+        private var _contactText:String = "";
+
+        public function ContactChip()
+        {
+
+        }
+
+        public function set contactText(value:String):void
+        {
+            _contactText = value;
+        }
+    }
+
+    COMPILE::JS
     public class ContactChip implements IBead
     {
         /**
@@ -47,9 +65,7 @@ package org.apache.flex.mdl.beads
 
         private var _contactText:String = "";
 
-        COMPILE::JS
         private var contact:HTMLSpanElement;
-        COMPILE::JS
         private var textNode:Text;
 
         private var _strand:IStrand;
@@ -77,7 +93,8 @@ package org.apache.flex.mdl.beads
                     element.classList.add("mdl-chip--contact");
 
                     textNode = document.createTextNode('') as Text;
-
+                    textNode.nodeValue = _contactText;
+                    
                     contact = document.createElement("span") as HTMLSpanElement;
                     contact.classList.add("mdl-chip__contact");
                     contact.appendChild(textNode);
@@ -91,36 +108,9 @@ package org.apache.flex.mdl.beads
             }
         }
 
-        /**
-         *  The text for contact
-         *
-         *  @langversion 3.0
-         *  @playerversion Flash 10.2
-         *  @playerversion AIR 2.6
-         *  @productversion FlexJS 0.0
-         */
-        public function get contactText():String
-        {
-            COMPILE::SWF
-            {
-                return _contactText;
-            }
-            COMPILE::JS
-            {
-                return textNode.nodeValue;
-            }
-        }
-
         public function set contactText(value:String):void
         {
-            COMPILE::SWF
-            {
-                _contactText = value;
-            }
-            COMPILE::JS
-            {
-                textNode.nodeValue = value;
-            }
+            _contactText = value;
         }
     }
 }


Mime
View raw message