incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r449112 [3/3] - in /incubator/adffaces/trunk/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/context/ trinidad-api/src/test/java/org/apache/myfaces/trinidad/context/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadin...
Date Fri, 22 Sep 2006 22:18:36 GMT
Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/Skin.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/Skin.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/Skin.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/Skin.java Fri Sep 22 15:18:32 2006
@@ -15,25 +15,13 @@
  */
 package org.apache.myfaces.trinidadinternal.skin;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 import java.util.MissingResourceException;
-import java.util.Stack;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
-import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinProperties;
-import org.apache.myfaces.trinidadinternal.share.expl.Coercions;
 import org.apache.myfaces.trinidadinternal.share.nls.LocaleContext;
 import org.apache.myfaces.trinidadinternal.skin.icon.Icon;
 import org.apache.myfaces.trinidadinternal.skin.icon.ReferenceIcon;
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
-import org.apache.myfaces.trinidadinternal.style.xml.StyleSheetDocumentUtils;
-import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetDocument;
-import org.apache.myfaces.trinidadinternal.ui.laf.xml.parse.IconNode;
-import org.apache.myfaces.trinidadinternal.ui.laf.xml.parse.SkinPropertyNode;
-import org.apache.myfaces.trinidadinternal.util.OptimisticHashMap;
 
 
 
@@ -56,10 +44,7 @@
    * can be retrieved by id via SkinFactory.getSkin().
    * @see org.apache.myfaces.trinidadinternal.skin.SkinFactory#getSkin
    */
-  public String getId()
-  {
-    return null;
-  }
+  abstract public String getId();
 
   /**
    * Returns the name of the skin "family" for this skin.
@@ -70,18 +55,12 @@
    * particular skin instance to be selected based on the
    * current render-kit-id.
    */
-  public String getFamily()
-  {
-    return null;
-  }
+  abstract public String getFamily();
 
   /**
    * Returns the renderKitId for the Skin.
    */
-  public String getRenderKitId()
-  {
-    return null;
-  }
+  abstract public String getRenderKitId();
 
   /**
    * Returns the name of the XSS style sheet for this Skin.
@@ -91,17 +70,10 @@
   /**
    * Returns a translated String in the LocaleContext's translation Locale.
    */
-  public String getTranslatedString(
+  abstract public String getTranslatedString(
     LocaleContext lContext,
     String        key
-    ) throws MissingResourceException
-  {
-    Object o  = getTranslatedValue(lContext, key);
-    if (o == null)
-      return null;
-
-    return o.toString();
-  }
+    ) throws MissingResourceException;
 
   /**
    * Returns a translated value in the LocaleContext's translation Locale.
@@ -112,238 +84,26 @@
    * @param key The key of the translation to retrieve. Cannot be null.
    * @throws NullPointerException if lContext or key is null.
    */
-  public Object getTranslatedValue(
+  abstract public Object getTranslatedValue(
     LocaleContext lContext,
     String        key
-    ) throws MissingResourceException
-  {
-    //testTranslationKey(key); //jmw test
-
-    if (lContext == null)
-      throw new NullPointerException("Null lContext");
-    if (key == null)
-      throw new NullPointerException("Null key");
-
-    String bundleName = getBundleName();
-    if (bundleName == null)
-      return null;
-
-    return lContext.getBundle(bundleName).getObject(key);
-  }
-
-
-
-  /**
-   *  This is a test function.
-   *  This looks at the stack that I have on the request map for the
-   *  current component being rendered -- I store the prefix in
-   *  UIComponentUINode.
-   * @param key
-   */
-   /********* jmw for testing translation keys
-  public static void testTranslationKey(
-    String key)
-  {
-
-    javax.faces.context.FacesContext fcontext =
-      javax.faces.context.FacesContext.getCurrentInstance();
-    Stack translationKeyStack  = (Stack)fcontext.getExternalContext().
-                                        getRequestMap().get("TRANSLATION_KEY");
-
-
-    String translationKeyPrefix = null;
-
-    if ((translationKeyStack != null) && !translationKeyStack.empty())
-      translationKeyPrefix = (String)translationKeyStack.peek();
-
-
- //   System.out.println(translationKeyPrefix + " / " + key); //jmw test
-
-    String keyPrefix = null;
-    int index = key.indexOf('.');
-    if (index != -1)
-      keyPrefix = key.substring(0, index);
-
-    if (translationKeyPrefix != null)
-    {
-      if (!(translationKeyPrefix.equalsIgnoreCase(keyPrefix)))
-      {
-        System.out.println("***NO MATCH " + translationKeyPrefix + " / " + key + "");
-      }
-    }
-    if ((translationKeyPrefix == null) && (key != null) &&
-      !(key.equals("WINDOW_CREATION_ERROR") || key.equals("NO_SCRIPT_MESSAGE")))
-    {
-      System.out.println("***nothing was rendered, but I have a key of " + key);
-    }
-
-  }
-  ****/
-
-  /**
-   * Returns the name of the ResourceBundle for the Skin.
-   */
-  abstract protected String getBundleName();
+    ) throws MissingResourceException;
 
   /**
    * Our renderers call this to get the icon. This returns a renderable
    * icon. (ReferenceIcons are resolved -- the real icon they point to is
    * returned)
    */
-  public Icon getIcon(
-    String  iconName
-    )
-  {
-    return getIcon(iconName, true);
-  }
+  abstract public Icon getIcon(String  iconName);
 
   /**
    * Returns an Icon object; can be a ReferenceIcon.
    * @param iconName  The name of the icon to retrieve. Cannot be null
    * @throws NullPointerException if iconName is null.
    */
-  public Icon getIcon(
+  abstract public Icon getIcon(
     String  iconName,
-    boolean resolveIcon
-    )
-  {
-    if (iconName == null)
-      throw new NullPointerException("Null iconName");
-
-    Icon icon = _icons.get(iconName);
-    if (resolveIcon)
-    {
-      if (icon instanceof ReferenceIcon)
-      {
-        // find the true icon, not a ReferenceIcon
-        icon = _resolveReferenceIcon((ReferenceIcon)icon,
-                                     null);
-      }
-    }
-
-    return icon;
-  }
-
-  /**
-   * Find the actual icon
-   * @param refIcon a ReferenceIcon instance
-   * @param referencedIconStack  The stack of reference icon names which have
-   *          already been visited.  Used to detect circular dependencies.
-   * @return icon which is resolved. i.e., it is not a ReferenceIcon.
-   */
-  private Icon _resolveReferenceIcon(
-    ReferenceIcon refIcon,
-    Stack<String> referencedIconStack)
-  {
-    String refName = refIcon.getName();
-
-    // make sure we don't have a circular dependency
-    if ( _stackContains(referencedIconStack, refName))
-    {
-      if (_LOG.isWarning())
-        _LOG.warning(_CIRCULAR_INCLUDE_ERROR + refName);
-      return null;
-    }
-    
-    if (referencedIconStack == null)
-    {
-      referencedIconStack = new Stack<String>();
-    }
-
-    referencedIconStack.push(refName);
-
-    Icon icon = getIcon(refName, false);
-
-    if ((icon instanceof ReferenceIcon) && (icon != null))
-    {
-
-      return _resolveReferenceIcon((ReferenceIcon)icon,
-                                    referencedIconStack);
-
-    }
-
-    return icon;
-  }
-
-    // Tests whether the value is present in the (possibly null) stack.
-  private static boolean _stackContains(Stack<String> stack, Object value)
-  {
-    if (stack == null)
-      return false;
-
-    return stack.contains(value);
-  }
-
-  /**
-   * Registers an Icon for the specified icon name.
-   * @param iconName  The name of the icon. Cannot be null.
-   * @param icon      The Icon to register.
-   * @throws NullPointerException if iconName is null.
-   */
-  synchronized public void registerIcon(
-    String  iconName,
-    Icon    icon
-    )
-  {
-    if (iconName == null)
-      throw new NullPointerException("Null iconName");
-
-    _icons.put(iconName, icon);
-  }
-
-  /**
-   * Registers a style sheet which defines extension-specific
-   * styles.  The styles specified by this style sheet will be
-   * merged with the Skin's own styles.  The full set
-   * of styles can be obtained by calling getStyleSheetDocument().
-   * @todo Is this even supported???
-   * @param styleSheetName The name of the style sheet which
-   *          defines the extension's styles.  This style sheet
-   *          should be installed under the directory specified by
-   *          Configuration.STYLES_DIRECTORY path.
-   * @see #getStyleSheetDocument
-   * @throws NullPointerException if styleSheetName is null.
-   */
-  public void registerStyleSheet(
-    String styleSheetName
-    )
-  {
-    if (styleSheetName == null)
-      throw new NullPointerException("Null styleSheetName");
-
-    if (_extensionStyleSheetNames == null)
-    {
-      _extensionStyleSheetNames = new ArrayList<String>();
-    }
-
-    _extensionStyleSheetNames.add(styleSheetName);
-  }
-
-  /**
-   * Returns the StyleSheetDocument object which defines all of the
-   * styles for this Skin, including any styles that are
-   * contributed by UIExtensions.
-   */
-  public StyleSheetDocument getStyleSheetDocument(StyleContext context)
-  {
-    // We synchronize here because technically speaking multiple
-    // threads can simultaneously update the underlying style sheet
-    // objects.  However, in practice, this should never be an issue -
-    // especially in production systems where modification checking
-    // should always be disabled.  In this case, the style sheet objects
-    // are created when the first request is received and are never
-    // updated after that point.  So, if this synchronization turns
-    // out to be a bottleneck, it should be safe to remove this
-    // synchronization - at least when modification checking is
-    // disabled, if not altogether.
-    synchronized (this)
-    {
-      if ((_styleSheetDocument == null) || _checkStylesModified(context))
-        _styleSheetDocument = _createStyleSheetDocument(context);
-
-      return _styleSheetDocument;
-    }
-  }
+    boolean resolveIcon);
 
   /**
    * Retrieves a property that was set via a call to setProperty().
@@ -351,254 +111,25 @@
    * Skin instance to avoid having to re-compute Skin-specific
    * values on each render.
    */
-  public Object getProperty(Object key)
-  {
-    if (_properties == null)
-      return null;
-
-    return _properties.get(key);
-  }
+  abstract public Object getProperty(Object key);
 
   /**
    * Sets a value for the specified property key.
+   * Some Renderer implementations may store properties on the
+   * Skin instance to avoid having to re-compute Skin-specific
+   * values on each render.
    */
-  synchronized public void setProperty(
+  abstract public void setProperty(
     Object key,
-    Object value
-    )
-  {
-    if (_properties == null)
-      _properties = new OptimisticHashMap<Object, Object>();
-
-    _properties.put(key, value);
-  }
-
-  // Checks to see whether any of our style sheets have been updated
-  private boolean _checkStylesModified(
-    StyleContext context
-    )
-  {
-    boolean modified = false;
-
-    if (_skinStyleSheet != null)
-      modified = _skinStyleSheet.checkModified(context);
-
-    // We also check all of the UIExtension style sheets even
-    // if we already know that the skin's style sheet has been
-    // modified.  We need to do this because we want to call
-    // StyleSheetEntry.checkModified() for each entry - otherwise
-    // out of date StyleSheetEntries may not get updated.
-    if (_extensionStyleSheets != null)
-    {
-      for (int i = 0; i < _extensionStyleSheets.length; i++)
-      {
-        StyleSheetEntry entry = _extensionStyleSheets[i];
-        if (entry.checkModified(context))
-          modified = true;
-      }
-    }
-
-    return modified;
-  }
-
-  // Creates the StyleSheetDocument for this Skin
-  // (as a side effect, this also registers icons and skin properties
-  // defined in the skin's style-sheet.)
-  private StyleSheetDocument _createStyleSheetDocument(
-    StyleContext context
-    )
-  {
-    // If we haven't created the StyleSheetDocument yet,
-    // then presumably we haven't attempted to load the
-    // style sheet files.  Create StyleSheetEntry instances
-    // for each style sheet file that we depend on.
-    if (_styleSheetDocument == null)
-    {
-      String styleSheetName = getStyleSheetName();
-
-      // =-=jmw I'm not sure where a good place is to parse the css file and
-      // register the icons and properties. For now, I suppose I can do it here.
-
-      if (styleSheetName != null)
-      {
-        _skinStyleSheet = StyleSheetEntry.createEntry(context, styleSheetName);
-
-
-        // register the icons and properties if there are any.
-        // this is a strange place for this. Where is a better spot???
-        // get a List of IconNodes, and register them.
-        if (_skinStyleSheet != null)
-        {
-          // register icons
-          List<IconNode> icons = _skinStyleSheet.getIcons();
-          if (icons != null)
-          {
-            for(IconNode iconNode : icons)
-            {
-              registerIcon(iconNode.getIconName(), iconNode.getIcon());
-            }
-          }
-          
-          // register properties
-          List<SkinPropertyNode> skinProperties = 
-            _skinStyleSheet.getSkinProperties();
-          
-          if (skinProperties != null)
-          {
-            for(SkinPropertyNode property : skinProperties)
-            {
-              Object propValueObj = property.getPropertyValue();
-              // convert to a type if possible first
-              // =-=jmw should I get the type for af|breadCrumbs-ora-show-last-item or just
-              // -ora-show-last-item. in other words, will the property name be the same type
-              // no matter which component it is being used for? If so, then
-              // just storing -ora-show-last-item in the map is good enough.
-              // For now, just for the heck of it, use af|breadCrumbs-ora-show-last-item
-
-              String key = property.getPropertySelector() +
-                           property.getPropertyName();
-              // look up in map to get conversion
-              Class<?> type = _PROPERTY_CLASS_TYPE_MAP.get(key);
-              if (type != null)
-              {
-                try
-                {
-                  // coerce the value to the type
-                  propValueObj = Coercions.coerce(null, (String)propValueObj,
-                                type);
-                }
-                catch (IllegalArgumentException ex)
-                {
-                  if (_LOG.isWarning())
-                    _LOG.warning(ex);
-                }
-              }
-
-
-              setProperty(key, propValueObj);
-            }
-          }
-        }
-      }
-
-
-      // Now create entries for UIExtension-specific style sheets.
-      _extensionStyleSheets = _getExtensionStyleSheets(context);
-    }
-
-    // Now merge all of the documents provided by all of our
-    // entries into a single StyleSheetDocument.
-    StyleSheetDocument document = null;
-
-    if (_skinStyleSheet != null)
-      document = _skinStyleSheet.getDocument();
-
-    // Merge in any UIExtension style sheets on top of
-    // the skin's style sheet
-    if (_extensionStyleSheets != null)
-    {
-      for (int i = 0; i < _extensionStyleSheets.length; i++)
-      {
-        StyleSheetEntry entry = _extensionStyleSheets[i];
-        StyleSheetDocument extensionDocument = entry.getDocument();
-
-        if (extensionDocument != null)
-        {
-          // Merge the UIExtension's StyleSheetDocument on top of
-          // the current StyleSheetDocument.  Note: This is not
-          // exactly efficient - we would be better off creating
-          // an array of StyleSheetDocuments and merging them all
-          // in one pass.  But since this code should rarely be
-          // executed, this shouldn't be a bottleneck...
-          document = StyleSheetDocumentUtils.mergeStyleSheetDocuments(
-                                               document,
-                                               extensionDocument);
-          // =-=jmw @todo when we have extension documents, we'll need
-          // to register icons and skin properties from those on the skin?
-        }
-      }
-    }
-
-    // We're done!
-    if (document != null)
-      return document;
-
-    // If we weren't able to produce a StyleSheetDocument for whatever
-    // reason (maybe we don't have any style sheet, maybe there were
-    // I/O problems), create a empty StyleSheetDocument so that we
-    // don't repeatedly try to re-create the document.
-    return new StyleSheetDocument(null, 
-                                  null, 
-                                  StyleSheetDocument.UNKNOWN_TIMESTAMP);
-  }
-
-  // Gets the StyleSheetEntries for UIExtensions
-  private StyleSheetEntry[] _getExtensionStyleSheets(StyleContext context)
-  {
-    if (_extensionStyleSheetNames == null)
-      return null;
-
-    // Create a list to hold our StyleSheetEntries
-    int count = _extensionStyleSheetNames.size();
-    List<StyleSheetEntry> entries = new ArrayList<StyleSheetEntry>(count);
-
-    // Loop through all registered style sheet names and
-    // try to create a StyleSheetEntry for each name.
-    for(String name : _extensionStyleSheetNames)
-    {
-      StyleSheetEntry entry = StyleSheetEntry.createEntry(context, name);
-      if (entry != null)
-      {
-        entries.add(entry);
-      }
-    }
-
-    if (!entries.isEmpty())
-    {
-      _extensionStyleSheets = new StyleSheetEntry[entries.size()];
-      return entries.toArray(_extensionStyleSheets);
-    }
-
-    return null;
-  }
-
-  // HashMap that maps icon name to Icons
-  private OptimisticHashMap<String, Icon> _icons = new OptimisticHashMap<String, Icon>();
-
-  // The StyleSheetDocument which contains all of the styles
-  // for this Skin - including styles contributed by UIExtensions.
-  private StyleSheetDocument _styleSheetDocument;
-
-  // A StyleSheetEntry which defines the styles that are
-  // provided by this Skin's style sheet only (does
-  // not include UIExtension styles).
-  private StyleSheetEntry _skinStyleSheet;
-
-  // List of extension style sheet names
-  private List<String> _extensionStyleSheetNames;
-
-  // Array of UIExtension StyleSheetEntries
-  private StyleSheetEntry[] _extensionStyleSheets;
-
-  // HashMap of Skin properties
-  private OptimisticHashMap<Object, Object> _properties;
-
-  // Map of property to class type
-  private static final Map<String, Class<?>> _PROPERTY_CLASS_TYPE_MAP;
-  static
-  {
-    _PROPERTY_CLASS_TYPE_MAP = new HashMap<String, Class<?>>();
-    
-    _PROPERTY_CLASS_TYPE_MAP.put(
-      SkinProperties.AF_NAVIGATIONPATH_SHOW_LAST_ITEM_PROPERTY_KEY, Boolean.class);
-    _PROPERTY_CLASS_TYPE_MAP.put(
-      SkinProperties.AF_TABLE_SELECTION_BAR_IN_TABLE, Boolean.class);
-    _PROPERTY_CLASS_TYPE_MAP.put(
-      SkinProperties.AF_TABLE_REPEAT_CONTROL_BAR, Boolean.class);
-  }
-
-  // Error messages
-  private static final String _CIRCULAR_INCLUDE_ERROR =
-    "Circular dependency detected in skin reference icon ";
-  private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(Skin.class);
+    Object value);
+
+  /**
+   * Registers an Icon for the specified icon name.
+   * @param iconName  The name of the icon. Cannot be null.
+   * @param icon      The Icon to register.
+   * @throws NullPointerException if iconName is null.
+   */
+  abstract public void registerIcon(
+    String  iconName,
+    Icon    icon);
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java Fri Sep 22 15:18:32 2006
@@ -48,7 +48,7 @@
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/skin/SkinExtension.java#0 $) $Date: 10-nov-2005.18:58:55 $
  * @author The Oracle ADF Faces Team
  */
