Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id BBD7F200C01 for ; Thu, 19 Jan 2017 13:31:04 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BA5D4160B54; Thu, 19 Jan 2017 12:31:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DEA14160B42 for ; Thu, 19 Jan 2017 13:31:03 +0100 (CET) Received: (qmail 90090 invoked by uid 500); 19 Jan 2017 12:31:02 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 90082 invoked by uid 99); 19 Jan 2017 12:31:02 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Jan 2017 12:31:02 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7B840DFB86; Thu, 19 Jan 2017 12:31:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: carlosrovira@apache.org To: commits@flex.apache.org Message-Id: <377898c2f0924d408c05c4e23cc35d60@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: =?utf-8?q?flex-asjs_git_commit=3A_Dialog_should_be_customizable_so?= =?utf-8?q?_isn=E2=80=99t_like_Alert_or_SimpleAlert=2C_but_we_only_allow_one?= =?utf-8?q?_=3Cdialog=3E_instance_to_be_created=2C_and_then_reuse_it_to_popu?= =?utf-8?q?p=2E_maybe_this_could_change=2E_We_only_need_to_finish_with_polyf?= =?utf-8?q?ill_to_end_implementation?= Date: Thu, 19 Jan 2017 12:31:02 +0000 (UTC) archived-at: Thu, 19 Jan 2017 12:31:04 -0000 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 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 Authored: Thu Jan 19 13:30:56 2017 +0100 Committer: Carlos Rovira 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. @@ -33,8 +38,7 @@ limitations under the License. - + 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"> - - - - - + @@ -39,7 +30,7 @@ limitations under the License. - + \ 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. * - * - * - * - * + * + * + * + * * * @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(); } }