You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2017/09/17 12:29:58 UTC

[myfaces-trinidad] branch 1.2.12.5.0-branch created (now 752a0b7)

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

deki pushed a change to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git.


      at 752a0b7  TRINIDAD-2155 Incomplete serialization implementation in AccessibilityProfile$SerializableAccessibilityProfile

This branch includes the following new commits:

     new c6b8590  Merge of trunk SVN revisions 1096803, 1096816 and 1096825 for TRINIDAD-2047
     new 2e32356  TRINIDAD-2128 - Fix for library loading in a portal
     new 69108ab  TRINIDAD-2089 - UIXCollection stamp saving directly iterates children without setting up their visiting context
     new ace0523  TRINIDAD-2196
     new 81eb2d4  TRINIDAD-1041
     new 179c23c  TRINIDAD-1041
     new 752a0b7  TRINIDAD-2155 Incomplete serialization implementation in AccessibilityProfile$SerializableAccessibilityProfile

The 7 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.


-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].

[myfaces-trinidad] 06/07: TRINIDAD-1041

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

deki pushed a commit to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 179c23c031e67615632944e925f3b1cf86adf2a4
Author: Scott Bryan <so...@apache.org>
AuthorDate: Wed Jan 18 20:58:42 2012 +0000

    TRINIDAD-1041
---
 .../main/webapp/skins/localedemo/localedemo.css    | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/trinidad-examples/trinidad-demo/src/main/webapp/skins/localedemo/localedemo.css b/trinidad-examples/trinidad-demo/src/main/webapp/skins/localedemo/localedemo.css
