}
@Override
public HandlerRegistration bind(EventBus eventBus, final HistoryHandler historyHandler) {
HandlerRegistration addHandler = eventBus.addHandler(AnimationSelectedEvent.getType(), new AnimationSelectedEvent.Handler() {
@Override
public void onAnimationSelected(AnimationSelectedEvent event) {
Animation animation = event.getAnimation();
AnimationNames animationName = animation.getAnimationName();
Place place = null;
switch (animationName) {
case SLIDE:
place = new AnimationSlidePlace();
break;
case SLIDE_UP:
place = new AnimationSlideUpPlace();
break;
case DISSOLVE:
place = new AnimationDissolvePlace();
break;
case FADE:
place = new AnimationFadePlace();
break;
case FLIP:
place = new AnimationFlipPlace();
break;
case POP:
place = new AnimationPopPlace();
break;
case SWAP:
place = new AnimationSwapPlace();
break;
default:
// TODO log
place = new AnimationSlidePlace();
break;
}
if (MGWT.getFormFactor().isTablet() || MGWT.getFormFactor().isDesktop()) {
historyHandler.replaceCurrentPlace(place);
historyHandler.goTo(place, true);
} else {
historyHandler.goTo(place);
}
}
});
HandlerRegistration register3 = UIEntrySelectedEvent.register(eventBus, new UIEntrySelectedEvent.Handler() {
@Override
public void onAnimationSelected(UIEntrySelectedEvent event) {
UIEntry entry = event.getEntry();
Place place = null;
switch (entry) {
case BUTTON_BAR:
place = new ButtonBarPlace();
break;
case BUTTONS:
place = new ButtonPlace();
break;
case ELEMENTS:
place = new ElementsPlace();
break;
case FORMS:
place = new FormsPlace();
break;
case POPUPS:
place = new PopupPlace();
break;
case PROGRESS_BAR:
place = new ProgressBarPlace();
break;
case PROGRESS_INDICATOR:
place = new ProgressIndicatorPlace();
break;
case PULL_TO_REFRESH:
place = new PullToRefreshPlace();
break;
case SCROLL_WIDGET:
place = new ScrollWidgetPlace();
break;
case SEARCH_BOX:
place = new SearchBoxPlace();
break;
case SLIDER:
place = new SliderPlace();
break;
case TABBAR:
place = new TabBarPlace();
break;
case CAROUSEL:
place = new CarouselPlace();
break;
case GROUP_LIST:
place = new GroupedCellListPlace();
break;
default:
break;
}
if (MGWT.getFormFactor().isTablet() || MGWT.getFormFactor().isDesktop()) {
historyHandler.replaceCurrentPlace(place);
historyHandler.goTo(place, true);
} else {
historyHandler.goTo(place);
}
}
});
HandlerRegistration register2 = ActionEvent.register(eventBus, ActionNames.BACK, new ActionEvent.Handler() {
@Override
public void onAction(ActionEvent event) {
History.back();
}
});
HandlerRegistration register = ActionEvent.register(eventBus, ActionNames.ANIMATION_END, new ActionEvent.Handler() {
@Override
public void onAction(ActionEvent event) {
if (MGWT.getFormFactor().isPhone()) {
History.back();