类sun.awt.AWTAccessor.ComponentAccessor源码实例Demo

下面列出了怎么用sun.awt.AWTAccessor.ComponentAccessor的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: Bytecoder   文件: DropTarget.java
/**
 * Notify the DropTarget that it has been associated with a Component
 *
 **********************************************************************
 * This method is usually called from java.awt.Component.addNotify() of
 * the Component associated with this DropTarget to notify the DropTarget
 * that a ComponentPeer has been associated with that Component.
 *
 * Calling this method, other than to notify this DropTarget of the
 * association of the ComponentPeer with the Component may result in
 * a malfunction of the DnD system.
 **********************************************************************
 */
public void addNotify() {
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    ComponentPeer peer = acc.getPeer(component);
    if (peer == null || peer == componentPeer) {
        return;
    }

    componentPeer = peer;


    for (Component c = component;
         c != null && peer instanceof LightweightPeer; c = c.getParent()) {
        peer = acc.getPeer(c);
    }

    if (peer instanceof DropTargetPeer) {
        nativePeer = (DropTargetPeer) peer;
        ((DropTargetPeer)peer).addDropTarget(this);
    } else {
        nativePeer = null;
    }
}
 
源代码2 项目: Bytecoder   文件: KeyboardFocusManagerPeerImpl.java
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? acc.getPeer(component) : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick && acc.canBeFocusOwner(component);
}
 
源代码3 项目: openjdk-jdk9   文件: DropTarget.java
/**
 * Notify the DropTarget that it has been associated with a Component
 *
 **********************************************************************
 * This method is usually called from java.awt.Component.addNotify() of
 * the Component associated with this DropTarget to notify the DropTarget
 * that a ComponentPeer has been associated with that Component.
 *
 * Calling this method, other than to notify this DropTarget of the
 * association of the ComponentPeer with the Component may result in
 * a malfunction of the DnD system.
 **********************************************************************
 */
public void addNotify() {
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    ComponentPeer peer = acc.getPeer(component);
    if (peer == null || peer == componentPeer) {
        return;
    }

    componentPeer = peer;


    for (Component c = component;
         c != null && peer instanceof LightweightPeer; c = c.getParent()) {
        peer = acc.getPeer(c);
    }

    if (peer instanceof DropTargetPeer) {
        nativePeer = (DropTargetPeer) peer;
        ((DropTargetPeer)peer).addDropTarget(this);
    } else {
        nativePeer = null;
    }
}
 
public static boolean shouldFocusOnClick(Component component) {
    boolean acceptFocusOnClick = false;

    // A component is generally allowed to accept focus on click
    // if its peer is focusable. There're some exceptions though.


    // CANVAS & SCROLLBAR accept focus on click
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (component instanceof Canvas ||
        component instanceof Scrollbar)
    {
        acceptFocusOnClick = true;

    // PANEL, empty only, accepts focus on click
    } else if (component instanceof Panel) {
        acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);


    // Other components
    } else {
        ComponentPeer peer = (component != null ? acc.getPeer(component) : null);
        acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
    }
    return acceptFocusOnClick && acc.canBeFocusOwner(component);
}
 
源代码5 项目: openjdk-jdk9   文件: XWindow.java
static XWindow getParentXWindowObject(Component target) {
    if (target == null) return null;
    Component temp = target.getParent();
    if (temp == null) return null;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    ComponentPeer peer = acc.getPeer(temp);
    if (peer == null) return null;
    while ((peer != null) && !(peer instanceof XWindow))
    {
        temp = temp.getParent();
        peer = acc.getPeer(temp);
    }
    if (peer != null && peer instanceof XWindow)
        return (XWindow) peer;
    else return null;
}
 
源代码6 项目: openjdk-jdk9   文件: XWindow.java
public void handleExposeEvent(XEvent xev) {
    super.handleExposeEvent(xev);
    XExposeEvent xe = xev.get_xexpose();
    if (isEventDisabled(xev)) {
        return;
    }

    int x = scaleDown(xe.get_x());
    int y = scaleDown(xe.get_y());
    int w = scaleDown(xe.get_width());
    int h = scaleDown(xe.get_height());

    Component target = getEventSource();
    ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();

    if (!compAccessor.getIgnoreRepaint(target)
        && compAccessor.getWidth(target) != 0
        && compAccessor.getHeight(target) != 0)
    {
        postPaintEvent(target, x, y, w, h);
    }
}
 
