2

I am quite new to GWT. I would like to extend some standard widget to suit my needs. I've created my first widget HorizontalTabs, which extend classes from GWT MaterialDesign(Here is demo and here are sources) And I am getting an error: Cannot read property 'hash' of undefined

Here is code of view:

public class HorizontalTabs extends Composite {

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

    interface HorizontalTabsUiBinder extends UiBinder<Widget, HorizontalTabs> {
    }
 public HorizontalTabs() {
    initWidget(uiBinder.createAndBindUi(this));
    }
}

<!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:m="urn:import:gwt.material.design.client.ui">
    <m:MaterialRow>
        <m:MaterialRow>
            <m:MaterialColumn grid="s12">
                <m:MaterialTab ui:field="tab" backgroundColor="blue" indicatorColor="yellow" waves="YELLOW">

                </m:MaterialTab>
            </m:MaterialColumn>
        </m:MaterialRow>
        <m:MaterialRow ui:field="tabContentRow">

        </m:MaterialRow>
    </m:MaterialRow>
</ui:UiBinder> 

To use it am adding it to one of my view class as follow:

public class FilesView extends ViewWithUiHandlers<FilesUiHandlers> implements FilesPresenter.MyView {
    interface Binder extends UiBinder<Widget, FilesView> {}
    private static FilesViewUiBinder uiBinder = GWT.create(FilesViewUiBinder.class);
    interface FilesViewUiBinder extends UiBinder<Widget, FilesView> {}
    @UiField
    MaterialRow row;
    public FilesView() {
    initWidget(uiBinder.createAndBindUi(this));
    row.add(new HorizontalTabs());
    }

<!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:m="urn:import:gwt.material.design.client.ui">
    <g:HTMLPanel>
        <h2>Your files</h2>
        <m:MaterialRow>
            <m:MaterialRow ui:field="row">
            </m:MaterialRow>
        </m:MaterialRow>
    </g:HTMLPanel>
</ui:UiBinder>

Everythink compiles ok. But problems occur when I try to enter the view that contain this widget.

Here is the stack trace:

SEVERE: Exception caught: Exception caught: Exception caught: Exception caught: Exception caught: Exception caught: (TypeError) : Cannot read property 'hash' of undefinedcom.google.gwt.user.client.ui.AttachDetachException: Exception caught: Exception caught: Exception caught: Exception caught: Exception caught: Exception caught: (TypeError) : Cannot read property 'hash' of undefined
    at Unknown.fillInStackTrace_0_g$(cms-0.js@3:8443)
    at Unknown.Throwable_3_g$(cms-0.js@8:8398)
    at Unknown.Exception_3_g$(cms-0.js@18:8541)
    at Unknown.RuntimeException_3_g$(cms-0.js@18:8582)
    at Unknown.UmbrellaException_3_g$(cms-0.js@25:36497)
    at Unknown.UmbrellaException_5_g$(cms-0.js@26:36558)
    at Unknown.AttachDetachException_1_g$(cms-0.js@26:55009)
    at Unknown.tryCommand_1_g$(cms-0.js@11:55065)
    at Unknown.doAttachChildren_1_g$(cms-0.js@3:54662)
    at Unknown.onAttach_2_g$(cms-0.js@8:54494)
    at Unknown.setParent_2_g$(cms-0.js@12:54590)
    at Unknown.adopt_0_g$(cms-0.js@14:54649)
    at Unknown.add_14_g$(cms-0.js@8:54707)
    at Unknown.add_13_g$(cms-0.js@8:54700)
    at Unknown.add_66_g$(cms-0.js@8:77215)
    at Unknown.add_11_g$(cms-0.js@8:54637)
    at Unknown.add_65_g$(cms-0.js@43:77211)
    at Unknown.setPanelContent_0_g$(cms-0.js@54:114885)
    at Unknown.setInSlot_7_g$(cms-0.js@25:107982)
    at Unknown.setInSlot_1_g$(cms-0.js@25:73077)
    at Unknown.setInSlot_0_g$(cms-0.js@8:73066)
    at Unknown.execute_27_g$(cms-0.js@30:76290)
    at Unknown.$executeScheduled_0_g$(cms-0.js@40:11660)
    at Unknown.runScheduledTasks_0_g$(cms-0.js@9:11382)
    at Unknown.flushPostEventPumpCommands_0_g$(cms-0.js@5:11474)
    at Unknown.execute_5_g$(cms-0.js@22:11613)
    at Unknown.execute_4_g$(cms-0.js@19:11350)
    at Unknown.apply_0_g$(cms-0.js@28:10845)
    at Unknown.entry0_0_g$(cms-0.js@16:10901)
    at Unknown.anonymous(cms-0.js@14:10881)
    at Unknown.callback_0_g$(cms-0.js@45:11401)
Caused by: com.google.gwt.user.client.ui.AttachDetachException: Exception caught: Exception caught: 

I assume this is silly problem, but I really can not find solution. Please help.

Maybe there is the way to find reason, but for me it is very hard to debug GWT application when I need to find runtime exception.

masterdany88
  • 5,041
  • 11
  • 58
  • 132
  • Both of your widgets are working fine at my end(without gwtp classes), nothing looks wrong to me. Try to debug your application to find out file causing problem. – Ajhar Shaikh Mar 24 '16 at 11:58

1 Answers1

0

It may be the case that I did not have any public getters and setters and constructors for widget models objects. But now I am not sure. It started to work.

masterdany88
  • 5,041
  • 11
  • 58
  • 132
  • I know this is very old but could you possibly share what getters and setters you needed to add? I'm having this same problem and can't figure it out for the life of me. – Tim Mattison Jul 15 '21 at 12:19