Java Code Examples for sun.awt.SunToolkit#invokeLaterOnAppContext()

The following examples show how to use sun.awt.SunToolkit#invokeLaterOnAppContext() . 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: _AppEventHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event, final Object... args) {
    // grab a local ref to the listeners and its contexts as an array of the map's entries
    final ArrayList<Map.Entry<L, AppContext>> localEntries;
    synchronized (this) {
        if (listenerToAppContext.size() == 0) {
            return;
        }
        localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size());
        localEntries.addAll(listenerToAppContext.entrySet());
    }

    for (final Map.Entry<L, AppContext> e : localEntries) {
        final L listener = e.getKey();
        final AppContext listenerContext = e.getValue();
        SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() {
            public void run() {
                performOnListener(listener, event);
            }
        });
    }
}
 
Example 2
Source File: _AppEventHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event, final Object... args) {
    // grab a local ref to the listeners and its contexts as an array of the map's entries
    final ArrayList<Map.Entry<L, AppContext>> localEntries;
    synchronized (this) {
        if (listenerToAppContext.size() == 0) {
            return;
        }
        localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size());
        localEntries.addAll(listenerToAppContext.entrySet());
    }

    for (final Map.Entry<L, AppContext> e : localEntries) {
        final L listener = e.getKey();
        final AppContext listenerContext = e.getValue();
        SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() {
            public void run() {
                performOnListener(listener, event);
            }
        });
    }
}
 
Example 3
Source File: _AppEventHandler.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event, final Object... args) {
    // grab a local ref to the listeners and its contexts as an array of the map's entries
    final ArrayList<Map.Entry<L, AppContext>> localEntries;
    synchronized (this) {
        if (listenerToAppContext.size() == 0) {
            return;
        }
        localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size());
        localEntries.addAll(listenerToAppContext.entrySet());
    }

    for (final Map.Entry<L, AppContext> e : localEntries) {
        final L listener = e.getKey();
        final AppContext listenerContext = e.getValue();
        SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() {
            public void run() {
                performOnListener(listener, event);
            }
        });
    }
}
 
Example 4
Source File: _AppEventHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event) {
    // grab a local ref to the handler
    final H localHandler;
    final AppContext localHandlerContext;
    synchronized (_AppEventDispatcher.this) {
        localHandler = _handler;
        localHandlerContext = handlerContext;
    }

    if (localHandler == null) {
        performDefaultAction(event);
    } else {
        SunToolkit.invokeLaterOnAppContext(localHandlerContext, new Runnable() {
            public void run() {
                performUsing(localHandler, event);
            }
        });
    }
}
 
Example 5
Source File: _AppEventHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event) {
    // grab a local ref to the handler
    final H localHandler;
    final AppContext localHandlerContext;
    synchronized (_AppEventDispatcher.this) {
        localHandler = _handler;
        localHandlerContext = handlerContext;
    }

    if (localHandler == null) {
        performDefaultAction(event);
    } else {
        SunToolkit.invokeLaterOnAppContext(localHandlerContext, new Runnable() {
            public void run() {
                performUsing(localHandler, event);
            }
        });
    }
}
 
Example 6
Source File: SunDragSourceContextPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example 7
Source File: _AppEventHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event) {
    // grab a local ref to the handler
    final H localHandler;
    final AppContext localHandlerContext;
    synchronized (_AppEventDispatcher.this) {
        localHandler = _handler;
        localHandlerContext = handlerContext;
    }

    if (localHandler == null) {
        performDefaultAction(event);
    } else {
        SunToolkit.invokeLaterOnAppContext(localHandlerContext, new Runnable() {
            public void run() {
                performUsing(localHandler, event);
            }
        });
    }
}
 
Example 8
Source File: SunDragSourceContextPeer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 9
Source File: SunDragSourceContextPeer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 10
Source File: _AppEventHandler.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event, final Object... args) {
    // grab a local ref to the listeners and its contexts as an array of the map's entries
    final ArrayList<Map.Entry<L, AppContext>> localEntries;
    synchronized (this) {
        if (listenerToAppContext.size() == 0) {
            return;
        }
        localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size());
        localEntries.addAll(listenerToAppContext.entrySet());
    }

    for (final Map.Entry<L, AppContext> e : localEntries) {
        final L listener = e.getKey();
        final AppContext listenerContext = e.getValue();
        SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() {
            public void run() {
                performOnListener(listener, event);
            }
        });
    }
}
 
