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 2017/01/15 23:23:35 UTC

git commit: [flex-asjs] [refs/heads/develop] - Mostly all Dialog implementation but still not working

Repository: flex-asjs
Updated Branches:
  refs/heads/develop afd317a09 -> dddc9e723


Mostly all Dialog implementation but still not working


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

Branch: refs/heads/develop
Commit: dddc9e7236ac2e13430d4f2ad10c0e6e775981e4
Parents: afd317a
Author: Carlos Rovira <ca...@apache.org>
Authored: Mon Jan 16 00:23:32 2017 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Mon Jan 16 00:23:32 2017 +0100

----------------------------------------------------------------------
 .../MDLExample/src/main/flex/Dialogs.mxml       | 30 +++++++++++--
 .../src/main/flex/org/apache/flex/mdl/Dialog.as | 46 +++++++++++++++++---
 .../flex/org/apache/flex/mdl/DialogActions.as   | 26 +++++++++++
 3 files changed, 93 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dddc9e72/examples/flexjs/MDLExample/src/main/flex/Dialogs.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/Dialogs.mxml b/examples/flexjs/MDLExample/src/main/flex/Dialogs.mxml
index 1fda92d..f1e1371 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Dialogs.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Dialogs.mxml
@@ -18,19 +18,41 @@ limitations under the License.
 
 -->
 <mdl:TabBarPanel xmlns:fx="http://ns.adobe.com/mxml/2009"
+                 xmlns:js="library://ns.apache.org/flexjs/basic"
                  xmlns:mdl="library://ns.apache.org/flexjs/mdl">
 
+    <fx:Script>
+        <![CDATA[
+            private function showModal():void
+            {
+                dialog.showModal();
+            }
+
+            private function closeModal():void
+            {
+                dialog.close();
+            }
+        ]]>
+    </fx:Script>
+
     <mdl:Grid>
         
-        <mdl:Button id="showdialog" text="Show Dialog" raised="true">
+        <mdl:Button id="showdialog" text="Show Dialog" raised="true" click="showModal()">
             <mdl:beads>
                 <mdl:Tooltip text="Dialog is still under development"/>
             </mdl:beads>
         </mdl:Button>
 
-        <!--<mdl:Dialog>
-
-        </mdl:Dialog>-->
+        <mdl:Dialog id="dialog">
+            <js:H4 text="Allow data collection?" className="mdl-dialog__title"/>
+            <mdl:DialogContent>
+                <js:P text="This is an example of the Material Design Lite dialog component. Please use responsibly."/>
+            </mdl:DialogContent>
+            <mdl:DialogActions>
+                <mdl:Button text="Agree" raised="true"/>
+                <mdl:Button text="Disagree" raised="true" click="closeModal()"/>
+            </mdl:DialogActions>
+        </mdl:Dialog>
 
     </mdl:Grid>
 </mdl:TabBarPanel>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dddc9e72/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Dialog.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Dialog.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Dialog.as
index 59b9a25..b9060e5 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Dialog.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Dialog.as
@@ -40,10 +40,10 @@ package org.apache.flex.mdl
 		/**
 		 *  constructor.
          *  
-         *  <inject_html>
+         *  <no_inject_html>
          *  <script src="https://cdnjs.cloudflare.com/ajax/libs/dialog-polyfill/0.4.5/dialog-polyfill.min.js"></script>
          *  <script src="https://cdnjs.cloudflare.com/ajax/libs/dialog-polyfill/0.4.5/dialog-polyfill.min.css"></script>
-         *  </inject_html>
+         *  </no_inject_html>
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
@@ -57,18 +57,54 @@ package org.apache.flex.mdl
 			className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user;
 		}
 		
+		/**
+		 * showModal
+		 */
+		public function showModal():void
+		{
+			COMPILE::JS
+			{
+				dialog['showModal']();
+			}
+		}
+
+		/**
+		 * show
+		 */
+		public function show():void
+		{
+			COMPILE::JS
+			{
+				dialog['show']();
+			}
+		}
+
+		/**
+		 * close
+		 */
+		public function close():void
+		{
+			COMPILE::JS
+			{
+				dialog['close']();
+			}
+		}
+
+		COMPILE::JS
+		private var dialog:HTMLElement; //HTMLDialogElement;
+
         /**
          * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+		 * @flexjsignorecoercion HTMLElement
          */
         COMPILE::JS
         override protected function createElement():WrappedHTMLElement
         {
 			typeNames = "mdl-dialog";
             
-            element = document.createElement('dialog') as WrappedHTMLElement;
+            dialog = document.createElement('dialog') as HTMLElement; //HTMLDialogElement;
+			element = dialog as WrappedHTMLElement;
 
-			//document.body.appendChild(element);
-            
 			positioner = element;
             
             // absolute positioned children need a non-null

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dddc9e72/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DialogActions.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DialogActions.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DialogActions.as
index b114550..c25ec4c 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DialogActions.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/DialogActions.as
@@ -72,5 +72,31 @@ package org.apache.flex.mdl
 
             return element;
         }
+
+		protected var _fullWidth:Boolean = false;
+        /**
+		 *  A boolean flag to activate "mdl-dialog__actions--full-width" effect selector.
+		 *  Modifies the actions to each take the full width of the container. This makes each take their own line.
+		 *  Optional on action container.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+        public function get fullWidth():Boolean
+        {
+            return _fullWidth;
+        }
+        public function set fullWidth(value:Boolean):void
+        {
+			_fullWidth = value;
+
+			COMPILE::JS
+            {
+				positioner.classList.toggle("mdl-dialog__actions--full-width", _fullWidth);
+				typeNames = positioner.className;
+			}
+        }
 	}
 }