new file mode 100644
index 0000000..4296a01
--- /dev/null
+++ b/trinidad-examples/trinidad-demo/src/main/webapp/skins/localedemo/localedemo.css
@@ -0,0 +1,30 @@
+/*
+ *  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.
+ */
+
+@locale en, de {
+    af|commandButton {
+        color: red;
+    }
+}
+
+@locale ro-RO {
+    af|commandButton {
+        color: blue;
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 05/07: TRINIDAD-1041

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

deki pushed a commit to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 81eb2d4568dc5477cfd7ccc87b72275543e1834d
Author: Scott Bryan <so...@apache.org>
AuthorDate: Wed Jan 18 20:56:20 2012 +0000

    TRINIDAD-1041
---
 src/site/xdoc/devguide/skinning.xml                | 20 ++++++-
 .../src/main/webapp/WEB-INF/trinidad-skins.xml     |  8 +++
 .../src/main/webapp/demos/panelPageSkinDemo.jspx   |  3 +-
 .../skin/SkinCSSDocumentHandler.java               | 64 +++++++++++++++++-----
 .../trinidadinternal/skin/SkinStyleSheetNode.java  | 23 ++++++--
 .../skin/SkinStyleSheetParserUtils.java            |  2 +-
 .../style/xml/parse/StyleSheetNode.java            |  5 +-
 .../style/xml/parse/StyleSheetNodeParser.java      | 35 +++---------
 .../style/xml/parse/StyleSheetNodeEqualsTest.java  | 30 ++--------
 9 files changed, 113 insertions(+), 77 deletions(-)

diff --git a/src/site/xdoc/devguide/skinning.xml b/src/site/xdoc/devguide/skinning.xml
index 184adce..9efd892 100644
--- a/src/site/xdoc/devguide/skinning.xml
+++ b/src/site/xdoc/devguide/skinning.xml
@@ -897,6 +897,11 @@ public class SkinTranslationMapDemo
         This is to define styles only for a particular accessibility profile.  See the <a href="configuration.html#accessibility-profile">Configuring Apache Trinidad</a> chapter for information on setting the accessibility profile.
         </li>
         <li>
+        <strong>@locale</strong> {/skin definitions go here/} - >
+        A certain locale must be specified, either only the language or both the language and the country.
+        This is to define styles only for a particular language and country.
+        </li>
+        <li>
         <strong>:rtl</strong> - >  pseudo-class to create a style or icon definition when the browser 
         is in a right-to-left language. The best example is that of images that are not symmetric.
         If you set a skin selector that uses a asymmetrical image, when you set your browser to
@@ -904,7 +909,7 @@ public class SkinTranslationMapDemo
         you use the :rtl pseudo-class at the end of your selector and point it to a flipped-looking image.
         </li>
         <li>
-        :lang or @locale  - >  Not yet implemented in Trinidad.         
+        :lang - >  Not yet implemented in Trinidad.         
         </li>          
         </ul>
           
@@ -934,11 +939,22 @@ public class SkinTranslationMapDemo
         }
         
         /* for Firefox 3 (gecko 1.9) use a smaller margin.*/
-        @agent gecko (version: 1.9)
+        @agent gecko and (version: 1.9)
         {
           af|someComponent {margin: 4px;}
         }
         
+        @locale en, de {
+           af|commandButton {
+              color: red;
+           }
+         }
+         @locale ro-RO {
+           af|commandButton {
+             color: blue;
+           }
+         }
+        
         /* The following selectors are for all platforms and all browsers */
         
          /* rounded corners on the top-start and top-end */
diff --git a/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-skins.xml b/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-skins.xml
index 7d97123..35e3dc7 100644
--- a/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-skins.xml
+++ b/trinidad-examples/trinidad-demo/src/main/webapp/WEB-INF/trinidad-skins.xml
@@ -124,4 +124,12 @@
       <style-sheet-name>skins/accdemo/accdemo.css</style-sheet-name>
     </skin>
 
+    <!-- A skin which demonstrates locale features,
+         eg. @locale -->
+    <skin>
+      <id>localedemo.desktop</id>
+      <family>localeDemo</family>
+      <render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
+      <style-sheet-name>skins/localedemo/localedemo.css</style-sheet-name>
+    </skin>
 </skins>
diff --git a/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx b/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx
index c5c118f..ad6632b 100644
--- a/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx
+++ b/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx
@@ -86,6 +86,7 @@
                   <tr:selectItem label="purpleBigFont" value="purpleBigFont"/>
                   <tr:selectItem label="beach" value="beach"/>
                   <tr:selectItem label="suede" value="suede"/>
+                  <tr:selectItem label="locale" value="localeDemo"/>
                 </tr:selectOneChoice>
                 <tr:commandButton text="Go"/>
                 <tr:goLink id="goLinkId" text="EmailablePageMode" 
@@ -156,7 +157,7 @@
                     </tr:showDetailItem>
                     <tr:showDetailItem text="Tab 2" disclosed="true">
                       <tr:panelHeader text="PanelTabbed details">
-                        <tr:outputText value="Everything in Camping  is on sale!  Enjoy huge savings on our most popular tents                     and sleeping bags. We even have dried food and mattresses"
+                        <tr:outputText value="In Locale Skin, commandButton text is red in en and de locales and blue in ro-RO. Test it out!"
                                        styleClass="mainContentText"/>
                         <tr:panelGroupLayout layout="horizontal">
                           <tr:goButton text="Sorry, Disabled" disabled="true"/>
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java
index 060c4ae..828a744 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java
@@ -19,15 +19,17 @@
 package org.apache.myfaces.trinidadinternal.skin;
 
 import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+import java.util.ArrayList;
+import java.util.Locale;
 import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.HashSet;
+import java.util.HashMap;
+import java.util.LinkedList;
 
 import org.apache.myfaces.trinidad.context.Version;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -112,6 +114,7 @@ public class SkinCSSDocumentHandler
        CompleteSelectorNode node =
          _createCompleteSelectorNode(selector,
                                      _propertyNodeList,
+                                     _locales,
                                      _selectorAgents,
                                      _selectorPlatforms,
                                      _getSelectorAccProperties());
@@ -189,6 +192,10 @@ public class SkinCSSDocumentHandler
       {
         _parseCustomAtRule(_AT_PLATFORM, atRule);
       }
+      else if (atRule.startsWith(_AT_LOCALE))
+      {
+        _parseCustomAtRule(_AT_LOCALE, atRule);
+      }
       else if (atRule.startsWith(_AT_ACC_PROFILE))
       {
         _parseCustomAtRule(_AT_ACC_PROFILE, atRule);
@@ -204,8 +211,8 @@ public class SkinCSSDocumentHandler
    */
   private void _parseCustomAtRule(String type, String atRule)
   {
-    // get the @agent agents, they are deliminated by commas
-    // parse out the content
+    // get the @agent agents, @platform platforms or the @locale locales 
+    // they are deliminated by commas parse out the content
     // save the atRule type, so the document handler code can get to it.
     // run this through parser again
     String content = _getAtRuleContent(atRule);
@@ -228,6 +235,8 @@ public class SkinCSSDocumentHandler
       _selectorAgents = null;
     else if (_AT_PLATFORM.equals(type))
       _selectorPlatforms = null;
+    else if (_AT_LOCALE.equals(type))
+      _locales = null;
     else if (_AT_ACC_PROFILE.equals(type))
     {
       assert(!_selectorAccPropertiesStack.isEmpty());
@@ -242,6 +251,7 @@ public class SkinCSSDocumentHandler
   private CompleteSelectorNode _createCompleteSelectorNode(
     String                     selector,
     List<PropertyNode>         propertyNodeList,
+    Set<Locale> locales,
     Map<Integer, Set<Version>> selectorAgentVersions,
     int[]                      selectorPlatforms,
     Set<String>                selectorAccProperties)
@@ -268,6 +278,7 @@ public class SkinCSSDocumentHandler
       new CompleteSelectorNode(
         selector,
         propertyNodeList,
+        locales,
         direction,
         selectorAgentVersions,
         selectorPlatforms,
@@ -295,6 +306,7 @@ public class SkinCSSDocumentHandler
       int direction = completeSelectorNode.getDirection();
       Map<Integer, Set<Version>> agentVersions = completeSelectorNode.getAgentVersions();
       int[] platforms = completeSelectorNode.getPlatforms();
+      Set<Locale> locales = completeSelectorNode.getLocales();
       Set<String> accProperties = completeSelectorNode.getAccessibilityProperties();
 
       // loop through the skinStyleSheetNodeList to find a match
@@ -306,7 +318,7 @@ public class SkinCSSDocumentHandler
       for (int i = skinStyleSheetNodes.size() - 1; i >= 0 && !match; --i)
       {
         SkinStyleSheetNode ssNode = skinStyleSheetNodes.get(i);
-        match = ssNode.matches(direction, agentVersions, platforms, accProperties);
+        match = ssNode.matches(direction, agentVersions, platforms, locales, accProperties);
         if (match)
           ssNode.add(completeSelectorNode.getSkinSelectorPropertiesNode());
       }
@@ -315,7 +327,7 @@ public class SkinCSSDocumentHandler
       {
        // no matching stylesheet node found, so create a new one
         SkinStyleSheetNode ssNode =
-         new SkinStyleSheetNode(namespaceMap, direction, agentVersions, platforms, accProperties);
+         new SkinStyleSheetNode(namespaceMap, direction, locales, agentVersions, platforms, accProperties);
         ssNode.add(completeSelectorNode.getSkinSelectorPropertiesNode());
         skinStyleSheetNodes.add(ssNode);
       }
@@ -326,7 +338,7 @@ public class SkinCSSDocumentHandler
   /**
    * Initialized at rule target types.
    * 
-   * @param type type of the at rule. _AT_AGENT, _AT_PLATFORM, or _AT_ACC_PROFILE
+   * @param type type of the at rule. _AT_AGENT, _AT_PLATFORM, _AT_ACC_PROFILE or _AT_LOCALE
    * @param atRule - the atRule string
    */
   private void _initAtRuleTargetTypes(
@@ -402,6 +414,15 @@ public class SkinCSSDocumentHandler
         
         _selectorPlatforms = _getIntArray(list);
       }
+      else if (_AT_LOCALE.equals(type))
+      {
+        _locales = new HashSet<Locale>();
+        for (int i = 0; i < typeArray.length; i++)
+        {
+          Locale locale = LocaleUtils.getLocaleForIANAString(typeArray[i].replace('_', '-').trim());
+          _locales.add(locale);
+        }
+      }
       else if (_AT_ACC_PROFILE.equals(type))
       {
         // The number of profile properties is always going to be
@@ -544,6 +565,7 @@ public class SkinCSSDocumentHandler
     public CompleteSelectorNode(
       String                     selectorName,
       List<PropertyNode>         propertyNodes,
+      Set<Locale>                locales,
       int                        direction,
       Map<Integer, Set<Version>> agentVersions,
       int[]                      platforms,
@@ -554,11 +576,13 @@ public class SkinCSSDocumentHandler
       _direction = direction;
       // copy the agents and platforms because these get nulled out
       // at the end of the @rule parsing.
-      _agentVersions = agentVersions != null ?
+      _agentVersions = (agentVersions != null) ?
         new HashMap<Integer, Set<Version>>(agentVersions) :
         new HashMap<Integer, Set<Version>>();
       
       _platforms = _copyIntArray(platforms);
+      _locales = ((locales != null) ? new HashSet<Locale>(locales)
+            :Collections.<Locale>emptySet());
       
       if (accProperties != null)
       {
@@ -592,6 +616,11 @@ public class SkinCSSDocumentHandler
       return _platforms;
     }
 
+    public Set<Locale> getLocales()
+    {
+      return _locales;
+    }
+
     public Set<String> getAccessibilityProperties()
     {
       return _accProperties;
@@ -613,12 +642,14 @@ public class SkinCSSDocumentHandler
     private int _direction;  // the reading direction
     private Map<Integer, Set<Version>> _agentVersions;
     private int[] _platforms;
+    private Set<Locale> _locales;    
     private Set<String> _accProperties;
   }
 
-  private static String _AT_AGENT = "@agent";
-  private static String _AT_PLATFORM = "@platform";
-  private static String _AT_ACC_PROFILE = "@accessibility-profile";
+  private static final String _AT_AGENT = "@agent";
+  private static final String _AT_PLATFORM = "@platform";
+  private static final String _AT_LOCALE = "@locale";
+  private static final String _AT_ACC_PROFILE = "@accessibility-profile";
 
   // below are properties that we set and reset
   // as the methods of this documentHandler get called.
@@ -636,6 +667,9 @@ public class SkinCSSDocumentHandler
   // we store a map of agents and their version sets
   private Map<Integer, Set<Version>> _selectorAgents = null;
 
+  // the locales of the selectors parsed in this document.
+  private Set<Locale> _locales = null;
+
   // Stack of accessibility property sets.  While java.util.Stack has the
   // push/pop API that we want, we don't need the synchronization, so we
   // just use a LinkedList instead and pretend its a stack.
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetNode.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetNode.java
index c715209..1bd945d 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetNode.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetNode.java
@@ -21,6 +21,7 @@ package org.apache.myfaces.trinidadinternal.skin;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
@@ -43,11 +44,13 @@ class SkinStyleSheetNode
     List<SkinSelectorPropertiesNode> skinSelectorNodeList,
     Map<String, String>              namespaceMap,
     int                              direction,
+    Set<Locale>                      locales,
     Map<Integer, Set<Version>>       agentVersions,
     Set<String>                      accProperties)
   {
     _skinSelectorNodeList = skinSelectorNodeList;
     _namespaceMap = namespaceMap;
+    _locales = locales;
     _direction = direction;
     _agentVersions = agentVersions;
     _accProperties = accProperties;
@@ -56,12 +59,14 @@ class SkinStyleSheetNode
   SkinStyleSheetNode(
     Map<String, String>        namespaceMap,
     int                        direction,
+    Set<Locale>                locales,
     Map<Integer, Set<Version>> agentVersions,
     int[]                      platforms,
     Set<String>                accProperties)
   {
     _namespaceMap = namespaceMap;
     _direction = direction;
+    _locales = locales;
     _agentVersions = agentVersions;
     _platforms = platforms;
     _accProperties = accProperties;
@@ -114,6 +119,11 @@ class SkinStyleSheetNode
     return _platforms;
   }
 
+  public Set<Locale> getLocales()
+  {
+    return _locales;
+  }
+
   public Set<String> getAcessibilityProperties()
   {
     return _accProperties;
@@ -123,6 +133,7 @@ class SkinStyleSheetNode
     int                        direction,
     Map<Integer, Set<Version>> agentVersions,
     int[]                      platforms,
+    Set<Locale>                locales,
     Set<String>                accProperties)
   {
     if (direction == _direction)
@@ -134,10 +145,13 @@ class SkinStyleSheetNode
         boolean platformsMatch = _intArraysEqual(platforms, _platforms);
         if (platformsMatch)
         {
-          boolean accMatch = _setsEqual(accProperties, _accProperties);
-
-          if (accMatch)
-            return true;
+          boolean localeMatch = _setsEqual(locales, _locales);
+          if (localeMatch)
+          {
+            boolean accMatch = _setsEqual(accProperties, _accProperties);
+            if (accMatch)
+             return true;
+          }
         }
       }
     }
@@ -166,6 +180,7 @@ class SkinStyleSheetNode
   private Map<String, String> _namespaceMap;
   private List<SkinSelectorPropertiesNode> _skinSelectorNodeList;
   private int _direction; // reading direction
+  private Set<Locale> _locales;
   private Map<Integer, Set<Version>> _agentVersions;
   private int[] _platforms;
   private Set<String> _accProperties;
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
index 9902f21..3efe719 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
@@ -273,7 +273,7 @@ class SkinStyleSheetParserUtils
         StyleSheetNode ssNode =
           new StyleSheetNode(styleNodeArray,
                              iconNodeList,
-                             null,/*locales, not yet supported*/
+                             skinSSNode.getLocales(),
                              skinSSNode.getDirection(),
                              skinSSNode.getAgentVersions(),
                              skinSSNode.getPlatforms(),
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java
index 81456b9..2cae0e2 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNode.java
@@ -55,7 +55,7 @@ public class StyleSheetNode
   public StyleSheetNode(
     StyleNode[] styles,
     Collection<IconNode> icons,
-    Locale[] locales,
+    Set<Locale> locales,
     int direction,
     Map<Integer, Set<Version>> agentVersions,
     int[] platforms,
@@ -77,8 +77,7 @@ public class StyleSheetNode
     // locales, browsers, versions, platforms order does not matter, so these are Sets.
     if (locales != null)
     {
-      Set<Locale> localesSet = _copyLocaleArrayToSet(locales);
-      _locales = Collections.unmodifiableSet(localesSet);
+      _locales = Collections.unmodifiableSet(locales);
     }
     else
       _locales = Collections.emptySet();
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java
index 4240bda..a887483 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeParser.java
@@ -19,6 +19,7 @@
 package org.apache.myfaces.trinidadinternal.style.xml.parse;
 
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -37,6 +38,7 @@ import org.apache.myfaces.trinidadinternal.share.xml.XMLUtils;
 import org.apache.myfaces.trinidadinternal.style.StyleConstants;
 import org.apache.myfaces.trinidadinternal.style.util.NameUtils;
 import org.apache.myfaces.trinidadinternal.style.xml.XMLConstants;
+import org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXParseException;
 
@@ -152,23 +154,6 @@ public class StyleSheetNodeParser extends BaseNodeParser
     }
   }
 
-  // Converts a string to a locale
-  private Locale _getLocale(String str)
-  {
-    // Language only
-    int length = str.length();
-    if (length == 2)
-      return new Locale(str, "");
-
-    // Locale and country
-    if ((length == 5) && (str.charAt(2) == '_'))
-      return new Locale(str.substring(0, 2), str.substring(3, 5));
-
-    // We don't handle variants at the moment...
-
-    return null;
-  }
-
   // Initialize locales
   private void _initLocales(String localeAttr)
   {
@@ -177,20 +162,16 @@ public class StyleSheetNodeParser extends BaseNodeParser
 
     // -= Simon Lessard =-
     // TODO: Check if synchronization is really needed.
-    Vector<Locale> locales = new Vector<Locale>();
+    _locales = Collections.synchronizedSet(new HashSet<Locale>());
     Iterator<String> tokens = _getTokens(localeAttr);
     while (tokens.hasNext())
     {
-      Locale locale = _getLocale(tokens.next());
+      String localeString = tokens.next();
+      // TODO: check if the replace of _ with - is really necessary. Also see RequestContextImpl.getFormattingLocale()
+      Locale locale = LocaleUtils.getLocaleForIANAString(localeString.replace('_', '-').trim());
 
       if (locale != null)
-        locales.addElement(locale);
-    }
-
-    if (locales != null)
-    {
-      _locales = new Locale[locales.size()];
-      locales.copyInto(_locales);
+        _locales.add(locale);
     }
   }
 
@@ -320,7 +301,7 @@ public class StyleSheetNodeParser extends BaseNodeParser
   // -= Simon Lessard =-
   // TODO: Check if synchronization is really needed.
   private Vector<StyleNode> _styles;
-  private Locale[]          _locales;
+  private Set<Locale>       _locales;
   private int               _direction;
   private int               _mode;
   private int[]             _browsers;
diff --git a/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java b/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java
index 4f8ca4e..b5f3767 100644
--- a/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java
+++ b/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetNodeEqualsTest.java
@@ -128,9 +128,8 @@ public class StyleSheetNodeEqualsTest extends TestCase
     List<IconNode> anotherIconNodes = _getIconNodes();
 
     // create locales arrays
-    Locale[] localesArray = getLocalesArray();
-    Locale[] anotherLocalesArray = getAnotherLocalesArray();
-    Locale[] diffOrderLocalesArray = getDiffOrderLocalesArray();
+    Set<Locale> localeSet = getLocalesSet();
+    Set<Locale> diffOrderLocalesSet = getDiffOrderLocalesSet();
      
     // create a browsers map
     Map<Integer, Set<Version>> browsers = new HashMap<Integer, Set<Version>>();
@@ -165,7 +164,7 @@ public class StyleSheetNodeEqualsTest extends TestCase
     StyleSheetNode styleSheetNode =
       new StyleSheetNode(styleSheetOneNodes,
                          iconNodes,
-                         localesArray,
+                         localeSet,
                          0,
                          browsers,
                          platforms,
@@ -174,7 +173,7 @@ public class StyleSheetNodeEqualsTest extends TestCase
     StyleSheetNode anotherStyleSheetNode =
       new StyleSheetNode(anotherStyleSheetOneNodes,
                          anotherIconNodes,
-                         anotherLocalesArray,
+                         localeSet,
                          0,
                          anotherBrowsersDiffOrder,
                          anotherPlatforms,
@@ -183,7 +182,7 @@ public class StyleSheetNodeEqualsTest extends TestCase
     StyleSheetNode sameDiffOrderStyleSheetNode =
       new StyleSheetNode(anotherStyleSheetOneNodes,
                          anotherIconNodes,
-                         diffOrderLocalesArray,
+                         diffOrderLocalesSet,
                          0,
                          anotherBrowsersDiffOrder,
                          differentOrderPlatforms,
@@ -207,7 +206,7 @@ public class StyleSheetNodeEqualsTest extends TestCase
 
     // these should be false
     assertEquals(styleSheetNode.equals(null), false);
-    assertEquals(styleSheetNode.equals(localesArray), false);
+    assertEquals(styleSheetNode.equals(localeSet), false);
     
     /* Test styleSheetNode's toString */
     /*
@@ -303,23 +302,6 @@ public class StyleSheetNodeEqualsTest extends TestCase
     return set;
   }
   
-  // same as above
-  private Locale[] getLocalesArray()
-  {
-    return new Locale[] {new Locale("tw", "TW"), new Locale("zh", "CN")};
-  }
-  
-  private Locale[] getAnotherLocalesArray()
-  {
-    return new Locale[] {new Locale("tw", "TW"), new Locale("zh", "CN")};
-  }
-  
-  // same as above, different order
-  private Locale[] getDiffOrderLocalesArray()
-  {
-    return new Locale[] {new Locale("zh", "CN"), new Locale("tw", "TW")};
-  }
-
   private List<IconNode> _getIconNodes()
   {
     List<IconNode> iconNodes = new ArrayList<IconNode>(2);

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 03/07: TRINIDAD-2089 - UIXCollection stamp saving directly iterates children without setting up their visiting context

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

deki pushed a commit to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 69108abc6a300baf6a51e4671214142da0d73e79
Author: Scott Bryan <so...@apache.org>
AuthorDate: Fri Oct 7 18:16:39 2011 +0000

    TRINIDAD-2089 - UIXCollection stamp saving directly iterates children without setting up their visiting context
    
    *Thanks Venkata
---
 .../myfaces/trinidad/component/UIXCollection.java  | 165 ++++++++++++---------
 1 file changed, 91 insertions(+), 74 deletions(-)

diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
index 6534721..518e8c9 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
@@ -800,92 +800,109 @@ public abstract class UIXCollection extends UIXComponentBase
     if (stamp.isTransient())
       return Transient.TRUE;
 
-    // The structure we will use is:
-    //   0: state of the stamp
-    //   1: state of the children (an array)
-    //   2: state of the facets (an array of name-key pairs)
-    // If there is no facet state, we have a two-element array
-    // If there is no facet state or child state, we have a one-elment array
-    // If there is no state at all, we return null
-
-    Object stampState = StampState.saveStampState(context, stamp);
-
-    // StampState can never EVER be an Object array, as if we do,
-    // we have no possible way of identifying the difference between
-    // just having stamp state, and having stamp state + child/facet state
-    assert(!(stampState instanceof Object[]));
-
-    int facetCount = _getFacetCount(stamp);
+    boolean needsTearDownContext = false;
+    
+    if(stamp instanceof FlattenedComponent && stamp instanceof UIXComponent)
+    {
+      ((UIXComponent)stamp).setupVisitingContext(context);
+      needsTearDownContext = true;
+    }
 
     Object[] state = null;
-
-    if (facetCount > 0)
+    
+    try
     {
-      boolean facetStateIsEmpty = true;
-      Object[] facetState = null;
-
-      Map<String, UIComponent> facetMap = stamp.getFacets();
-
-      int i = 0;
-      for(Map.Entry<String, UIComponent> entry : facetMap.entrySet())
+      // The structure we will use is:
+      //   0: state of the stamp
+      //   1: state of the children (an array)
+      //   2: state of the facets (an array of name-key pairs)
+      // If there is no facet state, we have a two-element array
+      // If there is no facet state or child state, we have a one-elment array
+      // If there is no state at all, we return null
+  
+      Object stampState = StampState.saveStampState(context, stamp);
+  
+      // StampState can never EVER be an Object array, as if we do,
+      // we have no possible way of identifying the difference between
+      // just having stamp state, and having stamp state + child/facet state
+      assert(!(stampState instanceof Object[]));
+  
+      int facetCount = _getFacetCount(stamp);
+  
+  
+      if (facetCount > 0)
       {
-        Object singleFacetState = saveStampState(context, entry.getValue());
-        if ((singleFacetState == null) ||
-            (singleFacetState == Transient.TRUE))
-          continue;
-
-        // Don't bother allocating anything until we have some non-null
-        // and non-transient facet state
-        if (facetStateIsEmpty)
+        boolean facetStateIsEmpty = true;
+        Object[] facetState = null;
+  
+        Map<String, UIComponent> facetMap = stamp.getFacets();
+  
+        int i = 0;
+        for(Map.Entry<String, UIComponent> entry : facetMap.entrySet())
+        {
+          Object singleFacetState = saveStampState(context, entry.getValue());
+          if ((singleFacetState == null) ||
+              (singleFacetState == Transient.TRUE))
+            continue;
+  
+          // Don't bother allocating anything until we have some non-null
+          // and non-transient facet state
+          if (facetStateIsEmpty)
+          {
+            facetStateIsEmpty = false;
+            facetState = new Object[facetCount * 2];
+          }
+  
+          int base = i * 2;
+          assert(facetState != null);
+          facetState[base] = entry.getKey();
+          facetState[base + 1] = singleFacetState;
+          i++;
+        }
+  
+        // OK, we had something:  allocate the state array to three
+        // entries, and insert the facet state at position 2
+        if (!facetStateIsEmpty)
         {
-          facetStateIsEmpty = false;
-          facetState = new Object[facetCount * 2];
+          // trim the facetState array if necessary
+          if(i < facetCount)
+          {
+            Object[] trimmed = new Object[i*2];
+            System.arraycopy(facetState, 0, trimmed, 0, i*2);
+            facetState = trimmed;
+          }
+          state = new Object[3];
+          state[2] = facetState;
         }
-
-        int base = i * 2;
-        assert(facetState != null);
-        facetState[base] = entry.getKey();
-        facetState[base + 1] = singleFacetState;
-        i++;
       }
-
-      // OK, we had something:  allocate the state array to three
-      // entries, and insert the facet state at position 2
-      if (!facetStateIsEmpty)
+  
+      // If we have any children, iterate through the array,
+      // saving state
+      Object childState = StampState.saveChildStampState(context,
+                                                         stamp,
+                                                         this);
+      if (childState != null)
       {
-        // trim the facetState array if necessary
-        if(i < facetCount)
-        {
-          Object[] trimmed = new Object[i*2];
-          System.arraycopy(facetState, 0, trimmed, 0, i*2);
-          facetState = trimmed;
-        }
-        state = new Object[3];
-        state[2] = facetState;
+        // If the state hasn't been allocated yet, we only
+        // need a two-element array
+        if (state == null)
+          state = new Object[2];
+        state[1] = childState;
       }
+  
+      // If we don't have an array, just return the stamp
+      // state
+      if (state == null)
+        return stampState;
+  
+      // Otherwise, store the stamp state at index 0, and return
+      state[0] = stampState;
     }
-
-    // If we have any children, iterate through the array,
-    // saving state
-    Object childState = StampState.saveChildStampState(context,
-                                                       stamp,
-                                                       this);
-    if (childState != null)
+    finally
     {
-      // If the state hasn't been allocated yet, we only
-      // need a two-element array
-      if (state == null)
-        state = new Object[2];
-      state[1] = childState;
+      if(needsTearDownContext)
+        ((UIXComponent)stamp).tearDownVisitingContext(context);
     }
-
-    // If we don't have an array, just return the stamp
-    // state
-    if (state == null)
-      return stampState;
-
-    // Otherwise, store the stamp state at index 0, and return
-    state[0] = stampState;
     return state;
   }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 01/07: Merge of trunk SVN revisions 1096803, 1096816 and 1096825 for TRINIDAD-2047

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

deki pushed a commit to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit c6b85909563ffb7be5a2115bed83d844dc695a3f
Author: Andrew Robinson <ar...@apache.org>
AuthorDate: Thu Apr 28 21:41:19 2011 +0000

    Merge of trunk SVN revisions 1096803, 1096816 and 1096825 for TRINIDAD-2047
---
 .../trinidad/component/UIXTableTemplate.java       | 41 +++++++++++++++++++--
 .../trinidad/component/UIXTreeTemplate.java        | 42 ++++++++++++++++++++--
 .../myfaces/trinidad/component/UIXCollection.java  | 19 +++++++---
 3 files changed, 93 insertions(+), 9 deletions(-)

diff --git a/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java b/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
index bcfe3e4..2b65681 100644
--- a/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
+++ b/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTableTemplate.java
@@ -55,6 +55,15 @@ import org.apache.myfaces.trinidad.model.SortCriterion;
 abstract public class UIXTableTemplate extends UIXIteratorTemplate
   implements CollectionComponent
 {
+/**/  static public final FacesBean.Type TYPE = new FacesBean.Type(UIXIterator.TYPE);
+
+  // These are "fake" properties that allow the table to get the disclosed row keys and the
+  // selected row key without triggering the call to getCollectionModel from the
+  // RowKeyFacesBeanWrapper class. See the stamp state saving code for its usage.
+  static private final PropertyKey _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY =
+    TYPE.registerKey("disclosedRowKeysWithoutModel", RowKeySet.class);
+  static private final PropertyKey _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY =
+    TYPE.registerKey("selectedRowKeysWithoutModel", RowKeySet.class);
 
 
   /**
@@ -422,8 +431,17 @@ abstract public class UIXTableTemplate extends UIXIteratorTemplate
     state[1] = super.__getMyStampState();
     state[2] = Integer.valueOf(getFirst());
     state[3] = Boolean.valueOf(isShowAll());
-    state[4] = getSelectedRowKeys();
-    state[5] = getDisclosedRowKeys();
+
+    // Use "hidden" property keys to allow the row key sets to be retrieved without the
+    // RowKeyFacesBeanWrapper trying to resolve the collection model to be set into the row key
+    // set. This is needed to stop the unnecessary lookup of the collection model when it is not
+    // needed during stamp state saving of the table.
+    RowKeySet selectedRowKeys = (RowKeySet)getProperty(_SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY);
+    RowKeySet disclosedRowKeys = (RowKeySet)getProperty(_DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY);
+
+    state[4] = selectedRowKeys;
+    state[5] = disclosedRowKeys;
+
     return state;
   }
 
@@ -536,6 +554,25 @@ abstract public class UIXTableTemplate extends UIXIteratorTemplate
     @Override
     public Object getProperty(PropertyKey key)
     {
+      if (key == _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY)
+      {
+        // This case is only true if the table is trying to serialize the disclosed row keys to
+        // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+        // get the collection model during stamp state saving. This should be permissible as the
+        // state saving code does not need the collection model to be set in the row key set in
+        // order to save its state.
+        return super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+      }
+      else if (key == _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY)
+      {
+        // This case is only true if the table is trying to serialize the selected row keys to
+        // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+        // get the collection model during stamp state saving. This should be permissible as the
+        // state saving code does not need the collection model to be set in the row key set in
+        // order to save its state.
+        return super.getProperty(SELECTED_ROW_KEYS_KEY);
+      }
+
       Object value = super.getProperty(key);
       if (key == DISCLOSED_ROW_KEYS_KEY)
       {
diff --git a/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java b/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
index 8e497e1..7c28963 100644
--- a/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
+++ b/trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/UIXTreeTemplate.java
@@ -56,6 +56,16 @@ abstract public class UIXTreeTemplate extends UIXHierarchy
 /**/  static public final PropertyKey DISCLOSED_ROW_KEYS_KEY = null;
 /**/  static public final PropertyKey SELECTED_ROW_KEYS_KEY = null;
 
+/**/  static public final FacesBean.Type TYPE = new FacesBean.Type(org.apache.myfaces.trinidad.component.UIXHierarchy.TYPE);
+
+  // These are "fake" properties that allow the table to get the disclosed row keys and the
+  // selected row key without triggering the call to getCollectionModel from the
+  // RowKeyFacesBeanWrapper class. See the stamp state saving code for its usage.
+  static private final PropertyKey _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY =
+    TYPE.registerKey("disclosedRowKeysWithoutModel", RowKeySet.class);
+  static private final PropertyKey _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY =
+    TYPE.registerKey("selectedRowKeysWithoutModel", RowKeySet.class);
+
   @Deprecated
   public void setRowDisclosureListener(MethodBinding binding)
   {
@@ -170,8 +180,17 @@ abstract public class UIXTreeTemplate extends UIXHierarchy
     Object[] state = new Object[4];
     state[0] = super.__getMyStampState();
     state[1] = getFocusRowKey();
-    state[2] = getSelectedRowKeys();
-    state[3] = getDisclosedRowKeys();
+
+    // Use "hidden" property keys to allow the row key sets to be retrieved without the
+    // RowKeyFacesBeanWrapper trying to resolve the collection model to be set into the row key
+    // set. This is needed to stop the unnecessary lookup of the collection model when it is not
+    // needed during stamp state saving of the table.
+    RowKeySet selectedRowKeys = (RowKeySet)getProperty(_SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY);
+    RowKeySet disclosedRowKeys = (RowKeySet)getProperty(_DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY);
+
+    state[2] = selectedRowKeys;
+    state[3] = disclosedRowKeys;
+
     return state;
   }
 
@@ -210,6 +229,25 @@ abstract public class UIXTreeTemplate extends UIXHierarchy
     @Override
     public Object getProperty(PropertyKey key)
     {
+      if (key == _DISCLOSED_ROW_KEYS_WITHOUT_MODEL_KEY)
+      {
+        // This case is only true if the table is trying to serialize the disclosed row keys to
+        // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+        // get the collection model during stamp state saving. This should be permissible as the
+        // state saving code does not need the collection model to be set in the row key set in
+        // order to save its state.
+        return super.getProperty(DISCLOSED_ROW_KEYS_KEY);
+      }
+      else if (key == _SELECTED_ROW_KEYS_WITHOUT_MODEL_KEY)
+      {
+        // This case is only true if the table is trying to serialize the selected row keys to
+        // the stamp state of a parent UIXCollection. This work-around prevents EL evaluation to
+        // get the collection model during stamp state saving. This should be permissible as the
+        // state saving code does not need the collection model to be set in the row key set in
+        // order to save its state.
+        return super.getProperty(SELECTED_ROW_KEYS_KEY);
+      }
+
       Object value = super.getProperty(key);
       if (key == DISCLOSED_ROW_KEYS_KEY)
       {
diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
index ee77b0a..6534721 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXCollection.java
@@ -770,6 +770,11 @@ public abstract class UIXCollection extends UIXComponentBase
   /**
    * Gets the currencyObject to setup the rowData to use to build initial
    * stamp state.
+   * <p>
+   *   This allows the collection model to have an initial row key outside of the UIComponent.
+   *   Should the model be at a row that is not the first row, the component will restore the row
+   *   back to the initial row key instead of a null row key once stamping is done.
+   * </p>
    */
   private Object _getCurrencyKeyForInitialStampState()
   {
@@ -1466,11 +1471,15 @@ public abstract class UIXCollection extends UIXComponentBase
     FacesContext context = getFacesContext();
     Object currencyObj = getRowKey();
 
-    // TRINIDAD-2047: we do not need to save stamp state if there is no active stamp
-    if (currencyObj == null)
-    {
-      return;
-    }
+    // Note: even though the currencyObj may be null, we still need to save the state. The reason
+    // is that the code does not clear out the state when it is saved, instead, the un-stamped
+    // state is saved. Once the row key is set back to null, this un-stamped state is restored
+    // onto the children components. This restoration allows editable value holders, show detail
+    // items and nested UIXCollections to clear their state.
+    // For nested UIXCollections, this un-stamped state is required to set the nested collection's
+    // _state (internal state containing the stamp state) to null when not on a row key. Without
+    // that call, the nested UIXCollection components would end up sharing the same stamp state
+    // across parent rows.
 
     int position = 0;
     for(UIComponent stamp : getStamps())

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 02/07: TRINIDAD-2128 - Fix for library loading in a portal

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

deki pushed a commit to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 2e323568204d1d3dd25fb568fc5a8a021c49b06b
Author: Scott Bryan <so...@apache.org>
AuthorDate: Tue Aug 16 21:30:31 2011 +0000

    TRINIDAD-2128 - Fix for library loading in a portal
---
 .../renderkit/core/xhtml/XhtmlUtils.java           | 54 +++++++++++-----------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
index a5aaf91..56e9c44 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/XhtmlUtils.java
@@ -167,35 +167,35 @@ public class XhtmlUtils
     // problems when resizing windows - but we're done with Netscape 4)
     libURL = context.getExternalContext().encodeResourceURL(libURL.toString());
 
-    if (XhtmlConstants.FACET_PORTLET.equals(rc.getOutputMode()))
-    {
-      if (rc.getProperties().get(_PORTLET_LIB_TABLE_KEY) == null)
-      {
-        rc.getProperties().put(_PORTLET_LIB_TABLE_KEY, Boolean.TRUE);
-        writer.writeText("var _uixJSL;" +
-                         "if(!_uixJSL)_uixJSL={};" +
-                         "function _addJSL(u)" +
-                         "{" +
-                           "if(!_uixJSL[u])" +
-                           "{" +
-                             "_uixJSL[u]=1;" +
-                             "document.write(\"<scrip\"+" +
-                                            "\"t src=\\\"\"+u+" +
-                                            "\"\\\"></scrip\"+" +
-                                            "\"t>\")" +
-                           "}" +
-                         "}",
-             null);
-      }
-      writer.writeText("_addJSL(\"", null);
-      writer.writeText(libURL, null);
-      writer.writeText("\")", null);
-    }
-    else
-    {
+//    if (XhtmlConstants.FACET_PORTLET.equals(rc.getOutputMode()))
+//    {
+//      if (rc.getProperties().get(_PORTLET_LIB_TABLE_KEY) == null)
+//      {
+//        rc.getProperties().put(_PORTLET_LIB_TABLE_KEY, Boolean.TRUE);
+//        writer.writeText("var _uixJSL;" +
+//                         "if(!_uixJSL)_uixJSL={};" +
+//                         "function _addJSL(u)" +
+//                         "{" +
+//                           "if(!_uixJSL[u])" +
+//                           "{" +
+//                             "_uixJSL[u]=1;" +
+//                             "document.write(\"<scrip\"+" +
+//                                            "\"t src=\\\"\"+u+" +
+//                                            "\"\\\"></scrip\"+" +
+//                                            "\"t>\")" +
+//                           "}" +
+//                         "}",
+//             null);
+//      }
+//      writer.writeText("_addJSL(\"", null);
+//      writer.writeText(libURL, null);
+//      writer.writeText("\")", null);
+//    }
+//    else
+//    {
       // The "safe" case: just write out the source
       writer.writeURIAttribute("src", libURL, null);
-    }
+//    }
 
     writer.endElement("script");
   }

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 07/07: TRINIDAD-2155 Incomplete serialization implementation in AccessibilityProfile$SerializableAccessibilityProfile

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

deki pushed a commit to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit 752a0b7c7ecb6d0f28dea9e0effc8c62c4ebe67b
Author: Gabrielle Crawford <gc...@apache.org>
AuthorDate: Thu Feb 2 22:24:33 2012 +0000

    TRINIDAD-2155 Incomplete serialization implementation in AccessibilityProfile$SerializableAccessibilityProfile
    
    Thanks to Prakash
---
 .../java/org/apache/myfaces/trinidad/context/AccessibilityProfile.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/AccessibilityProfile.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/AccessibilityProfile.java
index 8059533..f4619ff 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/AccessibilityProfile.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/AccessibilityProfile.java
@@ -166,7 +166,7 @@ public class AccessibilityProfile
 
   //Serialization for SerializableAccessibilityProfile internal subclass requires no-arg constructor
   //access of at least package security level.
-  private AccessibilityProfile()
+  AccessibilityProfile()
   {
     this(ColorContrast.STANDARD, FontSize.MEDIUM);
   }

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.

[myfaces-trinidad] 04/07: TRINIDAD-2196

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

deki pushed a commit to branch 1.2.12.5.0-branch
in repository https://gitbox.apache.org/repos/asf/myfaces-trinidad.git

commit ace05230e7ffa7c44ca222909ef1c033249a6898
Author: Scott Bryan <so...@apache.org>
AuthorDate: Wed Jan 18 20:22:27 2012 +0000

    TRINIDAD-2196
---
 .../apache/myfaces/trinidad/menu/MenuUtils.java    | 65 ++++++++-------------
 .../myfaces/trinidadinternal/menu/MenuUtils.java   | 66 ++++++++--------------
 2 files changed, 45 insertions(+), 86 deletions(-)

diff --git a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/MenuUtils.java b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/MenuUtils.java
index 441c183..60c6da4 100644
--- a/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/MenuUtils.java
+++ b/trinidad-api/src/main/java/org/apache/myfaces/trinidad/menu/MenuUtils.java
@@ -33,7 +33,6 @@ import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.util.ContainerUtils;
-import org.apache.myfaces.trinidad.util.ThreadLocalUtils;
 
 /**
  * Menu Utilities used by the Menu Model internal code.
@@ -203,18 +202,17 @@ public class MenuUtils
   }
   
   /**
-   * Create a ResourceBundle and put it on the Session map.
-   * 
-   * @param resBundle - String containing name of class containing the resource
-   *                    bundle.
-   * @param key - ThreadLocal key for the resource bundle being put on the
-   *              requestMap
+   * Create a ResourceBundle and put it in an EL-reachable scope.
+   *
+   * @param resBundleName - String containing name of class containing the 
+   *                        resource bundle.
+   * @param resBundleKey - String key for the resource bundle
    */
   @SuppressWarnings("unchecked")
-  static void loadBundle(String resBundle, ThreadLocal<String> key)
+  static public void loadBundle(String resBundleName, String resBundleKey)
   {
     FacesContext facesContext = FacesContext.getCurrentInstance();
-    Map<String, Object> applicationMap = 
+    Map<String, Object> applicationMap =
       facesContext.getExternalContext().getApplicationMap();
 
     // Get the view root locale
@@ -225,22 +223,22 @@ public class MenuUtils
     {
       requestLocale = facesContext.getApplication().getDefaultLocale();
     }
-    
+
     // Is there a bundle with this key already on the session map?
-    _BundleMap bundleMap = (_BundleMap) applicationMap.get(key.get());
-    
-    // if so, get its locale.  If the locale has not 
+    _BundleMap bundleMap = (_BundleMap) applicationMap.get(resBundleKey);
+
+    // if so, get its locale.  If the locale has not
     // changed, just return, i.e. use the existing bundle
     if (bundleMap != null)
     {
       Locale bundleLocale = bundleMap.getLocale();
-      
+
       if (bundleLocale == null)
       {
         ResourceBundle rb = bundleMap.getBundle();
         bundleLocale = rb.getLocale();
       }
-      
+
       if (requestLocale == bundleLocale)
       {
         // the bundle on the applicationMap is ok so just return
@@ -250,21 +248,21 @@ public class MenuUtils
 
     String bundleName = null;
 
-    if (resBundle != null) 
+    if (resBundleName != null)
     {
       // if _bundleName is an EL, then get its value
-      if (ContainerUtils.isValueReference(resBundle)) 
+      if (ContainerUtils.isValueReference(resBundleName))
       {
-        bundleName = MenuUtils.getBoundValue(resBundle, String.class);
-      } 
+        bundleName = MenuUtils.getBoundValue(resBundleName, String.class);
+      }
       else
       {
-        bundleName = resBundle ;
+        bundleName = resBundleName ;
       }
     }
 
     final ResourceBundle bundle;
-    
+
     try
     {
       bundle = ResourceBundle.getBundle(bundleName, requestLocale);
@@ -275,30 +273,11 @@ public class MenuUtils
       _LOG.severe(e);
       return;
     }
- 
-    // Put the bundle in the map.  At this point the key is 
+
+    // Put the bundle in the map.  At this point the key is
     // unique because of the handler Id we inserted when loadBundle
     // was called.
-    applicationMap.put(key.get(), new _BundleMap(bundle, requestLocale));
-  }
-
-  /**
-   * Create a ResourceBundle and put it on the Session map.
-   * The key is made into a ThreadLocal to ensure that this the resource
-   * bundle is threadsafe.
-   * 
-   * @param resBundleName - String containing name of class containing the 
-   *                        resource bundle.
-   * @param resBundleKey - String key for the resource bundle being put on the
-   *                       requestMap
-   */
-  @SuppressWarnings("unchecked")
-  static public void loadBundle(String resBundleName, String resBundleKey)
-  {
-    ThreadLocal<String> bundleKey = ThreadLocalUtils.newRequestThreadLocal();
-    
-    bundleKey.set(resBundleKey);    
-    loadBundle(resBundleName, bundleKey);
+    applicationMap.put(resBundleKey, new _BundleMap(bundle, requestLocale));
   }
   
   /**
diff --git a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java
index 1e9060f..8e9da3d 100644
--- a/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java
+++ b/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuUtils.java
@@ -201,20 +201,19 @@ class MenuUtils
     }
     return Integer.parseInt(propVal);
   }
-  
+
   /**
-   * Create a ResourceBundle and put it on the Session map.
-   * 
-   * @param resBundle - String containing name of class containing the resource
-   *                    bundle.
-   * @param key - ThreadLocal key for the resource bundle being put on the
-   *              requestMap
+   * Create a ResourceBundle and put it an EL-reachable scope.
+   *
+   * @param resBundleName - String containing name of class containing the 
+   *                        resource bundle.
+   * @param resBundleKey - String key for the resource bundle\
    */
   @SuppressWarnings("unchecked")
-  static void loadBundle(String resBundle, ThreadLocal<String> key)
+  static void loadBundle(String resBundleName, String resBundleKey)
   {
     FacesContext facesContext = FacesContext.getCurrentInstance();
-    Map<String, Object> applicationMap = 
+    Map<String, Object> applicationMap =
       facesContext.getExternalContext().getApplicationMap();
 
     // Get the view root locale
@@ -225,22 +224,22 @@ class MenuUtils
     {
       requestLocale = facesContext.getApplication().getDefaultLocale();
     }
-    
+
     // Is there a bundle with this key already on the session map?
-    _BundleMap bundleMap = (_BundleMap) applicationMap.get(key.get());
-    
-    // if so, get its locale.  If the locale has not 
+    _BundleMap bundleMap = (_BundleMap) applicationMap.get(resBundleKey);
+
+    // if so, get its locale.  If the locale has not
     // changed, just return, i.e. use the existing bundle
     if (bundleMap != null)
     {
       Locale bundleLocale = bundleMap.getLocale();
-      
+
       if (bundleLocale == null)
       {
         ResourceBundle rb = bundleMap.getBundle();
         bundleLocale = rb.getLocale();
       }
-      
+
       if (requestLocale == bundleLocale)
       {
         // the bundle on the applicationMap is ok so just return
@@ -250,21 +249,21 @@ class MenuUtils
 
     String bundleName = null;
 
-    if (resBundle != null) 
+    if (resBundleName != null)
     {
       // if _bundleName is an EL, then get its value
-      if (ContainerUtils.isValueReference(resBundle)) 
+      if (ContainerUtils.isValueReference(resBundleName))
       {
-        bundleName = MenuUtils.getBoundValue(resBundle, String.class);
-      } 
+        bundleName = MenuUtils.getBoundValue(resBundleName, String.class);
+      }
       else
       {
-        bundleName = resBundle ;
+        bundleName = resBundleName ;
       }
     }
 
     final ResourceBundle bundle;
-    
+
     try
     {
       bundle = ResourceBundle.getBundle(bundleName, requestLocale);
@@ -275,30 +274,11 @@ class MenuUtils
       _LOG.severe(e);
       return;
     }
- 
-    // Put the bundle in the map.  At this point the key is 
+
+    // Put the bundle in the map.  At this point the key is
     // unique because of the handler Id we inserted when loadBundle
     // was called.
-    applicationMap.put(key.get(), new _BundleMap(bundle, requestLocale));
-  }
-
-  /**
-   * Create a ResourceBundle and put it on the Session map.
-   * The key is made into a ThreadLocal to ensure that this the resource
-   * bundle is threadsafe.
-   * 
-   * @param resBundleName - String containing name of class containing the 
-   *                        resource bundle.
-   * @param resBundleKey - String key for the resource bundle being put on the
-   *                       requestMap
-   */
-  @SuppressWarnings("unchecked")
-  static void loadBundle(String resBundleName, String resBundleKey)
-  {
-    ThreadLocal<String> bundleKey = ThreadLocalUtils.newRequestThreadLocal();
-    
-    bundleKey.set(resBundleKey);    
-    loadBundle(resBundleName, bundleKey);
+    applicationMap.put(resBundleKey, new _BundleMap(bundle, requestLocale));
   }
   
   /**

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.