Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-incubator-e4-dev] CSS flavor used for theming in RAP

Hi Ralf,

Thank ou very much for your answer.

>We do not directly apply styles to the widgets. We parse the CSS theme files and generate instructions for our client library that define >the default style of widgets.

>RAP application developers register the CSS theme file with an extension point. There is no other API to apply styling.
Ok I understand.

>You refer to SWT styles like this:

  >Button[style='SWT.CHECK'] {
  > color:red;
  >}

>How would I select a button that has both style flags PUSH and BORDER set?
Yes it's a problem. But this rule is default behaviour of selectors management. Each SWT widget are linked to CSSStylableElement instance which define how manage the selectors with IElementProvider.

And you can implement your own CSSStylableElement to change this rule (see SWTElement which implement CSSStylableElement).

>One other thing I'm not quite sure about: You map style as well as all other widget properties, plus any user data to attributes, e.g.:

  >text.setEditable( true );

> Text[editable=true] {
  >  color: blue;
  >}

  >text.setData( "foo", "warning" );

  >Text[foo="warning"] {
  >  color: red;
  >}

>This mean that style flag (or property) attributes could also be overwritten like this:

> Button button = new Button( parent, SWT.PUSH );
  >button.setData( "style", "SWT.RADIO" );

>Would this result in a push button rendered like a radio button?
Yes you are right, but you can change this rule if you implement your own CSSStylableElement.

>Wouldn't it be a good idea to avoid such collisions by prefixing user data attributes like this:

  >Text[data.foo="warning"] {
  > color: red;
  >}
Yes you can manage that like by extending SWTElement and manage this rule into getAttribute method.

Thank a lot for your idea.

Regards Angelo


2008/7/9 Ralf Sternberg <rsternberg@xxxxxxxxxxxxxx>:
Hi Angelo,

Thanks for pointing me to the TK-UI CSS engine, which is very interesting. See my comments inline.


Angelo zerr wrote:
Hi Ralf,

I have read your RAP description about your CSS engine.
Thank you.

It seems that your CSS engine looks like TK-UI CSS engine.
TK-UI CSS design is very similar to Matthew Hatem's work too. But TK-UI have design to manage any Object with CSS (Swing widgets, SWT widgets, update XML element....).

My question is how do you apply CSS styles. Have you API to apply styles.

We do not directly apply styles to the widgets. We parse the CSS theme files and generate instructions for our client library that define the default style of widgets.

RAP application developers register the CSS theme file with an extension point. There is no other API to apply styling.


If you are interested you can see the TK-UI API at
http://tk-ui.sourceforge.net/user-guide/cssengine/cssengine.html.

Thanks for the pointers, I'll have a look closer look at it asap.


You can find some information about SWT CSS implementation at http://tk-ui.sourceforge.net/user-guide/cssengine/swtcssengine.html.

I just read this. It seems that the CSS flavor of the SWT part of your engine is indeed quite similar to ours, except for the use of attribute selectors. Let me ask a few question regarding this:

You refer to SWT styles like this:

 Button[style='SWT.CHECK'] {
   color:red;
 }

How would I select a button that has both style flags PUSH and BORDER set?

One other thing I'm not quite sure about: You map style as well as all other widget properties, plus any user data to attributes, e.g.:

 text.setEditable( true );

 Text[editable=true] {
   color: blue;
 }

 text.setData( "foo", "warning" );

 Text[foo="warning"] {
   color: red;
 }

This mean that style flag (or property) attributes could also be overwritten like this:

 Button button = new Button( parent, SWT.PUSH );
 button.setData( "style", "SWT.RADIO" );

Would this result in a push button rendered like a radio button?

Wouldn't it be a good idea to avoid such collisions by prefixing user data attributes like this:

 Text[data.foo="warning"] {
   color: red;
 }

Best Regards,
Ralf

_______________________________________________
eclipse-incubator-e4-dev mailing list
eclipse-incubator-e4-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipse-incubator-e4-dev


Back to the top