Search in sources :

Example 1 with UrlRouting

use of com.haulmont.cuba.gui.UrlRouting in project cuba by cuba-platform.

the class AppUI method setApplicationContext.

@Inject
protected void setApplicationContext(ApplicationContext applicationContext) {
    Dialogs dialogs = new WebDialogs(this);
    autowireContext(dialogs, applicationContext);
    setDialogs(dialogs);
    Notifications notifications = new WebNotifications(this);
    autowireContext(notifications, applicationContext);
    setNotifications(notifications);
    WebBrowserTools webBrowserTools = new WebBrowserToolsImpl(this);
    autowireContext(webBrowserTools, applicationContext);
    setWebBrowserTools(webBrowserTools);
    Fragments fragments = new WebFragments(this);
    autowireContext(fragments, applicationContext);
    setFragments(fragments);
    Screens screens = new WebScreens(this);
    autowireContext(screens, applicationContext);
    setScreens(screens);
    UrlRouting urlRouting = new WebUrlRouting(this);
    autowireContext(urlRouting, applicationContext);
    setUrlRouting(urlRouting);
    History history = new WebHistory(this);
    autowireContext(history, applicationContext);
    setHistory(history);
    UrlChangeHandler urlChangeHandler = new UrlChangeHandler(this);
    autowireContext(urlChangeHandler, applicationContext);
    setUrlChangeHandler(urlChangeHandler);
    getPage().addPopStateListener(urlChangeHandler::handleUrlChange);
}
Also used : WebHistory(com.haulmont.cuba.web.sys.navigation.WebHistory) History(com.haulmont.cuba.web.sys.navigation.History) WebHistory(com.haulmont.cuba.web.sys.navigation.WebHistory) UrlChangeHandler(com.haulmont.cuba.web.sys.navigation.UrlChangeHandler) UrlRouting(com.haulmont.cuba.gui.UrlRouting) Inject(javax.inject.Inject)

Example 2 with UrlRouting

use of com.haulmont.cuba.gui.UrlRouting in project cuba by cuba-platform.

the class WebAppWorkArea method reflectTabChangeToUrl.

protected void reflectTabChangeToUrl(boolean userOriginated) {
    if (!userOriginated) {
        return;
    }
    Component selectedTab = tabbedContainer.getTabSheetBehaviour().getSelectedTab();
    if (selectedTab == null) {
        return;
    }
    Window selectedWindow = ((TabWindowContainer) selectedTab).getBreadCrumbs().getCurrentWindow();
    WebWindow webWindow = (WebWindow) selectedWindow;
    NavigationState resolvedState = webWindow.getResolvedState();
    if (resolvedState != null) {
        int stateMark = generateUrlStateMark();
        NavigationState newState = new NavigationState(resolvedState.getRoot(), String.valueOf(stateMark), resolvedState.getNestedRoute(), resolvedState.getParams());
        webWindow.setResolvedState(newState);
        Screen screen = selectedWindow.getFrameOwner();
        UrlRouting urlRouting = UiControllerUtils.getScreenContext(screen).getUrlRouting();
        urlRouting.pushState(screen, newState.getParams());
    }
}
Also used : WebWindow(com.haulmont.cuba.web.gui.WebWindow) NavigationState(com.haulmont.cuba.gui.navigation.NavigationState) Screen(com.haulmont.cuba.gui.screen.Screen) WebAbstractComponent(com.haulmont.cuba.web.gui.components.WebAbstractComponent) Component(com.vaadin.ui.Component) UrlRouting(com.haulmont.cuba.gui.UrlRouting) WebWindow(com.haulmont.cuba.web.gui.WebWindow)

Aggregations

UrlRouting (com.haulmont.cuba.gui.UrlRouting)2 NavigationState (com.haulmont.cuba.gui.navigation.NavigationState)1 Screen (com.haulmont.cuba.gui.screen.Screen)1 WebWindow (com.haulmont.cuba.web.gui.WebWindow)1 WebAbstractComponent (com.haulmont.cuba.web.gui.components.WebAbstractComponent)1 History (com.haulmont.cuba.web.sys.navigation.History)1 UrlChangeHandler (com.haulmont.cuba.web.sys.navigation.UrlChangeHandler)1 WebHistory (com.haulmont.cuba.web.sys.navigation.WebHistory)1 Component (com.vaadin.ui.Component)1 Inject (javax.inject.Inject)1