You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pi...@apache.org on 2021/09/17 09:49:57 UTC

[royale-asjs] branch develop updated (34624f1 -> 9f6f459)

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

piotrz pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.


    from 34624f1  Jewel FormValidator: Extract error check to separate method to easier extend
     new b290699  Jewel Validator: Add FormValidatorWithoutSnackbar validator which prevents from displaying snackbar in case of errors
     new ba77715  Jewel Validator: Add class description for FormValidatorWithoutSnackbar
     new 9f6f459  Jewel Validator: Add "noErrorTip" property which prevents from displaying error tooltip near required field

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../Jewel/src/main/resources/jewel-manifest.xml    |  1 +
 ...alidator.as => FormValidatorWithoutSnackbar.as} | 55 ++++++++++------------
 .../royale/jewel/beads/validators/Validator.as     | 54 +++++++++++++++------
 3 files changed, 64 insertions(+), 46 deletions(-)
 copy frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/{SelectedItemNullValidator.as => FormValidatorWithoutSnackbar.as} (58%)

[royale-asjs] 01/03: Jewel Validator: Add FormValidatorWithoutSnackbar validator which prevents from displaying snackbar in case of errors

Posted by pi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit b2906996cfa20a17ae48c06a48cb799227ebf4d3
Author: Piotr Zarzycki <pi...@gmail.com>
AuthorDate: Fri Sep 17 11:46:37 2021 +0200

    Jewel Validator: Add FormValidatorWithoutSnackbar validator which prevents from displaying snackbar in case of errors
---
 .../Jewel/src/main/resources/jewel-manifest.xml    |  1 +
 .../validators/FormValidatorWithoutSnackbar.as     | 52 ++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index 5d95488..45b50c7 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -106,6 +106,7 @@
 
     <component id="Validator" class="org.apache.royale.jewel.beads.validators.Validator"/>
     <component id="FormValidator" class="org.apache.royale.jewel.beads.validators.FormValidator"/>
+    <component id="FormValidatorWithoutSnackbar" class="org.apache.royale.jewel.beads.validators.FormValidatorWithoutSnackbar"/>
     <component id="StringValidator" class="org.apache.royale.jewel.beads.validators.StringValidator"/>
     <component id="DateValidator" class="org.apache.royale.jewel.beads.validators.DateValidator"/>
     <component id="SelectedItemNullValidator" class="org.apache.royale.jewel.beads.validators.SelectedItemNullValidator"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/FormValidatorWithoutSnackbar.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/FormValidatorWithoutSnackbar.as
new file mode 100644
index 0000000..6c74240
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/FormValidatorWithoutSnackbar.as
@@ -0,0 +1,52 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.royale.jewel.beads.validators
+{
+    import org.apache.royale.jewel.beads.validators.FormValidator;
+    import org.apache.royale.events.Event;
+    
+	public class FormValidatorWithoutSnackbar extends FormValidator 
+	{
+		public function FormValidatorWithoutSnackbar()
+		{
+			super();
+		}
+
+		/**
+		 *  Override of the base class dispatchValidEvent in order to remove snackbar notification.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.9
+		 */
+		override protected function dispatchValidEvent():void
+		{
+			//Override this method in order to remove snackbar notification
+			if (isError)
+			{
+				hostComponent.dispatchEvent(new Event("invalid"));
+			}
+			else
+			{
+				hostComponent.dispatchEvent(new Event("valid"));
+			}
+		}
+	}
+}
\ No newline at end of file

[royale-asjs] 03/03: Jewel Validator: Add "noErrorTip" property which prevents from displaying error tooltip near required field

Posted by pi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 9f6f459610c7de831f2a02eb5925bbd7ed3f4a01
Author: Piotr Zarzycki <pi...@gmail.com>
AuthorDate: Fri Sep 17 11:49:44 2021 +0200

    Jewel Validator: Add "noErrorTip" property which prevents from displaying error tooltip near required field
---
 .../royale/jewel/beads/validators/Validator.as     | 54 ++++++++++++++++------
 1 file changed, 39 insertions(+), 15 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as
index 3e2fb64..adcf9eb 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/Validator.as
@@ -300,6 +300,25 @@ package org.apache.royale.jewel.beads.validators
             _requiredFieldError = value;
 		}
 
+		private var _noErrorTip:Boolean;
+		/**
+		 *  If true removes displaying error tip
+		 *  Default false
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.9
+		 */
+		public function get noErrorTip():Boolean
+		{
+			return _noErrorTip;
+		}
+		public function set noErrorTip(value:Boolean):void
+		{
+			_noErrorTip = value;
+		}
+
 		/**
 		 *  Performs validation and return the result.
 		 *  When result is false(invalid), errorTip appears on the control.
@@ -367,26 +386,31 @@ package org.apache.royale.jewel.beads.validators
 			if (!errorText)
 				return;
 
-			if (_errorTip == null) {
-				_errorTip = new ErrorTipLabel();
+			if (!noErrorTip) {
+				if (_errorTip == null) {
+					_errorTip = new ErrorTipLabel();
 
-				_host = UIUtils.findPopUpHost(hostComponent);
-				_host.popUpParent.addElement(_errorTip, false);
-				IEventDispatcher(_host.popUpParent).addEventListener("cleanValidationErrors", cleanValidationErrorsHandler);
-			}
-			COMPILE::JS
-			{
-				hostComponent.element.addEventListener("blur",removeTip);
-			}
+					_host = UIUtils.findPopUpHost(hostComponent);
+					_host.popUpParent.addElement(_errorTip, false);
+					IEventDispatcher(_host.popUpParent).addEventListener("cleanValidationErrors", cleanValidationErrorsHandler);
+				}
+				COMPILE::JS
+				{
+					hostComponent.element.addEventListener("blur", removeTip);
+				}
 
-            _errorTip.text = errorText;
+				_errorTip.text = errorText;
+
+				COMPILE::JS
+				{
+					window.addEventListener('resize', repositionHandler, false);
+					window.addEventListener('scroll', repositionHandler, true);
+					repositionHandler();
+				}
+			}
 
 			COMPILE::JS
 			{
-				window.addEventListener('resize', repositionHandler, false);
-				window.addEventListener('scroll', repositionHandler, true);
-				repositionHandler();
-
 				createErrorBorder();
 			}
 		}

[royale-asjs] 02/03: Jewel Validator: Add class description for FormValidatorWithoutSnackbar

Posted by pi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit ba777153c63a32f409ee4f43b405f1ae062b9fc5
Author: Piotr Zarzycki <pi...@gmail.com>
AuthorDate: Fri Sep 17 11:48:35 2021 +0200

    Jewel Validator: Add class description for FormValidatorWithoutSnackbar
---
 .../jewel/beads/validators/FormValidatorWithoutSnackbar.as    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/FormValidatorWithoutSnackbar.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/FormValidatorWithoutSnackbar.as
index 6c74240..ef6a32d 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/FormValidatorWithoutSnackbar.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/FormValidatorWithoutSnackbar.as
@@ -20,7 +20,16 @@ package org.apache.royale.jewel.beads.validators
 {
     import org.apache.royale.jewel.beads.validators.FormValidator;
     import org.apache.royale.events.Event;
-    
+
+	/**
+	 *  The FormValidatorWithoutSnackbar class is a specialty bead that can be used with
+	 *  form control. It prevents from displaying Snackbar notification in case of errors.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.9
+	 */
 	public class FormValidatorWithoutSnackbar extends FormValidator 
 	{
 		public function FormValidatorWithoutSnackbar()