Java 类sun.awt.PeerEvent 实例源码

项目:OpenJSharp    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:OpenJSharp    文件:Toolkit.java   
@Override
public void firePropertyChange(final PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
        return;
    }
    Runnable updater = new Runnable() {
        public void run() {
            PropertyChangeSupport pcs = (PropertyChangeSupport)
                    AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
            if (null != pcs) {
                pcs.firePropertyChange(evt);
            }
        }
    };
    final AppContext currentAppContext = AppContext.getAppContext();
    for (AppContext appContext : AppContext.getAppContexts()) {
        if (null == appContext || appContext.isDisposed()) {
            continue;
        }
        if (currentAppContext == appContext) {
            updater.run();
        } else {
            final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
            SunToolkit.postEvent(appContext, e);
        }
    }
}
项目:OpenJSharp    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:jdk8u-jdk    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:jdk8u-jdk    文件:Toolkit.java   
@Override
public void firePropertyChange(final PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
        return;
    }
    Runnable updater = new Runnable() {
        public void run() {
            PropertyChangeSupport pcs = (PropertyChangeSupport)
                    AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
            if (null != pcs) {
                pcs.firePropertyChange(evt);
            }
        }
    };
    final AppContext currentAppContext = AppContext.getAppContext();
    for (AppContext appContext : AppContext.getAppContexts()) {
        if (null == appContext || appContext.isDisposed()) {
            continue;
        }
        if (currentAppContext == appContext) {
            updater.run();
        } else {
            final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
            SunToolkit.postEvent(appContext, e);
        }
    }
}
项目:jdk8u-jdk    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:openjdk-jdk10    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:openjdk-jdk10    文件:Toolkit.java   
@Override
public void firePropertyChange(final PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
        return;
    }
    Runnable updater = new Runnable() {
        public void run() {
            PropertyChangeSupport pcs = (PropertyChangeSupport)
                    AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
            if (null != pcs) {
                pcs.firePropertyChange(evt);
            }
        }
    };
    final AppContext currentAppContext = AppContext.getAppContext();
    for (AppContext appContext : AppContext.getAppContexts()) {
        if (null == appContext || appContext.isDisposed()) {
            continue;
        }
        if (currentAppContext == appContext) {
            updater.run();
        } else {
            final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
            SunToolkit.postEvent(appContext, e);
        }
    }
}
项目:openjdk-jdk10    文件:SunClipboard.java   
/**
 * Checks change of the {@code DataFlavor}s and, if necessary,
 * posts notifications on {@code FlavorEvent}s to the
 * AppContexts' EDTs.
 * The parameter {@code formats} is null iff we have just
 * failed to get formats available on the clipboard.
 *
 * @param formats data formats that have just been retrieved from
 *        this clipboard
 */
