sun.lwawt.LWWindowPeer Java Examples

The following examples show how to use sun.lwawt.LWWindowPeer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CAccessibility.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return AWTView ptr, a peer of the CPlatformView associated with the toplevel container of the Accessible, if any
 */
private static long getAWTView(Accessible a) {
    Accessible ax = CAccessible.getSwingAccessible(a);
    if (!(ax instanceof Component)) return 0;

    return invokeAndWait(new Callable<Long>() {
        public Long call() throws Exception {
            Component cont = (Component) ax;
            while (cont != null && !(cont instanceof Window)) {
                cont = cont.getParent();
            }
            if (cont != null) {
                LWWindowPeer peer = (LWWindowPeer) cont.getPeer();
                if (peer != null) {
                    return ((CPlatformWindow) peer.getPlatformWindow()).getContentView().getAWTView();
                }
            }
            return 0L;
        }
    }, (Component)ax);
}
 
Example #2
Source File: CWarningWindow.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
                             int screenX, int screenY, int modifiers,
                             int clickCount, boolean popupTrigger,
                             byte[] bdata) {
    LWWindowPeer peer = ownerPeer.get();
    if (id == MouseEvent.MOUSE_EXITED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    } else if(id == MouseEvent.MOUSE_ENTERED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    }
}
 
Example #3
Source File: CWarningWindow.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
                             int absX, int absY, int modifiers,
                             int clickCount, boolean popupTrigger,
                             byte[] bdata) {
    LWWindowPeer peer = ownerPeer.get();
    if (id == MouseEvent.MOUSE_EXITED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    } else if(id == MouseEvent.MOUSE_ENTERED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    }
}
 
Example #4
Source File: CWarningWindow.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public CWarningWindow(final Window _ownerWindow, final LWWindowPeer _ownerPeer) {
    super();

    this.ownerPeer = new WeakReference<LWWindowPeer>(_ownerPeer);
    this.ownerWindow = _ownerWindow;

    initialize(null, null, _ownerPeer.getPlatformWindow());

    setOpaque(false);

    String warningString = ownerWindow.getWarningString();
    if (warningString != null) {
        contentView.setToolTip(ownerWindow.getWarningString());
    }

    updateIconSize();
}
 
Example #5
Source File: CWarningWindow.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public CWarningWindow(final Window _ownerWindow, final LWWindowPeer _ownerPeer) {
    super();

    this.ownerPeer = new WeakReference<LWWindowPeer>(_ownerPeer);
    this.ownerWindow = _ownerWindow;

    initialize(null, null, _ownerPeer.getPlatformWindow());

    setOpaque(false);

    String warningString = ownerWindow.getWarningString();
    if (warningString != null) {
        contentView.setToolTip(ownerWindow.getWarningString());
    }

    updateIconSize();
}
 
Example #6
Source File: CWarningWindow.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public CWarningWindow(final Window _ownerWindow, final LWWindowPeer _ownerPeer) {
    super();

    this.ownerPeer = new WeakReference<LWWindowPeer>(_ownerPeer);
    this.ownerWindow = _ownerWindow;

    initialize(null, null, _ownerPeer.getPlatformWindow());

    setOpaque(false);

    String warningString = ownerWindow.getWarningString();
    if (warningString != null) {
        contentView.setToolTip(ownerWindow.getWarningString());
    }

    updateIconSize();
}
 
Example #7
Source File: CAccessibility.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return AWTView ptr, a peer of the CPlatformView associated with the toplevel container of the Accessible, if any
 */
private static long getAWTView(Accessible a) {
    Accessible ax = CAccessible.getSwingAccessible(a);
    if (!(ax instanceof Component)) return 0;

    return invokeAndWait(new Callable<Long>() {
        public Long call() throws Exception {
            Component cont = (Component) ax;
            while (cont != null && !(cont instanceof Window)) {
                cont = cont.getParent();
            }
            if (cont != null) {
                LWWindowPeer peer = (LWWindowPeer) cont.getPeer();
                if (peer != null) {
                    return ((CPlatformWindow) peer.getPlatformWindow()).getContentView().getAWTView();
                }
            }
            return 0L;
        }
    }, (Component)ax);
}
 
