PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); historyHandler.register(placeController, eventBus, place); historyHandler.handleCurrentHistory();
/** * Handle the current history token. Typically called at application start, to * ensure bookmark launches work. */ public void handleCurrentHistory() { handleHistoryToken(historian.getToken()); }
private String tokenForPlace(Place newPlace) { if (defaultPlace.equals(newPlace)) { return ""; } String token = mapper.getToken(newPlace); if (token != null) { return token; } log().warning("Place not mapped to a token: " + newPlace); return ""; } }
/** * Legacy method tied to the old location for {@link EventBus}. * * @deprecated use {@link #register(PlaceController, EventBus, Place)} */ @Deprecated public com.google.gwt.event.shared.HandlerRegistration register(PlaceController placeController, com.google.gwt.event.shared.EventBus eventBus, Place defaultPlace) { return new LegacyHandlerWrapper(register(placeController, (EventBus) eventBus, defaultPlace)); }
protected MvpController() { super(EventBus.get()); this.activityManager = new ActivityManager(this, EventBus.get()); this.historyHandler = new PlaceHistoryHandler(this); this.setDefaultPlace(this.defaultPlace); }
public void handleCurrentHistory() { this.historyHandler.handleCurrentHistory(); }
/** * Legacy method tied to the old location for {@link EventBus}. * * @deprecated use {@link #register(PlaceController, EventBus, Place)} */ @Deprecated public com.google.gwt.event.shared.HandlerRegistration register(PlaceController placeController, com.google.gwt.event.shared.EventBus eventBus, Place defaultPlace) { return new LegacyHandlerWrapper(register(placeController, (EventBus) eventBus, defaultPlace)); }
protected MvpController() { super(EventBus.get()); this.activityManager = new ActivityManager(this, EventBus.get()); this.historyHandler = new PlaceHistoryHandler(this); this.setDefaultPlace(this.defaultPlace); }
public void handleCurrentHistory() { this.historyHandler.handleCurrentHistory(); }
private void init(ApplicationContext applicationContext) { // Start ActivityManager for the main widget with our ActivityMapper ActivityMapper activityMapper = applicationContext.activityMapper(this); ActivityManager activityManager = new ActivityManager(activityMapper, eventBus); activityManager.setDisplay(appWidget); // Start PlaceHistoryHandler with our PlaceHistoryMapper final PlaceHistoryMapper historyMapper = applicationContext.placeHistoryMapper(); PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); historyHandler.register(placeController, eventBus, applicationContext.defaultPlace()); RootPanel.get("pageContent").add(appWidget); applicationContext.initialise(this); // Goes to the place represented on URL else default place historyHandler.handleCurrentHistory(); History.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { Place place = historyMapper.getPlace(event.getValue()); if (place != null) { placeController.goTo(place); } } }); }
/** * Legacy method tied to the old location for {@link EventBus}. * * @deprecated use {@link #register(PlaceController, EventBus, Place)} */ @Deprecated public com.google.gwt.event.shared.HandlerRegistration register(PlaceController placeController, com.google.gwt.event.shared.EventBus eventBus, Place defaultPlace) { return new LegacyHandlerWrapper(register(placeController, (EventBus) eventBus, defaultPlace)); }
private void handleHistoryToken(String token) { Place newPlace = null; if ("".equals(token)) { newPlace = defaultPlace; } if (newPlace == null) { newPlace = mapper.getPlace(token); } if (newPlace == null) { log().warning("Unrecognized history token: " + token); newPlace = defaultPlace; } placeController.goTo(newPlace); }
/** * Handle the current history token. Typically called at application start, to * ensure bookmark launches work. */ public void handleCurrentHistory() { handleHistoryToken(historian.getToken()); }
@Override public void onModuleLoad() { populateMenu(); // Create view container final SimplePanel container = new SimplePanel(); container.setStyleName("container requestor-showcase-container"); RootPanel.get().add(container); // Main Factory (Dependency Injector) ShowcaseClientFactory clientFactory = CLIENT_FACTORY; EventBus eventBus = clientFactory.getEventBus(); PlaceController placeController = clientFactory.getPlaceController(); // Activity-Place binding ActivityMapper activityMapper = new ShowcaseActivityMapper(); ActivityManager activityManager = new ActivityManager(activityMapper, eventBus); activityManager.setDisplay(container); // Place-History binding PlaceHistoryMapper historyMapper = new ShowcasePlaceHistoryMapper(); PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); historyHandler.register(placeController, eventBus, defaultPlace); // Add Loading widget RootPanel.get().add(new Loading(eventBus)); // Goes to place represented on URL or default place historyHandler.handleCurrentHistory(); }
public void setDefaultPlace(Place defaultPlace) { this.defaultPlace = defaultPlace; if (this.historyRegistration != null) { this.historyRegistration.removeHandler(); } this.historyRegistration = this.historyHandler.register(this, EventBus.get(), this.defaultPlace); }
private String tokenForPlace(Place newPlace) { if (defaultPlace.equals(newPlace)) { return ""; } String token = mapper.getToken(newPlace); if (token != null) { return token; } log().warning("Place not mapped to a token: " + newPlace); return ""; } }
/** * Handle the current history token. Typically called at application start, to * ensure bookmark launches work. */ public void handleCurrentHistory() { handleHistoryToken(historian.getToken()); }
PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(historyMapper); historyHandler.register(placeController, eventBus, DEFAULT_PLACE); historyHandler.handleCurrentHistory();
public void setDefaultPlace(Place defaultPlace) { this.defaultPlace = defaultPlace; if (this.historyRegistration != null) { this.historyRegistration.removeHandler(); } this.historyRegistration = this.historyHandler.register(this, EventBus.get(), this.defaultPlace); }
private String tokenForPlace(Place newPlace) { if (defaultPlace.equals(newPlace)) { return ""; } String token = mapper.getToken(newPlace); if (token != null) { return token; } log().warning("Place not mapped to a token: " + newPlace); return ""; } }