Search in sources :

Example 1 with DialogWindow

use of com.haulmont.cuba.desktop.sys.DialogWindow in project cuba by cuba-platform.

the class DesktopWindow method setCaption.

@Override
public void setCaption(String caption) {
    this.caption = caption;
    DialogWindow dialogWindow = asDialogWindow();
    if (dialogWindow != null) {
        dialogWindow.setTitle(caption);
    } else {
        JPanel tabWindow = asTabWindow();
        if (tabWindow != null) {
            setTabCaptionAndDescription(tabWindow);
        } else {
            JPanel singleWindow = asDetachedWindow();
            if (singleWindow != null) {
                TopLevelFrame topLevelFrame = asTopLevelFrame();
                if (topLevelFrame != null) {
                    topLevelFrame.setTitle(formatTabCaption(caption, description));
                }
                windowManager.getBreadCrumbs(singleWindow).update();
            }
        }
    }
}
Also used : TopLevelFrame(com.haulmont.cuba.desktop.TopLevelFrame) DialogWindow(com.haulmont.cuba.desktop.sys.DialogWindow)

Example 2 with DialogWindow

use of com.haulmont.cuba.desktop.sys.DialogWindow in project cuba by cuba-platform.

the class DesktopWindow method setDescription.

@Override
public void setDescription(String description) {
    this.description = description;
    DialogWindow dialogWindow = asDialogWindow();
    if (dialogWindow != null) {
        dialogWindow.setTitle(caption);
    } else {
        JPanel tabWindow = asTabWindow();
        if (tabWindow != null) {
            setTabCaptionAndDescription(tabWindow);
        } else {
            JPanel singleWindow = asDetachedWindow();
            if (singleWindow != null) {
                TopLevelFrame topLevelFrame = asTopLevelFrame();
                if (topLevelFrame != null) {
                    topLevelFrame.setTitle(formatTabCaption(caption, description));
                }
            }
        }
    }
}
Also used : TopLevelFrame(com.haulmont.cuba.desktop.TopLevelFrame) DialogWindow(com.haulmont.cuba.desktop.sys.DialogWindow)

Example 3 with DialogWindow

use of com.haulmont.cuba.desktop.sys.DialogWindow in project cuba by cuba-platform.

the class DesktopWindow method requestRepaint.

protected void requestRepaint() {
    if (!scheduledRepaint) {
        SwingUtilities.invokeLater(() -> {
            getContainer().revalidate();
            getContainer().repaint();
            java.awt.Container container = getContainer().getTopLevelAncestor();
            if (container instanceof DialogWindow) {
                DialogWindow dialog = (DialogWindow) container;
                if (!dialog.isResizable() && (getHeight() <= 0 || getWidth() <= 0)) {
                    dialog.pack();
                }
            }
            scheduledRepaint = false;
        });
        scheduledRepaint = true;
    }
}
Also used : DialogWindow(com.haulmont.cuba.desktop.sys.DialogWindow) java.awt(java.awt)

Example 4 with DialogWindow

use of com.haulmont.cuba.desktop.sys.DialogWindow in project cuba by cuba-platform.

the class DefaultExceptionHandler method handle.

@Override
public boolean handle(Thread thread, Throwable exception) {
    JXErrorPane errorPane = new JXErrorPaneExt();
    errorPane.setErrorInfo(createErrorInfo(exception));
    JDialog dialog = JXErrorPane.createDialog(App.getInstance().getMainFrame(), errorPane);
    dialog.setMinimumSize(new Dimension(600, (int) dialog.getMinimumSize().getHeight()));
    final DialogWindow lastDialogWindow = getLastDialogWindow();
    dialog.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosed(WindowEvent e) {
            if (lastDialogWindow != null)
                lastDialogWindow.enableWindow();
            else
                App.getInstance().getMainFrame().activate();
        }
    });
    dialog.setModal(false);
    if (lastDialogWindow != null)
        lastDialogWindow.disableWindow(null);
    else
        App.getInstance().getMainFrame().deactivate(null);
    dialog.setVisible(true);
    return true;
}
Also used : JXErrorPaneExt(com.haulmont.cuba.desktop.sys.JXErrorPaneExt) WindowEvent(java.awt.event.WindowEvent) WindowAdapter(java.awt.event.WindowAdapter) JXErrorPane(org.jdesktop.swingx.JXErrorPane) DialogWindow(com.haulmont.cuba.desktop.sys.DialogWindow)

Aggregations

DialogWindow (com.haulmont.cuba.desktop.sys.DialogWindow)4 TopLevelFrame (com.haulmont.cuba.desktop.TopLevelFrame)2 JXErrorPaneExt (com.haulmont.cuba.desktop.sys.JXErrorPaneExt)1 java.awt (java.awt)1 WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 JXErrorPane (org.jdesktop.swingx.JXErrorPane)1