Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » CSS in custom widget
CSS in custom widget [message #548437] Wed, 21 July 2010 20:22 Go to next message
Paul Kendall is currently offline Paul KendallFriend
Messages: 40
Registered: July 2009
Member
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
Re: CSS in custom widget [message #548527 is a reply to message #548437] Thu, 22 July 2010 09:27 Go to previous messageGo to next message
Philipp Eichhorn is currently offline Philipp EichhornFriend
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 #548542 is a reply to message #548437] Thu, 22 July 2010 09:52 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
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


--
Benjamin Muskalla | EclipseSource Karlsruhe
http://www.eclipsesource.com | http://twitter.com/eclipsesource
Re: CSS in custom widget [message #548739 is a reply to message #548527] Thu, 22 July 2010 19:05 Go to previous messageGo to next message
Paul Kendall is currently offline Paul KendallFriend
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 Go to previous message
Paul Kendall is currently offline Paul KendallFriend
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
Previous Topic:Using RWT to convert a SWT application to a web app
Next Topic:Global session timeout
Goto Forum:
  


Current Time: Sun Feb 25 16:51:50 GMT 2024

Powered by FUDForum. Page generated in 0.02599 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top