Skip to content

Instantly share code, notes, and snippets.

@Pacane
Created February 12, 2016 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pacane/4aac8a0d4643e861416a to your computer and use it in GitHub Desktop.
Save Pacane/4aac8a0d4643e861416a to your computer and use it in GitHub Desktop.
package com.arcbees.client.application.users;
import java.util.Map;
import com.arcbees.client.application.services.UserService;
import com.arcbees.client.place.NameTokens;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.NameToken;
import com.gwtplatform.mvp.client.annotations.ProxyStandard;
import com.gwtplatform.mvp.client.presenter.slots.NestedSlot;
import com.gwtplatform.mvp.client.proxy.ProxyPlace;
import com.gwtplatform.mvp.shared.proxy.PlaceRequest;
public class UsersPresenter extends Presenter<UsersPresenter.MyView, UsersPresenter.MyProxy> {
interface MyView extends View {
void displayUsers(Map<Integer, String> users);
}
@ProxyStandard
@NameToken(NameTokens.USERS)
interface MyProxy extends ProxyPlace<UsersPresenter> {
}
public static final NestedSlot SLOT_MAIN = new NestedSlot();
private final UserService userService;
@Inject
UsersPresenter(
EventBus eventBus,
MyView view,
MyProxy proxy,
UserService userService) {
super(eventBus, view, proxy, RevealType.Root);
this.userService = userService;
}
@Override
public void prepareFromRequest(PlaceRequest request) {
Map<Integer, String> users = userService.getUsers();
getView().displayUsers(users);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment