You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/10 09:01:37 UTC

[royale-asjs] branch feature/jewel-snackbar updated: Code need COMPILE::JS blocks to compile (maybe you can compile it since your're using a JS only version?). This solves the conflicts and the code runs right.

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch feature/jewel-snackbar
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/jewel-snackbar by this push:
     new 5b60eb9  Code need COMPILE::JS blocks to compile (maybe you can compile it since your're using a JS only version?). This solves the conflicts and the code runs right.
5b60eb9 is described below

commit 5b60eb9fb4c5e29dc7566f799c003e5a80e5c645
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Mon Sep 10 11:01:33 2018 +0200

    Code need COMPILE::JS blocks to compile (maybe you can compile it since your're using a JS only version?). This solves the conflicts and the code runs right.
---
 .../src/main/royale/models/MainNavigationModel.as  |  1 -
 .../royale/org/apache/royale/jewel/Snackbar.as     |  1 +
 .../royale/jewel/beads/views/SnackbarView.as       | 33 ++++++++++++++--------
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
index f764ee8..1f80a24 100644
--- a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
+++ b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
@@ -39,7 +39,6 @@ package models
             new NavigationLinkVO("Text", "text_panel", MaterialIconType.SUBJECT),
             new NavigationLinkVO("TextInput", "textinput_panel", MaterialIconType.TEXT_FIELDS),
             new NavigationLinkVO("Forms & Validation", "form_validation_panel", MaterialIconType.ASSIGNMENT_TURNED_IN),
-            new NavigationLinkVO("DropDownList", "dropdownlist_panel", MaterialIconType.CREDIT_CARD)
             new NavigationLinkVO("DropDownList", "dropdownlist_panel", MaterialIconType.CREDIT_CARD),
 
             // new NavigationLinkVO("Menu", "menus_panel"),
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as
index b33b8c0..95c460b 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as
@@ -21,6 +21,7 @@ package org.apache.royale.jewel
     import org.apache.royale.core.IPopUp;
     import org.apache.royale.core.StyledUIBase;
     import org.apache.royale.core.UIBase;
+	import org.apache.royale.events.Event;
     import org.apache.royale.jewel.beads.models.SnackbarModel;
 
     COMPILE::JS
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as
index 418dbff..5739a03 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as
@@ -74,19 +74,21 @@ package org.apache.royale.jewel.beads.views
 
             host = value as Snackbar;
             var model:SnackbarModel = host.model as SnackbarModel;
-
-			var messageElement:Element = document.createElement("div");
-			messageElement.className = "jewel snackbar-message";
-            messageElement.innerHTML = model.message;
-
-			var contentElement:Element = document.createElement("div");
-			contentElement.className = "jewel snackbar-content";
-			contentElement.appendChild(messageElement);
-
             model.addEventListener("messageChange", messageChangeHandler);
             model.addEventListener("actionChange", actionChangeHandler);
 
-            host.element.appendChild(contentElement);
+            COMPILE::JS
+            {
+                var messageElement:Element = document.createElement("div");
+                messageElement.className = "jewel snackbar-message";
+                messageElement.innerHTML = model.message;
+
+                var contentElement:Element = document.createElement("div");
+                contentElement.className = "jewel snackbar-content";
+                contentElement.appendChild(messageElement);
+
+                host.element.appendChild(contentElement);
+            }
 
             if (model.action) actionChangeHandler(null);
         }
@@ -96,7 +98,10 @@ package org.apache.royale.jewel.beads.views
          *  Update the text when message changed. 
          */
         private function messageChangeHandler(event:Event):void {
-            Element(host.element.firstChild.firstChild).innerHTML = SnackbarModel(host.model).message;
+            COMPILE::JS
+            {
+                HTMLElement(host.element.firstChild.firstChild).innerHTML = SnackbarModel(host.model).message;
+            }
         }
 
         /**
@@ -105,6 +110,8 @@ package org.apache.royale.jewel.beads.views
         private function actionChangeHandler(event:Event):void {
             var model:SnackbarModel = host.model as SnackbarModel;
 
+            COMPILE::JS
+            {
             if (model.action) {
 				if (!actionElement) {
 					actionElement = document.createElement("div");
@@ -120,15 +127,19 @@ package org.apache.royale.jewel.beads.views
 					actionElement = null;
 				}
 			}
+            }
         }
 
         /**
          *  Trigger event and dismiss the host when action clicked.
          */
         private function actionClickHandler(event:Event):void {
+            COMPILE::JS
+            {
             actionElement.removeEventListener("click", actionClickHandler);
             host.dispatchEvent(new Event(Snackbar.ACTION));
             SnackbarModel(host.model).duration = -1; // set -1 to dismiss
+            }
         }
 
     }


Re: [royale-asjs] branch feature/jewel-snackbar updated: Code need COMPILE::JS blocks to compile (maybe you can compile it since your're using a JS only version?). This solves the conflicts and the code runs right.

Posted by Carlos Rovira <ca...@apache.org>.
Hi,

someone knows how this code was compiling for Yu Taro?. Maybe could be that
he's with a js-only environment and he doesn't need to put COMPILE::JS
declaration blocks?. As well he doesn't have a Event import declaration in
one of the class. I'm curious how he get this to compile, while I can't.

Thanks



El lun., 10 sept. 2018 a las 11:01, <ca...@apache.org> escribió:

> This is an automated email from the ASF dual-hosted git repository.
>
> carlosrovira pushed a commit to branch feature/jewel-snackbar
> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
>
>
> The following commit(s) were added to refs/heads/feature/jewel-snackbar by
> this push:
>      new 5b60eb9  Code need COMPILE::JS blocks to compile (maybe you can
> compile it since your're using a JS only version?). This solves the
> conflicts and the code runs right.
> 5b60eb9 is described below
>
> commit 5b60eb9fb4c5e29dc7566f799c003e5a80e5c645
> Author: Carlos Rovira <ca...@apache.org>
> AuthorDate: Mon Sep 10 11:01:33 2018 +0200
>
>     Code need COMPILE::JS blocks to compile (maybe you can compile it
> since your're using a JS only version?). This solves the conflicts and the
> code runs right.
> ---
>  .../src/main/royale/models/MainNavigationModel.as  |  1 -
>  .../royale/org/apache/royale/jewel/Snackbar.as     |  1 +
>  .../royale/jewel/beads/views/SnackbarView.as       | 33
> ++++++++++++++--------
>  3 files changed, 23 insertions(+), 12 deletions(-)
>
> diff --git
> a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
> b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
> index f764ee8..1f80a24 100644
> ---
> a/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
> +++
> b/examples/royale/JewelExample/src/main/royale/models/MainNavigationModel.as
> @@ -39,7 +39,6 @@ package models
>              new NavigationLinkVO("Text", "text_panel",
> MaterialIconType.SUBJECT),
>              new NavigationLinkVO("TextInput", "textinput_panel",
> MaterialIconType.TEXT_FIELDS),
>              new NavigationLinkVO("Forms & Validation",
> "form_validation_panel", MaterialIconType.ASSIGNMENT_TURNED_IN),
> -            new NavigationLinkVO("DropDownList", "dropdownlist_panel",
> MaterialIconType.CREDIT_CARD)
>              new NavigationLinkVO("DropDownList", "dropdownlist_panel",
> MaterialIconType.CREDIT_CARD),
>
>              // new NavigationLinkVO("Menu", "menus_panel"),
> diff --git
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as
> index b33b8c0..95c460b 100644
> ---
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as
> +++
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/Snackbar.as
> @@ -21,6 +21,7 @@ package org.apache.royale.jewel
>      import org.apache.royale.core.IPopUp;
>      import org.apache.royale.core.StyledUIBase;
>      import org.apache.royale.core.UIBase;
> +       import org.apache.royale.events.Event;
>      import org.apache.royale.jewel.beads.models.SnackbarModel;
>
>      COMPILE::JS
> diff --git
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as
> index 418dbff..5739a03 100644
> ---
> a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as
> +++
> b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/SnackbarView.as
> @@ -74,19 +74,21 @@ package org.apache.royale.jewel.beads.views
>
>              host = value as Snackbar;
>              var model:SnackbarModel = host.model as SnackbarModel;
> -
> -                       var messageElement:Element =
> document.createElement("div");
> -                       messageElement.className = "jewel
> snackbar-message";
> -            messageElement.innerHTML = model.message;
> -
> -                       var contentElement:Element =
> document.createElement("div");
> -                       contentElement.className = "jewel
> snackbar-content";
> -                       contentElement.appendChild(messageElement);
> -
>              model.addEventListener("messageChange", messageChangeHandler);
>              model.addEventListener("actionChange", actionChangeHandler);
>
> -            host.element.appendChild(contentElement);
> +            COMPILE::JS
> +            {
> +                var messageElement:Element =
> document.createElement("div");
> +                messageElement.className = "jewel snackbar-message";
> +                messageElement.innerHTML = model.message;
> +
> +                var contentElement:Element =
> document.createElement("div");
> +                contentElement.className = "jewel snackbar-content";
> +                contentElement.appendChild(messageElement);
> +
> +                host.element.appendChild(contentElement);
> +            }
>
>              if (model.action) actionChangeHandler(null);
>          }
> @@ -96,7 +98,10 @@ package org.apache.royale.jewel.beads.views
>           *  Update the text when message changed.
>           */
>          private function messageChangeHandler(event:Event):void {
> -            Element(host.element.firstChild.firstChild).innerHTML =
> SnackbarModel(host.model).message;
> +            COMPILE::JS
> +            {
> +                HTMLElement(host.element.firstChild.firstChild).innerHTML
> = SnackbarModel(host.model).message;
> +            }
>          }
>
>          /**
> @@ -105,6 +110,8 @@ package org.apache.royale.jewel.beads.views
>          private function actionChangeHandler(event:Event):void {
>              var model:SnackbarModel = host.model as SnackbarModel;
>
> +            COMPILE::JS
> +            {
>              if (model.action) {
>                                 if (!actionElement) {
>                                         actionElement =
> document.createElement("div");
> @@ -120,15 +127,19 @@ package org.apache.royale.jewel.beads.views
>                                         actionElement = null;
>                                 }
>                         }
> +            }
>          }
>
>          /**
>           *  Trigger event and dismiss the host when action clicked.
>           */
>          private function actionClickHandler(event:Event):void {
> +            COMPILE::JS
> +            {
>              actionElement.removeEventListener("click",
> actionClickHandler);
>              host.dispatchEvent(new Event(Snackbar.ACTION));
>              SnackbarModel(host.model).duration = -1; // set -1 to dismiss
> +            }
>          }
>
>      }
>
>

-- 
Carlos Rovira
http://about.me/carlosrovira