Search in sources :

Example 46 with WindowInfo

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

the class WebFrame method openFrame.

@Override
public Frame openFrame(Component parent, String windowAlias) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
    WebWindowManager wm = App.getInstance().getWindowManager();
    Frame wrappedFrame = ((Frame.Wrapper) wrapper).getWrappedFrame();
    return wm.openFrame(wrappedFrame, parent, windowInfo);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 47 with WindowInfo

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

the class WebFrame method openEditor.

@Override
public Window.Editor openEditor(Entity item, WindowManager.OpenType openType, Map<String, Object> params, Datasource parentDs) {
    WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
    WindowInfo editorScreen = windowConfig.getEditorScreen(item);
    WebWindowManager wm = App.getInstance().getWindowManager();
    return wm.openEditor(editorScreen, item, openType, params, parentDs);
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) WebWindowManager(com.haulmont.cuba.web.WebWindowManager) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 48 with WindowInfo

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

the class FrameComponentLoader method createComponent.

@Override
public void createComponent() {
    String src = element.attributeValue("src");
    String screenId = element.attributeValue("screen");
    if (src == null && screenId == null) {
        throw new GuiDevelopmentException("Either 'src' or 'screen' must be specified for 'frame'", context.getFullFrameId());
    }
    if (src == null) {
        WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
        WindowInfo windowInfo = windowConfig.getWindowInfo(screenId);
        src = windowInfo.getTemplate();
        if (src == null) {
            throw new GuiDevelopmentException("Screen " + screenId + " doesn't have template path configured", context.getFullFrameId());
        }
    }
    if (element.attributeValue("id") != null) {
        frameId = element.attributeValue("id");
    }
    LayoutLoader layoutLoader = new LayoutLoader(context, factory, LayoutLoaderConfig.getFrameLoaders());
    layoutLoader.setLocale(getLocale());
    layoutLoader.setMessagesPack(getMessagesPack());
    String currentFrameId = context.getCurrentFrameId();
    context.setCurrentFrameId(frameId);
    try {
        Pair<ComponentLoader, Element> loaderElementPair = layoutLoader.createFrameComponent(src, frameId, context.getParams());
        frameLoader = loaderElementPair.getFirst();
        resultComponent = (Frame) frameLoader.getResultComponent();
    } finally {
        context.setCurrentFrameId(currentFrameId);
    }
}
Also used : WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) LayoutLoader(com.haulmont.cuba.gui.xml.layout.LayoutLoader) Element(org.dom4j.Element) GuiDevelopmentException(com.haulmont.cuba.gui.GuiDevelopmentException) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo) ComponentLoader(com.haulmont.cuba.gui.xml.layout.ComponentLoader)

Example 49 with WindowInfo

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

the class DesktopFrame method openFrame.

@Override
public Frame openFrame(Component parent, String windowAlias) {
    WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
    Frame wrappedFrame = ((Frame.Wrapper) wrapper).getWrappedFrame();
    return getWindowManagerImpl().openFrame(wrappedFrame, parent, windowInfo);
}
Also used : DetachedFrame(com.haulmont.cuba.desktop.DetachedFrame) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Example 50 with WindowInfo

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

the class App method afterLoggedIn.

/**
 * Perform actions after success login
 */
protected void afterLoggedIn() {
    UserSessionSource sessionSource = AppBeans.get(UserSessionSource.NAME);
    User user = sessionSource.getUserSession().getUser();
    // Change password on logon
    if (Boolean.TRUE.equals(user.getChangePasswordAtNextLogon())) {
        mainFrame.deactivate("");
        final DesktopWindowManager wm = mainFrame.getWindowManager();
        for (Window window : wm.getOpenWindows()) {
            window.setEnabled(false);
        }
        WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
        WindowInfo changePasswordDialog = windowConfig.getWindowInfo("sec$User.changePassword");
        Window changePasswordWindow = wm.openWindow(changePasswordDialog, OpenType.DIALOG.closeable(false), ParamsMap.of("cancelEnabled", false));
        changePasswordWindow.addCloseListener(actionId -> {
            for (Window window : wm.getOpenWindows()) {
                window.setEnabled(true);
            }
        });
    }
}
Also used : Window(com.haulmont.cuba.gui.components.Window) WindowConfig(com.haulmont.cuba.gui.config.WindowConfig) User(com.haulmont.cuba.security.entity.User) WindowInfo(com.haulmont.cuba.gui.config.WindowInfo)

Aggregations

WindowInfo (com.haulmont.cuba.gui.config.WindowInfo)74 WindowConfig (com.haulmont.cuba.gui.config.WindowConfig)43 WebWindowManager (com.haulmont.cuba.web.WebWindowManager)15 WindowManager (com.haulmont.cuba.gui.WindowManager)9 Element (org.dom4j.Element)8 Window (com.haulmont.cuba.gui.components.Window)7 LegacyFrame (com.haulmont.cuba.gui.screen.compatibility.LegacyFrame)5 HashMap (java.util.HashMap)5 Screens (com.haulmont.cuba.gui.Screens)3 FrameOwner (com.haulmont.cuba.gui.screen.FrameOwner)3 LayoutLoader (com.haulmont.cuba.gui.xml.layout.LayoutLoader)3 com.haulmont.cuba.core.global (com.haulmont.cuba.core.global)2 DetachedFrame (com.haulmont.cuba.desktop.DetachedFrame)2 GuiDevelopmentException (com.haulmont.cuba.gui.GuiDevelopmentException)2 Notifications (com.haulmont.cuba.gui.Notifications)2 OpenType (com.haulmont.cuba.gui.WindowManager.OpenType)2 Filter (com.haulmont.cuba.gui.components.Filter)2 Fragment (com.haulmont.cuba.gui.components.Fragment)2 RelatedAction (com.haulmont.cuba.gui.components.actions.RelatedAction)2 AddConditionWindow (com.haulmont.cuba.gui.components.filter.addcondition.AddConditionWindow)2