Why is gwt-bootstrap necessary?
Asked Answered
G

2

6

I'm new to GWT and was looking at using Twitter Bootstrap for a CSS framework. But then I ran across gwt-bootstrap, which bills itself as a way of using Bootstrap in a GWT app.

Since I'm so new to GWT, it has me a little concerned/confused: why can't a GWT app just use the regular Bootstrap framework? Why does it even need gwt-bootstrap?

Georginegeorglana answered 13/5, 2013 at 18:45 Comment(1)
Note that you should use gwtBootstrap3 now :) gwtbootstrap3.github.io/gwtbootstrap3-demoSimonetta
T
13

I started GWT-Bootstrap with the intention to bind the bootstrap JS and CSS to reusable GWT components, otherwise, you will probably need to replicate code, which will probably ends with you creating your own code, which will probably be very similar to GWT-Bootstrap.

It also have some facilities to bind events and etc.

But, answering your main question: It depends. If you don't trust community and/or have a lot of time, you could do your own gwt-bootstrap like project, but probably integrated with your project, at least, this was what happened in my case... so, I started GWT-Bootstrap and some fellas like it, and big story short: Now it is what it is. Need a lot of improvements, updates, better docs, and a lot of things, but the true is: I don't have so much time for it.

So, if I was you, I probably will help GWT-Bootstrap community instead of "reinvent the wheel", but that's just my opinion.

Happy study.


EDIT to add thing @IAmYourFaja ask in comments.

The injection as you mean (or as I believe you are meaning) is not centralized.

We have the ResourceInjector that injects some resources, setup viewport and etc, and the Resources.gwt.xml module which injects CSS files. We also have the component classes, which setup the JS plugins (when needed) and CSS classes. You can take a look at TabPanel for an example if you want.

Tittle answered 14/5, 2013 at 0:51 Comment(2)
Thanks @Tittle (+1) - I figured it was something along those lines. Any chance you could provide me with a quick code example of how GWT-Bootstrap adds CSS classes to GWT widgets? Or, tell me which class inside the GWT-Bootstrap project does this? I think once I see it in action everything will make sense for me! Thanks again!Georginegeorglana
I have edited the question adding it. If you have any more questions, I be glad do answer. Cheers.Tittle
H
2

It looks like a large part of gwt-bootstrap is wrapping the javascript pieces of Bootstrap, which would mean you could keep using Java. There are other chunks that let you use Enums instead of plain Css class names.

GWT does generate javascript and css, and you can still mix other Css and JS with it. I think this project just makes it so you can keep your codebase in Java.

It looks like it also supports UiBinder-y references, as in

<b:Row>
    <b:Column size="4">...</b:Column>
    <b:Column size="8">...</b:Column>
</b:Row>
Hadik answered 13/5, 2013 at 20:14 Comment(2)
Thanks @Riley Lark (+1) - but are you sure that keeping everything in Java is the only benefit of gwt-bootstrap? Are you sure that GWT doesn't have like its own CSS that typically overrides anything you try to add custom? It just seems like a large project if it wasn't absolutely necessary...thanks again!Georginegeorglana
GWT has its own CSS but we made sure that it doesn't interfere with the one of GWT-Bootstrap. As Riley said, GWT-Bootstrap is just a wrapper around Bootstrap. It makes it easier to use Bootstrap in a GWT project. GWT uses Widgets, Bootstrap uses divs, Anchors, ... If you'd want to add it to your GWT project you'd have to add CSS classes to some of the GWT widgets and that's, as caarlos0 pointed out, mainly what we did with GWT-Bootstrap.Kendyl

© 2022 - 2024 — McMap. All rights reserved.