protected final void checkChange(final long[] formats) {
    if (Arrays.equals(formats, currentFormats)) {
        // we've been able to successfully get available on the clipboard
        // DataFlavors this and previous time and they are coincident;
        // don't notify
        return;
    }
    currentFormats = formats;

    for (final AppContext appContext : AppContext.getAppContexts()) {
        if (appContext == null || appContext.isDisposed()) {
            continue;
        }
        Set<FlavorListener> flavorListeners = getFlavorListeners(appContext);
        if (flavorListeners != null) {
            for (FlavorListener listener : flavorListeners) {
                if (listener != null) {
                    PeerEvent peerEvent = new PeerEvent(this,
                            () -> listener.flavorsChanged(new FlavorEvent(SunClipboard.this)),
                            PeerEvent.PRIORITY_EVENT);
                    SunToolkit.postEvent(appContext, peerEvent);
                }
            }
        }
    }
}
项目:openjdk-jdk10    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:openjdk9    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:openjdk9    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:Java8CN    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:jdk8u_jdk    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:jdk8u_jdk    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:VarJ    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) { 
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp; 
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was 
            // initially shown
            SunToolkit.postEvent(modalAppContext, 
                    new PeerEvent(this, 
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:VarJ    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {                               
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;               
    if (cache == null) {                                                       
        return false;                                                          
    }                                                                          
    int index = eventToCacheIndex(e);                                          
    if (index != -1 && cache[index] != null) {                                 
        e = e.coalesceEvents((PeerEvent)cache[index].event);                   
        if (e != null) {                                                       
            cache[index].event = e;                                            
            return true;                                                       
        } else {                                                               
            cache[index] = null;                                               
        }                                                                      
    }                                                                          
    return false;                                                              
}
项目:VarJ    文件:EventQueue.java   
private boolean coalesceEvent(AWTEvent e, int priority) {                      
    if (!(e.getSource() instanceof Component)) {                               
        return false;                                                          
    }                                                                          
    if (e instanceof PeerEvent) {                                              
        return coalescePeerEvent((PeerEvent)e);                                
    }                                                                          
    // The worst case                                                          
    if (((Component)e.getSource()).isCoalescingEnabled()
        && coalesceOtherEvent(e, priority)) 
    {
        return true;
    }                                                                          
    if (e instanceof PaintEvent) {                                             
        return coalescePaintEvent((PaintEvent)e);                              
    }                                                                          
    if (e instanceof MouseEvent) {                                             
        return coalesceMouseEvent((MouseEvent)e);                              
    }                                                                          
    return false;                                                              
}
项目:VarJ    文件:Dialog.java   
private void hideAndDisposeHandler() {
    if (keepBlocking) {
        synchronized (getTreeLock()) {
            keepBlocking = false;

            if (showAppContext != null) {
                // Wake up event dispatch thread on which the dialog was
                // initially shown
                SunToolkit.postEvent(showAppContext,
                                     new PeerEvent(this,
                                                   new WakingRunnable(),
                                                   PeerEvent.PRIORITY_EVENT));
                showAppContext = null;
            }
            EventQueue.invokeLater(new WakingRunnable());
            getTreeLock().notifyAll();
        }
    }
    isInHide = false;
}
项目:jdk-1.7-annotated    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private static int getPriority(AWTEvent theEvent) {
    if (theEvent instanceof PeerEvent) {
        PeerEvent peerEvent = (PeerEvent)theEvent;
        if ((peerEvent.getFlags() & PeerEvent.ULTIMATE_PRIORITY_EVENT) != 0) {
            return ULTIMATE_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.PRIORITY_EVENT) != 0) {
            return HIGH_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.LOW_PRIORITY_EVENT) != 0) {
            return LOW_PRIORITY;
        }
    }
    int id = theEvent.getID();
    if ((id >= PaintEvent.PAINT_FIRST) && (id <= PaintEvent.PAINT_LAST)) {
        return LOW_PRIORITY;
    }
    return NORM_PRIORITY;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private boolean coalesceEvent(AWTEvent e, int priority) {
    if (!(e.getSource() instanceof Component)) {
        return false;
    }
    if (e instanceof PeerEvent) {
        return coalescePeerEvent((PeerEvent)e);
    }
    // The worst case
    if (((Component)e.getSource()).isCoalescingEnabled()
        && coalesceOtherEvent(e, priority))
    {
        return true;
    }
    if (e instanceof PaintEvent) {
        return coalescePaintEvent((PaintEvent)e);
    }
    if (e instanceof MouseEvent) {
        return coalesceMouseEvent((MouseEvent)e);
    }
    return false;
}
项目:infobip-open-jdk-8    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:infobip-open-jdk-8    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:jdk8u-dev-jdk    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:jdk8u-dev-jdk    文件:WDropTargetContextPeer.java   
@Override
protected void eventPosted(final SunDropTargetEvent e) {
    if (e.getID() != SunDropTargetEvent.MOUSE_DROPPED) {
        Runnable runnable = new Runnable() {
                @Override
                public void run() {
                    e.getDispatcher().unregisterAllEvents();
                }
            };
        // NOTE: this PeerEvent must be a NORM_PRIORITY event to be
        // dispatched after this SunDropTargetEvent, but before the next
        // one, so we should pass zero flags.
        PeerEvent peerEvent = new PeerEvent(e.getSource(), runnable, 0);
        SunToolkit.executeOnEventHandlerThread(peerEvent);
    }
}
项目:jdk7-jdk    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:jdk7-jdk    文件:EventQueue.java   
private static int getPriority(AWTEvent theEvent) {
    if (theEvent instanceof PeerEvent) {
        PeerEvent peerEvent = (PeerEvent)theEvent;
        if ((peerEvent.getFlags() & PeerEvent.ULTIMATE_PRIORITY_EVENT) != 0) {
            return ULTIMATE_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.PRIORITY_EVENT) != 0) {
            return HIGH_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.LOW_PRIORITY_EVENT) != 0) {
            return LOW_PRIORITY;
        }
    }
    int id = theEvent.getID();
    if ((id >= PaintEvent.PAINT_FIRST) && (id <= PaintEvent.PAINT_LAST)) {
        return LOW_PRIORITY;
    }
    return NORM_PRIORITY;
}
项目:jdk7-jdk    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:jdk7-jdk    文件:EventQueue.java   
private boolean coalesceEvent(AWTEvent e, int priority) {
    if (!(e.getSource() instanceof Component)) {
        return false;
    }
    if (e instanceof PeerEvent) {
        return coalescePeerEvent((PeerEvent)e);
    }
    // The worst case
    if (((Component)e.getSource()).isCoalescingEnabled()
        && coalesceOtherEvent(e, priority))
    {
        return true;
    }
    if (e instanceof PaintEvent) {
        return coalescePaintEvent((PaintEvent)e);
    }
    if (e instanceof MouseEvent) {
        return coalesceMouseEvent((MouseEvent)e);
    }
    return false;
}
项目:openjdk-source-code-learn    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private static int getPriority(AWTEvent theEvent) {
    if (theEvent instanceof PeerEvent) {
        PeerEvent peerEvent = (PeerEvent)theEvent;
        if ((peerEvent.getFlags() & PeerEvent.ULTIMATE_PRIORITY_EVENT) != 0) {
            return ULTIMATE_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.PRIORITY_EVENT) != 0) {
            return HIGH_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.LOW_PRIORITY_EVENT) != 0) {
            return LOW_PRIORITY;
        }
    }
    int id = theEvent.getID();
    if ((id >= PaintEvent.PAINT_FIRST) && (id <= PaintEvent.PAINT_LAST)) {
        return LOW_PRIORITY;
    }
    return NORM_PRIORITY;
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private boolean coalesceEvent(AWTEvent e, int priority) {
    if (!(e.getSource() instanceof Component)) {
        return false;
    }
    if (e instanceof PeerEvent) {
        return coalescePeerEvent((PeerEvent)e);
    }
    // The worst case
    if (((Component)e.getSource()).isCoalescingEnabled()
        && coalesceOtherEvent(e, priority))
    {
        return true;
    }
    if (e instanceof PaintEvent) {
        return coalescePaintEvent((PaintEvent)e);
    }
    if (e instanceof MouseEvent) {
        return coalesceMouseEvent((MouseEvent)e);
    }
    return false;
}
项目:OLD-OpenJDK8    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:openjdk-jdk7u-jdk    文件:Container.java   
private void stopLWModal() {
    synchronized (getTreeLock()) {
        if (modalAppContext != null) {
            Container nativeContainer = getHeavyweightContainer();
            if(nativeContainer != null) {
                if (this.modalComp !=  null) {
                    nativeContainer.modalComp = this.modalComp;
                    this.modalComp = null;
                    return;
                }
                else {
                    nativeContainer.modalComp = null;
                }
            }
            // Wake up event dispatch thread on which the dialog was
            // initially shown
            SunToolkit.postEvent(modalAppContext,
                    new PeerEvent(this,
                            new WakingRunnable(),
                            PeerEvent.PRIORITY_EVENT));
        }
        EventQueue.invokeLater(new WakingRunnable());
        getTreeLock().notifyAll();
    }
}
项目:openjdk-jdk7u-jdk    文件:EventQueue.java   
private static int getPriority(AWTEvent theEvent) {
    if (theEvent instanceof PeerEvent) {
        PeerEvent peerEvent = (PeerEvent)theEvent;
        if ((peerEvent.getFlags() & PeerEvent.ULTIMATE_PRIORITY_EVENT) != 0) {
            return ULTIMATE_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.PRIORITY_EVENT) != 0) {
            return HIGH_PRIORITY;
        }
        if ((peerEvent.getFlags() & PeerEvent.LOW_PRIORITY_EVENT) != 0) {
            return LOW_PRIORITY;
        }
    }
    int id = theEvent.getID();
    if ((id >= PaintEvent.PAINT_FIRST) && (id <= PaintEvent.PAINT_LAST)) {
        return LOW_PRIORITY;
    }
    return NORM_PRIORITY;
}