@singleton in gwt usage -


i have object paneldatahandler like

 @singleton  public class paneldatahandler {     private list<panel> paneldetails;     private  integer nextid;     @inject     public paneldatahandler(){         paneldetails = new arraylist<panel>();         nextid = 0;      }      ... } 

now there 2 buttons different handlers in code. on button save details of panels saved , other display list of panels entered.
have gone through many posts , stackoverflow question couldn't arrive solution.
want create instance of paneldatahandler pdh , add panels in 1 handler , added list of panels in handler.

public class panelsaveeventhandler implements eventhandler {      public void savepanelslist() {        pdh.addpanels();      }  } 

getting list

public class panelclickeventhandler implements eventhandler{     public void displaypanelgrid() {          mypagingdatagrid<panel> grid = new mypagingdatagrid<panel>();         grid.setheight("500px");         grid.setdatalist(pdh.getpanellist());         rootpanel.get().add(grid);      }  } 

my ginjector interface

@ginmodules({ dispatchasyncmodule.class, clientmodule.class }) public interface clientginjector extends ginjector { ... ...      asyncprovider<paneldatahandler> getpaneldatahandler(); } 

my entrypoint

public class panelestimator implements entrypoint {      private final clientginjector ginjector = gwt.create(clientginjector.class);     @override     public void onmoduleload() {         // required gwt-platform proxy's generator         delayedbindregistry.bind(ginjector);             ginjector.getplacemanager().revealcurrentplace();         system.out.println(ginjector.getpaneldatahandler());     }  } 

where , how can create instance paneldatahandler can used above

thanks in advance answers

finally got solution problems, valuable suggestions
using singleton object, has injected i.e,

@inject
paneldatahandler pdh;

it not

paneldatahandler pdh=new paneldatahandler();


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -