Package org.noos.xing.mydoggy.plaf.ui.cmp

Examples of org.noos.xing.mydoggy.plaf.ui.cmp.ModalWindow


            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getSource() != descriptor)
                    return;

                if (window.isVisible()) {
                    ModalWindow oldWindow = window;

                    // Clean
                    Component focusOwner = oldWindow.getWindow().getFocusOwner();
                    oldWindow.setVisible(false);
                    oldWindow.getWindow().removeMouseMotionListener(resizeMouseInputHandler);
                    oldWindow.getWindow().removeMouseListener(resizeMouseInputHandler);
                    oldWindow.getWindow().removeComponentListener(windowComponentAdapter);

                    // Init new window
                    if ((Boolean) evt.getNewValue()) {
                        window = new JModalFrame(toolWindow,
                                                 resourceManager,
                                                 resourceManager.getBoolean("dialog.owner.enabled", true) ? descriptor.getWindowAnchestor() : null,
                                                 null,
                                                 false);
                    } else {
                        window = new JModalWindow(resourceManager,
                                                  resourceManager.getBoolean("dialog.owner.enabled", true) ? descriptor.getWindowAnchestor() : null,
                                                  null,
                                                  false);
                    }
                    window.setBounds(oldWindow.getBounds());
                    window.setName("toolWindow.floating.window." + toolWindow.getId());
                    window.setContentPane(oldWindow.getContentPane());
                    resizeMouseInputHandler = new FloatingResizeMouseInputHandler(window.getWindow());
                    moveMouseInputHandler = new FloatingMoveMouseInputHandler(window.getWindow());
                    window.getWindow().addMouseMotionListener(resizeMouseInputHandler);
                    window.getWindow().addMouseListener(resizeMouseInputHandler);
                    window.getWindow().addComponentListener(windowComponentAdapter);

                    // Dispose old
                    oldWindow.getWindow().dispose();

                    // Show new
                    window.setVisible(true);

                    if (focusOwner != null)
                        SwingUtil.requestFocus(focusOwner);
                } else {
                    ModalWindow oldWindow = window;

                    // Clean old window
                    oldWindow.getWindow().removeComponentListener(windowComponentAdapter);
                    oldWindow.getWindow().removeMouseMotionListener(resizeMouseInputHandler);
                    oldWindow.getWindow().removeMouseListener(resizeMouseInputHandler);

                    // Prepare for new
                    if ((Boolean) evt.getNewValue()) {
                        window = new JModalFrame(toolWindow,
                                                 resourceManager,
                                                 resourceManager.getBoolean("dialog.owner.enabled", true) ? descriptor.getWindowAnchestor() : null,
                                                 null,
                                                 false);
                    } else {
                        window = new JModalWindow(resourceManager,
                                                  resourceManager.getBoolean("dialog.owner.enabled", true) ? descriptor.getWindowAnchestor() : null,
                                                  null,
                                                  false);
                    }

                    window.setName("toolWindow.floating.window." + toolWindow.getId());
                    window.setContentPane(oldWindow.getContentPane());
                    resizeMouseInputHandler = new FloatingResizeMouseInputHandler(window.getWindow());
                    moveMouseInputHandler = new FloatingMoveMouseInputHandler(window.getWindow());
                    window.getWindow().addMouseMotionListener(resizeMouseInputHandler);
                    window.getWindow().addMouseListener(resizeMouseInputHandler);
                    window.getWindow().addComponentListener(new WindowComponentAdapter());

                    // Finalize clean
                    oldWindow.getWindow().dispose();
                }
            }
        });
        addPropertyChangeListener("enabled", new TypeEnabledPropertyChangeListener());
View Full Code Here

TOP

Related Classes of org.noos.xing.mydoggy.plaf.ui.cmp.ModalWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.