Open window in maximized state

Is it possible to open a dialog window in its maximized state? e.g. automatically open a Dialog window maximised without using the “+” sign?

e.g. have this:

openWindow("consultationScreen", WindowManager.OpenType.DIALOG.closeable(true).resizable(true).modal(true), params);

open in the maximised state without having to click the + button?

I would have thought this would do it…

public class Consultationscreen extends AbstractWindow {

    @Override
    public void init(Map<String, Object> params) {
        setSizeFull();
        super.init(params);
    }
}
1 Like

Hi,

Unfortunately, there is no API for this in Cuba. At the moment, you can use Vaadin API in your window controller (from “ready” life-cycle method):


public class ClientEdit extends AbstractEditor<Client> {
    @Override
    public void ready() {
        super.ready();

        // maximize using Vaadin Window
        com.vaadin.ui.Component parent = unwrapComposition(Component.class);
        while (parent != null) {
            if (parent instanceof com.vaadin.ui.Window) {
                Window window = (Window) parent;
                window.setWindowMode(WindowMode.MAXIMIZED);
            }
            parent = parent.getParent();
        }
    }
}

Thank you for this idea, I’ve created an issue. We will implement this feature it in one of the next minor versions. See: https://youtrack.cuba-platform.com/issue/PL-9390

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-9390