You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Simon Lessard <si...@gmail.com> on 2007/09/21 19:02:15 UTC

Re: [TRINIDAD] New element in trinidad-skins.xml /SkinImpl/SkinAddition

Hello Jeanne,

I could live with that as long as the XSD should prevents the usage of both
a bundle and a map at the same time. However, I would prefer a
"resource-bundle" element than a "translation-map". For one, it's much
easier to create a ResourceBundle from a Map than the other way around.
Also, that would be more aligned with JSF 1.2 since its include a way to
define resource-bundle with a var name within the faces-config.xml.

~ Simon

On 9/21/07, Jeanne Waldman <je...@oracle.com> wrote:
>
>  Hi,
>
> I have a new issue I need to resolve and I wanted to run by my solution --
> https://issues.apache.org/jira/browse/TRINIDAD-728
> "support for el to be used in a skin to bind to other translation data
> sources"
>
> Currently, a SkinExtension and SkinAddition can have resource bundles
> associated with them so that a person can "skin" text.
> We have customers who want to use a Map that is EL-accessible* instead* of
> a ResourceBundle.
>
> I'd like to add a  '*translation-map*' element to the <skin> and
> <skin-addition> elements in trinidad-skins.xml.
> I'd add new constructors to SkinExtension and SkinAddition to accept a
> translationMap ValueExpression.
>
> Let me know what you think and if you think 'translation-map' is a good
> name for the new element.
> See below for an example.
>
> Thanks,
> Jeanne
>
> from trinidad-skins.xml:
>     <skin>
>         <id>
>             purple.desktop
>         </id>
>         <family>
>             purple
>         </family>
>         <render-kit-id>
>             org.apache.myfaces.trinidad.desktop
>         </render-kit-id>
>         <style-sheet-name>
>             skins/purple/purpleSkin.css
>         </style-sheet-name>
>         <bundle-name>
>             org.apache.myfaces.trinidaddemo.resource.SkinBundle
>         </bundle-name>
>     </skin>
>     <!-- You can extend any skin you want. Here we want the purple
>     skin, but with a bigger font size -->
>     <skin>
>         <id>
>             purpleBigFont.desktop
>         </id>
>         <family>
>             purpleBigFont
>         </family>
>         <extends>
>             purple.desktop
>         </extends>
>         <render-kit-id>
>             org.apache.myfaces.trinidad.desktop
>         </render-kit-id>
>         <style-sheet-name>
>             skins/purple/purpleBigFontSkin.css
>         </style-sheet-name>
>         *<translation-map>#{skinTranslationMap.contents}</translation-map>
> *
>     </skin>
>

Re: [TRINIDAD] New element in trinidad-skins.xml /SkinImpl/SkinAddition

Posted by Simon Lessard <si...@gmail.com>.
On 9/21/07, Blake Sullivan <bl...@oracle.com> wrote:
>
>  Simon Lessard wrote:
>
> Hello Jeanne,
>
> I could live with that as long as the XSD should prevents the usage of
> both a bundle and a map at the same time.
>
> I agree
>
> However, I would prefer a "resource-bundle" element than a
> "translation-map".
>
> For one, it's much easier to create a ResourceBundle from a Map than the
> other way around.
>
> This is true, but don't we already allow the ResourceBundle to be picked
> by base-name?  Also, though easy-enough, no code is still better than
> straightforward code.  This feature is aimed at users who have access to
> Maps through managed beans or variable resolvers.  The returned Maps map be
> used elsewhere in the application code (since Maps are much more flexible
> than ResourceBundles (the very reason it is easy to slice off Map
> functionality to expose it as a ResourceBundle)).
>

 Semantically, ResourceBundle is slightly better than a map though (not much
I agree).

> Also, that would be more aligned with JSF 1.2 since its include a way to
> define resource-bundle with a var name within the faces-config.xml.
>
> This would also be useful, but isn't mutually exclusive with the above.
>

If we accept only a map, it's quite exclusive, unless we add yet another
tag, but I would be -1 on that. However, as Adam suggested, we could call it
"translation-source" and support both Map and ResourceBundle instances. We
have to a very thin adapter Map --> ResourceBundle if a Map instance is
passed and the remaining code will continue to work as it's now, with a
ResourceBundle.

