public interface Configurator
GWT-Bootstrap uses embedded copies of bootstrap.css and bootstrap.js by default. If you need to use your own copies
or include other resources, you'll need to create a custom Configurator
and a custom Resources
.
A suggested layout is below. First, create your resource package at the same level as client/server/shared. Next, create
css and js directories beneath the resources directory, and add your custom css and js files into those. Next, create your custom
Configurator
and a custom Resources
. Finally, add
a replace-with
tag and a public
tag to your module xml.
Full example below:
1. Create your resources package directory and add css and js directories beneath that. Add your custom css and js files to the css and js directories, respectively.
src/main/java/com/example |-- client |-- resources | |-- css | | `-- bootstrap.min.css < your custom css | | `-- bootstrap-responsive.min.css < your custom css | |-- js | | `-- bootstrap.min.js < your custom js | |-- ExampleConfigurator.java < your custom Configurator class | `-- ExampleResources.java < your custom Resources interface |-- server |-- shared `-- Example.gwt.xml < your module xml file2. Create a Resources interface (extending
Resources
) that overrides the
getters of the files you want to replace.
public interface MyResources extends Resources { @Source("css/bootstrap.min.css") TextResource bootstrapCss(); @Source("css/bootstrap-responsive.min.css") TextResource bootstrapResponsiveCss(); }
3. Create a Configurator
that returns your new Resources
.
public MyConfigurator implements Configurator { public Resources getResources() { return GWT.create(MyResources.class); } }
4. Add a replace-with
tag, a source
tag, and a public
tag to your module xml
(*.gwt.xml
):
<source path='resources'/> <replace-with class="com.example.resources.ExampleConfigurator"> <when-type-is class="com.github.gwtbootstrap.client.ui.config.Configurator"/> </replace-with> <public path="resources"> <exclude name="** /*.java"/> <exclude name="** /*.class"/> </public>
A more detailed tutorial and a full working example can be found here.
Resources
,
DefaultConfigurator
Modifier and Type | Method and Description |
---|---|
Resources |
getResources()
Get the Bootstrap Resources that should be used for this project.
|
boolean |
hasResponsiveDesign()
Determines whether the project uses a responsive design.
|
Resources getResources()
boolean hasResponsiveDesign()
If the responsive design is enabled, the interface can adapt to the screen size and show different content on smartphones, tablets and desktop computers.
true
if the responsive features should be enabled.
Default: false
IsResponsive
,
Bootstrap documentationCopyright © 2012-2014 gwtbootstrap. All Rights Reserved.