flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject flex-asjs git commit: Dialog should be customizable so isn’t like Alert or SimpleAlert, but we only allow one <dialog> instance to be created, and then reuse it to popup. maybe this could change. We only need to finish with polyfill to end implementation
Date Thu, 19 Jan 2017 12:31:02 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop a72274a28 -> bdae42bd2


Dialog should be customizable so isn’t like Alert or SimpleAlert, but we only allow one
<dialog> instance to be created, and then reuse it to popup. maybe this could change.
We only need to finish with polyfill to end implementation


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

Branch: refs/heads/develop
Commit: bdae42bd2f712987b3cef87266331e37b2f8339f
Parents: a72274a
Author: Carlos Rovira <carlosrovira@apache.org>
Authored: Thu Jan 19 13:30:56 2017 +0100
Committer: Carlos Rovira <carlosrovira@apache.org>
Committed: Thu Jan 19 13:30:56 2017 +0100

----------------------------------------------------------------------
 .../MDLExample/src/main/flex/Dialogs.mxml       | 10 ++--
 .../MDLExample/src/main/flex/TestDialog.mxml    | 13 +-----
 .../src/main/flex/org/apache/flex/mdl/Dialog.as | 48 ++++++++++----------
 3 files changed, 34 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bdae42bd/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 761b0d7..c0fd6f3 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Dialogs.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Dialogs.mxml
@@ -23,9 +23,14 @@ limitations under the License.
 
     <fx:Script>
         <![CDATA[
+            private var dialog:TestDialog;
             private function showModal():void
             {
-                var dialog:TestDialog = new TestDialog();
+                if(dialog == null)
+                {
+                    dialog = new TestDialog();
+                }
+                
                 dialog.showModal();
             }
         ]]>
@@ -33,8 +38,7 @@ limitations under the License.
 
     <mdl:Grid>
         
-        <mdl:Button id="showdialog" text="Show Dialog" raised="true" 
-                    click="showModal()"/>
+        <mdl:Button id="showdialog" text="Show Dialog" raised="true" click="showModal()"/>
 
     </mdl:Grid>
 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bdae42bd/examples/flexjs/MDLExample/src/main/flex/TestDialog.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/TestDialog.mxml b/examples/flexjs/MDLExample/src/main/flex/TestDialog.mxml
index 9da5f8d..36dfb48 100644
--- a/examples/flexjs/MDLExample/src/main/flex/TestDialog.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/TestDialog.mxml
@@ -21,16 +21,7 @@ limitations under the License.
             xmlns:js="library://ns.apache.org/flexjs/basic"
             xmlns:mdl="library://ns.apache.org/flexjs/mdl"
             xmlns="http://www.w3.org/1999/xhtml">
-
-    <fx:Script>
-        <![CDATA[
-            private function closeModal():void
-            {
-                close();
-            }
-        ]]>
-    </fx:Script>
-
+    
     <js:H4 text="Allow data collection?" className="mdl-dialog__title"/>
     
     <mdl:DialogContent>
@@ -39,7 +30,7 @@ limitations under the License.
     
     <mdl:DialogActions>
         <mdl:Button text="Agree" raised="true"/>
-        <mdl:Button text="Disagree" raised="true" click="closeModal()"/>
+        <mdl:Button text="Disagree" raised="true" click="close()"/>
     </mdl:DialogActions>
         
 </mdl:Dialog>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bdae42bd/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 4078d69..3aa427c 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.
          *  
-         *  <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>
-         *  </no_inject_html>
+         *  <inject_html>
+         *  <link rel="stylesheet" href="http://cdn.bootcss.com/dialog-polyfill/0.4.5/dialog-polyfill.min.css">
+         *  <link rel="stylesheet" href="http://cdn.bootcss.com/dialog-polyfill/0.4.5/dialog-polyfill.min.js">
+         *  </inject_html>
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
@@ -55,11 +55,6 @@ package org.apache.flex.mdl
 			super();
 
 			className = ""; //set to empty string avoid 'undefined' output when no class selector
is assigned by user;
-
-			COMPILE::JS
-			{
-				addDialog();
-			}
 		}
 
 		COMPILE::JS
@@ -89,30 +84,37 @@ package org.apache.flex.mdl
         }
 
 		/**
-		 *  This function make the dialog be added to document.body.
-		 *  The parent in MDL must be the Application (IPopUpHost)
+		 * flag to ensure only one dialog is created
+		 */
+		private var lockDialogCreation:Boolean = false;
+
+		/**
+		 *  This function make the dialog be added to document.body only once
+		 *  The parent in MDL must be the Application (IPopUpHost) as MDL requisite
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		COMPILE::JS
-		public function addDialog() : void
-		{
-			if(Application.topLevelApplication != null)
-			{
-				Application.topLevelApplication.addElement(this);
-			}
-		}
-
-		/**
-		 * show modal
-		 */
 		public function showModal():void
 		{
 			COMPILE::JS
 			{
+				if(!lockDialogCreation)
+				{
+					lockDialogCreation = true;
+
+					if(Application.topLevelApplication != null)
+					{
+						Application.topLevelApplication.addElement(this);
+					}
+				}
+				
+				if (! dialog.showModal) {
+					//dialogPolyfill.registerDialog(dialog);
+				}
+
 				dialog.showModal();
 			}
 		}


Mime
View raw message