Search in sources :

Example 1 with DesktopWindow

use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.

the class DesktopWindowManager method moveFocus.

protected void moveFocus(java.awt.Component tab) {
    Window window = tabs.get(tab).getCurrentWindow();
    if (window != null) {
        String focusComponentId = window.getFocusComponent();
        boolean focused = false;
        if (focusComponentId != null) {
            com.haulmont.cuba.gui.components.Component focusComponent = window.getComponent(focusComponentId);
            if (focusComponent != null) {
                if (focusComponent.isEnabled() && focusComponent.isVisible()) {
                    focusComponent.requestFocus();
                    focused = true;
                }
            }
        }
        if (!focused && window instanceof Window.Wrapper) {
            Window.Wrapper wrapper = (Window.Wrapper) window;
            focused = ((DesktopWindow) wrapper.getWrappedWindow()).findAndFocusChildComponent();
            if (!focused) {
                tabsPane.requestFocus();
            }
        }
    }
}
Also used : Window(com.haulmont.cuba.gui.components.Window) DesktopWindow(com.haulmont.cuba.desktop.gui.components.DesktopWindow) com.haulmont.cuba.gui.components(com.haulmont.cuba.gui.components) Component(com.haulmont.cuba.gui.components.Component)

Example 2 with DesktopWindow

use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.

the class DesktopWindowManager method isCloseWithCloseButtonPrevented.

protected boolean isCloseWithCloseButtonPrevented(Window currentWindow) {
    DesktopWindow desktopWindow = (DesktopWindow) ComponentsHelper.getWindowImplementation(currentWindow);
    if (desktopWindow != null) {
        Window.BeforeCloseWithCloseButtonEvent event = new Window.BeforeCloseWithCloseButtonEvent(desktopWindow);
        desktopWindow.fireBeforeCloseWithCloseButton(event);
        return event.isClosePrevented();
    }
    return false;
}
Also used : Window(com.haulmont.cuba.gui.components.Window) DesktopWindow(com.haulmont.cuba.desktop.gui.components.DesktopWindow) DesktopWindow(com.haulmont.cuba.desktop.gui.components.DesktopWindow)

Example 3 with DesktopWindow

use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.

the class DesktopWindowManager method setWindowCaption.

@Override
public void setWindowCaption(Window window, String caption, String description) {
    Window desktopWindow = window;
    if (window instanceof Window.Wrapper) {
        desktopWindow = ((Window.Wrapper) window).getWrappedWindow();
    }
    window.setCaption(caption);
    String formattedCaption = formatTabDescription(caption, description);
    WindowOpenInfo openInfo = windowOpenMode.get(desktopWindow);
    if (openInfo != null) {
        OpenMode openMode = openInfo.getOpenMode();
        if (openMode != OpenMode.DIALOG) {
            if (tabsPane != null) {
                int selectedIndex = tabsPane.getSelectedIndex();
                if (selectedIndex != -1) {
                    setActiveWindowCaption(caption, description, selectedIndex);
                }
            } else if (!isMainWindowManager) {
                setTopLevelWindowCaption(formattedCaption);
            }
        } else {
            JDialog jDialog = (JDialog) openInfo.getData();
            if (jDialog != null) {
                jDialog.setTitle(formattedCaption);
            }
        }
    }
}
Also used : Window(com.haulmont.cuba.gui.components.Window) DesktopWindow(com.haulmont.cuba.desktop.gui.components.DesktopWindow)

Example 4 with DesktopWindow

use of com.haulmont.cuba.desktop.gui.components.DesktopWindow in project cuba by cuba-platform.

the class DesktopWindowManager method isCloseWithShortcutPrevented.

protected boolean isCloseWithShortcutPrevented(Window currentWindow) {
    DesktopWindow desktopWindow = (DesktopWindow) ComponentsHelper.getWindowImplementation(currentWindow);
    if (desktopWindow != null) {
        Window.BeforeCloseWithShortcutEvent event = new Window.BeforeCloseWithShortcutEvent(desktopWindow);
        desktopWindow.fireBeforeCloseWithShortcut(event);
        return event.isClosePrevented();
    }
    return false;
}
Also used : Window(com.haulmont.cuba.gui.components.Window) DesktopWindow(com.haulmont.cuba.desktop.gui.components.DesktopWindow) DesktopWindow(com.haulmont.cuba.desktop.gui.components.DesktopWindow)

Aggregations

DesktopWindow (com.haulmont.cuba.desktop.gui.components.DesktopWindow)4 Window (com.haulmont.cuba.gui.components.Window)4 com.haulmont.cuba.gui.components (com.haulmont.cuba.gui.components)1 Component (com.haulmont.cuba.gui.components.Component)1