源代码7 项目: openjdk-jdk9   文件: XWindowPeer.java
public void recursivelySetIcon(java.util.List<IconInfo> icons) {
    dumpIcons(winAttr.icons);
    setIconHints(icons);
    Window target = (Window)this.target;
    Window[] children = target.getOwnedWindows();
    int cnt = children.length;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    for (int i = 0; i < cnt; i++) {
        final ComponentPeer childPeer = acc.getPeer(children[i]);
        if (childPeer != null && childPeer instanceof XWindowPeer) {
            if (((XWindowPeer)childPeer).winAttr.iconsInherited) {
                ((XWindowPeer)childPeer).winAttr.icons = icons;
                ((XWindowPeer)childPeer).recursivelySetIcon(icons);
            }
        }
    }
}
 
源代码8 项目: openjdk-jdk9   文件: XWindowPeer.java
public void repositionSecurityWarning() {
    // NOTE: On KWin if the window/border snapping option is enabled,
    // the Java window may be swinging while it's being moved.
    // This doesn't make the application unusable though looks quite ugly.
    // Probobly we need to find some hint to assign to our Security
    // Warning window in order to exclude it from the snapping option.
    // We are not currently aware of existance of such a property.
    if (warningWindow != null) {
        // We can't use the coordinates stored in the XBaseWindow since
        // they are zeros for decorated frames.
        ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
        int x = compAccessor.getX(target);
        int y = compAccessor.getY(target);
        int width = compAccessor.getWidth(target);
        int height = compAccessor.getHeight(target);
        warningWindow.reposition(x, y, width, height);
    }
}
 
源代码9 项目: openjdk-jdk9   文件: XPanelPeer.java
public void setBackground(Color c) {
    Component comp;
    int i;

    Container cont = (Container) target;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    synchronized(target.getTreeLock()) {
        int n = cont.getComponentCount();
        for(i=0; i < n; i++) {
            comp = cont.getComponent(i);
            ComponentPeer peer = acc.getPeer(comp);
            if (peer != null) {
                Color color = comp.getBackground();
                if (color == null || color.equals(c)) {
                    peer.setBackground(c);
                }
            }
        }
    }
    super.setBackground(c);
}
 
源代码10 项目: openjdk-jdk9   文件: XPanelPeer.java
private void setForegroundForHierarchy(Container cont, Color c) {
    synchronized(target.getTreeLock()) {
        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
        int n = cont.getComponentCount();
        for(int i=0; i < n; i++) {
            Component comp = cont.getComponent(i);
            Color color = comp.getForeground();
            if (color == null || color.equals(c)) {
                ComponentPeer cpeer = acc.getPeer(comp);
                if (cpeer != null) {
                    cpeer.setForeground(c);
                }
                if (cpeer instanceof LightweightPeer
                    && comp instanceof Container)
                {
                    setForegroundForHierarchy((Container) comp, c);
                }
            }
        }
    }
}
 
源代码11 项目: openjdk-jdk9   文件: D3DGraphicsDevice.java
@Override
protected void addFSWindowListener(Window w) {
    // if the window is not a toplevel (has an owner) we have to use the
    // real toplevel to enter the full-screen mode with (4933099).
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (!(w instanceof Frame) && !(w instanceof Dialog) &&
        (realFSWindow = getToplevelOwner(w)) != null)
    {
        ownerOrigBounds = realFSWindow.getBounds();
        WWindowPeer fp = acc.getPeer(realFSWindow);
        ownerWasVisible = realFSWindow.isVisible();
        Rectangle r = w.getBounds();
        // we use operations on peer instead of component because calling
        // them on component will take the tree lock
        fp.reshape(r.x, r.y, r.width, r.height);
        fp.setVisible(true);
    } else {
        realFSWindow = w;
    }

    fsWindowWasAlwaysOnTop = realFSWindow.isAlwaysOnTop();
    ((WWindowPeer) acc.getPeer(realFSWindow)).setAlwaysOnTop(true);

    fsWindowListener = new D3DFSWindowAdapter();
    realFSWindow.addWindowListener(fsWindowListener);
}
 
源代码12 项目: openjdk-jdk9   文件: WInputMethod.java
private WComponentPeer getNearestNativePeer(Component comp)
{
    if (comp==null)     return null;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    ComponentPeer peer = acc.getPeer(comp);
    if (peer==null)     return null;

    while (peer instanceof java.awt.peer.LightweightPeer) {
        comp = comp.getParent();
        if (comp==null) return null;
        peer = acc.getPeer(comp);
        if (peer==null) return null;
    }

    if (peer instanceof WComponentPeer)
        return (WComponentPeer)peer;
    else
        return null;

}
 
