Showing posts with label GWT Platform. Show all posts
Showing posts with label GWT Platform. Show all posts
Tuesday, 5 February 2013
Wednesday, 3 October 2012
Understanding GWT Code Splitting
Problem Background
In traditional desktop application like Word Processor, there are so many features of that application that we don’t normally use. For instance, the Mail Merge tool within Word Processor is extremely useful when it's needed, but for others it may not be. So the question is how do we load only the functionality that will be used?
GWT Solution
The solution of GWT for this important issue is a concept which is called Code Splitting. In general, GWT framework provides a mechanism to split our code into segments in a way that each segment will be downloaded only when needed.
GWT.runAsync(RunAsyncCallback callback) is the method for code splitting, which will create a ‘split point’ in the code, and everything beyond that split point will be downloaded only on demand.
eg
HelloCodeSplitting.java
public class HelloCodeSplitting implements EntryPoint {
public void onModuleLoad() {
Button b = new Button("Click me", new ClickHandler() {
public void onClick(ClickEvent event) {
RunAsyncCallback callback = new RunAsyncCallback() { //#1 Creates callback
public void onSuccess () { //#2 Defines success handler
Window.alert("Hello, AJAX");
}
public void onFailure (Throwable reason) { //#3 Defines error handler
Window.alert("Code download failed");
}
};
GWT.runAsync(callback); //#4 Loads and executes
}//end of onclick
RootPanel.get().add(b);
}//end of moduleload
}//end of Class
@GinModules({ HelloCodeSplittingModule.class })
public interface HelloCodeSplittingGinjector extends Ginjector {
PlaceManager getPlaceManager();
EventBus getEventBus();
AsyncProvider<HelloCodeSplittingPresenter> getHelloCodeSplittingPresenter();
}
@ProxyCodeSplit
@NameToken("main")
public interface HelloCodeSplittingProxy extends ProxyPlace<HelloCodeSplittingPresenter> {
}
References
1 - http://www.javabeat.net/2011/11/code-splitting-in-gwt/
2 - http://stackoverflow.com/questions/8652534/gwtp-code-splitting
3 - http://www.summa-tech.com/blog/2011/05/03/a-pattern-for-gwt-code-splitting/
4 - https://developers.google.com/web-toolkit/doc/latest/DevGuideCodeSplitting#patterns
5 - http://benbracha.wordpress.com/2012/05/04/gwt-code-splitting/
6 - http://jcheng.wordpress.com/2010/02/16/elegant-code-splitting-with-gwt/
7- Doloto: Code Splitting for Network-Bound Web 2.0 Applications, http://research.microsoft.com/apps/pubs/default.aspx?id=70518
In traditional desktop application like Word Processor, there are so many features of that application that we don’t normally use. For instance, the Mail Merge tool within Word Processor is extremely useful when it's needed, but for others it may not be. So the question is how do we load only the functionality that will be used?
GWT Solution
The solution of GWT for this important issue is a concept which is called Code Splitting. In general, GWT framework provides a mechanism to split our code into segments in a way that each segment will be downloaded only when needed.
GWT.runAsync(RunAsyncCallback callback) is the method for code splitting, which will create a ‘split point’ in the code, and everything beyond that split point will be downloaded only on demand.
eg
HelloCodeSplitting.java
public class HelloCodeSplitting implements EntryPoint {
public void onModuleLoad() {
Button b = new Button("Click me", new ClickHandler() {
public void onClick(ClickEvent event) {
RunAsyncCallback callback = new RunAsyncCallback() { //#1 Creates callback
public void onSuccess () { //#2 Defines success handler
Window.alert("Hello, AJAX");
}
public void onFailure (Throwable reason) { //#3 Defines error handler
Window.alert("Code download failed");
}
};
GWT.runAsync(callback); //#4 Loads and executes
}//end of onclick
RootPanel.get().add(b);
}//end of moduleload
}//end of Class
In GWTP
GWTP takes care of calling GWT.runAsync, whenever the corresponding Presenter is shown. But need to use AsyncProvider in the Ginjector .
So, I can achieve the same thing in gwtp framework as follows :
HelloCodeSplittingGinjector.java
@GinModules({ HelloCodeSplittingModule.class })
public interface HelloCodeSplittingGinjector extends Ginjector {
PlaceManager getPlaceManager();
EventBus getEventBus();
AsyncProvider<HelloCodeSplittingPresenter> getHelloCodeSplittingPresenter();
}
HelloCodeSplittingPresenter.java
@ProxyCodeSplit
@NameToken("main")
public interface HelloCodeSplittingProxy extends ProxyPlace<HelloCodeSplittingPresenter> {
}
References
1 - http://www.javabeat.net/2011/11/code-splitting-in-gwt/
2 - http://stackoverflow.com/questions/8652534/gwtp-code-splitting
3 - http://www.summa-tech.com/blog/2011/05/03/a-pattern-for-gwt-code-splitting/
4 - https://developers.google.com/web-toolkit/doc/latest/DevGuideCodeSplitting#patterns
5 - http://benbracha.wordpress.com/2012/05/04/gwt-code-splitting/
6 - http://jcheng.wordpress.com/2010/02/16/elegant-code-splitting-with-gwt/
7- Doloto: Code Splitting for Network-Bound Web 2.0 Applications, http://research.microsoft.com/apps/pubs/default.aspx?id=70518
Monday, 24 September 2012
java.lang.IllegalArgumentException: invoke arguments: JS value of type boolean, expected java.lang.String
Problem Background
Here I've 3 Tabs with SubTabs under them. When I click on a Tab, only the default SubTab maintained with code like following in every Sub TabContainerPresenter can be viewed, but the other with priority other than 0 are not even clickable./*Main TabContainerPresenter*/
@TabInfo(container = MainPagePresenter.class, priority = 1, nameToken = NameTokens.ADD_AGENT)
static String getTabLabel(TGinInjector ginjector) {
return ginjector.getTConstants().agent();
}
/*Child TabContainerPresenters*/
@TabInfo(container = AgentPresenter.class)
static TabData getTabLabel(TGinInjector ginjector) {
return new TabDataBasic(ginjector.getTConstants().addAgent(), 0);
}
@TabInfo(container = AgentPresenter.class)
static TabData getTabLabel(TGinInjector ginjector) {
return new TabDataBasic(ginjector.getTConstants().listAgents(), 1);
}
When tried to click on SubTab with priority other than than 0, throws the error
java.lang.IllegalArgumentException: invoke arguments: JS value of type boolean, expected java.lang.String.
1 - My EntryPoint - T.java
public class T implements EntryPoint {
public final TGinInjector gInjector = GWT.create(TInjector.class);
@Override
public void onModuleLoad() {
TResources.INSTANCE.tCss().ensureInjected();
RootPanel loader = RootPanel.get("loader");
loader.setStyleName("in-loader");
DelayedBindRegistry.bind(gInjector);
gInjector.getPlaceManager().revealCurrentPlace();
}
2 - My Ginjector - TGinInjector.java
@GinModules({ TModule.class })
public interface TGinInjector extends Ginjector {
PlaceManager getPlaceManager();
EventBus getEventBus();
TConstants getTConstants();
Provider<MainPagePresenter> getMainPagePresenter();
/*
* Statement Module
*/
AsyncProvider<TStatementPresenter> getTStatementPresenter();
AsyncProvider<StatementPresenter> getStatementPresenter();
/*
* Agent Module
*/
AsyncProvider<AgentPresenter> getAgentPresenter();
AsyncProvider<AddAgentPresenter> getAddAgentPresenter();
AsyncProvider<ListAgentPresenter> getListAgentPresenter();
}
3 - My PresenterModule is - TModule.java
public class TModule extends AbstractPresenterModule {
@Override
protected void configure() {
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
bind(TokenFormatter.class).to(ParameterTokenFormatter.class).in(
Singleton.class);
bind(RootPresenter.class).to(TRootPresenter.class)
.asEagerSingleton();
bind(PlaceManager.class).to(TPlaceManager.class).in(
Singleton.class);
bindConstant().annotatedWith(DefaultPlace.class).to(
NameTokens.STATEMENT);
bindPresenter(MainPagePresenter.class, IMainPageView.class,
MainPageView.class, MainPagePresenter.MainProxy.class);
/*
* Statement Module
*/
bindPresenter(
TStatementPresenter.class,
ITStatementView.class,
TStatementTabView.class,
TStatementPresenter.ITStatementTabContentProxy.class);
bindPresenter(StatementPresenter.class, IStatementView.class,
StatementView.class,
StatementPresenter.IStatementTabContentProxyPlace.class);
/*
* Agent Module
*/
bindPresenter(AgentPresenter.class, IAgentView.class, AgentView.class,
AgentPresenter.AgentProxy.class);
bindPresenter(AddAgentPresenter.class, IAddAgentView.class,
AddAgentView.class, AddAgentPresenter.AddAgentTabContentProxyPlace.class);
bindPresenter(ListAgentPresenter.class, IListAgentView.class,
ListAgentView.class, ListAgentPresenter.ListAgentProxy.class);
bindPresenter(AddServicePresenter.class, IAddServiceView.class,
AddServiceView.class, AddServiceProxy.class);
}
4 - My PlaceManagerImpl - TPlaceManager.java
public class TPlaceManager extends PlaceManagerImpl {
private final PlaceRequest defaultPlaceRequest;
@Inject
public TPlaceManager(EventBus eventBus, TokenFormatter tokenFormatter, @DefaultPlace String nameToken) {
super(eventBus, tokenFormatter);
defaultPlaceRequest = new PlaceRequest(nameToken);
}
@Override
public void revealDefaultPlace() {
revealPlace(defaultPlaceRequest);
}
}
5 - My AgentPresenter for a Tab - AgentPresenter.java
public class AgentPresenter extends
SubContainerPresenterBase<AgentView, AgentPresenter.AgentTabContentProxy> {
@RequestTabs
public static final Type<RequestTabsHandler> TYPE_RequestTabs = new Type<RequestTabsHandler>();
@ContentSlot
public static final Type<RevealContentHandler<?>> TYPE_SetTabContent = new Type<RevealContentHandler<?>>();
@Inject
public AgentPresenter(EventBus eventBus, AgentView view, AgentProxy proxy,
Type<RevealContentHandler<?>> setTabContent,
Type<RequestTabsHandler> requestTabs) {
super(eventBus, view, proxy, TYPE_SetTabContent, TYPE_RequestTabs);
}
@ProxyCodeSplit
public interface AgentTabContentProxy extends TabContentProxy<AgentPresenter> {
}
@TabInfo(container = MainPagePresenter.class, priority = 1, nameToken = NameTokens.ADD_AGENT)
static String getTabLabel(TGinInjector ginjector) {
return ginjector.getTConstants().agent();
}
@Override
protected void revealInParent() {
RevealContentEvent.fire(this, MainPagePresenter.TYPE_SetMainContent,
this);
}
}
6 - AddAgentPresenter.java for a SubTab AddAgent with priority 0
/**
* @author prayag
* @date Sep 13, 2012
*/
public class AddAgentPresenter extends Presenter<IAddAgentView, AddAgentPresenter.AddAgentTabContentProxyPlace> implements IAddAgentView.AddAgentViewUiHandler {
@Inject
private IAgentServiceAsync agentService;
@Inject
public AddAgentPresenter(EventBus eventBus, IAddAgentView view, AddAgentTabContentProxyPlace proxy) {
super(eventBus, view, proxy);
getView().setUiHandlers(this);
}
@ProxyCodeSplit
@NameToken(NameTokens.ADD_AGENT)
public interface AddAgentTabContentProxyPlace extends TabContentProxyPlace<AddAgentPresenter> {
}
@TabInfo(container = AgentPresenter.class)
static TabData getTabLabel(TGinInjector ginjector) {
return new TabDataBasic(ginjector.getTConstants().addAgent(), 0);
}
@Override
protected void revealInParent() {
RevealContentEvent.fire(this, AgentPresenter.TYPE_SetTabContent, this);
}
@Override
protected void onReveal() {
super.onReveal();
}
@Override
public void addAgent(AgentDto dto) {
agentService.addAgent(dto, new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
Window.alert("Agent added successfully.");
}
@Override
public void onFailure(Throwable caught) {
Window.alert("Faild to add the agent." + caught.getMessage());
}
});
}
}
7 - ListAgentPresenter.java for a SubTab ListAgent with priority 1
public class ListAgentPresenter extends
Presenter<IListAgentView, ListAgentPresenter.ListAgentProxy> implements
IListAgentView.ListAgentViewUiHandler {
@Inject
private IAgentServiceAsync agentService;
@Inject
public ListAgentPresenter(EventBus eventBus, IListAgentView view,
ListAgentProxy proxy, ListAgentDataProvider dataprovider) {
super(eventBus, view, proxy);
dataprovider.addDataDisplay(view.getDisplay());
getView().setUiHandlers(this);
}
@ProxyCodeSplit
@NameToken(NameTokens.LIST_AGENT)
public interface ListAgentProxy extends
TabContentProxyPlace<ListAgentPresenter> {
}
@TabInfo(container = AgentPresenter.class)
static TabData getTabLabel(TGinInjector ginjector) {
return new TabDataBasic(ginjector.getTConstants()
.listAgents(), 1);
}
@Override
protected void revealInParent() {
RevealContentEvent.fire(this, AgentPresenter.TYPE_SetTabContent, this);
}
@Override
protected void onReveal() {
super.onReveal();
}
private void refreshTable() {
getView().getDisplay().setVisibleRangeAndClearData(
getView().getDisplay().getVisibleRange(), true);
}
}
Friday, 21 September 2012
Getting started with GWT-Bootstrap
GWT-Bootstrap is an open source project that aims to provide all the Twitter Bootstrap styles and widgets to GWT applications.
The steps getting started with GWT-Bootstrap include :
<!-- gwt-bootstrap repo -->
<repositories>
<repository>
<id>sonatype</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="t">
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.i18n.I18N" />
<inherits name="com.google.gwt.http.HTTP" />
<inherits name="com.google.gwt.json.JSON"/>
<inherits name="com.google.gwt.uibinder.UiBinder" />
<inherits name="com.google.gwt.inject.Inject" />
<inherits name="com.gwtplatform.mvp.Mvp" />
<!-- inherit the GWT-Bootstrap widget library -->
<inherits name="com.github.gwtbootstrap.Bootstrap"/>
<!-- end of inherit the GWT-Bootstrap widget library -->
<!-- start of inherit the GWT-Bootstrap datepicker library -->
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
<!-- end of inherit the GWT-Bootstrap datepicker library -->
<source path="client" />
<source path="shared" />
<define-configuration-property name="gin.ginjector" is-multi-valued="false"/>
<set-configuration-property name="gin.ginjector" value="com.zcode.t.client.mvp.TGinInjector"/>
<set-configuration-property name="UiBinder.useSafeHtmlTemplates" value="true" />
<set-property name="user.agent" value="safari"/>
<extend-property name="locale" values="en" />
<set-property-fallback name="locale" value="en"/>
<entry-point class="com.zcode.t.client.T" />
</module>
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:w="urn:import:com.zcode.t.client.ui.widget"
xmlns:c="urn:import:com.google.gwt.user.cellview.client"
xmlns:gwt="urn:import:com.google.gwt.user.cellview.client"
xmlns:com="urn:import:com.zcode.t.client.view.components"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:b2="urn:import:com.github.gwtbootstrap.datepicker.client.ui"
>
<ui:with field="res" type="com.zcode.t.client.resources.TResources" />
<ui:style>
.button {
float: left;
}
.label {
margin-top: 5px;
margin-right: 5px;
float: left;
}
.box {
margin-right: 5px;
}
.rbutton {
float: left;
margin-right: 5px;
}
</ui:style>
<g:HTMLPanel styleName="{res.tCss.mainContentPanel}">
<g:HTMLPanel styleName="{res.tCss.msDatePickerHolder}">
<g:Label styleName="{res.tCss.msLabel}">From</g:Label>
<!-- using the DateBox widget -->
<b2:DateBox ui:field="fromDate" styleName="{res.tCss.msDatePicker}"/>
<g:Label styleName="{res.tCss.msLabel}">To</g:Label>
<b2:DateBox ui:field="toDate" styleName="{res.tCss.msDatePicker}"/>
<g:Button ui:field="dateRangeSubmit" styleName="{res.tCss.msResetButton}">Submit</g:Button>
</g:HTMLPanel>
<g:HTMLPanel styleName="{res.tCss.clear}" />
</g:HTMLPanel>
</ui:UiBinder>
2 - Base Widgets, Styles for Buttons, available at http://gwtbootstrap.github.com/#base:
3 - Demo of Datepicker for Bootstrap, available at http://www.eyecon.ro/bootstrap-datepicker/
4 - USING A CUSTOM BOOTSTRAP THEME WITH GWT-BOOTSTRAP, available at http://caarlos0.github.com/posts/using-a-custom-bootstrap-theme-in-gwt-bootstrap/
The steps getting started with GWT-Bootstrap include :
STEP 1 : add gwt-bootstrap maven dependency in pom.xml
Add gwt-bootstrap maven dependency to pom.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zcode</groupId>
<artifactId>t</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>t</name>
<url>http://www.t.com.np</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>6.1.4</jetty.version>
<spring.version>3.0.5.RELEASE</spring.version>
<slf4j.version>1.6.1</slf4j.version>
<java.version>1.6</java.version>
<junit.version>4.8.2</junit.version>
<logback.version>0.9.26</logback.version>
<gwt.version>2.4.0</gwt.version>
<webappDirectory>src/main/webapp</webappDirectory>
</properties>
<dependencies>
<!-- gwt-bootstrap dependencies start -->
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.1.0.0-SNAPSHOT</version>
</dependency>
<!-- gwt-bootstrap dependencies end -->
And then add gwt-bootstrap maven repository to pom.xml :
<repository>
<id>sonatype</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
Here is a sample pom.xml :
And then add gwt-bootstrap maven repository to pom.xml :
<repository>
<id>sonatype</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
Here is a sample pom.xml :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zcode</groupId>
<artifactId>t</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>t</name>
<url>http://www.t.com.np</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>6.1.4</jetty.version>
<spring.version>3.0.5.RELEASE</spring.version>
<slf4j.version>1.6.1</slf4j.version>
<java.version>1.6</java.version>
<junit.version>4.8.2</junit.version>
<logback.version>0.9.26</logback.version>
<gwt.version>2.4.0</gwt.version>
<webappDirectory>src/main/webapp</webappDirectory>
</properties>
<dependencies>
<!-- gwt dependencies start -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.gwtplatform</groupId>
<artifactId>gwtp-mvp-client</artifactId>
<version>0.6</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>3.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<version>1.5.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- gwt dependencies end -->
<!-- gwt-bootstrap dependencies start -->
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.1.0.0-SNAPSHOT</version>
</dependency>
<!-- gwt-bootstrap dependencies end -->
<dependencies><!-- gwt-bootstrap repo -->
<repositories>
<repository>
<id>sonatype</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</project>
STEP 2 : Configuring module - inherit the GWT-Bootstrap widget library
Here is a sample gwt module inheriting gwt-bootstrap library : t.gwt.xml<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
<module rename-to="t">
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.i18n.I18N" />
<inherits name="com.google.gwt.http.HTTP" />
<inherits name="com.google.gwt.json.JSON"/>
<inherits name="com.google.gwt.uibinder.UiBinder" />
<inherits name="com.google.gwt.inject.Inject" />
<inherits name="com.gwtplatform.mvp.Mvp" />
<!-- inherit the GWT-Bootstrap widget library -->
<inherits name="com.github.gwtbootstrap.Bootstrap"/>
<!-- end of inherit the GWT-Bootstrap widget library -->
<!-- start of inherit the GWT-Bootstrap datepicker library -->
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
<!-- end of inherit the GWT-Bootstrap datepicker library -->
<source path="client" />
<source path="shared" />
<define-configuration-property name="gin.ginjector" is-multi-valued="false"/>
<set-configuration-property name="gin.ginjector" value="com.zcode.t.client.mvp.TGinInjector"/>
<set-configuration-property name="UiBinder.useSafeHtmlTemplates" value="true" />
<set-property name="user.agent" value="safari"/>
<extend-property name="locale" values="en" />
<set-property-fallback name="locale" value="en"/>
<entry-point class="com.zcode.t.client.T" />
</module>
STEP 3 : using in UiBinder
Add xml namespaces,xmlns:b = "urn:import:com.github.gwtbootstrap.client.ui"
and
xmlns:b2="urn:import:com.github.gwtbootstrap.datepicker.client.ui"Here is a sample UiBinder :
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:w="urn:import:com.zcode.t.client.ui.widget"
xmlns:c="urn:import:com.google.gwt.user.cellview.client"
xmlns:gwt="urn:import:com.google.gwt.user.cellview.client"
xmlns:com="urn:import:com.zcode.t.client.view.components"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:b2="urn:import:com.github.gwtbootstrap.datepicker.client.ui"
>
<ui:with field="res" type="com.zcode.t.client.resources.TResources" />
<ui:style>
.button {
float: left;
}
.label {
margin-top: 5px;
margin-right: 5px;
float: left;
}
.box {
margin-right: 5px;
}
.rbutton {
float: left;
margin-right: 5px;
}
</ui:style>
<g:HTMLPanel styleName="{res.tCss.mainContentPanel}">
<g:HTMLPanel styleName="{res.tCss.msDatePickerHolder}">
<g:Label styleName="{res.tCss.msLabel}">From</g:Label>
<!-- using the DateBox widget -->
<b2:DateBox ui:field="fromDate" styleName="{res.tCss.msDatePicker}"/>
<g:Label styleName="{res.tCss.msLabel}">To</g:Label>
<b2:DateBox ui:field="toDate" styleName="{res.tCss.msDatePicker}"/>
<g:Button ui:field="dateRangeSubmit" styleName="{res.tCss.msResetButton}">Submit</g:Button>
</g:HTMLPanel>
<g:HTMLPanel styleName="{res.tCss.clear}" />
</g:HTMLPanel>
</ui:UiBinder>
References :
1 - Using GWT Bootstrap SNAPSHOTS version with Maven, available at https://github.com/gwtbootstrap/gwt-bootstrap/wiki/Using-GWT-Bootstrap-SNAPSHOTS-version-with-Maven2 - Base Widgets, Styles for Buttons, available at http://gwtbootstrap.github.com/#base:
3 - Demo of Datepicker for Bootstrap, available at http://www.eyecon.ro/bootstrap-datepicker/
4 - USING A CUSTOM BOOTSTRAP THEME WITH GWT-BOOTSTRAP, available at http://caarlos0.github.com/posts/using-a-custom-bootstrap-theme-in-gwt-bootstrap/
Subscribe to:
Posts (Atom)






