This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234776 - CSS styles included into the page using outputStylesheet tag are not recognized in the CSS styles window
Summary: CSS styles included into the page using outputStylesheet tag are not recogniz...
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSF Editor (show other bugs)
Version: 7.4
Hardware: All All
: P3 normal (vote)
Assignee: Martin Fousek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-22 10:19 UTC by Martin Fousek
Modified: 2013-09-12 08:38 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Project sample (4.62 KB, application/zip)
2013-08-27 00:58 UTC, janario
Details
Project with more cases to test (24.01 KB, application/x-zip-compressed)
2013-08-29 05:08 UTC, Martin Fousek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Fousek 2013-08-22 10:19:47 UTC
Reported by the NetCat user:
"I've tried the css with chrome connector but I found some limitations like:
It doesn't work with jsf resources that are generated with /javax.faces.resouces/**"

Reproduced by me. Any .css file defined using outputStylesheet tag wasn't available in the "CSS Styles" window at all. The link tag and .xhtml mapping at least made the style file and its definitions available, but the standard JSF way probably breaks some url mappings.
Comment 1 Martin Fousek 2013-08-26 09:23:22 UTC
As I wrote into the issue #234775. I'm not able to reproduce issue with the selection mode within the "Browser DOM" or "CSS Styles" panels even for styles defined using the outputStylesheet Facelet component.

But at least the outputStylesheet imported .css files are not customizable using the style's property editor. This is the only issue I see there now. Please Janario correct me or provide cases which doesn't work to you. Thank a lot!
Comment 2 janario 2013-08-27 00:57:52 UTC
I've created a simple project to test it(JSFTest.zip)

In the test.xhtml there is an css link that works fine. You can run the project and try to switch the background-color in test.css
This one works fine:
<link href="resources/css/test.css" rel="stylesheet" type="text/css" />


Also I've added an outputStylesheet to the same css file:
<h:outputStylesheet library="css" name="test.css" />

This doesn't work because it renders something like:
With /faces/* servlet: <link type="text/css" rel="stylesheet" href="/JSFTest/faces/javax.faces.resource/test.css?ln=css" />
With *.xhtml servlet: <link type="text/css" rel="stylesheet" href="/JSFTest/javax.faces.resource/test.css.xhtml?ln=css" />

So, it can't match the files because of the /javax.faces.resource/ prefix

As I've seen the project javaee.project that does some find to match files where appears in the 'CSS Styles' tab

Some details of class:
org.netbeans.modules.javaee.project.api.ClientSideDevelopmentSupport

Around line 307 it ignore all servlets that maps with suffix such as *.xhtml
This is reported in issue 234775
Line 307:
// only some patterns are currently handled;
// see comments in convertServerURLToProjectFile method
if (!pattern.endsWith("*")) { // NOI18N


Still in class ClientSideDevelopmentSupport
at method convertServerURLToProjectFile around line 362
I think this one is responsible to find and match files and resources from an url to a project file based on the servlets mappings




You can try with the project test and do some debug in the ClientSideDevelopmentSupport methods

Thanks
Comment 3 janario 2013-08-27 00:58:27 UTC
Created attachment 139278 [details]
Project sample
Comment 4 Martin Fousek 2013-08-27 06:17:49 UTC
(In reply to janario from comment #2)
> I've created a simple project to test it(JSFTest.zip)

Thanks for attaching testing project.

> This doesn't work because it renders something like:
> With /faces/* servlet: <link type="text/css" rel="stylesheet"
> href="/JSFTest/faces/javax.faces.resource/test.css?ln=css" />
> With *.xhtml servlet: <link type="text/css" rel="stylesheet"
> href="/JSFTest/javax.faces.resource/test.css.xhtml?ln=css" />

That's exactly what I needed to know. The ground of the issue is still the mapping of outputStylesheet links - that I tried to explain in the #234775. I'll take a look on it. Thanks a lot for your valuable comments.
Comment 5 Martin Fousek 2013-08-29 05:08:24 UTC
Created attachment 139397 [details]
Project with more cases to test

I'm attaching project where are more possibilities which should work then. They are within files:
- /index.xhtml
- /contracts/myContract/template.xhtml
Comment 6 Martin Fousek 2013-09-11 06:53:28 UTC
Initial commits which fixes half of cases written in the test project:
web-main #e3dd43e4947b
web-main #d8d172dc10b6
web-main #0a145cb3423e
Comment 7 Martin Fousek 2013-09-12 08:17:25 UTC
JSF resources defined using EL resolved in web-main #d8cfe10a6a7b:
<link href="#{resource['anyFolder:test3.css']}" rel="stylesheet" type="text/css"/>
Comment 8 Martin Fousek 2013-09-12 08:38:58 UTC
Ok, all cases from my testing project works well now. Reported cases using /faces servlet mapping works well too. Remains .xhtml servlet mapping which breaks the CSS selection+editing mode then. That will be solved as #234775. This one I'm marking as fixed since 4 changesets I attached before.