-public class SkinExtension extends Skin
+public class SkinExtension extends SkinImpl
 {
   /**
    * Creates a Skin which extends the specified base
@@ -94,7 +94,7 @@
     if (renderKitId == null)
       renderKitId = "org.apache.myfaces.trinidad.desktop";
 
-    _baseSkin = baseSkin;
+    _baseSkin = (SkinImpl) baseSkin;
     _id = id;
     _family = family;
     _renderKitId = renderKitId;
@@ -368,7 +368,7 @@
     // sheet.
 
     // Get the StyleSheetDocument from the base Skin
-    Skin baseSkin = getBaseSkin();
+    SkinImpl baseSkin = (SkinImpl) getBaseSkin();
     StyleSheetDocument baseDocument = baseSkin.getStyleSheetDocument(context);
 
     // Get the StyleSheetDocument for the SkinExtension - we
@@ -623,7 +623,7 @@
   private String      _id;
   private String      _family;
   private String      _renderKitId;
-  private Skin        _baseSkin;
+  private SkinImpl    _baseSkin;
   private String      _styleSheetName;
   private String      _bundleName;
 

Added: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java?view=auto&rev=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java Fri Sep 22 15:18:32 2006
@@ -0,0 +1,607 @@
+/*
+ * Copyright  2000-2006 The Apache Software Foundation.
+ * 
+ * Licensed 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.myfaces.trinidadinternal.skin;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Stack;
+
+import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinProperties;
+import org.apache.myfaces.trinidadinternal.share.expl.Coercions;
+import org.apache.myfaces.trinidadinternal.share.nls.LocaleContext;
+import org.apache.myfaces.trinidadinternal.skin.icon.Icon;
+import org.apache.myfaces.trinidadinternal.skin.icon.ReferenceIcon;
+import org.apache.myfaces.trinidadinternal.style.StyleContext;
+import org.apache.myfaces.trinidadinternal.style.xml.StyleSheetDocumentUtils;
+import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetDocument;
+import org.apache.myfaces.trinidadinternal.ui.laf.xml.parse.IconNode;
+import org.apache.myfaces.trinidadinternal.ui.laf.xml.parse.SkinPropertyNode;
+import org.apache.myfaces.trinidadinternal.util.OptimisticHashMap;
+
+
+
+/**
+ * Defines the components (icons, styles, etc)
+ * which are used to implement a particular skin.
+ * @todo. look through UIExtension comments.
+ *
+ * This implementation class adds the details that should
+ * not be exposed outside of this API.
+ *
+ * @see SkinFactory
+ * @see org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext#getSkinFactory
+ *
+ * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/skin/Skin.java#0 $) $Date: 10-nov-2005.18:58:54 $
+ * @author The Oracle ADF Faces Team
+ */
+abstract public class SkinImpl extends Skin
+{
+  /**
+   * Returns an string identifier which uniquely identies
+   * this Skin implementation.  Skin implementations
+   * can be retrieved by id via SkinFactory.getSkin().
+   * @see org.apache.myfaces.trinidadinternal.skin.SkinFactory#getSkin
+   */
+  public String getId()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the name of the skin "family" for this skin.
+   * The family name is used when specifying a preferred skin
+   * in trinidad-config.xml.
+   * This provides a way to refer to a group of
+   * related skin implementations while allowing the
+   * particular skin instance to be selected based on the
+   * current render-kit-id.
+   */
+  public String getFamily()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the renderKitId for the Skin.
+   */
+  public String getRenderKitId()
+  {
+    return null;
+  }
+
+  /**
+   * Returns the name of the XSS style sheet for this Skin.
+   */
+  abstract public String getStyleSheetName();
+
+  /**
+   * Returns a translated String in the LocaleContext's translation Locale.
+   */
+  public String getTranslatedString(
+    LocaleContext lContext,
+    String        key
+    ) throws MissingResourceException
+  {
+    Object o  = getTranslatedValue(lContext, key);
+    if (o == null)
+      return null;
+
+    return o.toString();
+  }
+
+  /**
+   * Returns a translated value in the LocaleContext's translation Locale.
+   * This value may or may not be a String, and developers should avoid
+   * calling toString() unless absolutely necessary.
+   * @param lContext The LocaleContext which provides the translation Locale.
+   *                 Cannot be null.
+   * @param key The key of the translation to retrieve. Cannot be null.
+   * @throws NullPointerException if lContext or key is null.
+   */
+  public Object getTranslatedValue(
+    LocaleContext lContext,
+    String        key
+    ) throws MissingResourceException
+  {
+    //testTranslationKey(key); //jmw test
+
+    if (lContext == null)
+      throw new NullPointerException("Null lContext");
+    if (key == null)
+      throw new NullPointerException("Null key");
+
+    String bundleName = getBundleName();
+    if (bundleName == null)
+      return null;
+
+    return lContext.getBundle(bundleName).getObject(key);
+  }
+
+
+
+  /**
+   *  This is a test function.
+   *  This looks at the stack that I have on the request map for the
+   *  current component being rendered -- I store the prefix in
+   *  UIComponentUINode.
+   * @param key
+   */
+   /********* jmw for testing translation keys
+  public static void testTranslationKey(
+    String key)
+  {
+
+    javax.faces.context.FacesContext fcontext =
+      javax.faces.context.FacesContext.getCurrentInstance();
+    Stack translationKeyStack  = (Stack)fcontext.getExternalContext().
+                                        getRequestMap().get("TRANSLATION_KEY");
+
+
+    String translationKeyPrefix = null;
+
+    if ((translationKeyStack != null) && !translationKeyStack.empty())
+      translationKeyPrefix = (String)translationKeyStack.peek();
+
+
+ //   System.out.println(translationKeyPrefix + " / " + key); //jmw test
+
+    String keyPrefix = null;
+    int index = key.indexOf('.');
+    if (index != -1)
+      keyPrefix = key.substring(0, index);
+
+    if (translationKeyPrefix != null)
+    {
+      if (!(translationKeyPrefix.equalsIgnoreCase(keyPrefix)))
+      {
+        System.out.println("***NO MATCH " + translationKeyPrefix + " / " + key + "");
+      }
+    }
+    if ((translationKeyPrefix == null) && (key != null) &&
+      !(key.equals("WINDOW_CREATION_ERROR") || key.equals("NO_SCRIPT_MESSAGE")))
+    {
+      System.out.println("***nothing was rendered, but I have a key of " + key);
+    }
+
+  }
+  ****/
+
+  /**
+   * Returns the name of the ResourceBundle for the Skin.
+   */
+  abstract protected String getBundleName();
+
+  /**
+   * Our renderers call this to get the icon. This returns a renderable
+   * icon. (ReferenceIcons are resolved -- the real icon they point to is
+   * returned)
+   */
+  public Icon getIcon(
+    String  iconName
+    )
+  {
+    return getIcon(iconName, true);
+  }
+
+  /**
+   * Returns an Icon object; can be a ReferenceIcon.
+   * @param iconName  The name of the icon to retrieve. Cannot be null
+   * @throws NullPointerException if iconName is null.
+   */
+  public Icon getIcon(
+    String  iconName,
+    boolean resolveIcon
+    )
+  {
+    if (iconName == null)
+      throw new NullPointerException("Null iconName");
+
+    Icon icon = _icons.get(iconName);
+    if (resolveIcon)
+    {
+      if (icon instanceof ReferenceIcon)
+      {
+        // find the true icon, not a ReferenceIcon
+        icon = _resolveReferenceIcon((ReferenceIcon)icon,
+                                     null);
+      }
+    }
+
+    return icon;
+  }
+
+  /**
+   * Find the actual icon
+   * @param refIcon a ReferenceIcon instance
+   * @param referencedIconStack  The stack of reference icon names which have
+   *          already been visited.  Used to detect circular dependencies.
+   * @return icon which is resolved. i.e., it is not a ReferenceIcon.
+   */
+  private Icon _resolveReferenceIcon(
+    ReferenceIcon refIcon,
+    Stack<String> referencedIconStack)
+  {
+    String refName = refIcon.getName();
+
+    // make sure we don't have a circular dependency
+    if ( _stackContains(referencedIconStack, refName))
+    {
+      if (_LOG.isWarning())
+        _LOG.warning(_CIRCULAR_INCLUDE_ERROR + refName);
+      return null;
+    }
+    
+    if (referencedIconStack == null)
+    {
+      referencedIconStack = new Stack<String>();
+    }
+
+    referencedIconStack.push(refName);
+
+    Icon icon = getIcon(refName, false);
+
+    if ((icon instanceof ReferenceIcon) && (icon != null))
+    {
+
+      return _resolveReferenceIcon((ReferenceIcon)icon,
+                                    referencedIconStack);
+
+    }
+
+    return icon;
+  }
+
+    // Tests whether the value is present in the (possibly null) stack.
+  private static boolean _stackContains(Stack<String> stack, Object value)
+  {
+    if (stack == null)
+      return false;
+
+    return stack.contains(value);
+  }
+
+  /**
+   * Registers an Icon for the specified icon name.
+   * @param iconName  The name of the icon. Cannot be null.
+   * @param icon      The Icon to register.
+   * @throws NullPointerException if iconName is null.
+   */
+  synchronized public void registerIcon(
+    String  iconName,
+    Icon    icon
+    )
+  {
+    if (iconName == null)
+      throw new NullPointerException("Null iconName");
+
+    _icons.put(iconName, icon);
+  }
+
+  /**
+   * Registers a style sheet which defines extension-specific
+   * styles.  The styles specified by this style sheet will be
+   * merged with the Skin's own styles.  The full set
+   * of styles can be obtained by calling getStyleSheetDocument().
+   * @todo Is this even supported???
+   * @param styleSheetName The name of the style sheet which
+   *          defines the extension's styles.  This style sheet
+   *          should be installed under the directory specified by
+   *          Configuration.STYLES_DIRECTORY path.
+   * @see #getStyleSheetDocument
+   * @throws NullPointerException if styleSheetName is null.
+   */
+  public void registerStyleSheet(
+    String styleSheetName
+    )
+  {
+    if (styleSheetName == null)
+      throw new NullPointerException("Null styleSheetName");
+
+    if (_extensionStyleSheetNames == null)
+    {
+      _extensionStyleSheetNames = new ArrayList<String>();
+    }
+
+    _extensionStyleSheetNames.add(styleSheetName);
+  }
+
+  /**
+   * Returns the StyleSheetDocument object which defines all of the
+   * styles for this Skin, including any styles that are
+   * contributed by UIExtensions.
+   */
+  public StyleSheetDocument getStyleSheetDocument(StyleContext context)
+  {
+    // We synchronize here because technically speaking multiple
+    // threads can simultaneously update the underlying style sheet
+    // objects.  However, in practice, this should never be an issue -
+    // especially in production systems where modification checking
+    // should always be disabled.  In this case, the style sheet objects
+    // are created when the first request is received and are never
+    // updated after that point.  So, if this synchronization turns
+    // out to be a bottleneck, it should be safe to remove this
+    // synchronization - at least when modification checking is
+    // disabled, if not altogether.
+    synchronized (this)
+    {
+      if ((_styleSheetDocument == null) || _checkStylesModified(context))
+        _styleSheetDocument = _createStyleSheetDocument(context);
+
+      return _styleSheetDocument;
+    }
+  }
+
+  /**
+   * Retrieves a property that was set via a call to setProperty().
+   * Some Renderer implementations may store properties on the
+   * Skin instance to avoid having to re-compute Skin-specific
+   * values on each render.
+   */
+  public Object getProperty(Object key)
+  {
+    if (_properties == null)
+      return null;
+
+    return _properties.get(key);
+  }
+
+  /**
+   * Sets a value for the specified property key.
+   */
+  synchronized public void setProperty(
+    Object key,
+    Object value
+    )
+  {
+    if (_properties == null)
+      _properties = new OptimisticHashMap<Object, Object>();
+
+    _properties.put(key, value);
+  }
+
+  // Checks to see whether any of our style sheets have been updated
+  private boolean _checkStylesModified(
+    StyleContext context
+    )
+  {
+    boolean modified = false;
+
+    if (_skinStyleSheet != null)
+      modified = _skinStyleSheet.checkModified(context);
+
+    // We also check all of the UIExtension style sheets even
+    // if we already know that the skin's style sheet has been
+    // modified.  We need to do this because we want to call
+    // StyleSheetEntry.checkModified() for each entry - otherwise
+    // out of date StyleSheetEntries may not get updated.
+    if (_extensionStyleSheets != null)
+    {
+      for (int i = 0; i < _extensionStyleSheets.length; i++)
+      {
+        StyleSheetEntry entry = _extensionStyleSheets[i];
+        if (entry.checkModified(context))
+          modified = true;
+      }
+    }
+
+    return modified;
+  }
+
+  // Creates the StyleSheetDocument for this Skin
+  // (as a side effect, this also registers icons and skin properties
+  // defined in the skin's style-sheet.)
+  private StyleSheetDocument _createStyleSheetDocument(
+    StyleContext context
+    )
+  {
+    // If we haven't created the StyleSheetDocument yet,
+    // then presumably we haven't attempted to load the
+    // style sheet files.  Create StyleSheetEntry instances
+    // for each style sheet file that we depend on.
+    if (_styleSheetDocument == null)
+    {
+      String styleSheetName = getStyleSheetName();
+
+      // =-=jmw I'm not sure where a good place is to parse the css file and
+      // register the icons and properties. For now, I suppose I can do it here.
+
+      if (styleSheetName != null)
+      {
+        _skinStyleSheet = StyleSheetEntry.createEntry(context, styleSheetName);
+
+
+        // register the icons and properties if there are any.
+        // this is a strange place for this. Where is a better spot???
+        // get a List of IconNodes, and register them.
+        if (_skinStyleSheet != null)
+        {
+          // register icons
+          List<IconNode> icons = _skinStyleSheet.getIcons();
+          if (icons != null)
+          {
+            for(IconNode iconNode : icons)
+            {
+              registerIcon(iconNode.getIconName(), iconNode.getIcon());
+            }
+          }
+          
+          // register properties
+          List<SkinPropertyNode> skinProperties = 
+            _skinStyleSheet.getSkinProperties();
+          
+          if (skinProperties != null)
+          {
+            for(SkinPropertyNode property : skinProperties)
+            {
+              Object propValueObj = property.getPropertyValue();
+              // convert to a type if possible first
+              // =-=jmw should I get the type for af|breadCrumbs-ora-show-last-item or just
+              // -ora-show-last-item. in other words, will the property name be the same type
+              // no matter which component it is being used for? If so, then
+              // just storing -ora-show-last-item in the map is good enough.
+              // For now, just for the heck of it, use af|breadCrumbs-ora-show-last-item
+
+              String key = property.getPropertySelector() +
+                           property.getPropertyName();
+              // look up in map to get conversion
+              Class<?> type = _PROPERTY_CLASS_TYPE_MAP.get(key);
+              if (type != null)
+              {
+                try
+                {
+                  // coerce the value to the type
+                  propValueObj = Coercions.coerce(null, (String)propValueObj,
+                                type);
+                }
+                catch (IllegalArgumentException ex)
+                {
+                  if (_LOG.isWarning())
+                    _LOG.warning(ex);
+                }
+              }
+
+
+              setProperty(key, propValueObj);
+            }
+          }
+        }
+      }
+
+
+      // Now create entries for UIExtension-specific style sheets.
+      _extensionStyleSheets = _getExtensionStyleSheets(context);
+    }
+
+    // Now merge all of the documents provided by all of our
+    // entries into a single StyleSheetDocument.
+    StyleSheetDocument document = null;
+
+    if (_skinStyleSheet != null)
+      document = _skinStyleSheet.getDocument();
+
+    // Merge in any UIExtension style sheets on top of
+    // the skin's style sheet
+    if (_extensionStyleSheets != null)
+    {
+      for (int i = 0; i < _extensionStyleSheets.length; i++)
+      {
+        StyleSheetEntry entry = _extensionStyleSheets[i];
+        StyleSheetDocument extensionDocument = entry.getDocument();
+
+        if (extensionDocument != null)
+        {
+          // Merge the UIExtension's StyleSheetDocument on top of
+          // the current StyleSheetDocument.  Note: This is not
+          // exactly efficient - we would be better off creating
+          // an array of StyleSheetDocuments and merging them all
+          // in one pass.  But since this code should rarely be
+          // executed, this shouldn't be a bottleneck...
+          document = StyleSheetDocumentUtils.mergeStyleSheetDocuments(
+                                               document,
+                                               extensionDocument);
+          // =-=jmw @todo when we have extension documents, we'll need
+          // to register icons and skin properties from those on the skin?
+        }
+      }
+    }
+
+    // We're done!
+    if (document != null)
+      return document;
+
+    // If we weren't able to produce a StyleSheetDocument for whatever
+    // reason (maybe we don't have any style sheet, maybe there were
+    // I/O problems), create a empty StyleSheetDocument so that we
+    // don't repeatedly try to re-create the document.
+    return new StyleSheetDocument(null, 
+                                  null, 
+                                  StyleSheetDocument.UNKNOWN_TIMESTAMP);
+  }
+
+  // Gets the StyleSheetEntries for UIExtensions
+  private StyleSheetEntry[] _getExtensionStyleSheets(StyleContext context)
+  {
+    if (_extensionStyleSheetNames == null)
+      return null;
+
+    // Create a list to hold our StyleSheetEntries
+    int count = _extensionStyleSheetNames.size();
+    List<StyleSheetEntry> entries = new ArrayList<StyleSheetEntry>(count);
+
+    // Loop through all registered style sheet names and
+    // try to create a StyleSheetEntry for each name.
+    for(String name : _extensionStyleSheetNames)
+    {
+      StyleSheetEntry entry = StyleSheetEntry.createEntry(context, name);
+      if (entry != null)
+      {
+        entries.add(entry);
+      }
+    }
+
+    if (!entries.isEmpty())
+    {
+      _extensionStyleSheets = new StyleSheetEntry[entries.size()];
+      return entries.toArray(_extensionStyleSheets);
+    }
+
+    return null;
+  }
+
+  // HashMap that maps icon name to Icons
+  private OptimisticHashMap<String, Icon> _icons = new OptimisticHashMap<String, Icon>();
+
+  // The StyleSheetDocument which contains all of the styles
+  // for this Skin - including styles contributed by UIExtensions.
+  private StyleSheetDocument _styleSheetDocument;
+
+  // A StyleSheetEntry which defines the styles that are
+  // provided by this Skin's style sheet only (does
+  // not include UIExtension styles).
+  private StyleSheetEntry _skinStyleSheet;
+
+  // List of extension style sheet names
+  private List<String> _extensionStyleSheetNames;
+
+  // Array of UIExtension StyleSheetEntries
+  private StyleSheetEntry[] _extensionStyleSheets;
+
+  // HashMap of Skin properties
+  private OptimisticHashMap<Object, Object> _properties;
+
+  // Map of property to class type
+  private static final Map<String, Class<?>> _PROPERTY_CLASS_TYPE_MAP;
+  static
+  {
+    _PROPERTY_CLASS_TYPE_MAP = new HashMap<String, Class<?>>();
+    
+    _PROPERTY_CLASS_TYPE_MAP.put(
+      SkinProperties.AF_NAVIGATIONPATH_SHOW_LAST_ITEM_PROPERTY_KEY, Boolean.class);
+    _PROPERTY_CLASS_TYPE_MAP.put(
+      SkinProperties.AF_TABLE_SELECTION_BAR_IN_TABLE, Boolean.class);
+    _PROPERTY_CLASS_TYPE_MAP.put(
+      SkinProperties.AF_TABLE_REPEAT_CONTROL_BAR, Boolean.class);
+  }
+
+  // Error messages
+  private static final String _CIRCULAR_INCLUDE_ERROR =
+    "Circular dependency detected in skin reference icon ";
+  private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(Skin.class);
+}

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java Fri Sep 22 15:18:32 2006
@@ -24,7 +24,7 @@
  *
  * @author The Oracle ADF Faces Team
  */
-public class SkinNotAvailable extends Skin
+public class SkinNotAvailable extends SkinImpl
 {
   /**
    * returns the singleton instance of this class.

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java Fri Sep 22 15:18:32 2006
@@ -143,7 +143,7 @@
     synchronized (this)
     {
       // gets the skin's StyleSheetDocument (it creates it if needed)
-      skinDocument = _skinDocument = _skin.getStyleSheetDocument(context);
+      skinDocument = _skinDocument = ((SkinImpl) _skin).getStyleSheetDocument(context);
     }
 
 
@@ -168,7 +168,7 @@
     // Synchronize access to _skinDocument
     synchronized (this)
     {
-      return (_skinDocument != _skin.getStyleSheetDocument(context));
+      return (_skinDocument != ((SkinImpl) _skin).getStyleSheetDocument(context));
     }
   }
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/BaseImageIcon.java Fri Sep 22 15:18:32 2006
@@ -219,8 +219,8 @@
    * URI separator ('/').
    */
   abstract protected String getBaseURI(
-  FacesContext        context,
-  RenderingContext arc);
+    FacesContext        context,
+    RenderingContext arc);
 
   /**
    * Returns the URI of the image relative to the base URI.

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/ContextImageIcon.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/ContextImageIcon.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/ContextImageIcon.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/ContextImageIcon.java Fri Sep 22 15:18:32 2006
@@ -17,14 +17,11 @@
 package org.apache.myfaces.trinidadinternal.skin.icon;
 
 import java.io.IOException;
+import java.io.InputStream;
 
 import javax.faces.context.FacesContext;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletRequest;
 
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
-import org.apache.myfaces.trinidadinternal.share.io.InputStreamProvider;
-import org.apache.myfaces.trinidadinternal.share.io.ServletNameResolver;
 
 import org.apache.myfaces.trinidadinternal.style.Style;
 
@@ -110,25 +107,13 @@
   /**
    * Override of Icon.getImageIcon().
    */
-  @Override
-  public InputStreamProvider getImageData(
+  public InputStream openStream(
     FacesContext        context,
     RenderingContext arc
     ) throws IOException
   {
-
-    ServletRequest servletRequest = 
-      (ServletRequest)context.getExternalContext().getRequest();
-    ServletContext servletContext = 
-      (ServletContext)context.getExternalContext().getContext();
-
-    if ((servletRequest == null) || (servletContext == null))
-      return null;
-
-    ServletNameResolver resolver = new ServletNameResolver(servletRequest,
-                                                           servletContext);
-
-    return resolver.getProvider(getRelativeURI(context, arc));
+    return context.getExternalContext().getResourceAsStream(
+                                          getRelativeURI(context, arc));
   }
 
   /**

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/Icon.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/Icon.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/Icon.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/icon/Icon.java Fri Sep 22 15:18:32 2006
@@ -17,13 +17,13 @@
 package org.apache.myfaces.trinidadinternal.skin.icon;
 
 import java.io.IOException;
+import java.io.InputStream;
 
 import java.util.Map;
 import javax.faces.context.FacesContext;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
-import org.apache.myfaces.trinidadinternal.share.io.InputStreamProvider;
 
 /**
  * An object which represents a customizable icon that is capable of
@@ -111,14 +111,14 @@
   }
 
   /**
-   * Returns an InputStreamProvider which provides access to the
+   * Returns an InputStream which provides access to the
    * image data for image-based Icons.
    * @param FacesContext context
    * @param RenderingContext arc The RenderingContext for the
    *                                 current request.
    * @todo Is this still necessary?
    */
-  public InputStreamProvider getImageData(
+  public InputStream openStream(
     FacesContext        context,
     RenderingContext arc
     ) throws IOException

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/cache/FileSystemStyleCache.java Fri Sep 22 15:18:32 2006
@@ -979,7 +979,7 @@
 
       _init(
        localeContext.getTranslationLocale(),
-       localeContext.getReadingDirection(),
+       LocaleUtils.getReadingDirection(localeContext),
        agent.getAgentApplication(),
        agent.getAgentMajorVersion(),
        agent.getAgentOS(),

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/GraphicsUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/GraphicsUtils.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/GraphicsUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/GraphicsUtils.java Fri Sep 22 15:18:32 2006
@@ -268,13 +268,10 @@
           }
           else if ((current - start) > abortTimeout)
           {
-            // Stop the graphics loader thread
-            // -= Simon Lessard =-
-            // FIXME: stop() is bad, especially with all that synchronized 
-            //        class used, it's deadlock prone, should stop it 
-            //        differently.
+            // Don't know whether interrupt() is useful here,
+            // but give it a whirl
             if (_sGraphicsLoaderThread != null)
-              _sGraphicsLoaderThread.stop();
+              _sGraphicsLoaderThread.interrupt();
 
             // Disable the graphics environment
             __setGraphicsLoaded(false);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/NameUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/NameUtils.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/NameUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/NameUtils.java Fri Sep 22 15:18:32 2006
@@ -420,7 +420,7 @@
   // Get the direction as a String
   private static String _getDirectionString(StyleContext context)
   {
-    int direction = context.getLocaleContext().getReadingDirection();
+    int direction = LocaleUtils.getReadingDirection(context.getLocaleContext());
 
     String name = getDirectionName(direction);
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/xml/parse/StyleSheetDocument.java Fri Sep 22 15:18:32 2006
@@ -308,7 +308,7 @@
   {
     LocaleContext localeContext = context.getLocaleContext();
     Locale locale = localeContext.getTranslationLocale();
-    int direction = localeContext.getReadingDirection();
+    int direction = LocaleUtils.getReadingDirection(localeContext);
     int mode = NameUtils.getMode(ModeUtils.getCurrentMode(context));
     TrinidadAgent agent = context.getAgent();
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/RootRenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/RootRenderingContext.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/RootRenderingContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/RootRenderingContext.java Fri Sep 22 15:18:32 2006
@@ -462,8 +462,7 @@
     Skin skin = getSkin();
     if (mappedIconName != null)
     {
-      if ((getLocaleContext().getReadingDirection() ==
-          LocaleUtils.DIRECTION_RIGHTTOLEFT) &&
+      if (getLocaleContext().isRightToLeft() &&
           (!mappedIconName.endsWith(StyleUtils.RTL_CSS_SUFFIX)))
       {
         // append :rtl to the mappedIconName. If no icon with that name,

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/UIXRenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/UIXRenderingContext.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/UIXRenderingContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/UIXRenderingContext.java Fri Sep 22 15:18:32 2006
@@ -27,7 +27,7 @@
 
 import org.apache.myfaces.trinidadinternal.image.ImageContext;
 
-import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContext;
+import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.skin.icon.Icon;
 import org.apache.myfaces.trinidadinternal.skin.Skin;
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/composite/CompositeRenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/composite/CompositeRenderingContext.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/composite/CompositeRenderingContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/composite/CompositeRenderingContext.java Fri Sep 22 15:18:32 2006
@@ -32,7 +32,7 @@
 
 import org.apache.myfaces.trinidadinternal.image.ImageContext;
 
-import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContext;
+import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
 
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafRenderer.java Fri Sep 22 15:18:32 2006
@@ -19,9 +19,11 @@
 
 import javax.faces.component.UIComponent;
 
+import org.apache.myfaces.trinidad.context.RequestContext;
+
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidadinternal.agent.CapabilityKey;
-import org.apache.myfaces.trinidadinternal.share.config.AccessibilityMode;
+import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
 import org.apache.myfaces.trinidadinternal.share.config.Configuration;
 import org.apache.myfaces.trinidadinternal.ui.AttributeKey;
 import org.apache.myfaces.trinidadinternal.ui.ElementRenderer;
@@ -497,8 +499,7 @@
           UIXRenderingContext context
           )
   {
-    return context.getLocaleContext().getReadingDirection() ==
-            LocaleUtils.DIRECTION_RIGHTTOLEFT;
+    return context.getLocaleContext().isRightToLeft();
   }
 
 
@@ -1047,7 +1048,9 @@
    */
   public static boolean isInaccessibleMode(UIXRenderingContext context)
   {
-    return AccessibilityMode.isInaccessibleMode(context.getConfiguration());
+    RenderingContext rc = RenderingContext.getCurrentInstance();
+    return rc.getAccessibilityMode() ==
+       RequestContext.Accessibility.INACCESSIBLE;
   }
 
   /**
@@ -1055,7 +1058,9 @@
    */
   public static boolean isScreenReaderMode(UIXRenderingContext context)
   {
-    return AccessibilityMode.isScreenReaderMode(context.getConfiguration());
+    RenderingContext rc = RenderingContext.getCurrentInstance();
+    return rc.getAccessibilityMode() ==
+       RequestContext.Accessibility.SCREEN_READER;
   }
 
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafUtils.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/BaseLafUtils.java Fri Sep 22 15:18:32 2006
@@ -125,8 +125,7 @@
     UIXRenderingContext context
     )
   {
-    return context.getLocaleContext().getReadingDirection() ==
-                   LocaleUtils.DIRECTION_RIGHTTOLEFT;
+    return context.getLocaleContext().isRightToLeft();
   }
 
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/GeneratedImageRenderer.java Fri Sep 22 15:18:32 2006
@@ -497,15 +497,6 @@
     return BaseDesktopUtils.getBackgroundColor(context);
   }
 
-  static protected int getDirection(
-    UIXRenderingContext context,
-    UINode node
-    )
-  {
-    // Always get direction from LocaleContext
-    return context.getLocaleContext().getReadingDirection();
-  }
-
   static protected boolean isTextAntialiased(
     UIXRenderingContext context,
     UINode node,

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/desktop/TreeRenderer.java Fri Sep 22 15:18:32 2006
@@ -111,7 +111,7 @@
     final String varName = "_adftree" +
             XhtmlUtils.getJSIdentifier(name);
 
-    int readingDirection = context.getLocaleContext().getReadingDirection();
+    boolean leftToRight = !context.getLocaleContext().isRightToLeft();
     int rootSize = tree.getRowCount();
     RowKeySet state = getExpandedRowKeys(tree);      
     Map<Object, Boolean> selectedPaths = getSelectedPaths(focusPath);
@@ -129,7 +129,7 @@
                   state,
                   selectedPaths,
                   new Boolean[_DEFAULT_TREE_DEPTH],
-                  (readingDirection == LocaleUtils.DIRECTION_LEFTTORIGHT),
+                  leftToRight,
                   (i == 0),
                   (i == rootSize - 1),
                   0);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/AccentedLafIconProvider.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/AccentedLafIconProvider.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/AccentedLafIconProvider.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/AccentedLafIconProvider.java Fri Sep 22 15:18:32 2006
@@ -173,7 +173,7 @@
     if (isDirectionIndependent)
       direction = LocaleUtils.DIRECTION_LEFTTORIGHT;
     else
-      direction = context.getLocaleContext().getReadingDirection();
+      direction = LocaleUtils.getReadingDirection(context.getLocaleContext());
 
     assert (direction != -1);
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/FormValueRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/FormValueRenderer.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/FormValueRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/FormValueRenderer.java Fri Sep 22 15:18:32 2006
@@ -23,7 +23,7 @@
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormData;
+import org.apache.myfaces.trinidadinternal.renderkit.FormData;
 import org.apache.myfaces.trinidadinternal.share.url.FormEncoder;
 import org.apache.myfaces.trinidadinternal.ui.NodeRole;
 import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HiddenLabelUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HiddenLabelUtils.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HiddenLabelUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HiddenLabelUtils.java Fri Sep 22 15:18:32 2006
@@ -22,7 +22,6 @@
 
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidadinternal.share.config.Configuration;
-import org.apache.myfaces.trinidadinternal.share.config.AccessibilityMode;
 
 import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
 import org.apache.myfaces.trinidadinternal.ui.UIConstants;
@@ -92,8 +91,7 @@
     UIComponent component
     ) throws IOException
   {
-    Configuration config = context.getConfiguration();
-    if (!AccessibilityMode.isInaccessibleMode(config) &&
+    if (!XhtmlLafRenderer.isInaccessibleMode(context) &&
         (text != null) &&
         (id   != null))
     {

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HtmlRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HtmlRenderer.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HtmlRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/HtmlRenderer.java Fri Sep 22 15:18:32 2006
@@ -220,10 +220,9 @@
 
     LocaleContext localeContext = context.getLocaleContext();
 
-    String direction =
-       (localeContext.getReadingDirection()==LocaleUtils.DIRECTION_LEFTTORIGHT)
-          ? "ltr"
-          : "rtl";
+    String direction = localeContext.isRightToLeft()
+          ? "rtl"
+          : "ltr";
     writer.writeAttribute("dir", direction, null);
 
     // render the correct language

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/NavigationBarRenderer.java Fri Sep 22 15:18:32 2006
@@ -41,7 +41,7 @@
 import org.apache.myfaces.trinidadinternal.ui.data.bind.AccessKeyBoundValue;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.SkinTranslatedBoundValue;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.NodeRoleUtils;
-import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContext;
+import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.ui.partial.PartialPageRendererUtils;
 
 /**

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/XhtmlLafRenderer.java Fri Sep 22 15:18:32 2006
@@ -30,8 +30,8 @@
 import org.apache.myfaces.trinidadinternal.image.ImageProvider;
 import org.apache.myfaces.trinidadinternal.image.ImageProviderRequest;
 import org.apache.myfaces.trinidadinternal.image.ImageProviderResponse;
+import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
-import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContext;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SkinSelectors;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlRenderer;

Added: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/IconInputStreamProvider.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/IconInputStreamProvider.java?view=auto&rev=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/IconInputStreamProvider.java (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/IconInputStreamProvider.java Fri Sep 22 15:18:32 2006
@@ -0,0 +1,89 @@
+package org.apache.myfaces.trinidadinternal.ui.laf.simple.desktop;
+
+import java.io.InputStream;
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
+import org.apache.myfaces.trinidadinternal.share.io.InputStreamProvider;
+import org.apache.myfaces.trinidadinternal.skin.icon.Icon;
+
+class IconInputStreamProvider implements InputStreamProvider
+{
+  IconInputStreamProvider(Icon icon)
+  {
+    _icon = icon;
+  }
+
+  /**
+   * Return an InputStream for the target.  This function
+   * should never return null - if a stream cannot be opened,
+   * throw an IOException.
+   */
+  public InputStream  openInputStream() throws IOException
+  {
+    return _icon.openStream(FacesContext.getCurrentInstance(),
+                            RenderingContext.getCurrentInstance());
+  }
+
+  /**
+   * Returns the name of the target location, suitable
+   * for user display.
+   */
+  public String  getDisplayName()
+  {
+    return _icon.toString();
+  }
+
+  /**
+   * Returns an identifier object that uniquely
+   * identifies the target location. If two providers
+   * return equal identifiers, that is, given:
+   * <pre>
+   *   Object identifierA = providerA.getIdentifier();
+   *   Object identifierB = providerB.getIdentifier();
+   * </pre>
+   * ... then:
+   * <pre>
+   *   if (identifierA.equals(identifierB)) ...
+   * </pre>
+   * then the two providers must point to the same location.
+   */
+  public Object getIdentifier()
+  {
+    return _icon;
+  }
+
+  /**
+   * Returns true if the underlying target has changed
+   * since the last call to openInputStream()
+   */
+  public boolean           hasSourceChanged()
+  {
+    return false;
+  }
+
+  /**
+   * Returns the cached result from reading and parsing this
+   * provider.
+   * @see CachingNameResolver
+   */
+  public Object            getCachedResult()
+  {
+    return _cachedResult;
+  }
+
+  /**
+   * Stores the cached result of reading and parsing this
+   * provider.
+   * @see CachingNameResolver
+   */
+  public void              setCachedResult(Object value)
+  {
+    _cachedResult = value;
+  }
+
+  private Icon   _icon;
+  private Object _cachedResult;
+}

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleButtonUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleButtonUtils.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleButtonUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/simple/desktop/SimpleButtonUtils.java Fri Sep 22 15:18:32 2006
@@ -283,14 +283,7 @@
 
       if (icon != null)
       {
-        try
-        {
-          return icon.getImageData(_fContext, _arc);
-        }
-        catch (IOException e)
-        {
-          _LOG.severe(e);
-        }
+        return new IconInputStreamProvider(icon);
       }
 
       return null;
@@ -307,8 +300,7 @@
   {
     LocaleContext lContext = context.getLocaleContext();
 
-    return (LocaleUtils.DIRECTION_RIGHTTOLEFT ==
-            lContext.getReadingDirection());
+    return lContext.isRightToLeft();
   }
 
   // Key for Boolean Skin property which we use

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/FacesRenderingContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/FacesRenderingContext.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/FacesRenderingContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/uinode/FacesRenderingContext.java Fri Sep 22 15:18:32 2006
@@ -24,7 +24,7 @@
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.context.RequestContext;
 
-import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PartialPageContext;
+import org.apache.myfaces.trinidadinternal.renderkit.PartialPageContext;
 
 import org.apache.myfaces.trinidadinternal.agent.TrinidadAgent;
 import org.apache.myfaces.trinidadinternal.share.config.ContextBasedConfiguration;
@@ -37,6 +37,7 @@
 import org.apache.myfaces.trinidadinternal.style.StyleContext;
 
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
+import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderingContext;
 
 /**
  * RenderingContext implementation that supports JSF.
@@ -138,7 +139,7 @@
    */
   public StyleContext getStyleContext()
   {
-    return _adfRenderingContext.getStyleContext();
+    return ((CoreRenderingContext) _adfRenderingContext).getStyleContext();
   }
 
   /**
@@ -151,7 +152,7 @@
 
   public TrinidadAgent getAgent()
   {
-    return _adfRenderingContext.getAgent();
+    return ((CoreRenderingContext) _adfRenderingContext).getTrinidadAgent();
   }
 
   @Override

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/FormattedTextParser.java Fri Sep 22 15:18:32 2006
@@ -721,8 +721,8 @@
         return;
 
       RenderingContext arc = RenderingContext.getCurrentInstance();
-      if (!Boolean.FALSE.equals(arc.getAgent().getCapability(
-                                    TrinidadAgent.CAP_NAVIGATION)))
+      if (!Boolean.FALSE.equals(arc.getAgent().getCapabilities().get(
+               TrinidadAgent.CAP_NAVIGATION)))
         context.getResponseWriter().writeURIAttribute("href", href, null);
     }
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/nls/LocaleUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/nls/LocaleUtils.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/nls/LocaleUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/nls/LocaleUtils.java Fri Sep 22 15:18:32 2006
@@ -17,6 +17,8 @@
 
 import java.util.Locale;
 
+import org.apache.myfaces.trinidadinternal.share.nls.LocaleContext;
+
 
 
 /**
@@ -45,6 +47,17 @@
    */
   public static final int DIRECTION_RIGHTTOLEFT = 2;
 
+  
+  /**
+   * Conversion function to go from LocaleContext to the obsolete
+   * reading direction API.
+   */
+  public static int getReadingDirection(LocaleContext localeContext)
+  {
+    return localeContext.isRightToLeft()
+             ? DIRECTION_RIGHTTOLEFT
+             : DIRECTION_LEFTTORIGHT;
+  }
 
 
   /**

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/CoreRenderKitTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/CoreRenderKitTest.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/CoreRenderKitTest.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/CoreRenderKitTest.java Fri Sep 22 15:18:32 2006
@@ -32,6 +32,7 @@
 import org.apache.myfaces.trinidad.component.core.CoreDocument;
 import org.apache.myfaces.trinidad.component.core.CoreForm;
 import org.apache.myfaces.trinidad.component.html.HtmlHtml;
+import org.apache.myfaces.trinidad.context.RequestContext;
 
 import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
 
@@ -138,12 +139,12 @@
                                          false));
     _definitions.add(new SuiteDefinition("minimalScrRdr",
                                          "minimal",
-                                         "screenReader",
+                                         RequestContext.Accessibility.SCREEN_READER,
                                          RenderKitBootstrap.getGeckoAgent(),
                                          false));
     _definitions.add(new SuiteDefinition("minimalInacc",
                                          "minimal",
-                                         "inaccessible",
+                                         RequestContext.Accessibility.INACCESSIBLE,
                                          RenderKitBootstrap.getGeckoAgent(),
                                          false));
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/MRequestContext.java Fri Sep 22 15:18:32 2006
@@ -142,12 +142,12 @@
   }
 
   @Override
-  public String getAccessibilityMode()
+  public Accessibility getAccessibilityMode()
   {
     return _accMode;
   }
 
-  public void setAccessibilityMode(String accMode)
+  public void setAccessibilityMode(Accessibility accMode)
   {
     _accMode = accMode;
   }
@@ -260,7 +260,7 @@
   }
 
   private String _skin;
-  private String _accMode;
+  private Accessibility _accMode;
   private Agent _agent;
   private boolean _rtl = false;
   static private TimeZone _FIXED_TIME_ZONE =

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java?view=diff&rev=449112&r1=449111&r2=449112
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java Fri Sep 22 15:18:32 2006
@@ -40,6 +40,7 @@
 import org.apache.commons.lang.StringUtils;
 
 import org.apache.myfaces.trinidad.context.Agent;
+import org.apache.myfaces.trinidad.context.RequestContext;
 import org.apache.myfaces.trinidad.render.ExtendedRenderKitService;
 import org.apache.myfaces.trinidad.util.Service;
 
@@ -80,7 +81,7 @@
                     String categoryName,
                     String skin,
                     Agent agent,
-                    String accMode,
+                    RequestContext.Accessibility accMode,
                     boolean rightToLeft)
     {
       super(name + "-" + categoryName);
@@ -217,7 +218,7 @@
     private MRequestContext _requestContext;
     private String           _skin;
     private Agent            _agent;
-    private String           _accMode;
+    private RequestContext.Accessibility  _accMode;
     private boolean          _rightToLeft;
   }
 
@@ -515,7 +516,7 @@
     public SuiteDefinition(
       String category,
       String skin,
-      String accessibilityMode,
+      RequestContext.Accessibility accessibilityMode,
       Agent  agent,
       boolean rightToLeft)
     {
@@ -536,7 +537,7 @@
       return _skin;
     }
 
-    public String getAccessibilityMode()
+    public RequestContext.Accessibility getAccessibilityMode()
     {
       return _accessibilityMode;
     }
@@ -554,7 +555,7 @@
 
     private String _category;
     private String _skin;
-    private String _accessibilityMode;
+    private RequestContext.Accessibility _accessibilityMode;
     private Agent _agent;
     private boolean _rightToLeft;
   }



Mime
View raw message