You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pi...@apache.org on 2016/11/28 07:20:57 UTC
git commit: [flex-asjs] [refs/heads/develop] - Add ButtonChip - it's
Chip but main element is Button instead Span
Repository: flex-asjs
Updated Branches:
refs/heads/develop 62150cf44 -> 99dc3584a
Add ButtonChip - it's Chip but main element is Button instead Span
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/99dc3584
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/99dc3584
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/99dc3584
Branch: refs/heads/develop
Commit: 99dc3584a53474d086886d23050de5b7393d675e
Parents: 62150cf
Author: piotrz <pi...@apache.org>
Authored: Mon Nov 28 08:20:49 2016 +0100
Committer: piotrz <pi...@apache.org>
Committed: Mon Nov 28 08:20:49 2016 +0100
----------------------------------------------------------------------
.../flexjs/MDLExample/src/main/flex/Chips.mxml | 3 +
.../main/flex/org/apache/flex/mdl/ButtonChip.as | 101 +++++++++++++++++++
.../src/main/flex/org/apache/flex/mdl/Chip.as | 1 -
.../src/main/resources/mdl-manifest.xml | 2 +-
4 files changed, 105 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/99dc3584/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 8d8c16a..41dc406 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Chips.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Chips.mxml
@@ -23,5 +23,8 @@ limitations under the License.
<mdl:GridCell column="1">
<mdl:Chip text="Basic Chip" />
</mdl:GridCell>
+ <mdl:GridCell column="2">
+ <mdl:ButtonChip text="Button Chip" />
+ </mdl:GridCell>
</mdl:Grid>
</mdl:TabBarPanel>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/99dc3584/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ButtonChip.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ButtonChip.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ButtonChip.as
new file mode 100644
index 0000000..a6400f2
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/ButtonChip.as
@@ -0,0 +1,101 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ COMPILE::SWF
+ {
+ import org.apache.flex.html.TextButton;
+ }
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ import org.apache.flex.core.UIBase;
+ }
+
+ /**
+ * The Chip class provides a MDL UI-like appearance for
+ * a Chip.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ COMPILE::SWF
+ public class ButtonChip extends TextButton
+ {
+ public function ButtonChip()
+ {
+ super();
+ }
+ }
+
+ COMPILE::JS
+ public class ButtonChip extends UIBase
+ {
+ public function ButtonChip()
+ {
+ super();
+
+ className = "";
+ }
+
+ private var chip:HTMLButtonElement;
+ private var chipTextSpan:HTMLSpanElement;
+ private var textNode:Text;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ * @flexjsignorecoercion HTMLSpanElement
+ * @flexjsignorecoercion HTMLButtonElement
+ * @flexjsignorecoercion Text
+ */
+ override protected function createElement():WrappedHTMLElement
+ {
+ typeNames = "mdl-chip";
+
+ chipTextSpan = document.createElement("span") as HTMLSpanElement;
+ chipTextSpan.className = "mdl-chip__text";
+
+ textNode = document.createTextNode('') as Text;
+ chipTextSpan.appendChild(textNode);
+
+ chip = document.createElement("button") as HTMLButtonElement;
+ chip.appendChild(chipTextSpan);
+
+ element = chip as WrappedHTMLElement;
+
+ positioner = element;
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ public function get text():String
+ {
+ return textNode.nodeValue;
+ }
+
+ public function set text(value:String):void
+ {
+ textNode.nodeValue = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/99dc3584/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Chip.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Chip.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Chip.as
index f0fd85c..3943eeb 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Chip.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Chip.as
@@ -64,7 +64,6 @@ package org.apache.flex.mdl
/**
* @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
* @flexjsignorecoercion HTMLSpanElement
- * @flexjsignorecoercion HTMLButtonElement
* @flexjsignorecoercion Text
*/
override protected function createElement():WrappedHTMLElement
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/99dc3584/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 44d4a75..848b95d 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
@@ -58,5 +58,5 @@
<component id="Grid" class="org.apache.flex.mdl.Grid"/>
<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"/>
</componentPackage>