Example 11
Source File: _AppEventHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event, final Object... args) {
    // grab a local ref to the listeners and its contexts as an array of the map's entries
    final ArrayList<Map.Entry<L, AppContext>> localEntries;
    synchronized (this) {
        if (listenerToAppContext.size() == 0) {
            return;
        }
        localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size());
        localEntries.addAll(listenerToAppContext.entrySet());
    }

    for (final Map.Entry<L, AppContext> e : localEntries) {
        final L listener = e.getKey();
        final AppContext listenerContext = e.getValue();
        SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() {
            public void run() {
                performOnListener(listener, event);
            }
        });
    }
}
 
Example 12
Source File: SunDragSourceContextPeer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * upcall from native code via implemented class (do)
 */

protected final void dragDropFinished(final boolean success,
                                      final int operations,
                                      final int x, final int y) {
    DragSourceEvent event =
        new DragSourceDropEvent(getDragSourceContext(),
                                operations & sourceActions,
                                success, x, y);
    EventDispatcher dispatcher =
        new EventDispatcher(DISPATCH_FINISH, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
    setNativeContext(0);
    dragImage = null;
    dragImageOffset = null;
}
 
Example 13
Source File: _AppEventHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event, final Object... args) {
    // grab a local ref to the listeners and its contexts as an array of the map's entries
    final ArrayList<Map.Entry<L, AppContext>> localEntries;
    synchronized (this) {
        if (listenerToAppContext.size() == 0) {
            return;
        }
        localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size());
        localEntries.addAll(listenerToAppContext.entrySet());
    }

    for (final Map.Entry<L, AppContext> e : localEntries) {
        final L listener = e.getKey();
        final AppContext listenerContext = e.getValue();
        SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() {
            public void run() {
                performOnListener(listener, event);
            }
        });
    }
}
 
Example 14
Source File: _AppEventHandler.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event) {
    // grab a local ref to the handler
    final H localHandler;
    final AppContext localHandlerContext;
    synchronized (_AppEventDispatcher.this) {
        localHandler = _handler;
        localHandlerContext = handlerContext;
    }

    if (localHandler == null) {
        performDefaultAction(event);
    } else {
        SunToolkit.invokeLaterOnAppContext(localHandlerContext, new Runnable() {
            public void run() {
                performUsing(localHandler, event);
            }
        });
    }
}
 
Example 15
Source File: SunDragSourceContextPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 16
Source File: _AppEventHandler.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
void dispatch(final _NativeEvent event, final Object... args) {
    // grab a local ref to the listeners and its contexts as an array of the map's entries
    final ArrayList<Map.Entry<L, AppContext>> localEntries;
    synchronized (this) {
        if (listenerToAppContext.size() == 0) {
            return;
        }
        localEntries = new ArrayList<Map.Entry<L, AppContext>>(listenerToAppContext.size());
        localEntries.addAll(listenerToAppContext.entrySet());
    }

    for (final Map.Entry<L, AppContext> e : localEntries) {
        final L listener = e.getKey();
        final AppContext listenerContext = e.getValue();
        SunToolkit.invokeLaterOnAppContext(listenerContext, new Runnable() {
            public void run() {
                performOnListener(listener, event);
            }
        });
    }
}
 
Example 17
Source File: SunDragSourceContextPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected final void postDragSourceDragEvent(final int targetAction,
                                             final int modifiers,
                                             final int x, final int y,
                                             final int dispatchType) {

    final int dropAction =
        SunDragSourceContextPeer.convertModifiersToDropAction(modifiers,
                                                              sourceActions);

    DragSourceDragEvent event =
        new DragSourceDragEvent(getDragSourceContext(),
                                dropAction,
                                targetAction & sourceActions,
                                modifiers, x, y);
    EventDispatcher dispatcher = new EventDispatcher(dispatchType, event);

    SunToolkit.invokeLaterOnAppContext(
        SunToolkit.targetToAppContext(getComponent()), dispatcher);

    startSecondaryEventLoop();
}
 
Example 18
Source File: XSystemTrayPeer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void invokeOnEachAppContext(Runnable runnable) {
    for (AppContext appContext : AppContext.getAppContexts()) {
        SunToolkit.invokeLaterOnAppContext(appContext, runnable);
    }
}
 
Example 19
Source File: XSystemTrayPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void invokeOnEachAppContext(Runnable runnable) {
    for (AppContext appContext : AppContext.getAppContexts()) {
        SunToolkit.invokeLaterOnAppContext(appContext, runnable);
    }
}
 
Example 20
Source File: XSystemTrayPeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private void invokeOnEachAppContext(Runnable runnable) {
    for (AppContext appContext : AppContext.getAppContexts()) {
        SunToolkit.invokeLaterOnAppContext(appContext, runnable);
    }
}