源代码13 项目: openjdk-jdk9   文件: TestXEmbedServer.java
public void addClient() {
    client = new Canvas() {
            public void paint(Graphics g) {
                super.paint(g);
            }
        };
    client.setBackground(new Color(30, 220, 40));
    clientCont.add(client);
    clientCont.validate();
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    WindowIDProvider pid = (WindowIDProvider)acc.getPeer(client);
    log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow());
    Rectangle toFocusBounds = toFocus.getBounds();
    toFocusBounds.setLocation(toFocus.getLocationOnScreen());
    f.validate();

    // KDE doesn't accept clicks on title as activation - click below title
    Rectangle fbounds = f.getBounds();
    fbounds.y += f.getInsets().top;
    fbounds.height -= f.getInsets().top;

    Process proc = startClient(new Rectangle[] {fbounds, dummy.getBounds(), toFocusBounds,
                                                new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()),
                                                new Rectangle(10, 130, 20, 20)}, pid.getWindow());
    new ClientWatcher(client, proc, clientCont).start();
}
 
源代码14 项目: Bytecoder   文件: BasicSplitPaneUI.java
/**
 * Should be messaged before the dragging session starts, resets
 * lastDragLocation and dividerSize.
 */
protected void startDragging() {
    Component       leftC = splitPane.getLeftComponent();
    Component       rightC = splitPane.getRightComponent();
    ComponentPeer   cPeer;

    beginDragDividerLocation = getDividerLocation(splitPane);
    draggingHW = false;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if(leftC != null && (cPeer = acc.getPeer(leftC)) != null &&
       !(cPeer instanceof LightweightPeer)) {
        draggingHW = true;
    } else if(rightC != null && (cPeer = acc.getPeer(rightC)) != null
              && !(cPeer instanceof LightweightPeer)) {
        draggingHW = true;
    }
    if(orientation == JSplitPane.HORIZONTAL_SPLIT) {
        setLastDragLocation(divider.getBounds().x);
        dividerSize = divider.getSize().width;
        if(!isContinuousLayout() && draggingHW) {
            nonContinuousLayoutDivider.setBounds
                    (getLastDragLocation(), 0, dividerSize,
                     splitPane.getHeight());
                  addHeavyweightDivider();
        }
    } else {
        setLastDragLocation(divider.getBounds().y);
        dividerSize = divider.getSize().height;
        if(!isContinuousLayout() && draggingHW) {
            nonContinuousLayoutDivider.setBounds
                    (0, getLastDragLocation(), splitPane.getWidth(),
                     dividerSize);
                  addHeavyweightDivider();
        }
    }
}
 
源代码15 项目: openjdk-jdk9   文件: BasicSplitPaneUI.java
/**
 * Should be messaged before the dragging session starts, resets
 * lastDragLocation and dividerSize.
 */
protected void startDragging() {
    Component       leftC = splitPane.getLeftComponent();
    Component       rightC = splitPane.getRightComponent();
    ComponentPeer   cPeer;

    beginDragDividerLocation = getDividerLocation(splitPane);
    draggingHW = false;
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if(leftC != null && (cPeer = acc.getPeer(leftC)) != null &&
       !(cPeer instanceof LightweightPeer)) {
        draggingHW = true;
    } else if(rightC != null && (cPeer = acc.getPeer(rightC)) != null
              && !(cPeer instanceof LightweightPeer)) {
        draggingHW = true;
    }
    if(orientation == JSplitPane.HORIZONTAL_SPLIT) {
        setLastDragLocation(divider.getBounds().x);
        dividerSize = divider.getSize().width;
        if(!isContinuousLayout() && draggingHW) {
            nonContinuousLayoutDivider.setBounds
                    (getLastDragLocation(), 0, dividerSize,
                     splitPane.getHeight());
                  addHeavyweightDivider();
        }
    } else {
        setLastDragLocation(divider.getBounds().y);
        dividerSize = divider.getSize().height;
        if(!isContinuousLayout() && draggingHW) {
            nonContinuousLayoutDivider.setBounds
                    (0, getLastDragLocation(), splitPane.getWidth(),
                     dividerSize);
                  addHeavyweightDivider();
        }
    }
}
 
源代码16 项目: openjdk-jdk9   文件: XComponentPeer.java
/**
 * @see java.awt.peer.ComponentPeer
 */