~ Simon

-- Blake Sullivan
>
>
> ~ Simon
>
> On 9/21/07, Jeanne Waldman < jeanne.waldman@oracle.com> wrote:
> >
> > Hi,
> >
> > I have a new issue I need to resolve and I wanted to run by my solution
> > --
> > https://issues.apache.org/jira/browse/TRINIDAD-728
> > "support for el to be used in a skin to bind to other translation data
> > sources"
> >
> > Currently, a SkinExtension and SkinAddition can have resource bundles
> > associated with them so that a person can "skin" text.
> > We have customers who want to use a Map that is EL-accessible* instead*of a ResourceBundle.
> >
> > I'd like to add a  '*translation-map*' element to the <skin> and
> > <skin-addition> elements in trinidad-skins.xml.
> > I'd add new constructors to SkinExtension and SkinAddition to accept a
> > translationMap ValueExpression.
> >
> > Let me know what you think and if you think 'translation-map' is a good
> > name for the new element.
> > See below for an example.
> >
> > Thanks,
> > Jeanne
> >
> > from trinidad-skins.xml:
> >     <skin>
> >         <id>
> >             purple.desktop
> >         </id>
> >         <family>
> >             purple
> >         </family>
> >         <render-kit-id>
> >             org.apache.myfaces.trinidad.desktop
> >         </render-kit-id>
> >         <style-sheet-name>
> >             skins/purple/purpleSkin.css
> >         </style-sheet-name>
> >         <bundle-name>
> >             org.apache.myfaces.trinidaddemo.resource.SkinBundle
> >         </bundle-name>
> >     </skin>
> >     <!-- You can extend any skin you want. Here we want the purple
> >     skin, but with a bigger font size -->
> >     <skin>
> >         <id>
> >             purpleBigFont.desktop
> >         </id>
> >         <family>
> >             purpleBigFont
> >         </family>
> >         <extends>
> >             purple.desktop
> >         </extends>
> >         <render-kit-id>
> >             org.apache.myfaces.trinidad.desktop
> >         </render-kit-id>
> >         <style-sheet-name>
> >             skins/purple/purpleBigFontSkin.css
> >         </style-sheet-name>
> >         *<translation-map>#{skinTranslationMap.contents
> > }</translation-map>*
> >     </skin>
> >
>
>
>

Re: [TRINIDAD] New element in trinidad-skins.xml /SkinImpl/SkinAddition

Posted by Blake Sullivan <bl...@oracle.com>.
Simon Lessard wrote:
> Hello Jeanne,
>
> I could live with that as long as the XSD should prevents the usage of 
> both a bundle and a map at the same time. 
I agree
> However, I would prefer a "resource-bundle" element than a 
> "translation-map".
> For one, it's much easier to create a ResourceBundle from a Map than 
> the other way around.
This is true, but don't we already allow the ResourceBundle to be picked 
by base-name?  Also, though easy-enough, no code is still better than 
straightforward code.  This feature is aimed at users who have access to 
Maps through managed beans or variable resolvers.  The returned Maps map 
be used elsewhere in the application code (since Maps are much more 
flexible than ResourceBundles (the very reason it is easy to slice off 
Map functionality to expose it as a ResourceBundle)).
> Also, that would be more aligned with JSF 1.2 since its include a way 
> to define resource-bundle with a var name within the faces-config.xml.
This would also be useful, but isn't mutually exclusive with the above.

-- Blake Sullivan
>
> ~ Simon
>
> On 9/21/07, *Jeanne Waldman* < jeanne.waldman@oracle.com 
> <ma...@oracle.com>> wrote:
>
>     Hi,
>
>     I have a new issue I need to resolve and I wanted to run by my
>     solution --
>     https://issues.apache.org/jira/browse/TRINIDAD-728
>     "support for el to be used in a skin to bind to other translation
>     data sources"
>
>     Currently, a SkinExtension and SkinAddition can have resource
>     bundles associated with them so that a person can "skin" text.
>     We have customers who want to use a Map that is EL-accessible/
>     instead/ of a ResourceBundle.
>
>     I'd like to add a  '*translation-map*' element to the <skin> and
>     <skin-addition> elements in trinidad-skins.xml.
>     I'd add new constructors to SkinExtension and SkinAddition to
>     accept a translationMap ValueExpression.
>
>     Let me know what you think and if you think 'translation-map' is a
>     good name for the new element.
>     See below for an example.
>
>     Thanks,
>     Jeanne
>
>     from trinidad-skins.xml:
>         <skin>
>             <id>
>                 purple.desktop
>             </id>
>             <family>
>                 purple
>             </family>
>             <render-kit-id>
>                 org.apache.myfaces.trinidad.desktop
>             </render-kit-id>
>             <style-sheet-name>
>                 skins/purple/purpleSkin.css
>             </style-sheet-name>
>             <bundle-name>
>                 org.apache.myfaces.trinidaddemo.resource.SkinBundle
>             </bundle-name>
>         </skin>
>         <!-- You can extend any skin you want. Here we want the purple
>         skin, but with a bigger font size -->
>         <skin>
>             <id>
>                 purpleBigFont.desktop
>             </id>
>             <family>
>                 purpleBigFont
>             </family>
>             <extends>
>                 purple.desktop
>             </extends>
>             <render-kit-id>
>                 org.apache.myfaces.trinidad.desktop
>             </render-kit-id>
>             <style-sheet-name>
>                 skins/purple/purpleBigFontSkin.css
>             </style-sheet-name>
>            
>     *<translation-map>#{skinTranslationMap.contents}</translation-map>*
>         </skin>
>
>


Re: [TRINIDAD] New element in trinidad-skins.xml /SkinImpl/SkinAddition

Posted by Adam Winer <aw...@gmail.com>.
On 9/21/07, Jeanne Waldman <je...@oracle.com> wrote:
>
>
>
>  Adam Winer wrote:
>  On 9/21/07, Simon Lessard <si...@gmail.com> wrote:
>
>
>  Hello Jeanne,
>
> I could live with that as long as the XSD should prevents the usage of both
> a bundle and a map at the same time. However, I would prefer a
> "resource-bundle" element than a "translation-map". For one, it's much
> easier to create a ResourceBundle from a Map than the other way around.
>
>  It's easy enough to do either, but its not really a ResourceBundle instance
> unless you can get it via ResourceBundle.getBundle().
>
> IMO, the real point here is just saying "let's get it from EL, instead of
> loading a ResourceBundle ourselves, so it can be anything, ResourceBundle,
> Map, we don't care". So name the element <translation-source> perhaps?
>
>  Are you saying my ValueExpression should be an Object type instead of a Map
> type, and then for now I can
>  accept Maps, but then as another enhancement I could accept
> ResourceBundles?
>  It seems that it can't be "anything," because I need to know what I am
> getting.

No, you actually can get anything.  Just use ELResolver.getValue()
to resolve the property.  That way, you have support for both
ResourceBundles and Maps with one element.

-- Adam


>
>
>  -- Adam
>
>
>
>
>  Also, that would be more aligned with JSF 1.2 since its include a way to
> define resource-bundle with a var name within the faces-config.xml.
>
> ~ Simon
>
>
> On 9/21/07, Jeanne Waldman < jeanne.waldman@oracle.com> wrote:
>
>
>  Hi,
>
> I have a new issue I need to resolve and I wanted to run by my solution --
> https://issues.apache.org/jira/browse/TRINIDAD-728
> "support for el to be used in a skin to bind to other translation data
>
>  sources"
>
>
>  Currently, a SkinExtension and SkinAddition can have resource bundles
>
>  associated with them so that a person can "skin" text.
>
>
>  We have customers who want to use a Map that is EL-accessible instead of a
>
>  ResourceBundle.
>
>
>  I'd like to add a 'translation-map' element to the <skin> and
>
>  <skin-addition> elements in trinidad-skins.xml.
>
>
>  I'd add new constructors to SkinExtension and SkinAddition to accept a
>
>  translationMap ValueExpression.
>
>
>  Let me know what you think and if you think 'translation-map' is a good
>
>  name for the new element.
>
>
>  See below for an example.
>
> Thanks,
> Jeanne
>
> from trinidad-skins.xml:
>  <skin>
>  <id>
>  purple.desktop
>  </id>
>  <family>
>  purple
>  </family>
>  <render-kit-id>
>  org.apache.myfaces.trinidad.desktop
>  </render-kit-id>
>  <style-sheet-name>
>  skins/purple/purpleSkin.css
>  </style-sheet-name>
>  <bundle-name>
>
>
>  org.apache.myfaces.trinidaddemo.resource.SkinBundle
>
>
>  </bundle-name>
>  </skin>
>  <!-- You can extend any skin you want. Here we want the purple
>  skin, but with a bigger font size -->
>  <skin>
>  <id>
>  purpleBigFont.desktop
>  </id>
>  <family>
>  purpleBigFont
>  </family>
>  <extends>
>  purple.desktop
>  </extends>
>  <render-kit-id>
>  org.apache.myfaces.trinidad.desktop
>  </render-kit-id>
>  <style-sheet-name>
>  skins/purple/purpleBigFontSkin.css
>  </style-sheet-name>
>  <translation-map>#{skinTranslationMap.contents}</translation-map>
>  </skin>
>
>
>
>
>

