Package org.apache.myfaces.trinidad.skin

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


    // If we didn't find a value in the local bundle, try getting
    // the translation from the base Skin.
    if (value == null)
    {
      Skin baseSkin = getBaseSkin();
      value = baseSkin.getTranslatedValue(lContext, key);
    }

    // If we found an translation, store it in the cache so that
    // we don't have to search for it again next time.
    _putCachedTranslatedValue(lContext, key, value);
View Full Code Here


  {
    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

                                    loader);
  }

  protected Skin getSkin(FacesContext context)
  {
    Skin skin = null;
    SkinFactory skinFactory = SkinFactory.getFactory();
    Object skinIdObj = context.getExternalContext().getRequestParameterMap().
      get("skinId");
    if (skinIdObj != null)
      skin = skinFactory.getSkin(context, skinIdObj.toString());
View Full Code Here

    FacesContext   context,
    StringBuilder  builder,
    ResourceBundle bundle,
    Locale         locale)
  {
    Skin             skin = getSkin(context);
    LocaleContext    lc = new LocaleContextImpl(locale);

    // We get the keys from the bundle, but try to get the values from
    // the skin if possible
    Enumeration<String> keys = bundle.getKeys();
    boolean writtenOne = false;
    while (keys.hasMoreElements())
    {
      if (writtenOne)
        builder.append(",\n");
      else
        writtenOne = true;

      String key = keys.nextElement();
      String value;
      // If we can get it from the skin, that's better, but if not,
      // go to the bundle
      if (skin == null)
        value = bundle.getString(key);
      else
        value = skin.getTranslatedString(lc, key);
     
      builder.append("'");
      builder.append(key);
      builder.append("':'");
      _appendUnicodeString(builder, value);
View Full Code Here

  {
    iconName = getSkinResourceMappedKey(iconName);
    if (iconName == null)
      return null;

    Skin skin = getSkin();

    // If we're in right-to-left, and the code asking us hasn't
    // already slapped on a right-to-left suffix, then go looking
    // in right-to-left land
    if (isRightToLeft() && !iconName.endsWith(StyleUtils.RTL_CSS_SUFFIX))
    {
      // append :rtl to the mappedIconName. If no icon with that name,
      // default to getting the icon with the original mappedIconName.
      String rtlIconName = iconName + StyleUtils.RTL_CSS_SUFFIX;
      Icon rtlIcon = skin.getIcon(rtlIconName);

      if ((rtlIcon == null) || rtlIcon.isNull())
      {
        // we want :rtl icons to default to regular icons, not a NullIcon,
        //  which is what the Skin does.
        rtlIcon = skin.getIcon(iconName);
        if (rtlIcon != null)
        {
          // cache regular icon so we don't need to get it again!
          skin.registerIcon(rtlIconName, rtlIcon);
        }
      }

      return rtlIcon;
    }
    else
    {
      return skin.getIcon(iconName);
    }
  }
View Full Code Here

      if (_LOG.isWarning())
        _LOG.warning("There is no SkinFactory");
      return;
    }

    Skin skin = null;

    // see if there is a skinID on the requestParameterMap. If there is, then
    // we want to use that skin. Otherwise, use find the skin as usual, using the portlet
    // renderKitId.
    if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(getOutputMode()))
View Full Code Here

    )
  {
    String mappedIconName = getSkinResourceMappedKey(iconName);
    Icon rtlIcon = null;
    Icon defaultRTLIcon = null;
    Skin skin = getSkin();
    if (mappedIconName != null)
    {
      if (getLocaleContext().isRightToLeft() &&
          (!mappedIconName.endsWith(StyleUtils.RTL_CSS_SUFFIX)))
      {
        // append :rtl to the mappedIconName. If no icon with that name,
        // default to getting the icon with the original mappedIconName.
        String rtlIconName = mappedIconName+StyleUtils.RTL_CSS_SUFFIX;
        // @todo I could optimize this a bit by having a method on SkinExtension
        // which doesn't create a NullIcon when the icon is not found, if I
        // know I want to set it to something else anyway.
        rtlIcon = skin.getIcon(rtlIconName);

        if (rtlIcon == null)
        {
          // we want :rtl icons to default to regular icons, not a NullIcon,
          //  which is what the Skin does.
          // Couldn't find rtl icon, so default it to the regular icon
          defaultRTLIcon = skin.getIcon(mappedIconName);
          if (defaultRTLIcon != null)
          {
            // cache regular icon so we don't need to get it again!
            skin.registerIcon(rtlIconName, defaultRTLIcon);
          }

        }
        return (rtlIcon != null) ? rtlIcon : defaultRTLIcon;

      }
      else
      {
        // no rtl icon
        return skin.getIcon(mappedIconName);
      }


    }
    else
View Full Code Here

    if (icons == null)
    {
      // Next, check to see if the IconData has already been
      // stored on the Skin
      Skin skin = context.getSkin();
      icons = (IconData)skin.getProperty(_ICONS_KEY);
      Icon enabledStart = context.getIcon(
                                    AF_MENU_TABS_ENABLED_START_ICON_NAME);
  
      if (icons == null || enabledStart == null
                        || !enabledStart.equals(icons.enabledStart))
      {
        // If we still haven't found the IconData, create it now
        icons = _createIconData(context);

        // Store the IconData as a property on the Skin,
        // so that we don't have to re-create it next time round
        skin.setProperty(_ICONS_KEY, icons);

        // Store the IconData as a local property, since we'll be
        // looking it up many times for each globalHeader render.
        context.setLocalProperty(_ICONS_KEY, icons);
      }
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.