Search in sources :

Example 1 with DisabledGlassPane

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

the class DetachedFrame method initUI.

private void initUI() {
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    glassPane = new DisabledGlassPane();
    JRootPane rootPane = SwingUtilities.getRootPane(this);
    rootPane.setGlassPane(glassPane);
    final java.awt.Component topLevelGlassPane = DesktopComponentsHelper.getTopLevelFrame(parentContainer).getGlassPane();
    topLevelGlassPane.addHierarchyListener(new HierarchyListener() {

        @Override
        public void hierarchyChanged(HierarchyEvent e) {
            if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) == HierarchyEvent.SHOWING_CHANGED) {
                if (topLevelGlassPane.isVisible()) {
                    glassPane.activate(null);
                } else {
                    glassPane.deactivate();
                }
            }
        }
    });
}
Also used : HierarchyEvent(java.awt.event.HierarchyEvent) DisabledGlassPane(com.haulmont.cuba.desktop.sys.DisabledGlassPane) java.awt(java.awt) HierarchyListener(java.awt.event.HierarchyListener)

Example 2 with DisabledGlassPane

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

the class TopLevelFrame method initUI.

protected void initUI() {
    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    glassPane = new DisabledGlassPane();
    JRootPane rootPane = SwingUtilities.getRootPane(this);
    rootPane.setGlassPane(glassPane);
    Configuration configuration = AppBeans.get(Configuration.NAME);
    DesktopConfig config = configuration.getConfig(DesktopConfig.class);
    DesktopResources resources = App.getInstance().getResources();
    if (StringUtils.isNotEmpty(config.getWindowIcon())) {
        setIconImage(resources.getImage(config.getWindowIcon()));
    }
}
Also used : Configuration(com.haulmont.cuba.core.global.Configuration) DisabledGlassPane(com.haulmont.cuba.desktop.sys.DisabledGlassPane)

Aggregations

DisabledGlassPane (com.haulmont.cuba.desktop.sys.DisabledGlassPane)2 Configuration (com.haulmont.cuba.core.global.Configuration)1 java.awt (java.awt)1 HierarchyEvent (java.awt.event.HierarchyEvent)1 HierarchyListener (java.awt.event.HierarchyListener)1