Search in sources :

Example 21 with RootPaneContainer

use of javax.swing.RootPaneContainer in project com.revolsys.open by revolsys.

the class AbstractRunnable method run.

@Override
public final void run() {
    try {
        if (isShowWaitCursor() && isEventDispatchThread()) {
            final Window activeWindow = getActiveWindow();
            if (activeWindow == null) {
                runDo();
            } else {
                Component component;
                Component glassPane = null;
                if (activeWindow instanceof RootPaneContainer) {
                    final RootPaneContainer container = (RootPaneContainer) activeWindow;
                    glassPane = container.getGlassPane();
                    glassPane.setVisible(true);
                    component = glassPane;
                } else {
                    component = activeWindow;
                }
                final Cursor cursor = activeWindow.getCursor();
                try {
                    component.setCursor(WAIT_CURSOR);
                    runDo();
                } finally {
                    if (glassPane != null) {
                        glassPane.setVisible(false);
                    }
                    component.setCursor(cursor);
                }
            }
        } else {
            runDo();
        }
    } catch (final Throwable t) {
        Logs.error(this, t);
    }
}
Also used : Window(java.awt.Window) RootPaneContainer(javax.swing.RootPaneContainer) Component(java.awt.Component) Cursor(java.awt.Cursor)

Example 22 with RootPaneContainer

use of javax.swing.RootPaneContainer in project com.revolsys.open by revolsys.

the class AbstractSwingWorker method done.

@Override
protected final void done() {
    final Window activeWindow = SwingUtil.getActiveWindow();
    if (isShowBusyCursor() && activeWindow != null) {
        Component component;
        Component glassPane = null;
        if (activeWindow instanceof RootPaneContainer) {
            final RootPaneContainer container = (RootPaneContainer) activeWindow;
            glassPane = container.getGlassPane();
            SwingUtil.setVisible(glassPane, true);
            component = glassPane;
        } else {
            component = activeWindow;
        }
        final Cursor cursor = activeWindow.getCursor();
        try {
            component.setCursor(WAIT_CURSOR);
            doDoneTask();
        } finally {
            if (glassPane != null) {
                SwingUtil.setVisible(glassPane, false);
            }
            component.setCursor(cursor);
        }
    } else {
        doDoneTask();
    }
}
Also used : Window(java.awt.Window) RootPaneContainer(javax.swing.RootPaneContainer) Component(java.awt.Component) Cursor(java.awt.Cursor)

Example 23 with RootPaneContainer

use of javax.swing.RootPaneContainer in project CodenameOne by codenameone.

the class BlockingAction method run.

public final void run() {
    try {
        exectute();
        SwingUtilities.invokeAndWait(new Runnable() {

            public void run() {
                afterComplete();
            }
        });
    } catch (Exception err) {
        err.printStackTrace();
    } finally {
        t.stop();
        RootPaneContainer r = (RootPaneContainer) ResourceEditorApp.getApplication().getMainFrame();
        r.setGlassPane(glassPane);
    }
}
Also used : RootPaneContainer(javax.swing.RootPaneContainer) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 24 with RootPaneContainer

use of javax.swing.RootPaneContainer in project CodenameOne by codenameone.

the class BaseForm method setOverrideMode.

public synchronized void setOverrideMode(boolean overrideMode, java.awt.Component c) {
    RootPaneContainer r = (RootPaneContainer) SwingUtilities.windowForComponent(c);
    if (overrideMode) {
        if (overrideImage == null) {
            overrideImage = new ImageIcon(getClass().getResource("/override_stamp.png"));
        }
        PainterGlasspane pg = new PainterGlasspane();
        MattePainter matte = new MattePainter(new Color(0xcc, 0xcc, 0xcc, 120)) {

            protected void doPaint(java.awt.Graphics2D g, java.lang.Object component, int width, int height) {
                super.doPaint(g, component, width, height);
                overrideImage.paintIcon(BaseForm.this, g, 0, 0);
            // g.drawImage(overrideImage.getImage(), width / 2 - overrideImage.getIconWidth() / 2, 0, BaseForm.this);
            }
        };
        pg.setPainter(matte);
        pg.addTarget(this);
        r.setGlassPane(pg);
        pg.setBounds(0, 0, r.getContentPane().getWidth(), r.getContentPane().getHeight());
        pg.setVisible(true);
    } else {
        r.setGlassPane(new JLabel());
    }
}
Also used : MattePainter(org.jdesktop.swingx.painter.MattePainter) ImageIcon(javax.swing.ImageIcon) Color(java.awt.Color) RootPaneContainer(javax.swing.RootPaneContainer) JLabel(javax.swing.JLabel) PainterGlasspane(org.jdesktop.swingx.painter.PainterGlasspane) Graphics2D(java.awt.Graphics2D)

Example 25 with RootPaneContainer

use of javax.swing.RootPaneContainer in project vcell by virtualcell.

the class ClientMDIManager method blockWindow.

public static Window blockWindow(Component component) {
    Window window = (Window) BeanUtils.findTypeParentOfComponent(component, Window.class);
    if (window instanceof RootPaneContainer) {
        GlassPane glass = new GlassPane(true);
        ((RootPaneContainer) window).setGlassPane(glass);
        glass.setVisible(true);
    }
    return window;
}
Also used : TopLevelWindow(cbit.vcell.client.desktop.TopLevelWindow) FieldDataWindow(cbit.vcell.field.gui.FieldDataWindow) Window(java.awt.Window) DocumentWindow(cbit.vcell.client.desktop.DocumentWindow) TestingFrameworkWindow(cbit.vcell.client.desktop.TestingFrameworkWindow) RootPaneContainer(javax.swing.RootPaneContainer) GlassPane(org.vcell.util.gui.GlassPane)

Aggregations

RootPaneContainer (javax.swing.RootPaneContainer)25 Component (java.awt.Component)5 Window (java.awt.Window)5 Controller (org.freeplane.features.mode.Controller)4 JComponent (javax.swing.JComponent)3 ResourceController (org.freeplane.core.resources.ResourceController)3 IconController (org.freeplane.features.icon.IconController)3 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)3 LinkController (org.freeplane.features.link.LinkController)3 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)3 MapController (org.freeplane.features.map.MapController)3 MMapController (org.freeplane.features.map.mindmapmode.MMapController)3 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 MNodeStyleController (org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController)3 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)3 ViewController (org.freeplane.features.ui.ViewController)3 Container (java.awt.Container)2 Cursor (java.awt.Cursor)2 ImageIcon (javax.swing.ImageIcon)2