/** * Adds a new browser history entry only if the requested page exists among the {@code pages} map * attribute.<br> * Does nothing if given {@code pageRequest} references a pop-up view or a <em>skip history</em> * page. * * @param request Page request. */ private void newPlace(final PageRequest request) { final Page page = request.getPage(); if (page != null && (page.skipHistory() || isPopupView(page))) { // "Pop-up views" and "Skip history pages" don't generate a new History item. return; } History.newItem(request.toString(), false); }
/** * Updates zones.<br> * Does nothing if given {@code pageRequest} references a pop-up view. * * @param pageRequest The page request (containing access rights). */ private void updateZones(final PageRequest pageRequest) { final Page page = pageRequest.getPage(); if (page != null && isPopupView(page)) { return; } eventBus.updateZone(Zone.AUTH_BANNER); eventBus.updateZoneRequest(Zone.MENU_BANNER.requestWith(RequestParameter.REQUEST, pageRequest)); }
/** {@inheritDoc} */ @Override public void onPageChange(final PageChangedEvent event) { final PageRequest pageRequest = event.getRequest(); final Page page = pageRequest.getPage(); // Tracks current page. trackPage(page); if (page != null && isPopupView(page)) { currentPopupPageRequest = pageRequest; } else { currentPageRequest = pageRequest; } newPlace(pageRequest); updateZones(pageRequest); }
/** {@inheritDoc} */ @Override public void onValueChange(final ValueChangeEvent<String> event) { try { final PageRequest pageRequest = PageRequest.fromString(event.getValue(), pages); // A popup page cannot be accessed directly by URL modification (such as <a> elements). if (isPopupView(pageRequest.getPage())) { if (Log.isInfoEnabled()) { Log.info("Popup page '" + pageRequest + "' cannot be accessed directly by URL."); } eventBus.navigate(null); } else { eventBus.fireEvent(new PageRequestEvent(pageRequest, true)); } } catch (final PageParsingException e) { eventBus.navigate(null); } }
/** * Returns the current page. * * @param includeCurrentPopup Set to <code>true</code> to get the current popup's page if any * popup is currently displayed, set to <code>false</code> to get the current non-popup page * even if a popup is currently displayed. * @return the current page or {@code null}. */ public Page getCurrentPage(boolean includeCurrentPopup) { final PageRequest pageRequest = getCurrentPageRequest(includeCurrentPopup); return pageRequest != null ? pageRequest.getPage() : null; }