PDA

View Full Version : [CLOSED] TabPanel and uibinder



pgy49
22 Nov 2011, 12:47 AM
Hello,

I don't know if this is a bug or if I miss something...
When I try using the TabPanel, with the same code as the Explorer Demo, I have the following error:



java.lang.NullPointerException: null
at com.google.gwt.safehtml.shared.SafeHtmlUtils.htmlEscape(SafeHtmlUtils.java:156)
at com.sencha.gxt.theme.base.client.tabs.TabPanelBaseAppearance_ItemTemplate_render_SafeHtml__TabPanelBaseStyle_style__TabItemConfig_config___SafeHtmlTemplatesImpl.render0(TabPanelBaseAppearance_ItemTemplate_render_SafeHtml__TabPanelBaseStyle_style__TabItemConfig_config___SafeHtmlTemplatesImpl.java:18)
at com.sencha.gxt.theme.base.client.tabs.TabPanelBaseAppearance_ItemTemplateImpl.render(TabPanelBaseAppearance_ItemTemplateImpl.java:30)
at com.sencha.gxt.theme.base.client.tabs.TabPanelBaseAppearance.insert(TabPanelBaseAppearance.java:218)
at com.sencha.gxt.widget.core.client.TabPanel.insert(TabPanel.java:368)
at com.sencha.gxt.widget.core.client.TabPanel.add(TabPanel.java:203)
at test.tabtest.client.TabTestUi_MyUiBinderImpl.createAndBindUi(TabTestUi_MyUiBinderImpl.java:32)
at test.tabtest.client.TabTestUi_MyUiBinderImpl.createAndBindUi(TabTestUi_MyUiBinderImpl.java:1)
at test.tabtest.client.TabTestUi.asWidget(TabTestUi.java:28)
at test.tabtest.client.TabTestUi.onModuleLoad(TabTestUi.java:32)


In debug mode, I see that TabItemConfig as a null "text" field.

This is the code:


package test.tabtest.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.widget.core.client.TabItemConfig;
import com.sencha.gxt.widget.core.client.TabPanel;
import com.sencha.gxt.widget.core.client.info.Info;

public class TabTestUi extends Composite implements IsWidget, EntryPoint {

interface MyUiBinder extends UiBinder<Widget, TabTestUi> {
}

private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

@UiField(provided = true)
String txt = "Bla bla bla bla bla";

public Widget asWidget() {
return uiBinder.createAndBindUi(this);
}

public void onModuleLoad() {
RootPanel.get().add(asWidget());
}

@UiHandler(value = {"folder", "panel"})
void onSelection(SelectionEvent<Widget> event) {
TabPanel panel = (TabPanel) event.getSource();
Widget w = event.getSelectedItem();
TabItemConfig config = panel.getConfig(w);
Info.display("Message", "'" + config.getText() + "' Selected");
}
}


and



<!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:tabs="urn:import:com.sencha.gxt.widget.core.client"
xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container">

<ui:with type="java.lang.String" field="txt" />


<ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig"
field="shortTextTabConfig">
<ui:attributes text="Short Text" />
</ui:with>
<ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig"
field="longTextTabConfig">
<ui:attributes text="Long Text" />
</ui:with>
<ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig"
field="normalTabConfig">
<ui:attributes text="Normal" />
</ui:with>

<ui:with type="com.sencha.gxt.widget.core.client.TabItemConfig"
field="disabledTabConfig">
<ui:attributes text="Disabled" enabled="false" />
</ui:with>

<ui:style>
.sep {
margin-top: 20px;
}
</ui:style>

<container:FlowLayoutContainer>
<tabs:TabPanel ui:field="folder" width="450"
addStyleNames="margin-10">
<tabs:child config="{shortTextTabConfig}">
<g:Label addStyleNames="pad-text" text="{txt}" />
</tabs:child>

<tabs:child config="{longTextTabConfig}">
<container:FlowLayoutContainer>
<g:Label text="{txt}" addStyleNames="pad-text" />
<g:Label text="{txt}" addStyleNames="pad-text {style.sep}" />
</container:FlowLayoutContainer>
</tabs:child>
</tabs:TabPanel>

<tabs:TabPanel ui:field="panel" plain="true" pixelSize="450, 250"
addStyleNames="margin-10">
<tabs:child config="{normalTabConfig}">
<g:Label text="Just a plain old tab" addStyleNames="pad-text" />
</tabs:child>

<tabs:child config="{disabledTabConfig}">
<g:Label text="This tab should be disabled" addStyleNames="pad-text" />
</tabs:child>
</tabs:TabPanel>
</container:FlowLayoutContainer>

</ui:UiBinder>


Thanks.

sven
22 Nov 2011, 12:55 AM
Do you have the uibinder bridge on your classpath?

pgy49
22 Nov 2011, 2:00 AM
Do you have the uibinder bridge on your classpath?

I work with Eclipse, I have gxt-3.0.0-SNAPSHOT and uibinder-bridge-2.4.0 in the BUILD Path.

DarekKay
22 Nov 2011, 2:26 AM
Maybe forgot to adjust your module xml file?
You need this:

<inherits name='com.google.gwt.uibinder.UiBinder' />
<inherits name="com.sencha.gwt.uibinder.UiBinder"/>

pgy49
22 Nov 2011, 2:29 AM
Maybe forgot to adjust your module xml file?
You need this:

<inherits name='com.google.gwt.uibinder.UiBinder' />
<inherits name="com.sencha.gwt.uibinder.UiBinder"/>

Thanks a lot !! It works now !

balakishan.r
8 Nov 2012, 2:10 AM
Hi, I tried with adding below line in module xml file but it is expecting UiBinder-bridge jar.
I added this jar and able to see the tabs as expected.

<inherits name="com.sencha.gwt.uibinder.UiBinder"/>
<inherits name='com.google.gwt.uibinder.UiBinder' />

Can any help me, is that the good approach to add this uibinder-bridge-2.4.0.jar?
or is there any alternative to solve this issue.

Thanks in advance.

Colin Alworth
8 Nov 2012, 3:39 PM
That is required in GWT 2.4.0 - if you are using GXT 2.5.0, the uibinder-bridge.jar is no longer required, as GWT has included our code into the 2.5.0 release.