GWT: Returning multiple styles for the same CSS field -


In a CssResource, can I return many style class names with the same method?

[Please make a mistake in the code - I am trying to relax from home, from memory) I have the following library code (which I can not change):

 < Code> Zero Render (ClientBundle 1 Bundle) {setInnerHtml ("& lt; div class = \" + bundle.css (). Style () + \ "/ & Gt;"); }   

The bundle is straight forward:

  Interface ClientBandle1 extension of the clientbundle {@ source ("css1.css") CSSRsource 1 css; }   

and CSS processing:

  interface CSSRSource 1 CSSRars {style1 (); }   

and css1.css:

  .style1 {width = 10; Height = 20}   

Now - I would like _ partially _ override "style 1" with other style (override height only, not width) From my own CSS (css2.css) However, my css2.css has been declared as such:

  .style2 {height = 30}   

So I partially override CSS 1 Want to Style1 CSS 2. With Style 2 (different category names).

If this vanilla is HTML, then I would have just written it:

... import css1 again css2 ...

     

However, because it is GWT, I'll need something like this:

  Interface ClientBundle 2 ClientBundle 1 {@Source ("css1.css "," Css2.css ") CSSRsource 2 css (); }   

and CSS processing:

  interface increases CSSRSSSource2 CSSResource1 {@CLASSAM ("Style1", "Style2") style ( ); }   

But of course, the above is not possible in GWT above.

Is there a way to specify two style class names according to a style method?

Many options, none of which are exactly what you are asking for:

Add more from a class:

Any time you are applying the style, as you & lt; Div class = "style1 style2" /> , add both styles if in UiBinder, & lt; Do something like g: widget addStyleNames = "{css.style1} {css.style2}" /> , and if in Java, just add both sections:

  widget. AddStyleNames (css.style1 () + "" + css.style2 ());   

or

  widget. AddStyleNames (css.style1 ()); Widget.addStyleNames (css.style2 ());   

Override that style:

Why not more than one style rule for style1 or style2 Are you Many ways depending on what you have done:

css1.css:

  .style1 {width: 10px; Height: 20px}   

and css2.css:

  .style1 {height: 30px}   

The CssResource / ClientBundle:

  Interface CssResource2 Extended CssResource1 {String (style); } Interface MyClientBundle {@ source ({"css1.css", "css2.css}) CSS Rarsource 2 CSS ();}   

is expanding (more or less) Style:

  .style1 {width: 10px; height: 30px}   

Since the subsequent CSS rules override with the same weight already.

Alternatively, something like:

css1.css:

  .style1, .style2 {width: 10px; height: 20px}   

css2.css:

  .style2 {height: 30px}   

style1 with something Also the result will be 10x20 whereas with style2 anything will be 10x30. < Code> @ClassName annotations can be used to ignore pre-defined style for more or less using CssResource2 .

Comments