Skip to content

Instantly share code, notes, and snippets.

@Pacane
Last active August 29, 2015 14:21
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/2474d91fa960b0cc4919 to your computer and use it in GitHub Desktop.
Save Pacane/2474d91fa960b0cc4919 to your computer and use it in GitHub Desktop.
ComputerPresenter
public class ComputerPresenter extends PresenterWidget<MyView>
implements ComputerHackedEvent.ComputerHackedHandler {
public interface MyView extends View {
void setComputerName(String computerName);
void displayStatus(String computerName, String hackerName);
}
private final String computerName;
@Inject
ComputerPresenter(
EventBus eventBus,
MyView view,
@Assisted String computerName) {
super(eventBus, view);
this.computerName = computerName;
view.setComputerName(computerName);
}
@Override
protected void onBind() {
super.onBind();
addRegisteredHandler(ComputerHackedEvent.TYPE, this);
}
@Override
public void onSystemHacked(ComputerHackedEvent event) {
getView().displayStatus(computerName, event.getHackerName());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment