当前位置: 首页>>代码示例>>Java>>正文


Java Window.TopLevelWindow方法代码示例

本文整理汇总了Java中com.haulmont.cuba.gui.components.Window.TopLevelWindow方法的典型用法代码示例。如果您正苦于以下问题:Java Window.TopLevelWindow方法的具体用法?Java Window.TopLevelWindow怎么用?Java Window.TopLevelWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.haulmont.cuba.gui.components.Window的用法示例。


在下文中一共展示了Window.TopLevelWindow方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
@Override
public void handle() {
    String screenName = requestParams.get("screen");
    if (screenName == null) {
        log.warn("ScreenId not found in request parameters");
        return;
    }

    MenuItem item = samplesMenuConfig.findItemById(screenName);
    if (item != null && !item.isMenu()) {
        Map<String, Object> params = samplesHelper.getParams(item);
        App.getInstance().getWindowManager()
                .openWindow(samplesHelper.getSampleBrowser(), WindowManager.OpenType.NEW_TAB, params);
        Window.TopLevelWindow window = App.getInstance().getTopLevelWindow();
        if (window instanceof SamplerMainWindow) {
            FoldersPane foldersPane = ((SamplerMainWindow) window).getFoldersPane();
            if (foldersPane instanceof SamplerWebFoldersPane) {
                ((SamplerWebFoldersPane) foldersPane).expandMenuItem(item.getId());
            }
        }
    } else {
        super.handle();
    }
}
 
开发者ID:cuba-platform,项目名称:sampler,代码行数:25,代码来源:SamplerLinkHandler.java

示例2: createNextWindowTabShortcut

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
public ShortcutListener createNextWindowTabShortcut(Window.TopLevelWindow topLevelWindow) {
    String nextTabShortcut = clientConfig.getNextTabShortcut();
    KeyCombination combination = KeyCombination.create(nextTabShortcut);

    return new ShortcutListener("onNextTab", combination.getKey().getCode(),
            KeyCombination.Modifier.codes(combination.getModifiers())) {
        @Override
        public void handleAction(Object sender, Object target) {
            TabSheetBehaviour tabSheet = getConfiguredWorkArea(createWorkAreaContext(topLevelWindow))
                    .getTabbedWindowContainer().getTabSheetBehaviour();

            if (tabSheet != null && !hasDialogWindows() && tabSheet.getComponentCount() > 1) {
                Component selectedTabComponent = tabSheet.getSelectedTab();
                String tabId = tabSheet.getTab(selectedTabComponent);
                int tabPosition = tabSheet.getTabPosition(tabId);
                int newTabPosition = (tabPosition + 1) % tabSheet.getComponentCount();

                String newTabId = tabSheet.getTab(newTabPosition);
                tabSheet.setSelectedTab(newTabId);

                moveFocus(tabSheet, newTabId);
            }
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:WebWindowManager.java

示例3: createPreviousWindowTabShortcut

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
public ShortcutListener createPreviousWindowTabShortcut(Window.TopLevelWindow topLevelWindow) {
    String previousTabShortcut = clientConfig.getPreviousTabShortcut();
    KeyCombination combination = KeyCombination.create(previousTabShortcut);

    return new ShortcutListener("onPreviousTab", combination.getKey().getCode(),
            KeyCombination.Modifier.codes(combination.getModifiers())) {
        @Override
        public void handleAction(Object sender, Object target) {
            TabSheetBehaviour tabSheet = getConfiguredWorkArea(createWorkAreaContext(topLevelWindow))
                    .getTabbedWindowContainer().getTabSheetBehaviour();

            if (tabSheet != null && !hasDialogWindows() && tabSheet.getComponentCount() > 1) {
                Component selectedTabComponent = tabSheet.getSelectedTab();
                String selectedTabId = tabSheet.getTab(selectedTabComponent);
                int tabPosition = tabSheet.getTabPosition(selectedTabId);
                int newTabPosition = (tabSheet.getComponentCount() + tabPosition - 1) % tabSheet.getComponentCount();

                String newTabId = tabSheet.getTab(newTabPosition);
                tabSheet.setSelectedTab(newTabId);

                moveFocus(tabSheet, newTabId);
            }
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:26,代码来源:WebWindowManager.java

示例4: getConfiguredWorkArea

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
protected WebAppWorkArea getConfiguredWorkArea(@Nullable WorkAreaContext workAreaContext) {
    Window.TopLevelWindow topLevelWindow = ui.getTopLevelWindow();

    if (topLevelWindow instanceof Window.MainWindow) {
        AppWorkArea workArea = ((Window.MainWindow) topLevelWindow).getWorkArea();
        if (workArea != null) {
            return (WebAppWorkArea) workArea;
        }
    }

    throw new IllegalStateException("Application does not have any configured work area");
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:WebWindowManager.java

示例5: initTabShortcuts

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
protected void initTabShortcuts() {
    Window.TopLevelWindow topLevelWindow = ui.getTopLevelWindow();
    CubaOrderedActionsLayout actionsLayout = topLevelWindow.unwrap(CubaOrderedActionsLayout.class);

    if (getConfiguredWorkArea(createWorkAreaContext(topLevelWindow)).getMode() == Mode.TABBED) {
        actionsLayout.addShortcutListener(createNextWindowTabShortcut(topLevelWindow));
        actionsLayout.addShortcutListener(createPreviousWindowTabShortcut(topLevelWindow));
    }
    actionsLayout.addShortcutListener(createCloseShortcut(topLevelWindow));
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:WebWindowManager.java

示例6: getWindowManager

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
/**
 * @return WindowManager instance or null if the current UI has no MainWindow
 */
public WebWindowManager getWindowManager() {
    if (getAppUI() == null) {
        return null;
    }

    Window.TopLevelWindow topLevelWindow = getTopLevelWindow();

    return topLevelWindow != null ? (WebWindowManager) topLevelWindow.getWindowManager() : null;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:13,代码来源:App.java

示例7: createTopLevelWindow

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
public void createTopLevelWindow(WindowInfo windowInfo) {
    ui.beforeTopLevelWindowInit();

    String template = windowInfo.getTemplate();

    Window.TopLevelWindow topLevelWindow;

    Map<String, Object> params = Collections.emptyMap();
    if (template != null) {
        //noinspection unchecked
        topLevelWindow = (Window.TopLevelWindow) createWindow(windowInfo, OpenType.NEW_TAB, params,
                LayoutLoaderConfig.getWindowLoaders(), true);
    } else {
        Class screenClass = windowInfo.getScreenClass();
        if (screenClass != null) {
            //noinspection unchecked
            topLevelWindow = (Window.TopLevelWindow) createWindowByScreenClass(windowInfo, params);
        } else {
            throw new DevelopmentException("Unable to load top level window");
        }
    }

    // detect work area
    Window windowImpl = ((Window.Wrapper) topLevelWindow).getWrappedWindow();

    if (topLevelWindow instanceof AbstractMainWindow) {
        AbstractMainWindow mainWindow = (AbstractMainWindow) topLevelWindow;

        // bind system UI components to AbstractMainWindow
        ComponentsHelper.walkComponents(windowImpl, component -> {
            if (component instanceof AppWorkArea) {
                mainWindow.setWorkArea((AppWorkArea) component);
            } else if (component instanceof UserIndicator) {
                mainWindow.setUserIndicator((UserIndicator) component);
            } else if (component instanceof FoldersPane) {
                mainWindow.setFoldersPane((FoldersPane) component);
            }

            return false;
        });
    }

    ui.setTopLevelWindow(topLevelWindow);

    // load menu
    ComponentsHelper.walkComponents(windowImpl, component -> {
        if (component instanceof TopLevelWindowAttachListener) {
            ((TopLevelWindowAttachListener) component).topLevelWindowAttached(topLevelWindow);
        }

        return false;
    });

    if (topLevelWindow instanceof Window.HasWorkArea) {
        AppWorkArea workArea = ((Window.HasWorkArea) topLevelWindow).getWorkArea();
        if (workArea != null) {
            workArea.addStateChangeListener(new AppWorkArea.StateChangeListener() {
                @Override
                public void stateChanged(AppWorkArea.State newState) {
                    if (newState == AppWorkArea.State.WINDOW_CONTAINER) {
                        initTabShortcuts();

                        // listener used only once
                        getConfiguredWorkArea(createWorkAreaContext(topLevelWindow)).removeStateChangeListener(this);
                    }
                }
            });
        }
    }

    afterShowWindow(topLevelWindow);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:73,代码来源:WebWindowManager.java

示例8: createCloseShortcut

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
public ShortcutListener createCloseShortcut(Window.TopLevelWindow topLevelWindow) {
    String closeShortcut = clientConfig.getCloseShortcut();
    KeyCombination combination = KeyCombination.create(closeShortcut);

    return new ShortcutListener("onClose", combination.getKey().getCode(),
            KeyCombination.Modifier.codes(combination.getModifiers())) {
        @Override
        public void handleAction(Object sender, Object target) {
            WebAppWorkArea workArea = getConfiguredWorkArea(createWorkAreaContext(topLevelWindow));
            if (workArea.getState() != AppWorkArea.State.WINDOW_CONTAINER) {
                return;
            }

            if (workArea.getMode() == Mode.TABBED) {
                TabSheetBehaviour tabSheet = workArea.getTabbedWindowContainer().getTabSheetBehaviour();
                if (tabSheet != null) {
                    Layout layout = (Layout) tabSheet.getSelectedTab();
                    if (layout != null) {
                        tabSheet.focus();

                        WindowBreadCrumbs breadCrumbs = tabs.get(layout);

                        if (!canWindowBeClosed(breadCrumbs.getCurrentWindow())) {
                            return;
                        }

                        if (isCloseWithShortcutPrevented(breadCrumbs.getCurrentWindow())) {
                            return;
                        }

                        if (stacks.get(breadCrumbs).empty()) {
                            final Component previousTab = tabSheet.getPreviousTab(layout);
                            if (previousTab != null) {
                                breadCrumbs.getCurrentWindow().closeAndRun(Window.CLOSE_ACTION_ID, () ->
                                        tabSheet.setSelectedTab(previousTab)
                                );
                            } else {
                                breadCrumbs.getCurrentWindow().close(Window.CLOSE_ACTION_ID);
                            }
                        } else {
                            breadCrumbs.getCurrentWindow().close(Window.CLOSE_ACTION_ID);
                        }
                    }
                }
            } else {
                Iterator<WindowBreadCrumbs> it = tabs.values().iterator();
                if (it.hasNext()) {
                    Window currentWindow = it.next().getCurrentWindow();
                    if (!isCloseWithShortcutPrevented(currentWindow)) {
                        ui.focus();
                        currentWindow.close(Window.CLOSE_ACTION_ID);
                    }
                }
            }
        }
    };
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:58,代码来源:WebWindowManager.java

示例9: getTopLevelWindow

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
/**
 * @return currently displayed top-level window
 */
public Window.TopLevelWindow getTopLevelWindow() {
    return getAppUI().getTopLevelWindow();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:7,代码来源:App.java

示例10: topLevelWindowAttached

import com.haulmont.cuba.gui.components.Window; //导入方法依赖的package包/类
void topLevelWindowAttached(Window.TopLevelWindow window); 
开发者ID:cuba-platform,项目名称:cuba,代码行数:2,代码来源:TopLevelWindowAttachListener.java


注:本文中的com.haulmont.cuba.gui.components.Window.TopLevelWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。