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/06 01:30:45 UTC

[29/41] git commit: [flex-asjs] [refs/heads/feature/mdl] - Disabled bead

Disabled 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/0f1d5c2f
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/0f1d5c2f
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/0f1d5c2f

Branch: refs/heads/feature/mdl
Commit: 0f1d5c2f378a4d3012118633bb6e5ad899193d69
Parents: 155a1be
Author: Carlos Rovira <ca...@apache.org>
Authored: Wed Oct 26 23:19:29 2016 +0200
Committer: Carlos Rovira <ca...@apache.org>
Committed: Sun Nov 6 02:28:52 2016 +0100

----------------------------------------------------------------------
 .../flexjs/MDLExample/src/main/flex/App.mxml    |  3 +-
 .../flex/org/apache/flex/mdl/beads/Disabled.as  | 80 ++++++++++++++++++++
 .../src/main/resources/mdl-manifest.xml         |  1 +
 3 files changed, 83 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f1d5c2f/examples/flexjs/MDLExample/src/main/flex/App.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/App.mxml b/examples/flexjs/MDLExample/src/main/flex/App.mxml
index 0507f21..472f556 100644
--- a/examples/flexjs/MDLExample/src/main/flex/App.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml
@@ -65,10 +65,11 @@ limitations under the License.
                             <mdl:ButtonEffect raised="true" ripple="true" accent="true"/>
                         </js:beads>
                     </mdl:Button>
-                    <!-- Raised disabled button ... it seems we don't have "disabled" implemented yet-->
+                    <!-- Raised disabled button-->
                     <mdl:Button text="BUTTON">
                         <js:beads>
                             <mdl:ButtonEffect raised="true"/>
+                            <mdl:Disabled/>
                         </js:beads>
                     </mdl:Button>
                 </js:HContainer>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f1d5c2f/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
new file mode 100644
index 0000000..46067ff
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as
@@ -0,0 +1,80 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.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.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion FlexJS 0.0
+	 */
+	public class Disabled implements IBead
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		public function Disabled()
+		{
+		}
+		
+		private var _strand:IStrand;
+		
+		/**
+		 *  @copy org.apache.flex.core.IBead#strand
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 *  @flexjsignorecoercion HTMLInputElement
+		 *  @flexjsignorecoercion org.apache.flex.core.UIBase;
+		 */
+		public function set strand(value:IStrand):void
+		{
+			_strand = value;
+			
+			COMPILE::JS
+			{
+				var host:UIBase = value as UIBase;
+                var input:HTMLInputElement;
+                //if (host.element is HTMLInputElement)
+                //{
+                    input = host.element as HTMLInputElement;
+                    input.disabled = "disabled";
+                //} else
+                //{
+                 //   throw new Error("Host element component in not type input");
+                //}
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0f1d5c2f/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 8d30325..2d14e56 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
@@ -29,5 +29,6 @@
     <component id="MDLEffect" class="org.apache.flex.mdl.beads.MDLEffect"/>
     <component id="ButtonEffect" class="org.apache.flex.mdl.beads.ButtonEffect"/>
     <component id="TextInputEffect" class="org.apache.flex.mdl.beads.TextInputEffect"/>
+    <component id="Disabled" class="org.apache.flex.mdl.beads.Disabled"/>
 
 </componentPackage>