public void setEnabled(final boolean value) {
    if (enableLog.isLoggable(PlatformLogger.Level.FINE)) {
        enableLog.fine("{0}ing {1}", (value ? "Enabl" : "Disabl"), this);
    }
    boolean status = value;
    // If any of our heavyweight ancestors are disable, we should be too
    // See 6176875 for more information
    final Container cp = SunToolkit.getNativeContainer(target);
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (cp != null) {
        status &= acc.<XComponentPeer>getPeer(cp).isEnabled();
    }
    synchronized (getStateLock()) {
        if (enabled == status) {
            return;
        }
        enabled = status;
    }

    if (target instanceof Container) {
        final Component[] list = ((Container) target).getComponents();
        for (final Component child : list) {
            final ComponentPeer p = acc.getPeer(child);
            if (p != null) {
                p.setEnabled(status && child.isEnabled());
            }
        }
    }
    repaint();
}
 
源代码17 项目: openjdk-jdk9   文件: XComponentPeer.java
XWindowPeer getParentTopLevel() {
    ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
    Container parent = (target instanceof Container) ? ((Container)target) : (compAccessor.getParent(target));
    // Search for parent window
    while (parent != null && !(parent instanceof Window)) {
        parent = compAccessor.getParent(parent);
    }
    if (parent != null) {
        return (XWindowPeer)compAccessor.getPeer(parent);
    } else {
        return null;
    }
}
 
源代码18 项目: openjdk-jdk9   文件: XWindow.java
static long getParentWindowID(Component target) {

        Component temp = target.getParent();
        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
        ComponentPeer peer = acc.getPeer(temp);
        while (!(peer instanceof XWindow))
        {
            temp = temp.getParent();
            peer = acc.getPeer(temp);
        }

        if (peer != null && peer instanceof XWindow)
            return ((XWindow)peer).getContentWindow();
        else return 0;
    }
 
源代码19 项目: openjdk-jdk9   文件: XFileDialogPeer.java
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
    int id = keyEvent.getID();
    int keyCode = keyEvent.getKeyCode();

    if (id == KeyEvent.KEY_PRESSED && keyCode == KeyEvent.VK_ESCAPE) {
        synchronized (target.getTreeLock()) {
            Component comp = (Component) keyEvent.getSource();
            while (comp != null) {
                // Fix for 6240084 Disposing a file dialog when the drop-down is active does not dispose the dropdown menu, on Xtoolkit
                // See also 6259493
                ComponentAccessor acc = AWTAccessor.getComponentAccessor();
                if (comp == pathChoice) {
                    XChoicePeer choicePeer = acc.getPeer(pathChoice);
                    if (choicePeer.isUnfurled()){
                        return false;
                    }
                }
                Object peer = acc.getPeer(comp);
                if (peer == this) {
                    handleCancel();
                    return true;
                }
                comp = comp.getParent();
            }
        }
    }

    return false;
}
 
源代码20 项目: openjdk-jdk9   文件: LWWindowPeer.java
@Override
public void repositionSecurityWarning() {
    if (warningWindow != null) {
        ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
        Window target = getTarget();
        int x = compAccessor.getX(target);
        int y = compAccessor.getY(target);
        int width = compAccessor.getWidth(target);
        int height = compAccessor.getHeight(target);
        warningWindow.reposition(x, y, width, height);
    }
}
 
源代码21 项目: openjdk-jdk9   文件: LWWindowPeer.java
@SuppressWarnings("deprecation")
private boolean isOneOfOwnersOf(LWWindowPeer peer) {
    Window owner = (peer != null ? peer.getTarget().getOwner() : null);
    while (owner != null) {
        final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
        if (acc.getPeer(owner) == this) {
            return true;
        }
        owner = owner.getOwner();
    }
    return false;
}
 
源代码22 项目: openjdk-jdk9   文件: CPlatformWindow.java
@SuppressWarnings("deprecation")
public CPlatformWindow convertJComponentToTarget(final JRootPane p) {
    Component root = SwingUtilities.getRoot(p);
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (root == null || acc.getPeer(root) == null) return null;
    return (CPlatformWindow)((LWWindowPeer)acc.getPeer(root)).getPlatformWindow();
}
 
源代码23 项目: openjdk-jdk9   文件: CPlatformWindow.java
@Override  // PlatformWindow
public void toFront() {
    LWCToolkit lwcToolkit = (LWCToolkit) Toolkit.getDefaultToolkit();
    Window w = DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow();
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if( w != null && acc.getPeer(w) != null
            && ((LWWindowPeer)acc.getPeer(w)).getPeerType() == LWWindowPeer.PeerType.EMBEDDED_FRAME
            && !lwcToolkit.isApplicationActive()) {
        lwcToolkit.activateApplicationIgnoringOtherApps();
    }
    updateFocusabilityForAutoRequestFocus(false);
    execute(CPlatformWindow::nativePushNSWindowToFront);
    updateFocusabilityForAutoRequestFocus(true);
}
 
源代码24 项目: openjdk-jdk9   文件: D3DScreenUpdateManager.java
/**
 * Returns true if the component has heavyweight children.
 *
 * @param comp component to check for hw children
 * @return true if Component has heavyweight children
 */
private static boolean hasHWChildren(Component comp) {
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    if (comp instanceof Container) {
        for (Component c : ((Container)comp).getComponents()) {
            if (acc.getPeer(c) instanceof WComponentPeer || hasHWChildren(c)) {
                return true;
            }
        }
    }
    return false;
}
 
源代码25 项目: openjdk-jdk9   文件: WPrinterJob.java
public PrintRequestAttributeSet
    showDocumentProperties(Window owner,
                           PrintService service,
                           PrintRequestAttributeSet aset)
{
    try {
        setNativePrintServiceIfNeeded(service.getName());
    } catch (PrinterException e) {
    }
    final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    long hWnd = acc.<WComponentPeer>getPeer(owner).getHWnd();
    DevModeValues info = new DevModeValues();
    getDevModeValues(aset, info);
    boolean ok =
        showDocProperties(hWnd, aset,
                          info.dmFields,
                          info.copies,
                          info.collate,
                          info.color,
                          info.duplex,
                          info.orient,
                          info.paper,
                          info.bin,
                          info.xres_quality,
                          info.yres);

    if (ok) {
        return aset;
    } else {
        return null;
    }
}
 
源代码26 项目: openjdk-jdk9   文件: AppletFlipBuffer.java
private static void test(final Applet applet) {
    ComponentAccessor acc = AWTAccessor.getComponentAccessor();
    for (int i = 1; i < 10; ++i) {
        for (final BufferCapabilities caps : bcs) {
            try {
                acc.createBufferStrategy(applet, i, caps);
            } catch (final AWTException ignored) {
                // this kind of buffer strategy is not supported
            }
        }
    }
}
 
源代码27 项目: jdk8u-jdk   文件: CPlatformWindow.java
private void orderAboveSiblingsImpl(Window[] windows) {
    ArrayList<Window> childWindows = new ArrayList<Window>();

    final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
    final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();

    // Go through the list of windows and perform ordering.
    for (Window w : windows) {
        boolean iconified = false;
        final Object p = componentAccessor.getPeer(w);
        if (p instanceof LWWindowPeer) {
            CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
            iconified = isIconified();
            if (pw != null && pw.isVisible() && !iconified) {
                // If the window is one of ancestors of 'main window' or is going to become main by itself,
                // the window should be ordered above its siblings; otherwise the window is just ordered
                // above its nearest parent.
                if (pw.isOneOfOwnersOrSelf(this)) {
                    CWrapper.NSWindow.orderFront(pw.getNSWindowPtr());
                } else {
                    CWrapper.NSWindow.orderWindow(pw.getNSWindowPtr(), CWrapper.NSWindow.NSWindowAbove,
                            pw.owner.getNSWindowPtr());
                }
                pw.applyWindowLevel(w);
            }
        }
        // Retrieve the child windows for each window from the list except iconified ones
        // and store them for future use.
        // Note: we collect data about child windows even for invisible owners, since they may have
        // visible children.
        if (!iconified) {
            childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
        }
    }
    // If some windows, which have just been ordered, have any child windows, let's start new iteration
    // and order these child windows.
    if (!childWindows.isEmpty()) {
        orderAboveSiblingsImpl(childWindows.toArray(new Window[0]));
    }
}
 
源代码28 项目: dragonwell8_jdk   文件: CPlatformWindow.java
private void orderAboveSiblingsImpl(Window[] windows) {
    ArrayList<Window> childWindows = new ArrayList<Window>();

    final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
    final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();

    // Go through the list of windows and perform ordering.
    for (Window w : windows) {
        boolean iconified = false;
        final Object p = componentAccessor.getPeer(w);
        if (p instanceof LWWindowPeer) {
            CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
            iconified = isIconified();
            if (pw != null && pw.isVisible() && !iconified) {
                // If the window is one of ancestors of 'main window' or is going to become main by itself,
                // the window should be ordered above its siblings; otherwise the window is just ordered
                // above its nearest parent.
                if (pw.isOneOfOwnersOrSelf(this)) {
                    pw.execute(CWrapper.NSWindow::orderFront);
                } else {
                    pw.owner.execute(ownerPtr -> {
                        pw.execute(ptr -> {
                            CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, ownerPtr);
                        });
                    });
                }
                pw.applyWindowLevel(w);
            }
        }
        // Retrieve the child windows for each window from the list except iconified ones
        // and store them for future use.
        // Note: we collect data about child windows even for invisible owners, since they may have
        // visible children.
        if (!iconified) {
            childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
        }
    }
    // If some windows, which have just been ordered, have any child windows, let's start new iteration
    // and order these child windows.
    if (!childWindows.isEmpty()) {
        orderAboveSiblingsImpl(childWindows.toArray(new Window[0]));
    }
}
 
源代码29 项目: TencentKona-8   文件: CPlatformWindow.java
private void orderAboveSiblingsImpl(Window[] windows) {
    ArrayList<Window> childWindows = new ArrayList<Window>();

    final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
    final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();

    // Go through the list of windows and perform ordering.
    for (Window w : windows) {
        boolean iconified = false;
        final Object p = componentAccessor.getPeer(w);
        if (p instanceof LWWindowPeer) {
            CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
            iconified = isIconified();
            if (pw != null && pw.isVisible() && !iconified) {
                // If the window is one of ancestors of 'main window' or is going to become main by itself,
                // the window should be ordered above its siblings; otherwise the window is just ordered
                // above its nearest parent.
                if (pw.isOneOfOwnersOrSelf(this)) {
                    pw.execute(CWrapper.NSWindow::orderFront);
                } else {
                    pw.owner.execute(ownerPtr -> {
                        pw.execute(ptr -> {
                            CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, ownerPtr);
                        });
                    });
                }
                pw.applyWindowLevel(w);
            }
        }
        // Retrieve the child windows for each window from the list except iconified ones
        // and store them for future use.
        // Note: we collect data about child windows even for invisible owners, since they may have
        // visible children.
        if (!iconified) {
            childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
        }
    }
    // If some windows, which have just been ordered, have any child windows, let's start new iteration
    // and order these child windows.
    if (!childWindows.isEmpty()) {
        orderAboveSiblingsImpl(childWindows.toArray(new Window[0]));
    }
}
 
源代码30 项目: openjdk-jdk8u   文件: CPlatformWindow.java
private void orderAboveSiblingsImpl(Window[] windows) {
    ArrayList<Window> childWindows = new ArrayList<Window>();

    final ComponentAccessor componentAccessor = AWTAccessor.getComponentAccessor();
    final WindowAccessor windowAccessor = AWTAccessor.getWindowAccessor();

    // Go through the list of windows and perform ordering.
    for (Window w : windows) {
        boolean iconified = false;
        final Object p = componentAccessor.getPeer(w);
        if (p instanceof LWWindowPeer) {
            CPlatformWindow pw = (CPlatformWindow)((LWWindowPeer)p).getPlatformWindow();
            iconified = isIconified();
            if (pw != null && pw.isVisible() && !iconified) {
                // If the window is one of ancestors of 'main window' or is going to become main by itself,
                // the window should be ordered above its siblings; otherwise the window is just ordered
                // above its nearest parent.
                if (pw.isOneOfOwnersOrSelf(this)) {
                    pw.execute(CWrapper.NSWindow::orderFront);
                } else {
                    pw.owner.execute(ownerPtr -> {
                        pw.execute(ptr -> {
                            CWrapper.NSWindow.orderWindow(ptr, CWrapper.NSWindow.NSWindowAbove, ownerPtr);
                        });
                    });
                }
                pw.applyWindowLevel(w);
            }
        }
        // Retrieve the child windows for each window from the list except iconified ones
        // and store them for future use.
        // Note: we collect data about child windows even for invisible owners, since they may have
        // visible children.
        if (!iconified) {
            childWindows.addAll(Arrays.asList(windowAccessor.getOwnedWindows(w)));
        }
    }
    // If some windows, which have just been ordered, have any child windows, let's start new iteration
    // and order these child windows.
    if (!childWindows.isEmpty()) {
        orderAboveSiblingsImpl(childWindows.toArray(new Window[0]));
    }
}
 
 类所在包
 类方法
 同包方法