Search in sources :

Example 1 with RuntimeWindow

use of com.servoy.j2db.scripting.RuntimeWindow in project servoy-client by Servoy.

the class NGFormManager method showFormInDialog.

@Override
public void showFormInDialog(String formName, Rectangle bounds, String title, boolean resizeble, boolean showTextToolbar, boolean closeAll, boolean modal, String windowName) {
    // first window is modal, second reuses same dialog
    boolean legacyV3Behavior = false;
    if (windowName == null) {
        windowName = DEFAULT_DIALOG_NAME;
        legacyV3Behavior = true;
    }
    RuntimeWindow thisWindow = application.getRuntimeWindowManager().getWindow(windowName);
    if (thisWindow != null && thisWindow.getType() != JSWindow.DIALOG && thisWindow.getType() != JSWindow.MODAL_DIALOG) {
        // make sure it is closed before reference to it is lost
        thisWindow.hide(true);
        thisWindow.destroy();
        thisWindow = null;
    }
    if (thisWindow == null) {
        thisWindow = application.getRuntimeWindowManager().createWindow(windowName, modal ? JSWindow.MODAL_DIALOG : JSWindow.DIALOG, null);
    }
    thisWindow.setInitialBounds(bounds.x, bounds.y, bounds.width, bounds.height);
    thisWindow.showTextToolbar(showTextToolbar);
    thisWindow.setTitle(title);
    thisWindow.setResizable(resizeble);
    thisWindow.oldShow(formName, closeAll, legacyV3Behavior);
}
Also used : RuntimeWindow(com.servoy.j2db.scripting.RuntimeWindow)

Example 2 with RuntimeWindow

use of com.servoy.j2db.scripting.RuntimeWindow in project servoy-client by Servoy.

the class FormManager method showFormInFrame.

public void showFormInFrame(String formName, Rectangle bounds, String windowTitle, boolean resizeble, boolean showTextToolbar, String windowName) {
    if (windowName == null) {
        windowName = DEFAULT_DIALOG_NAME;
    }
    RuntimeWindow thisWindow = application.getRuntimeWindowManager().getWindow(windowName);
    if (thisWindow != null && thisWindow.getType() != JSWindow.WINDOW) {
        // make sure it's closed before reference to it is lost
        thisWindow.hide(true);
        thisWindow.destroy();
        thisWindow = null;
    }
    if (thisWindow == null) {
        thisWindow = application.getRuntimeWindowManager().createWindow(windowName, JSWindow.WINDOW, null);
    }
    thisWindow.setInitialBounds(bounds.x, bounds.y, bounds.width, bounds.height);
    thisWindow.showTextToolbar(showTextToolbar);
    thisWindow.setTitle(windowTitle);
    thisWindow.setResizable(resizeble);
    // last two params are really not relevant for windows
    thisWindow.oldShow(formName, true, false);
}
Also used : RuntimeWindow(com.servoy.j2db.scripting.RuntimeWindow)

Example 3 with RuntimeWindow

use of com.servoy.j2db.scripting.RuntimeWindow in project servoy-client by Servoy.

the class FormManager method destroyContainer.

protected void destroyContainer(IMainContainer container) {
    RuntimeWindow w = application.getRuntimeWindowManager().getWindow(container.getContainerName());
    if (w != null)
        w.destroy();
    FormController fc = container.getController();
    if (fc != null && fc.isFormVisible()) {
        fc.getFormUI().setComponentVisible(false);
        List<Runnable> invokeLaterRunnables = new ArrayList<Runnable>();
        fc.notifyVisible(false, invokeLaterRunnables);
        Utils.invokeLater(application, invokeLaterRunnables);
    }
    container.flushCachedItems();
}
Also used : RuntimeWindow(com.servoy.j2db.scripting.RuntimeWindow) ArrayList(java.util.ArrayList)

Example 4 with RuntimeWindow

use of com.servoy.j2db.scripting.RuntimeWindow in project servoy-client by Servoy.

the class NGRuntimeWindowManager method destroy.

public void destroy(boolean keepMainApplicationWindow) {
    List<Entry<String, RuntimeWindow>> copy = new ArrayList<>(windows.entrySet());
    for (Entry<String, RuntimeWindow> we : copy) {
        RuntimeWindow rw = we.getValue();
        if (rw != null) {
            if (rw instanceof NGRuntimeWindow) {
                ((NGRuntimeWindow) rw).setController(null);
            }
            if (keepMainApplicationWindow && rw.equals(getMainApplicationWindow())) {
                continue;
            }
            if (rw instanceof NGRuntimeWindow) {
                rw.destroy();
            }
        }
        windows.remove(we.getKey());
    }
}
Also used : Entry(java.util.Map.Entry) RuntimeWindow(com.servoy.j2db.scripting.RuntimeWindow) ArrayList(java.util.ArrayList)

Example 5 with RuntimeWindow

use of com.servoy.j2db.scripting.RuntimeWindow in project servoy-client by Servoy.

the class SwingRuntimeWindow method getParent.

// For future implementation of case 286968 change
// @Override
// public int getState()
// {
// if (wrappedWindow instanceof JFrame)
// {
// int extendedState = ((JFrame)wrappedWindow).getExtendedState();
// int servoyState = NORMAL; // 0
// if ((extendedState & Frame.ICONIFIED) == Frame.ICONIFIED) servoyState = servoyState | ICONIFIED;
// if ((extendedState & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) servoyState = servoyState | MAXIMIZED;
// return servoyState;
// }
// else
// {
// return super.getState();
// }
// }
@Override
public JSWindow getParent() {
    if (wrappedWindow != null) {
        Window parent = wrappedWindow.getOwner();
        RuntimeWindow pw;
        if (parent == getApplication().getMainApplicationFrame()) {
            pw = getApplication().getRuntimeWindowManager().getWindow(null);
        } else if (parent != null) {
            pw = getApplication().getRuntimeWindowManager().getWindow(parent.getName());
        } else
            pw = null;
        return (pw != null) ? pw.getJSWindow() : null;
    }
    return super.getParent();
}
Also used : ISmartRuntimeWindow(com.servoy.j2db.plugins.ISmartRuntimeWindow) RuntimeWindow(com.servoy.j2db.scripting.RuntimeWindow) Window(java.awt.Window) JSWindow(com.servoy.j2db.scripting.JSWindow) FormWindow(com.servoy.j2db.FormWindow) ISmartRuntimeWindow(com.servoy.j2db.plugins.ISmartRuntimeWindow) RuntimeWindow(com.servoy.j2db.scripting.RuntimeWindow)

Aggregations

RuntimeWindow (com.servoy.j2db.scripting.RuntimeWindow)13 FormWindow (com.servoy.j2db.FormWindow)3 ISmartRuntimeWindow (com.servoy.j2db.plugins.ISmartRuntimeWindow)3 JSWindow (com.servoy.j2db.scripting.JSWindow)3 Window (java.awt.Window)3 IMainContainer (com.servoy.j2db.IMainContainer)2 FormDialog (com.servoy.j2db.gui.FormDialog)2 ArrayList (java.util.ArrayList)2 FormController (com.servoy.j2db.FormController)1 FormManager (com.servoy.j2db.FormManager)1 Pair (com.servoy.j2db.util.Pair)1 Entry (java.util.Map.Entry)1 IWebsocketEndpoint (org.sablo.websocket.IWebsocketEndpoint)1