I guess layout could be wherever fits better for your purpouses.. depending
on the number and types of graphical elements you have...
but the most important part would be event handling mecanism and the service
call interface...
example (using UiBinder for clarity):
with EventBus (centralized, better)
Button nextBtn;
TextBox pageIndexTxt;
TextBox nameTxt;
HandleManager eventBus;
public Constructor(HandleManager eventBus){
}
@UiHandler("nextBtn")
public void onNextClick(ClickEvent e){
NextPageEvent evt = new NextPageEvent(pageIndexTxt.getText()+1);
eventBus.fireEvent(evt);
}
public void bind(User user){
nameTxt.setText(user.getName());
(...)
}
Meanwhile in the justice room...
in your Main Presenter class you subscribe for listening to the event and
deal with it..(this most done before app can receive user inputs)
HandlerManager eventBus;
YourServiceAsync service = GWT.create(...);
YourCompositeWidget widget;
(...)
void onBind()
{
eventBus.addHandler(NextPageEvent.TYPE, new NextPageEventHandler() {
void onNextPage(NextPageEvent event){
service.getUserByPage(event.getPage(), new
AsyncCallback<User>() {
public void onSuccess(User result) {
widget.bind(result);
}
public void onFailure(Throwable caught) {
Window.alert("whatever");
}
});
});
}
without EventBus;
Just call service.getUserByPage()... directly on the event handling for the
button click
public void onNextClick(ClickEvent e);
Regards
Fabio Kaminski
On Thu, Feb 25, 2010 at 2:06 PM, Tapas Adhikary <[email protected]> wrote:
> Hi All,
>
> What is the best way to achieve pagination using GWT. If I want to develop
> the pagination of data that clicking on the next button the next set of data
> will be populated with a previous button and next button(if there is any
> more data) , what panel or layout I should use ? Any sample code will help
> more.
>
> Thanks,
> -Tapas
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.