Example #8
Source File: CAccessibility.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @return AWTView ptr, a peer of the CPlatformView associated with the toplevel container of the Accessible, if any
 */
private static long getAWTView(Accessible a) {
    Accessible ax = CAccessible.getSwingAccessible(a);
    if (!(ax instanceof Component)) return 0;

    return invokeAndWait(new Callable<Long>() {
        public Long call() throws Exception {
            Component cont = (Component) ax;
            while (cont != null && !(cont instanceof Window)) {
                cont = cont.getParent();
            }
            if (cont != null) {
                LWWindowPeer peer = (LWWindowPeer) cont.getPeer();
                if (peer != null) {
                    return ((CPlatformWindow) peer.getPlatformWindow()).getContentView().getAWTView();
                }
            }
            return 0L;
        }
    }, (Component)ax);
}
 
Example #9
Source File: CWarningWindow.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void notifyMouseEvent(int id, long when, int button, int x, int y,
                             int screenX, int screenY, int modifiers,
                             int clickCount, boolean popupTrigger,
                             byte[] bdata) {
    LWWindowPeer peer = ownerPeer.get();
    if (id == MouseEvent.MOUSE_EXITED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    } else if(id == MouseEvent.MOUSE_ENTERED) {
        if (peer != null) {
            peer.updateSecurityWarningVisibility();
        }
    }
}
 
Example #10
Source File: CPlatformView.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
    initializeBase(peer, responder);

    if (!LWCToolkit.getSunAwtDisableCALayers()) {
        this.windowLayer = createCGLayer();
    }
    setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
}
 
Example #11
Source File: CViewEmbeddedFrame.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void synthesizeWindowActivation(boolean activated) {
    if (isActive != activated) {
        isActive = activated;
        ((LWWindowPeer)getPeer()).notifyActivation(activated, null);
    }
}
 
Example #12
Source File: CDragSourceContextPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * upcall from native code
 */
private void dragMouseMoved(final int targetActions,
                            final int modifiers,
                            final int x, final int y) {

    try {
        Component componentAt = LWCToolkit.invokeAndWait(
                new Callable<Component>() {
                    @Override
                    public Component call() {
                        LWWindowPeer mouseEventComponent = LWWindowPeer.getWindowUnderCursor();
                        if (mouseEventComponent == null) {
                            return null;
                        }
                        Component root = SwingUtilities.getRoot(mouseEventComponent.getTarget());
                        if (root == null) {
                            return null;
                        }
                        Point rootLocation = root.getLocationOnScreen();
                        return getDropTargetAt(root, x - rootLocation.x, y - rootLocation.y);
                    }
                }, getComponent());

        if(componentAt != hoveringComponent) {
            if(hoveringComponent != null) {
                dragExit(x, y);
            }
            if(componentAt != null) {
                dragEnter(targetActions, modifiers, x, y);
            }
            hoveringComponent = componentAt;
        }

        postDragSourceDragEvent(targetActions, modifiers, x, y,
                DISPATCH_MOUSE_MOVED);
    } catch (Exception e) {
        throw new InvalidDnDOperationException("Failed to handle DragMouseMoved event");
    }
}
 
Example #13
Source File: CPlatformView.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
    initializeBase(peer, responder);

    if (!LWCToolkit.getSunAwtDisableCALayers()) {
        this.windowLayer = createCGLayer();
    }
    setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
}
 
Example #14
Source File: CDragSourceContextPeer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * upcall from native code
 */
private void dragMouseMoved(final int targetActions,
                            final int modifiers,
                            final int x, final int y) {

    try {
        Component componentAt = LWCToolkit.invokeAndWait(
                new Callable<Component>() {
                    @Override
                    public Component call() {
                        LWWindowPeer mouseEventComponent = LWWindowPeer.getWindowUnderCursor();
                        if (mouseEventComponent == null) {
                            return null;
                        }
                        Component root = SwingUtilities.getRoot(mouseEventComponent.getTarget());
                        if (root == null) {
                            return null;
                        }
                        Point rootLocation = root.getLocationOnScreen();
                        return getDropTargetAt(root, x - rootLocation.x, y - rootLocation.y);
                    }
                }, getComponent());

        if(componentAt != hoveringComponent) {
            if(hoveringComponent != null) {
                dragExit(x, y);
            }
            if(componentAt != null) {
                dragEnter(targetActions, modifiers, x, y);
            }
            hoveringComponent = componentAt;
        }

        postDragSourceDragEvent(targetActions, modifiers, x, y,
                DISPATCH_MOUSE_MOVED);
    } catch (Exception e) {
        throw new InvalidDnDOperationException("Failed to handle DragMouseMoved event");
    }
}
 
