Search in sources :

Example 11 with RootPaneContainer

use of javax.swing.RootPaneContainer in project spring-framework by spring-projects.

the class ProxyFactoryTests method testExclusionOfNonPublicInterfaces.

@Test
@Disabled("Not implemented yet, see https://jira.springframework.org/browse/SPR-5708")
public void testExclusionOfNonPublicInterfaces() {
    JFrame frame = new JFrame();
    ProxyFactory proxyFactory = new ProxyFactory(frame);
    Object proxy = proxyFactory.getProxy();
    assertThat(proxy instanceof RootPaneContainer).isTrue();
    assertThat(proxy instanceof Accessible).isTrue();
}
Also used : JFrame(javax.swing.JFrame) RootPaneContainer(javax.swing.RootPaneContainer) Accessible(javax.accessibility.Accessible) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 12 with RootPaneContainer

use of javax.swing.RootPaneContainer in project n2a by frothga.

the class Lay method setHints.

private static void setHints(Component cmp, HintList hints) {
    HintList finalHints = new HintList();
    finalHints.addHints(globalHints);
    finalHints.addHints(hints);
    for (HintPair hint : finalHints) {
        String key = hint.key;
        String value = hint.value;
        String lowerKey = key.toLowerCase();
        if (hintProcessors.containsKey(lowerKey)) {
            HintProcessor hp = hintProcessors.get(lowerKey);
            Component cmpSelected = null;
            try {
                // itself to which to apply the hint.
                if (hp.applicableTo == HintProcessor.WIN) {
                    cmpSelected = cmp;
                    if (isContentPane(cmpSelected)) {
                        while (!(cmpSelected instanceof Window)) {
                            cmpSelected = cmpSelected.getParent();
                        }
                    }
                // If this hint is allowed to be applied to either
                // windows or non-windows, make sure content panes
                // are replaced with their parent windows. This
                // assumes however that a developer would never
                // explicitly send in a content pane panel wanting
                // these types of hints applied (this could be
                // thought out better). However, right now this
                // meets the need of 'visible' being applied to
                // both Windows and non-content pane panels inside
                // contained by the window.
                } else if (hp.applicableTo == HintProcessor.BOTH) {
                    cmpSelected = cmp;
                    if (isContentPane(cmpSelected)) {
                        while (!(cmpSelected instanceof Window)) {
                            cmpSelected = cmpSelected.getParent();
                        }
                    }
                // If this hint is for non-window components only,
                // Make sure we apply it to the window's content pane
                // IF original component is a window.
                } else {
                    cmpSelected = cmp;
                    if (isContentPaneHolder(cmpSelected)) {
                        cmpSelected = ((RootPaneContainer) cmpSelected).getContentPane();
                    }
                }
                hp.process(value, cmpSelected, hints);
                if (debugOn) {
                    System.out.println("Applied hint (" + lowerKey + "=" + value + ") to [" + cmpSelected + "]");
                }
            } catch (Exception e) {
                // Soft fail (ClassCastException, NumberFormatException most common)
                if (debugOn) {
                    System.err.println("Hint error (" + lowerKey + "=" + value + ") to [" + cmpSelected + "]");
                    e.printStackTrace();
                }
            }
        }
    }
}
Also used : Window(java.awt.Window) RootPaneContainer(javax.swing.RootPaneContainer) Component(java.awt.Component) JComponent(javax.swing.JComponent) JTextComponent(javax.swing.text.JTextComponent)

Example 13 with RootPaneContainer

use of javax.swing.RootPaneContainer in project jodd by oblac.

the class SwingSpy method showSpyDialog.

/**
	 * Shows spy dialog or reload existing one.
	 *
	 * @param rootComponent root component
	 * @param component current component
	 */
public void showSpyDialog(final Component rootComponent, final Component component) {
    if (spyDialog != null) {
        spyDialog.setVisible(true);
        spyGlass.setVisible(true);
        spyPanel.reload(rootComponent, component);
        return;
    }
    if (rootComponent instanceof RootPaneContainer) {
        RootPaneContainer rootPane = (RootPaneContainer) rootComponent;
        spyGlass = new SwingSpyGlassPane(rootPane);
        rootPane.setGlassPane(spyGlass);
        rootPane.getGlassPane().setVisible(true);
        Toolkit.getDefaultToolkit().addAWTEventListener(spyGlass, AWTEvent.MOUSE_MOTION_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);
    }
    SwingUtilities.invokeLater(new Runnable() {

        public void run() {
            initSpyDialog(rootComponent, component);
        }
    });
}
Also used : RootPaneContainer(javax.swing.RootPaneContainer)

Example 14 with RootPaneContainer

use of javax.swing.RootPaneContainer in project intellij-community by JetBrains.

the class ScrollSettings method isInterpolationEligibleFor.

/* A heuristics that disables scrolling interpolation in diff / merge windows.
     We need to to make scrolling synchronization compatible with the interpolation first.

     NOTE: The implementation is a temporary, ad-hoc heuristics that is needed solely to
           facilitate testing of the experimental "true smooth scrolling" feature. */
static boolean isInterpolationEligibleFor(JScrollBar scrollbar) {
    Window window = (Window) scrollbar.getTopLevelAncestor();
    if (window instanceof JDialog && "Commit Changes".equals(((JDialog) window).getTitle())) {
        return false;
    }
    if (!(window instanceof RootPaneContainer)) {
        return true;
    }
    Component[] components = ((RootPaneContainer) window).getContentPane().getComponents();
    if (components.length == 1 && components[0].getClass().getName().contains("DiffWindow")) {
        return false;
    }
    if (components.length == 2 && components[0] instanceof Container) {
        Component[] subComponents = ((Container) components[0]).getComponents();
        if (subComponents.length == 1) {
            String name = subComponents[0].getClass().getName();
            if (name.contains("DiffWindow") || name.contains("MergeWindow")) {
                return false;
            }
        }
    }
    return true;
}
Also used : Window(java.awt.Window) RootPaneContainer(javax.swing.RootPaneContainer) Container(java.awt.Container) RootPaneContainer(javax.swing.RootPaneContainer) Component(java.awt.Component) JDialog(javax.swing.JDialog)

Example 15 with RootPaneContainer

use of javax.swing.RootPaneContainer in project pcgen by PCGen.

the class CursorControlUtilities method startWaitCursor.

public static void startWaitCursor(JComponent component) {
    RootPaneContainer root = ((RootPaneContainer) component.getTopLevelAncestor());
    root.getGlassPane().setCursor(WAIT_CURSOR);
    root.getGlassPane().addMouseListener(CLICK_CONSUMER);
    root.getGlassPane().setVisible(true);
    root.getRootPane().validate();
}
Also used : RootPaneContainer(javax.swing.RootPaneContainer)

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