Tuesday, 3 September 2013

@singleton in gwt usuage

@singleton in gwt usuage

I have an object PanelDataHandler which is like
@Singleton
public class PanelDataHandler {
private List<Panel> panelDetails;
private Integer nextId;
@Inject
public PanelDataHandler(){
panelDetails = new ArrayList<Panel>();
nextId = 0;
}
...
}
Now there are two buttons with different handlers in my code. on button is
to save the details of the panels saved and the other to display the list
of panels entered.
I have gone through many posts and stackoverflow question couldn't arrive
to a solution.
I want to create an Instance of PanelDataHandler pdh and add the panels to
it in one hanler and get the added list of panels in another handler.
public class PanelSaveEventHandler implements EventHandler {
public void savePanelsList() {
pdh.addPanels();
}
}
getting the 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);
}
}
Where and how can I create instance for PanelDataHandler so that it can be
used as above
Thanks in advance for the answers

No comments:

Post a Comment