gwt - UIBinder with Widget -


i trying add widget panel using uibinder composite doesn't load, here xml:

<ui:uibinder xmlns:ui='urn:ui:com.google.gwt.uibinder'          xmlns:g='urn:import:com.google.gwt.user.client.ui'          xmlns:my='urn:import:com.abc.client.test.ui'>  <g:htmlpanel ui:field="mainlayoutpanel">    <g:simplepanel ui:field="menupanel" >     <my:mainmenuviewimpl ui:field="mainmenu"/>   </g:simplepanel>    <!-- widget causing issue -->   <my:financialsnav ui:field="nav"/>    <g:simplepanel ui:field="mainpanel" />   </g:htmlpanel> </ui:uibinder> 

the corresponding java class:

public class applayoutimpl extends composite implements applayout{  @uifield htmlpanel mainlayoutpanel;  interface applayoutuibinder extends uibinder<widget,applayoutimpl>{}  private static applayoutuibinder binder=gwt.create(applayoutuibinder.class);  @uifield simplepanel menupanel;// nav @ top  @uifield(provided=true) financialsnav nav;// nav on side  @uifield simplepanel mainpanel;// center  @uifield(provided=true) mainmenuviewimpl mainmenu;  public applayoutimpl(clientfactory clientfactory){     mainmenu=clientfactory.getmainmenuview();     nav=clientfactory.getnav();     initwidget(binder.createandbindui(this)); }    @override public widget aswidget(){     return this; } } 

and widget causing issue:

public class financialsnav extends composite implements clickhandler{  private verticalpanel nav=new verticalpanel(); // operations private disclosurepanel operationswrapper=new disclosurepanel(proto2.constants.financials_navigation_operations()); private navbutton product=new navbutton(proto2.constants.financials_navigation_products(),         sharedutilities.product_token);   private navbutton generaloptions=new navbutton(proto2.constants.financials_navigation_generaloptions(),"");  private arraylist<navbutton[]> buttons; private navbutton[] operationsbuttons={product,vc,fc,emp,others}; //... private navbutton[] optionsbuttons={generaloptions};  private final eventbus bus;  public financialsnav(eventbus bus){     this.bus=bus;     buildnav();     initwidget(nav); }  private void buildnav(){     buttons=new arraylist<navbutton[]>();     buttons.add(operationsbuttons);     //...     buttons.add(optionsbuttons);      int n=buttons.size();     int nn;     for(int i=0;i<n;i++){         nn=buttons.get(i).length;         for(int j=0;j<nn;j++){             (buttons.get(i)[j]).addclickhandler(this);             (buttons.get(i)[j]).setstyleprimaryname(nav_button_style);             if(i==0){                 operationswrapper.add(buttons.get(i)[j]);             //...             }else if(i==4){                 optionswrapper.add(buttons.get(i)[j]);             }         }     }      nav.add(operationswrapper);     // ...     nav.add(optionswrapper);  } 

the financialsnav widget works fine when not used uibinder , rest of applayout works expected when financialsnav isn't there.

i spent hours on looking @ various tutorials , examples not find wrong code. tried various workaround such declaring panel in uibinder instead of financialsnav , adding nav panel.

also in same package shouldn't import issue.

any appreciated...

here clientfactory

public class clientfactoryimpl implements clientfactory{ private static final eventbus eventbus=new simpleeventbus(); private static final placecontroller placecontroller=new placecontroller(eventbus);  private static final createplanserviceasync createplanservice=gwt.create(createplanservice.class);  private static final financialsnav navview=new financialsnav(eventbus); private static final mainmenuviewimpl mainmenuview=new mainmenuviewimpl();  @override public eventbus geteventbus(){     return eventbus; }  @override public placecontroller getplacecontroller(){     return placecontroller; }  @override public financialsnav getnav(){     return navview; }  @override public mainmenuviewimpl getmainmenuview(){     return mainmenuview; }  @override public createplanserviceasync getcreateplanservice(){     return createplanservice; }  } 

financialsnav widgets has constructor arguments. create no argument constructor.

the entry <my:financialsnav ui:field="nav"/> equals new financialsnav().

in cases means must default instantiable; is, must provide zero-argument constructor. have pass argument

 /** used myuibinder instantiate financialsnav */   @uifactory financialsnav makefinancialsnav() { // method name insignificant. start make     return new financialsnav(eventbus);   } 

refer using widget requires constructor args

can show clientfactory code!!


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -