Package org.apache.myfaces.trinidad.skin

Examples of org.apache.myfaces.trinidad.skin.Skin


  {
    Object value = super.getProperty(key);

    if ( value == null)
    {
      Skin baseSkin = getBaseSkin();
      value =  baseSkin.getProperty(key);
    }

    return value;

  }
View Full Code Here


      return icon;
    }

    // If we don't have the icon locally, check the base skin.

    Skin baseSkin = getBaseSkin();
    // get baseSkin's icon. Don't resolve to a real icon. If it is a
    // ReferenceIcon, return the ReferenceIcon.
    icon = baseSkin.getIcon(iconName, false);

    // we found the icon on the base Skin, but it is a ReferenceIcon.
    // find the actual icon
    if (resolve)
    {
View Full Code Here

      }
    }
    else
    {

      Skin baseSkin = getBaseSkin();
      icon = baseSkin.getIcon(refName, false);

      if (icon instanceof ReferenceIcon)
      {
        Icon resolvedIcon = _resolveReferenceIcon((ReferenceIcon)icon,
                                                   referencedIconStack);
View Full Code Here

    DerivationKey derivationKey = _getDerivationKey(context, document);
    entryCache.put(derivationKey, entry);
   
    // just in case, clear the dirty flag.
    RenderingContext arc = RenderingContext.getCurrentInstance();
    Skin skin = arc.getSkin();
    skin.setDirty(false);

    return entry;
  }
View Full Code Here

    // Write out the style sheet
    // First figure out whether or not we need to compress the style classes.
    // We don't compress the style classes if the content compression flag is disabled or
    // if the skin is a portlet skin.
    RenderingContext arc = RenderingContext.getCurrentInstance();
    Skin skin = arc.getSkin();
    boolean compressStyles = _isCompressStyles(context);

    StyleWriterFactoryImpl writerFactory = new StyleWriterFactoryImpl(_targetPath,
      getTargetStyleSheetName(context, document));
    CSSGenerationUtils.writeCSS(context,
                                skin.getStyleSheetName(),
                                styles,
                                writerFactory,
                                compressStyles,
                                shortStyleClassMap,
                                namespacePrefixes,
View Full Code Here

      return;
    }

    synchronized (_skins)
    {
      Skin previousValue = _skins.put(skinId, skin);
      if (previousValue != null)
        _LOG.warning("DUPLICATE_ADD_SKIN_TO_SKIN_FACTORY", skinId);
    }
  }
View Full Code Here

    {
      _LOG.warning("CANNOT_GET_SKIN_WITH_NULL_SKINID");
      return null;
    }

    Skin skin = null;
    synchronized (_skins)
    {
      if (_skins.containsKey(skinId))
      {
        skin = _skins.get(skinId);
View Full Code Here

    if (renderKitId == null)
      renderKitId = XhtmlConstants.APACHE_TRINIDAD_DESKTOP;

    // loop through each skin in the SkinFactory
    // and see if the family and the renderKitId match
    Skin matchingSkin = null;
    List<Skin> matchingSkinList = new ArrayList<Skin>();

    for(Skin skin : _skins.values())
    {
      if (family.equalsIgnoreCase(skin.getFamily()) &&
          renderKitId.equalsIgnoreCase(skin.getRenderKitId()))
      {
        // exact family+renderKitId match!
        matchingSkinList.add(skin);
      }
    }
   

    if (matchingSkinList.isEmpty())
    {
      // if we get here, that means we couldn't find an exact
      // family/renderKitId match, so return the simple skin
      // that matches the renderkitid.
       if (_LOG.isWarning())
       {
         _LOG.warning("CANNOT_FIND_MATCHING_SKIN", new Object[]{family, renderKitId});
       }

      if (renderKitId.equals(XhtmlConstants.APACHE_TRINIDAD_PORTLET))
        matchingSkin = getSkin(context, _SIMPLE_PORTLET);
      else if (renderKitId.equals(XhtmlConstants.APACHE_TRINIDAD_PDA))
        matchingSkin = getSkin(context, _SIMPLE_PDA);
      else
        matchingSkin = getSkin(context, _SIMPLE_DESKTOP);
    }
    else
    {
      // at this point we know we have something in the matchingSkinList
      // which is a list of matching family and renderKitId skins. Now match the version
      // to find the best matched skin.
      boolean foundMatchingSkin = false;
      boolean versionIsDefault = (_DEFAULT.compareToIgnoreCase(version) == 0);
      // if the user didn't ask for the 'default' version, then look for the exact match
      if (!versionIsDefault)
      {
        for (Skin skin : matchingSkinList)
        {
          SkinVersion skinVersion = skin.getVersion();
          if (skinVersion != null)
          {
            String name = skinVersion.getName();
            if (version.equals(name))
            {
              matchingSkin = skin;
              break;
            }
          }
        }         
      }
      // matchingSkin will be null if an exact version match (family+renderKitId+exact version) was not found;
      // we can have an exact version match if the user asks for null version, and we find a skin with no
      // version set.
      if (matchingSkin == null || versionIsDefault)
      {
        // find skin with version= default
        matchingSkin = _getDefaultVersionSkin(matchingSkinList);

        if (matchingSkin == null)
        {
          // get the last skin in the matchingSkinList if there is no skin marked default.
          matchingSkin = matchingSkinList.get(matchingSkinList.size() -1);
        }
        else if ((matchingSkin != null) && versionIsDefault)
        {
          // found the default skin the user wanted
          foundMatchingSkin = true;
        }
      } // end matchingSkin == null || versionIsDefault
      else
      {
        foundMatchingSkin = true;
      }
      // log messages
      if (foundMatchingSkin)
      {
        if (_LOG.isFine())
          _LOG.fine("GET_SKIN_FOUND_SKIN_VERSION",
                    new Object[]{family, version, matchingSkin.getId()});
      }
      else
      {       
        if(_LOG.isWarning())
        {
          if ("".equals(version))
          {
            _LOG.warning("GET_SKIN_CANNOT_FIND_NO_VERSION",
                         new Object[]{family, matchingSkin.getId()});
          }
          else
          {   
            _LOG.warning("GET_SKIN_CANNOT_FIND_SKIN_VERSION",
                         new Object[]{family, version, matchingSkin.getId()});
          }
        }
      }
    }
   
View Full Code Here

   * @param matchingSkinList A list of Skins that we will look through to find the 'default'.
   * @return Skin with SkinVersion isDefault true, otherwise, null.
   */
  private Skin _getDefaultVersionSkin(List<Skin> matchingSkinList)
  {
    Skin matchingSkin = null;
    for (Skin skin : matchingSkinList)
    {
      SkinVersion skinVersion = skin.getVersion();
      if (skinVersion != null)
      {
View Full Code Here

  public Skin getSkin()
  {
    // this might switch the skin from portlet to desktop depending upon the request map parameters.
    if(!_checkedRequestMapSkin)
    {
      Skin requestedSkin = getRequestMapSkin();
      _checkedRequestMapSkin = true;
      if (requestedSkin != null)
      {
        _skin = requestedSkin;
        // recompute the cached style provider with the new skin
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidad.skin.Skin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.