royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carlosrov...@apache.org
Subject [royale-asjs] branch develop updated: Configuration for locales in DateField and DateChooser through beads in CSS
Date Sat, 10 Nov 2018 20:32:55 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/develop by this push:
     new cc44a59  Configuration for locales in DateField and DateChooser through beads in
CSS
cc44a59 is described below

commit cc44a597c73aabf1b3a921c48faf22d9e3311296
Author: Carlos Rovira <carlosrovira@apache.org>
AuthorDate: Sat Nov 10 21:32:47 2018 +0100

    Configuration for locales in DateField and DateChooser through beads in CSS
---
 .../projects/Core/src/main/royale/CoreClasses.as   |  1 +
 .../apache/royale/core/IDateControlConfigBead.as   | 33 ++++++++++++++++++++++
 .../royale/org/apache/royale/jewel/DateField.as    | 15 ++++++----
 .../datefield/SpanishDateComponentConfig.as        | 20 ++-----------
 4 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as
index 66bcff7..5edbb22 100644
--- a/frameworks/projects/Core/src/main/royale/CoreClasses.as
+++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as
@@ -103,6 +103,7 @@ import org.apache.royale.events.ItemRemovedEvent; ItemRemovedEvent;
     import org.apache.royale.core.IDocument; IDocument;
 	import org.apache.royale.core.IDragInitiator; IDragInitiator;
     import org.apache.royale.core.IFormatBead; IFormatBead;
+    import org.apache.royale.core.IDateControlConfigBead; IDateControlConfigBead;
     import org.apache.royale.core.IImage; IImage;
     import org.apache.royale.core.IImageModel; IImageModel;
     import org.apache.royale.core.IItemRendererProvider; IItemRendererProvider;
diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IDateControlConfigBead.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IDateControlConfigBead.as
new file mode 100644
index 0000000..d47ce38
--- /dev/null
+++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/core/IDateControlConfigBead.as
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+	/**
+	 *  The IDateControlConfigBead interface should be implemented by any bead that
+	 *  provides a locale configuration for date controls like DateField and DateChooser
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.0
+	 */
+	public interface IDateControlConfigBead extends IBead
+	{
+	}
+}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateField.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateField.as
index 1c90c89..c4eae27 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateField.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DateField.as
@@ -18,17 +18,18 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.jewel
 {
-	import org.apache.royale.core.StyledUIBase;
-	import org.apache.royale.core.IDateChooserModel;
-	import org.apache.royale.core.IFormatBead;
-	import org.apache.royale.events.Event;
-	import org.apache.royale.utils.loadBeadFromValuesManager;
-
 	COMPILE::JS
     {
         import org.apache.royale.core.WrappedHTMLElement;
         import org.apache.royale.html.util.addElementToWrapper;
     }
+	import org.apache.royale.core.IDateChooserModel;
+	import org.apache.royale.core.IDateControlConfigBead;
+	import org.apache.royale.core.IFormatBead;
+	import org.apache.royale.core.StyledUIBase;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.utils.loadBeadFromValuesManager;
+
 	
 	/**
 	 * The change event is dispatched when the selectedDate is changed.
@@ -76,6 +77,8 @@ package org.apache.royale.jewel
 		{
 			super.addedToParent();
 			loadBeadFromValuesManager(IFormatBead, "iFormatBead", this);
+			
+			loadBeadFromValuesManager(IDateControlConfigBead, "iDateControlConfigBead", this);
 
 			dispatchEvent(new Event("initComplete"));
 		}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/datefield/SpanishDateComponentConfig.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/datefield/SpanishDateComponentConfig.as
index 9ceae39..5e875a4 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/datefield/SpanishDateComponentConfig.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/datefield/SpanishDateComponentConfig.as
@@ -18,10 +18,8 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.jewel.beads.controls.datefield
 {
-    import org.apache.royale.core.IBead;
+    import org.apache.royale.core.IDateControlConfigBead;
     import org.apache.royale.core.IStrand;
-    import org.apache.royale.events.Event;
-    import org.apache.royale.events.IEventDispatcher;
     import org.apache.royale.jewel.beads.models.DateChooserModel;
 
     /**
@@ -34,7 +32,7 @@ package org.apache.royale.jewel.beads.controls.datefield
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.4
 	 */
-	public class SpanishDateComponentConfig implements IBead
+	public class SpanishDateComponentConfig implements IDateControlConfigBead
 	{
         /**
 		 *  constructor.
@@ -62,20 +60,6 @@ package org.apache.royale.jewel.beads.controls.datefield
 		public function set strand(value:IStrand):void
 		{
 			_strand = value;
-			IEventDispatcher(_strand).addEventListener("beadsAdded", configureDateControl);
-		}	
-        /**
-		 *  change model variables to use spanish ones
-		 *   
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.4
-		 *  @royaleignorecoercion org.apache.royale.events.IEventDispatcher
-		 */
-		private function configureDateControl(event:Event):void
-        {
-			IEventDispatcher(_strand).removeEventListener("beadsAdded", configureDateControl);
 
 			var model:DateChooserModel = _strand.getBeadByType(DateChooserModel) as DateChooserModel;
             model.dayNames = ['D', 'L', 'M', 'X', 'J', 'V', 'S'];


Mime
View raw message