You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2016/11/14 18:22:52 UTC
[6/7] git commit: [flex-asjs] [refs/heads/develop] - Mdl menu & menu
item work in progress
Mdl menu & menu item work in progress
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b133706d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b133706d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b133706d
Branch: refs/heads/develop
Commit: b133706d41865b41d0759f7090f929351d2d5c20
Parents: 7046285
Author: Carlos Rovira <ca...@apache.org>
Authored: Mon Nov 14 19:06:02 2016 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Mon Nov 14 19:06:02 2016 +0100
----------------------------------------------------------------------
.../src/main/flex/org/apache/flex/mdl/Menu.as | 106 ++++++++++++++++
.../main/flex/org/apache/flex/mdl/MenuItem.as | 126 +++++++++++++++++++
2 files changed, 232 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b133706d/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Menu.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Menu.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Menu.as
new file mode 100644
index 0000000..55d4bf5
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Menu.as
@@ -0,0 +1,106 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The Menu class creates a MDL menu
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class Menu extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function Menu()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ this.element = document.createElement('ul') as WrappedHTMLElement;
+ this.element.className = "mdl-menu mdl-js-menu mdl-menu--top-left";
+ this.element.setAttribute('data-mdl-for', dataMdlFor.toString());
+ this.element.setAttribute('id', '0');
+ this.positioner = this.element;
+ this.element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ private var _dataMdlFor:Number = 0;
+
+ /**
+ * The id value of the associated button that opens this menu.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get dataMdlFor():Number
+ {
+ return _dataMdlFor;
+ }
+ public function set dataMdlFor(value:Number):void
+ {
+ _dataMdlFor = value;
+ }
+
+ protected var _ripple:Boolean = false;
+ /**
+ * 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
+ {
+ _ripple = value;
+
+ typeNames += (_ripple ? " mdl-js-ripple-effect" : "");
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b133706d/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/MenuItem.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/MenuItem.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/MenuItem.as
new file mode 100644
index 0000000..50e7fc3
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/MenuItem.as
@@ -0,0 +1,126 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+ import org.apache.flex.core.UIBase;
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ /**
+ * The MenuItem class creates a MDL menu item
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class MenuItem extends UIBase
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function MenuItem()
+ {
+ super();
+ }
+
+ private var _text:String = "";
+
+ /**
+ * The text of the heading
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get text():String
+ {
+ COMPILE::SWF
+ {
+ return _text;
+ }
+ COMPILE::JS
+ {
+ return textNode.nodeValue;
+ }
+ }
+
+ public function set text(value:String):void
+ {
+ COMPILE::SWF
+ {
+ _text = value;
+ }
+ COMPILE::JS
+ {
+ textNode.nodeValue = value;
+ }
+ }
+
+ COMPILE::JS
+ private var textNode:Text;
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ this.element = document.createElement('li') as WrappedHTMLElement;
+ this.element.className = "mdl-menu__item";
+
+ textNode = document.createTextNode('') as Text;
+ this.element.appendChild(textNode);
+
+ this.positioner = this.element;
+ this.element.flexjs_wrapper = this;
+
+ return element;
+ }
+
+ protected var _ripple:Boolean = false;
+ /**
+ * 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
+ {
+ _ripple = value;
+
+ typeNames += (_ripple ? " mdl-js-ripple-effect" : "");
+ }
+
+ }
+}