Example #15
Source File: CViewPlatformEmbeddedFrame.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override // PlatformWindow
public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
    this.peer = peer;
    this.target = (CViewEmbeddedFrame) target;
    responder = new CPlatformResponder(peer, false);

    view = new CPlatformView();
    view.initialize(peer, responder);

    CWrapper.NSView.addSubview(this.target.getEmbedderHandle(), view.getAWTView());
    view.setAutoResizable(true);
}
 
Example #16
Source File: CDragSourceContextPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * upcall from native code
 */
private void dragMouseMoved(final int targetActions,
                            final int modifiers,
                            final int x, final int y) {

    try {
        Component componentAt = LWCToolkit.invokeAndWait(
                new Callable<Component>() {
                    @Override
                    public Component call() {
                        LWWindowPeer mouseEventComponent = LWWindowPeer.getWindowUnderCursor();
                        if (mouseEventComponent == null) {
                            return null;
                        }
                        Component root = SwingUtilities.getRoot(mouseEventComponent.getTarget());
                        if (root == null) {
                            return null;
                        }
                        Point rootLocation = root.getLocationOnScreen();
                        return getDropTargetAt(root, x - rootLocation.x, y - rootLocation.y);
                    }
                }, getComponent());

        if(componentAt != hoveringComponent) {
            if(hoveringComponent != null) {
                dragExit(x, y);
            }
            if(componentAt != null) {
                dragEnter(targetActions, modifiers, x, y);
            }
            hoveringComponent = componentAt;
        }

        postDragSourceDragEvent(targetActions, modifiers, x, y,
                DISPATCH_MOUSE_MOVED);
    } catch (Exception e) {
        throw new InvalidDnDOperationException("Failed to handle DragMouseMoved event");
    }
}
 
Example #17
Source File: CViewEmbeddedFrame.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void synthesizeWindowActivation(boolean activated) {
    if (isActive != activated) {
        isActive = activated;
        ((LWWindowPeer)getPeer()).notifyActivation(activated, null);
    }
}
 
Example #18
Source File: CPlatformView.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
    initializeBase(peer, responder);

    if (!LWCToolkit.getSunAwtDisableCALayers()) {
        this.windowLayer = createCGLayer();
    }
    setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
}
 
Example #19
Source File: CDragSourceContextPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * upcall from native code
 */
private void dragMouseMoved(final int targetActions,
                            final int modifiers,
                            final int x, final int y) {

    try {
        Component componentAt = LWCToolkit.invokeAndWait(
                new Callable<Component>() {
                    @Override
                    public Component call() {
                        LWWindowPeer mouseEventComponent = LWWindowPeer.getWindowUnderCursor();
                        if (mouseEventComponent == null) {
                            return null;
                        }
                        Component root = SwingUtilities.getRoot(mouseEventComponent.getTarget());
                        if (root == null) {
                            return null;
                        }
                        Point rootLocation = root.getLocationOnScreen();
                        return getDropTargetAt(root, x - rootLocation.x, y - rootLocation.y);
                    }
                }, getComponent());

        if(componentAt != hoveringComponent) {
            if(hoveringComponent != null) {
                dragExit(x, y);
            }
            if(componentAt != null) {
                dragEnter(targetActions, modifiers, x, y);
            }
            hoveringComponent = componentAt;
        }

        postDragSourceDragEvent(targetActions, modifiers, x, y,
                DISPATCH_MOUSE_MOVED);
    } catch (Exception e) {
        throw new InvalidDnDOperationException("Failed to handle DragMouseMoved event");
    }
}
 
Example #20
Source File: CDragSourceContextPeer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * upcall from native code
 */
