Home » Eclipse Projects » Remote Application Platform (RAP) » CSS in custom widget
|
Re: CSS in custom widget [message #548527 is a reply to message #548437] |
Thu, 22 July 2010 09:27 |
Philipp Eichhorn Messages: 8 Registered: December 2009 |
Junior Member |
|
|
Hi Paul,
Quote: | Am I wrong that there is no support for CSS? If so, how do I get the CSS
loaded so my widgets look right?
|
Well, there is CSS support in RAP, see:
http://help.eclipse.org/helios/topic/org.eclipse.rap.help/he lp/html/advanced/theming-custom.html
http://help.eclipse.org/helios/topic/org.eclipse.rap.help/he lp/html/advanced/theming.html
The main questions is, did you do a proper qooxdoo port or just a simple wrap?
Sidenote:
Although I don't like it and won't recommend it to you, you could always style in a non-RAP (-qooxdoo) way with your custom css, which you load with something like this:
var ref = document.createElement("link");
ref.setAttribute("rel", "stylesheet");
ref.setAttribute("type", "text/css");
ref.setAttribute("href", "myTheme.css");
document.getElementsByTagName("head")[0].appendChild(ref);
But remember to expose your "myTheme.css" as a resource.
[Updated on: Thu, 22 July 2010 09:34] Report message to a moderator
|
|
| |
Re: CSS in custom widget [message #548739 is a reply to message #548527] |
Thu, 22 July 2010 19:05 |
Paul Kendall Messages: 40 Registered: July 2009 |
Member |
|
|
Philipp Eichhorn wrote:
> Hi Paul,
>
> Quote:
>> Am I wrong that there is no support for CSS? If so, how do I get the CSS
>> loaded so my widgets look right?
>
>
> Well, there is CSS support in RAP, see:
>
>
http://help.eclipse.org/helios/topic/org.eclipse.rap.help/he lp/html/advanced/theming-
custom.html
>
>
http://help.eclipse.org/helios/topic/org.eclipse.rap.help/he lp/html/advanced/theming.html
>
> The main questions is, did you do a proper qooxdoo port or just a simple
> wrap?
>
It's a simple wrapping of the component.
>
> Sidenote:
> Although I don't like it and won't recommend you, you could always style
> in a non-RAP (-qooxdoo) way with your custom css, which you load with
> something like this:
>
>
> var ref = document.createElement("link");
> ref.setAttribute("rel", "stylesheet");
> ref.setAttribute("type", "text/css");
> ref.setAttribute("href", "myTheme.css");
> document.getElementsByTagName("head")[0].appendChild(ref);
>
>
> But remember to expose your "myTheme.css" as a resource.
Yes, this does not work. What I have currently is the YUI StyleSheet class
which can load CSS from a javascript string!
But, I don't like this either.
Cheers,
Paul
|
|
|
Re: CSS in custom widget [message #548740 is a reply to message #548542] |
Thu, 22 July 2010 19:08 |
Paul Kendall Messages: 40 Registered: July 2009 |
Member |
|
|
Benjamin Muskalla wrote:
> Hi Paul,
>
> as far as I understand, you're talking about browser-side CSS (not RAP
> theming). Just register your css with the org.eclipse.rap.ui.resources
> extension point and add the stylesheet to the document header (see
>
http://help.eclipse.org/help33/topic/org.eclipse.rap.help/he lp/html/advanced/branding.html
> - additionalHeaders).
>
> Regards,
> Ben
>
> Paul Kendall wrote:
>> Hi,
>> I'm working on a wrapping a javascript component as a custom widget which
>> has a good chunk of CSS included in it. I need to get this CSS into the
>> browser, but there does not seem to be any support for this in RAP.
>>
>> Am I wrong that there is no support for CSS? If so, how do I get the CSS
>> loaded so my widgets look right? If it is not supported can create a
>> patch to RAP that will allow it to work in a similar way to external JS
>> resources. Would this be accepted?
>>
>> Cheers,
>> Paul
>
>
Hi Ben,
The problem with this is that every application that wants to use the custom
widget is going to have to put the CSS in their branding! Not the best
solution. I was hoping for something like the IResource#isJSLibrary() for
CSS.
I currently have it working by using YUI to inject the CSS into the DOM. Not
the best solution, but it works for now.
Cheers,
Paul
|
|
|
Goto Forum:
Current Time: Thu Apr 18 04:52:31 GMT 2024
Powered by FUDForum. Page generated in 0.02486 seconds
|