[jira] [Commented] (TRINIDAD-1496) Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value instead of just getImageURI

2011-04-06 Thread Jeanne Waldman (JIRA)

[ 
https://issues.apache.org/jira/browse/TRINIDAD-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13016643#comment-13016643
 ] 

Jeanne Waldman commented on TRINIDAD-1496:
--

This is not as simple as I first thought because the Icon object is built with 
pre-processed URIs ready to be output to the css or html. They do not have the 
raw uris, and the raw uris cannot be determined from the regular uris, since 
for css relative urls, we would need to know where the css file was.

We parse each css files in SkinStyleSheetParserUtils. here we configure the url.
Then in StyleSheetDocument, when we do all the property merging, we create the 
Icon objects. At this point the css file information is long gone. We do not 
even know all the skins that were merged together to form this one 
StyleSheetDocument.

I've attached a patch for an idea for a fix. That is to pass in a dummy 
property into the IconNodes (raw-url), then in StyleSheetDocument we can read 
this, and use it to create the Icon. The Icon constructors will have to change. 
Also note, that we will have to check the code carefully for right-to-left 
icons. I did not in this patch. It's simply an idea.

 Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value 
 instead of just getImageURI
 --

 Key: TRINIDAD-1496
 URL: https://issues.apache.org/jira/browse/TRINIDAD-1496
 Project: MyFaces Trinidad
  Issue Type: New Feature
  Components: Components
