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

commit 5b4f2bb7f7cf2ade51c06b03be5e8367527b47e4
Author: Carlos Rovira <[email protected]>
AuthorDate: Mon Feb 25 23:42:30 2019 +0100

    trying to use SimpleLocalizedValuesImpl with Jewel Validator
---
 .../projects/Jewel/src/main/resources/defaults.css |  4 +++
 .../royale/jewel/beads/validators/Validator.as     | 29 ++++++++++++++++++++--
 .../validators/locale/de_DE/validator.properties   | 21 ++++++++++++++++
 .../validators/locale/en_US/validator.properties   | 21 ++++++++++++++++
 .../validators/locale/es_ES/validator.properties   | 21 ++++++++++++++++
 .../projects/Jewel/src/main/sass/_global.sass      |  3 +++
 6 files changed, 97 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css 
b/frameworks/projects/Jewel/src/main/resources/defaults.css
index ed8975b..4023d69 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -115,6 +115,10 @@ j|DataContainer {
   IViewportModel: 
ClassReference("org.apache.royale.html.beads.models.ViewportModel");
 }
 
+j|Validator {
+  ILocalizedValuesImpl: 
ClassReference("org.apache.royale.core.SimpleLocalizedValuesImpl");
+}
+
 j|Form {
   IBeadLayout: 
ClassReference("org.apache.royale.jewel.beads.layouts.FormLayout");
 }
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 0cf8890..b28f170 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
@@ -19,8 +19,11 @@
 package org.apache.royale.jewel.beads.validators
 {
        import org.apache.royale.core.IBead;
+       import org.apache.royale.core.ILocalizedValuesImpl;
        import org.apache.royale.core.IPopUpHost;
        import org.apache.royale.core.IStrand;
+       import org.apache.royale.core.SimpleLocalizedValuesImpl;
+       import org.apache.royale.core.Strand;
        import org.apache.royale.core.UIBase;
        import org.apache.royale.events.Event;
        import org.apache.royale.events.IEventDispatcher;
@@ -28,6 +31,7 @@ package org.apache.royale.jewel.beads.validators
        import org.apache.royale.jewel.supportClasses.tooltip.ErrorTipLabel;
        import org.apache.royale.utils.PointUtils;
        import org.apache.royale.utils.UIUtils;
+       import org.apache.royale.utils.loadBeadFromValuesManager;
 
        /**
         *  The Validator class is the base class for all validators.
@@ -39,8 +43,15 @@ package org.apache.royale.jewel.beads.validators
         *  @playerversion AIR 2.6
         *  @productversion Royale 0.9.4
         */
-       public class Validator implements IBead
+       public class Validator extends Strand implements IBead
        {
+               [Embed("locale/en_US/validator.properties", 
mimeType="text/plain")]
+               private var en_USvalidator:String;
+               [Embed("locale/de_DE/validator.properties", 
mimeType="text/plain")]
+               private var de_DEvalidator:String;
+               [Embed("locale/es_ES/validator.properties", 
mimeType="text/plain")]
+               private var es_ESvalidator:String;
+
                /**
                 *  constructor.
                 *
@@ -135,7 +146,21 @@ package org.apache.royale.jewel.beads.validators
                public function set strand(value:IStrand):void
                {
                        hostComponent = value as UIBase;
+
+                       //get translations from bundles
+                       try{
+                       var resourceManager:SimpleLocalizedValuesImpl = 
loadBeadFromValuesManager(ILocalizedValuesImpl, "iLocalizedValuesImpl", this) 
as SimpleLocalizedValuesImpl;
+                               resourceManager.localeChain = "es_ES";
+                               var rfe:String = 
resourceManager.getValue("validator", "requiredFieldError");
+                               _requiredFieldError = rfe
+                       }
+                       catch(e:Error)
+                       {
+                trace(e.message);
+                       }
+                       
                        _trigger = hostComponent;
+
                        COMPILE::JS
                        {
                                hostClassList = 
hostComponent.positioner.classList;
@@ -200,7 +225,7 @@ package org.apache.royale.jewel.beads.validators
                        _required = value;
                }
 
-               private var _requiredFieldError:String = "This field is 
required.";
+               private var _requiredFieldError:String = "NO TRANS";
                /**
                 *  The string to use as the errorTip.
                 *
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/de_DE/validator.properties
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/de_DE/validator.properties
new file mode 100644
index 0000000..47ee1cd
--- /dev/null
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/de_DE/validator.properties
@@ -0,0 +1,21 @@
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+# Validator string bundle
+requiredFieldError=Dieses Feld wird benötigt.
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/en_US/validator.properties
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/en_US/validator.properties
new file mode 100644
index 0000000..5b29a41
--- /dev/null
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/en_US/validator.properties
@@ -0,0 +1,21 @@
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+# Validator string bundle
+requiredFieldError=This field is required.
diff --git 
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/es_ES/validator.properties
 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/es_ES/validator.properties
new file mode 100644
index 0000000..cc47dc1
--- /dev/null
+++ 
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/locale/es_ES/validator.properties
@@ -0,0 +1,21 @@
+################################################################################
+##
+##  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.
+##
+################################################################################
+
+# Validator string bundle
+requiredFieldError=Este campo es requerido.
diff --git a/frameworks/projects/Jewel/src/main/sass/_global.sass 
b/frameworks/projects/Jewel/src/main/sass/_global.sass
index a0f154a..43dbea4 100644
--- a/frameworks/projects/Jewel/src/main/sass/_global.sass
+++ b/frameworks/projects/Jewel/src/main/sass/_global.sass
@@ -114,6 +114,9 @@ j|DataContainer
        IViewport: 
ClassReference("org.apache.royale.jewel.supportClasses.Viewport")
        IViewportModel: 
ClassReference("org.apache.royale.html.beads.models.ViewportModel")
 
+j|Validator
+       ILocalizedValuesImpl: 
ClassReference("org.apache.royale.core.SimpleLocalizedValuesImpl")
+       
 j|Form
        IBeadLayout: 
ClassReference("org.apache.royale.jewel.beads.layouts.FormLayout")
 

Reply via email to