private void dragMouseMoved(final int targetActions,
                            final int modifiers,
                            final int x, final int y) {

    try {
        Component componentAt = LWCToolkit.invokeAndWait(
                new Callable<Component>() {
                    @Override
                    public Component call() {
                        LWWindowPeer mouseEventComponent = LWWindowPeer.getWindowUnderCursor();
                        if (mouseEventComponent == null) {
                            return null;
                        }
                        Component root = SwingUtilities.getRoot(mouseEventComponent.getTarget());
                        if (root == null) {
                            return null;
                        }
                        Point rootLocation = root.getLocationOnScreen();
                        return getDropTargetAt(root, x - rootLocation.x, y - rootLocation.y);
                    }
                }, getComponent());

        if(componentAt != hoveringComponent) {
            if(hoveringComponent != null) {
                dragExit(x, y);
            }
            if(componentAt != null) {
                dragEnter(targetActions, modifiers, x, y);
            }
            hoveringComponent = componentAt;
        }

        postDragSourceDragEvent(targetActions, modifiers, x, y,
                DISPATCH_MOUSE_MOVED);
    } catch (Exception e) {
        throw new InvalidDnDOperationException("Failed to handle DragMouseMoved event");
    }
}
 
Example #21
Source File: CEmbeddedFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void addNotify() {
    if (getPeer() == null) {
        LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
        LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
        setPeer(peer);
        responder = new CPlatformResponder(peer, true);
    }
    super.addNotify();
}
 
Example #22
Source File: CEmbeddedFrame.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void addNotify() {
    if (getPeer() == null) {
        LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
        LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
        setPeer(peer);
        responder = new CPlatformResponder(peer, true);
    }
    super.addNotify();
}
 
Example #23
Source File: CViewPlatformEmbeddedFrame.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override // PlatformWindow
public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
    this.peer = peer;
    this.target = (CViewEmbeddedFrame) target;
    responder = new CPlatformResponder(peer, false);

    view = new CPlatformView();
    view.initialize(peer, responder);

    CWrapper.NSView.addSubview(this.target.getEmbedderHandle(), view.getAWTView());
    view.setAutoResizable(true);
}
 
Example #24
Source File: CEmbeddedFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void addNotify() {
    if (getPeer() == null) {
        LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
        LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
        setPeer(peer);
        responder = new CPlatformResponder(peer, true);
    }
    super.addNotify();
}
 
Example #25
Source File: CEmbeddedFrame.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void addNotify() {
    if (getPeer() == null) {
        LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
        LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
        setPeer(peer);
        responder = new CPlatformResponder(peer, true);
    }
    super.addNotify();
}
 
Example #26
Source File: CPlatformView.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
    initializeBase(peer, responder);

    if (!LWCToolkit.getSunAwtDisableCALayers()) {
        this.windowLayer = createCGLayer();
    }
    setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
}
 
Example #27
Source File: CEmbeddedFrame.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void addNotify() {
    if (getPeer() == null) {
        LWCToolkit toolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
        LWWindowPeer peer = toolkit.createEmbeddedFrame(this);
        setPeer(peer);
        responder = new CPlatformResponder(peer, true);
    }
    super.addNotify();
}
 
Example #28
Source File: CPlatformView.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void initialize(LWWindowPeer peer, CPlatformResponder responder) {
    initializeBase(peer, responder);

    if (!LWCToolkit.getSunAwtDisableCALayers()) {
        this.windowLayer = createCGLayer();
    }
    setPtr(nativeCreateView(0, 0, 0, 0, getWindowLayerPtr()));
}
 
Example #29
Source File: CViewEmbeddedFrame.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public void validateWithBounds(final int x, final int y, final int width, final int height) {
    try {
        LWCToolkit.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                ((LWWindowPeer) getPeer()).setBoundsPrivate(0, 0, width, height);
                validate();
                setVisible(true);
            }
        }, this);
    } catch (InvocationTargetException ex) {}
}
 
Example #30
Source File: CViewPlatformEmbeddedFrame.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override // PlatformWindow
public void initialize(Window target, final LWWindowPeer peer, PlatformWindow owner) {
    this.peer = peer;
    this.target = (CViewEmbeddedFrame) target;
    responder = new CPlatformResponder(peer, false);

    view = new CPlatformView();
    view.initialize(peer, responder);

    CWrapper.NSView.addSubview(this.target.getEmbedderHandle(), view.getAWTView());
    view.setAutoResizable(true);
}