Re: [TRINIDAD] New element in trinidad-skins.xml /SkinImpl/SkinAddition

Posted by Adam Winer <aw...@gmail.com>.
On 9/21/07, Simon Lessard <si...@gmail.com> wrote:
> Hello Jeanne,
>
> I could live with that as long as the XSD should prevents the usage of both
> a bundle and a map at the same time. However, I would prefer a
> "resource-bundle" element than a "translation-map". For one, it's much
> easier to create a ResourceBundle from a Map than the other way around.

It's easy enough to do either, but its not really a ResourceBundle instance
unless you can get it via ResourceBundle.getBundle().

IMO, the real point here is just saying "let's get it from EL, instead of
loading a ResourceBundle ourselves, so it can be anything, ResourceBundle,
Map, we don't care".  So name the element <translation-source> perhaps?

-- Adam


> Also, that would be more aligned with JSF 1.2 since its include a way to
> define resource-bundle with a var name within the faces-config.xml.
>
> ~ Simon
>
>
> On 9/21/07, Jeanne Waldman < jeanne.waldman@oracle.com> wrote:
> >
> > Hi,
> >
> > I have a new issue I need to resolve and I wanted to run by my solution --
> > https://issues.apache.org/jira/browse/TRINIDAD-728
> > "support for el to be used in a skin to bind to other translation data
> sources"
> >
> > Currently, a SkinExtension and SkinAddition can have resource bundles
> associated with them so that a person can "skin" text.
> > We have customers who want to use a Map that is EL-accessible instead of a
> ResourceBundle.
> >
> > I'd like to add a  'translation-map' element to the <skin> and
> <skin-addition> elements in trinidad-skins.xml.
> > I'd add new constructors to SkinExtension and SkinAddition to accept a
> translationMap ValueExpression.
> >
> > Let me know what you think and if you think 'translation-map' is a good
> name for the new element.
> > See below for an example.
> >
> > Thanks,
> > Jeanne
> >
> > from trinidad-skins.xml:
> >     <skin>
> >         <id>
> >             purple.desktop
> >         </id>
> >         <family>
> >             purple
> >         </family>
> >         <render-kit-id>
> >             org.apache.myfaces.trinidad.desktop
> >         </render-kit-id>
> >         <style-sheet-name>
> >             skins/purple/purpleSkin.css
> >         </style-sheet-name>
> >         <bundle-name>
> >
> org.apache.myfaces.trinidaddemo.resource.SkinBundle
> >         </bundle-name>
> >     </skin>
> >     <!-- You can extend any skin you want. Here we want the purple
> >     skin, but with a bigger font size -->
> >     <skin>
> >         <id>
> >             purpleBigFont.desktop
> >         </id>
> >         <family>
> >             purpleBigFont
> >         </family>
> >         <extends>
> >             purple.desktop
> >         </extends>
> >         <render-kit-id>
> >             org.apache.myfaces.trinidad.desktop
> >         </render-kit-id>
> >         <style-sheet-name>
> >             skins/purple/purpleBigFontSkin.css
> >         </style-sheet-name>
> >         <translation-map>#{skinTranslationMap.contents}</translation-map>
> >     </skin>
> >
>
>