Styled Add-on from component composition

Hi,

in a specially for this purpose created Vaadin project I created a custom component that consists solely of existing components. No new components, only component composition.
I use Cascading Style Sheets and a few pictures for this component. Now I want to pack this new component along with the images and the CSS file into a jar file in order to use this jar in other vaadin projects.
How do I do that?

Sorry for my bad English

Greetings from Germany
Thomas

Hi,

In that case, you won’t need widgetset compilation, just package the compiled classes, probably also sources, and the CSS in the Jar. The CSS is a bit tricky because unlike with new widgets, for which the CSS is defined in a “public” subfolder and packaged by the GWT Compiler, in this case you need to define a (partial) theme in the VAADIN/themes folder. Unlike in GWT widgets, the user of the library must include the theme with @import statement, which is an extra step to remember.

You should be able to package the Jar with Export → Vaadin Add-on Package Export in Eclipse. If you need to do it with Ant, I’m not sure if there is any example in the existing Add-ons. I have made some similar composite component add-ons, but packaged them with Eclipse.

Hi again,

First of all thank you for the quick reply.

That the use of the new jar @import MyTheme must be used is ugly. I want to use the new component is as simple as an add-on. Are there any other way?
Have pictures just like css files to put in the directory Vaadin / themes / MyTheme? Probably yes, right?

Greetings
Thomas

I don’t think there is any other way that allows styling with actual CSS rules that would affect sub-elements. You can use CssLayout to inject CSS to do some styling, but it only allows injecting CSS attributes to the layout element, not actual CSS rules. If you use Table, there’s the CellStyleGenerator.

I suppose it would be nice if the Vaadin plugin for Eclipse supported including such @import statement to the project theme automatically when you add a new add-on Jar in your project, a bit like how it currently generates statements in the widgetset definition file. Not sure if it would cause some problems. Created
#6006
for this.

Yes, custom themes can have pictures just like the built-in themes have.

Ok, thanks. Good idea to include support @import by eclipse plugin.

Regards
Thomas