Affects Versions:  1.2.11-core
Reporter: Matt Cooper
Priority: Minor

 In skinning, you can define image icons in 4 different ways:
 1.) Absolute URLs specify the complete URL to the resource, including the 
 protocol (e.g. http://). Example:
 content: url(http://incubator.apache.org/images/asf_logo_wide.gif);
 2.) Relative URLs are used if the specified URL does not start with a slash 
 (/) and if there's no protocol present. A relative URL is based on the 
 skin's CSS file location. For instance, if the CSS is located in 
 MyWebApp/skins/mySkin/ and the specified url is skinImages/myImage.gif, then 
 the final URL will be /MyWebApp/skins/mySkin/skinImages/myImage.gif. Example:
 content: url(skin_images/ObjectIconError.gif);
 3.) Context relative URLs are resolved relatively to the context root of the 
 web application. To use them, you simply have to make it start with a single 
 slash (/). For instance, if the context root is /MyWebApp and the specified 
 URL is /images/myImage.jpeg, the resulting URL will be 
 /MyWebApp/images/myImage.jpeg. Example:
 content: url(/skins/mySkin/skin_images/ObjectIconError.gif);
 4.) Server relative URLs are resolved relatively to the web server as opposed 
 to the context root. This allow to easily refer to resources located on 
 another application on the same server. To use this type of URL, the 
 specified URL must starts with two slashes (//). Example:
 content: url(//MyOtherWebApp/images/myCalendar.gif);
 The org.apache.myfaces.trinidad.skin.Icon class currently provides a 
 getImageURI() method.  This method returns a value that has the context path 
 built-in.  If a component exposes an icon attribute (there are a handful in 
 Apache MyFaces Trinidad and also in another framework that has components 
 built upon Trinidad), that icon String supports these same alternative 
 mechanisms for referring to the icon image.  Let's say you have a component 
 that you want to keep abstract but might want it to reuse existing components 
 (e.g. a rich text editor with a toolbar containing buttons that you want to 
 reuse an existing toolbar button component so you can have consistency in 
 button styling).  For that publicly-exposed component, you will want to allow 
 people to customize in skinning what the icons are for its toolbar.  These 
 icons must be defined in that publicly-exposed component but then converted 
 into a String that can be passed into the toolbar button component.  With the 
 current Icon.getImageURI(), if a user skinned the icon image using some of 
 the 4 above paths, either the icon would have 2 context paths added to it 
 (one from the skin framework and one from the toolbar button resource 
 encoding) or it would have a context path when it should not be including the 
 local context path (image definition option #4).  For the public component's 
 renderer to support all 4 of these image definition options, the 
 org.apache.myfaces.trinidad.skin.Icon needs to expose some mechanism to 
 either let it have access to the raw content value so that raw value can be 
 passed along to the button or at least some kind of mechanism to let the 
 public component's renderer know that it is not safe to let the button add 
 its own copy of the context path (e.g. add another 

[jira] [Commented] (TRINIDAD-1496) Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value instead of just getImageURI

2011-04-04 Thread Jeanne Waldman (JIRA)

[ 
https://issues.apache.org/jira/browse/TRINIDAD-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13015629#comment-13015629
 ] 

Jeanne Waldman commented on TRINIDAD-1496:
--

We have a specific example. Our panelCollection component has a 
af|panelCollection::freeze-icon selector. If the user types in 
af|panelCollection::freeze-icon {content: url(//afr/freeze_ena.png);}, then 
this means 'server-relative url'. If the user types in {content: 
url(//afr/freeze_ena.png);},, then this means a 'context-relative url.
The renderer code calls
String skinIcon = String.valueOf(icon.getImageURI(context, rc));

getImageURI returns the uri that is meant to be written out directly into the 
html page or css file. It already has prepended the context, if it is a 
context-relative url, or it has already stripped the first '/' if it is 
server-relative url.

In this case, the renderer wants to build up a toolbar button component, and 
call toolbarbutton.setIcon(). setIcon requires a URL in the same format as the 
af|panelCollection::freeze-icon content URL. Not the processed url ready for 
output.
The code does some kludgy things to get around this. Ideally, the code would 
call icon.getRawURI(context, rc), and it can directly pass this result to 
toolbarButton.setIcon().

What do people think?


 Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value 
 instead of just getImageURI
 --

 Key: TRINIDAD-1496
 URL: https://issues.apache.org/jira/browse/TRINIDAD-1496
 Project: MyFaces Trinidad
  Issue Type: New Feature
  Components: Components
Affects Versions:  1.2.11-core
Reporter: Matt Cooper
Priority: Minor

 In skinning, you can define image icons in 4 different ways:
 1.) Absolute URLs specify the complete URL to the resource, including the 
 protocol (e.g. http://). Example:
 content: url(http://incubator.apache.org/images/asf_logo_wide.gif);
 2.) Relative URLs are used if the specified URL does not start with a slash 
 (/) and if there's no protocol present. A relative URL is based on the 
 skin's CSS file location. For instance, if the CSS is located in 
 MyWebApp/skins/mySkin/ and the specified url is skinImages/myImage.gif, then 
 the final URL will be /MyWebApp/skins/mySkin/skinImages/myImage.gif. Example:
 content: url(skin_images/ObjectIconError.gif);
 3.) Context relative URLs are resolved relatively to the context root of the 
 web application. To use them, you simply have to make it start with a single 
 slash (/). For instance, if the context root is /MyWebApp and the specified 
 URL is /images/myImage.jpeg, the resulting URL will be 
 /MyWebApp/images/myImage.jpeg. Example:
 content: url(/skins/mySkin/skin_images/ObjectIconError.gif);
 4.) Server relative URLs are resolved relatively to the web server as opposed 
 to the context root. This allow to easily refer to resources located on 
 another application on the same server. To use this type of URL, the 
 specified URL must starts with two slashes (//). Example:
 content: url(//MyOtherWebApp/images/myCalendar.gif);
 The org.apache.myfaces.trinidad.skin.Icon class currently provides a 
 getImageURI() method.  This method returns a value that has the context path 
 built-in.  If a component exposes an icon attribute (there are a handful in 
 Apache MyFaces Trinidad and also in another framework that has components 
 built upon Trinidad), that icon String supports these same alternative 
 mechanisms for referring to the icon image.  Let's say you have a component 
 that you want to keep abstract but might want it to reuse existing components 
 (e.g. a rich text editor with a toolbar containing buttons that you want to 
 reuse an existing toolbar button component so you can have consistency in 
 button styling).  For that publicly-exposed component, you will want to allow 
 people to customize in skinning what the icons are for its toolbar.  These 
 icons must be defined in that publicly-exposed component but then converted 
 into a String that can be passed into the toolbar button component.  With the 
 current Icon.getImageURI(), if a user skinned the icon image using some of 
 the 4 above paths, either the icon would have 2 context paths added to it 
 (one from the skin framework and one from the toolbar button resource 
 encoding) or it would have a context path when it should not be including the 
 local context path (image definition option #4).  For the public component's 
 renderer to support all 4 of these image definition options, the 
 org.apache.myfaces.trinidad.skin.Icon needs to expose some mechanism to 
 either let it have access to the raw content value so that raw value can be 
 passed along to the button or at least some kind of mechanism to 

[jira] [Commented] (TRINIDAD-1496) Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value instead of just getImageURI

2011-04-04 Thread Jeanne Waldman (JIRA)

[ 
https://issues.apache.org/jira/browse/TRINIDAD-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13015635#comment-13015635
 ] 

Jeanne Waldman commented on TRINIDAD-1496:
--

Make sure to document that css-relative URIs make no sense for 'icon' selectors.

 Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value 
 instead of just getImageURI
 --

 Key: TRINIDAD-1496
 URL: https://issues.apache.org/jira/browse/TRINIDAD-1496
 Project: MyFaces Trinidad
  Issue Type: New Feature
  Components: Components
Affects Versions:  1.2.11-core
Reporter: Matt Cooper
Priority: Minor

 In skinning, you can define image icons in 4 different ways:
 1.) Absolute URLs specify the complete URL to the resource, including the 
 protocol (e.g. http://). Example:
 content: url(http://incubator.apache.org/images/asf_logo_wide.gif);
 2.) Relative URLs are used if the specified URL does not start with a slash 
 (/) and if there's no protocol present. A relative URL is based on the 
 skin's CSS file location. For instance, if the CSS is located in 
 MyWebApp/skins/mySkin/ and the specified url is skinImages/myImage.gif, then 
 the final URL will be /MyWebApp/skins/mySkin/skinImages/myImage.gif. Example:
 content: url(skin_images/ObjectIconError.gif);
 3.) Context relative URLs are resolved relatively to the context root of the 
 web application. To use them, you simply have to make it start with a single 
 slash (/). For instance, if the context root is /MyWebApp and the specified 
 URL is /images/myImage.jpeg, the resulting URL will be 
 /MyWebApp/images/myImage.jpeg. Example:
 content: url(/skins/mySkin/skin_images/ObjectIconError.gif);
 4.) Server relative URLs are resolved relatively to the web server as opposed 
 to the context root. This allow to easily refer to resources located on 
 another application on the same server. To use this type of URL, the 
 specified URL must starts with two slashes (//). Example:
 content: url(//MyOtherWebApp/images/myCalendar.gif);
 The org.apache.myfaces.trinidad.skin.Icon class currently provides a 
 getImageURI() method.  This method returns a value that has the context path 
 built-in.  If a component exposes an icon attribute (there are a handful in 
 Apache MyFaces Trinidad and also in another framework that has components 
 built upon Trinidad), that icon String supports these same alternative 
 mechanisms for referring to the icon image.  Let's say you have a component 
 that you want to keep abstract but might want it to reuse existing components 
 (e.g. a rich text editor with a toolbar containing buttons that you want to 
 reuse an existing toolbar button component so you can have consistency in 
 button styling).  For that publicly-exposed component, you will want to allow 
 people to customize in skinning what the icons are for its toolbar.  These 
 icons must be defined in that publicly-exposed component but then converted 
 into a String that can be passed into the toolbar button component.  With the 
 current Icon.getImageURI(), if a user skinned the icon image using some of 
 the 4 above paths, either the icon would have 2 context paths added to it 
 (one from the skin framework and one from the toolbar button resource 
 encoding) or it would have a context path when it should not be including the 
 local context path (image definition option #4).  For the public component's 
 renderer to support all 4 of these image definition options, the 
 org.apache.myfaces.trinidad.skin.Icon needs to expose some mechanism to 
 either let it have access to the raw content value so that raw value can be 
 passed along to the button or at least some kind of mechanism to let the 
 public component's renderer know that it is not safe to let the button add 
 its own copy of the context path (e.g. add another leading / to the result).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TRINIDAD-1496) Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value instead of just getImageURI

2011-04-04 Thread Blake Sullivan (JIRA)

[ 
https://issues.apache.org/jira/browse/TRINIDAD-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13015644#comment-13015644
 ] 

Blake Sullivan commented on TRINIDAD-1496:
--

I guess a getRawURI function is fine.  Its javadoc should probably point back 
to http://myfaces.apache.org/trinidad/devguide/skinning.html#urls

I think that at the same time, we want to make the following documentation 
changes to clarify what is going on:
1) In http://myfaces.apache.org/trinidad/devguide/skinning.html#urls

Add to the relative URL documentation that the URL will be relative to the 
document that the content is generated into--the rendered document for icons 
and the generated CSS file for everything else.

2) Change the getImageURI documentation to state that the returned URI is 
suitable for rendering directly into rendered content, for example HTML.  The 
current documentation is extremely vague about what kind of URI is returned and 
we want to make clear the difference between this URI and the getRawURI



 Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value 
 instead of just getImageURI
 --

 Key: TRINIDAD-1496
 URL: https://issues.apache.org/jira/browse/TRINIDAD-1496
 Project: MyFaces Trinidad
  Issue Type: New Feature
  Components: Components
Affects Versions:  1.2.11-core
Reporter: Matt Cooper
Priority: Minor

 In skinning, you can define image icons in 4 different ways:
 1.) Absolute URLs specify the complete URL to the resource, including the 
 protocol (e.g. http://). Example:
 content: url(http://incubator.apache.org/images/asf_logo_wide.gif);
 2.) Relative URLs are used if the specified URL does not start with a slash 
 (/) and if there's no protocol present. A relative URL is based on the 
 skin's CSS file location. For instance, if the CSS is located in 
 MyWebApp/skins/mySkin/ and the specified url is skinImages/myImage.gif, then 
 the final URL will be /MyWebApp/skins/mySkin/skinImages/myImage.gif. Example:
 content: url(skin_images/ObjectIconError.gif);
 3.) Context relative URLs are resolved relatively to the context root of the 
 web application. To use them, you simply have to make it start with a single 
 slash (/). For instance, if the context root is /MyWebApp and the specified 
 URL is /images/myImage.jpeg, the resulting URL will be 
 /MyWebApp/images/myImage.jpeg. Example:
 content: url(/skins/mySkin/skin_images/ObjectIconError.gif);
 4.) Server relative URLs are resolved relatively to the web server as opposed 
 to the context root. This allow to easily refer to resources located on 
 another application on the same server. To use this type of URL, the 
 specified URL must starts with two slashes (//). Example:
 content: url(//MyOtherWebApp/images/myCalendar.gif);
 The org.apache.myfaces.trinidad.skin.Icon class currently provides a 
 getImageURI() method.  This method returns a value that has the context path 
 built-in.  If a component exposes an icon attribute (there are a handful in 
 Apache MyFaces Trinidad and also in another framework that has components 
 built upon Trinidad), that icon String supports these same alternative 
 mechanisms for referring to the icon image.  Let's say you have a component 
 that you want to keep abstract but might want it to reuse existing components 
 (e.g. a rich text editor with a toolbar containing buttons that you want to 
 reuse an existing toolbar button component so you can have consistency in 
 button styling).  For that publicly-exposed component, you will want to allow 
 people to customize in skinning what the icons are for its toolbar.  These 
 icons must be defined in that publicly-exposed component but then converted 
 into a String that can be passed into the toolbar button component.  With the 
 current Icon.getImageURI(), if a user skinned the icon image using some of 
 the 4 above paths, either the icon would have 2 context paths added to it 
 (one from the skin framework and one from the toolbar button resource 
 encoding) or it would have a context path when it should not be including the 
 local context path (image definition option #4).  For the public component's 
 renderer to support all 4 of these image definition options, the 
 org.apache.myfaces.trinidad.skin.Icon needs to expose some mechanism to 
 either let it have access to the raw content value so that raw value can be 
 passed along to the button or at least some kind of mechanism to let the 
 public component's renderer know that it is not safe to let the button add 
 its own copy of the context path (e.g. add another leading / to the result).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (TRINIDAD-1496) Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value instead of just getImageURI

2011-04-04 Thread Blake Sullivan (JIRA)

[ 
https://issues.apache.org/jira/browse/TRINIDAD-1496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13015647#comment-13015647
 ] 

Blake Sullivan commented on TRINIDAD-1496:
--

I forgot to say that I agree that the relative URL case for icons isn't 
especially useful--it would only really work if all of the pages were in the 
same directory

 Need org.apache.myfaces.trinidad.skin.Icon to expose the raw content value 
 instead of just getImageURI
 --

 Key: TRINIDAD-1496
 URL: https://issues.apache.org/jira/browse/TRINIDAD-1496
 Project: MyFaces Trinidad
  Issue Type: New Feature
  Components: Components
Affects Versions:  1.2.11-core
Reporter: Matt Cooper
Priority: Minor

 In skinning, you can define image icons in 4 different ways:
 1.) Absolute URLs specify the complete URL to the resource, including the 
 protocol (e.g. http://). Example:
 content: url(http://incubator.apache.org/images/asf_logo_wide.gif);
 2.) Relative URLs are used if the specified URL does not start with a slash 
 (/) and if there's no protocol present. A relative URL is based on the 
 skin's CSS file location. For instance, if the CSS is located in 
 MyWebApp/skins/mySkin/ and the specified url is skinImages/myImage.gif, then 
 the final URL will be /MyWebApp/skins/mySkin/skinImages/myImage.gif. Example:
 content: url(skin_images/ObjectIconError.gif);
 3.) Context relative URLs are resolved relatively to the context root of the 
 web application. To use them, you simply have to make it start with a single 
 slash (/). For instance, if the context root is /MyWebApp and the specified 
 URL is /images/myImage.jpeg, the resulting URL will be 
 /MyWebApp/images/myImage.jpeg. Example:
 content: url(/skins/mySkin/skin_images/ObjectIconError.gif);
 4.) Server relative URLs are resolved relatively to the web server as opposed 
 to the context root. This allow to easily refer to resources located on 
 another application on the same server. To use this type of URL, the 
 specified URL must starts with two slashes (//). Example:
 content: url(//MyOtherWebApp/images/myCalendar.gif);
 The org.apache.myfaces.trinidad.skin.Icon class currently provides a 
 getImageURI() method.  This method returns a value that has the context path 
 built-in.  If a component exposes an icon attribute (there are a handful in 
 Apache MyFaces Trinidad and also in another framework that has components 
 built upon Trinidad), that icon String supports these same alternative 
 mechanisms for referring to the icon image.  Let's say you have a component 
 that you want to keep abstract but might want it to reuse existing components 
 (e.g. a rich text editor with a toolbar containing buttons that you want to 
 reuse an existing toolbar button component so you can have consistency in 
 button styling).  For that publicly-exposed component, you will want to allow 
 people to customize in skinning what the icons are for its toolbar.  These 
 icons must be defined in that publicly-exposed component but then converted 
 into a String that can be passed into the toolbar button component.  With the 
 current Icon.getImageURI(), if a user skinned the icon image using some of 
 the 4 above paths, either the icon would have 2 context paths added to it 
 (one from the skin framework and one from the toolbar button resource 
 encoding) or it would have a context path when it should not be including the 
 local context path (image definition option #4).  For the public component's 
 renderer to support all 4 of these image definition options, the 
 org.apache.myfaces.trinidad.skin.Icon needs to expose some mechanism to 
 either let it have access to the raw content value so that raw value can be 
 passed along to the button or at least some kind of mechanism to let the 
 public component's renderer know that it is not safe to let the button add 
 its own copy of the context path (e.g. add another leading / to the result).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira