Java 类java.awt.event.ContainerListener 实例源码

项目:javify    文件:Container.java   
/**
 * Deserialize this Container:
 * <ol>
 * <li>Read from the stream the default serializable fields.</li>
 * <li>Read a list of serializable ContainerListeners as optional
 * data.  If the list is null, no listeners will be registered.</li>
 * <li>Read this Container's FocusTraversalPolicy as optional data.
 * If this is null, then this Container will use a
 * DefaultFocusTraversalPolicy.</li>
 * </ol>
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject (ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject ();
  String key = (String) s.readObject ();
  while (key != null)
    {
      Object object = s.readObject ();
      if ("containerL".equals (key))
        addContainerListener((ContainerListener) object);
      // FIXME: under what key is the focus traversal policy stored?
      else if ("focusTraversalPolicy".equals (key))
        setFocusTraversalPolicy ((FocusTraversalPolicy) object);

      key = (String) s.readObject();
    }
}
项目:jvm-stm    文件:Container.java   
/**
 * Deserialize this Container:
 * <ol>
 * <li>Read from the stream the default serializable fields.</li>
 * <li>Read a list of serializable ContainerListeners as optional
 * data.  If the list is null, no listeners will be registered.</li>
 * <li>Read this Container's FocusTraversalPolicy as optional data.
 * If this is null, then this Container will use a
 * DefaultFocusTraversalPolicy.</li>
 * </ol>
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject (ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject ();
  String key = (String) s.readObject ();
  while (key != null)
    {
      Object object = s.readObject ();
      if ("containerL".equals (key))
        addContainerListener((ContainerListener) object);
      // FIXME: under what key is the focus traversal policy stored?
      else if ("focusTraversalPolicy".equals (key))
        setFocusTraversalPolicy ((FocusTraversalPolicy) object);

      key = (String) s.readObject();
    }
}
项目:cn1    文件:Container.java   
protected void processContainerEvent(ContainerEvent e) {
    // toolkit.lockAWT();
    // try {
    for (Iterator<?> i = containerListeners.getUserIterator(); i.hasNext();) {
        ContainerListener listener = (ContainerListener) i.next();

        switch (e.getID()) {
            case ContainerEvent.COMPONENT_ADDED:
                listener.componentAdded(e);
                break;
            case ContainerEvent.COMPONENT_REMOVED:
                listener.componentRemoved(e);
                break;
        }
    }
    // } finally {
    // toolkit.unlockAWT();
    // }
}
项目:JamVM-PH    文件:Container.java   
/**
 * Deserialize this Container:
 * <ol>
 * <li>Read from the stream the default serializable fields.</li>
 * <li>Read a list of serializable ContainerListeners as optional
 * data.  If the list is null, no listeners will be registered.</li>
 * <li>Read this Container's FocusTraversalPolicy as optional data.
 * If this is null, then this Container will use a
 * DefaultFocusTraversalPolicy.</li>
 * </ol>
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject (ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject ();
  String key = (String) s.readObject ();
  while (key != null)
    {
      Object object = s.readObject ();
      if ("containerL".equals (key))
        addContainerListener((ContainerListener) object);
      // FIXME: under what key is the focus traversal policy stored?
      else if ("focusTraversalPolicy".equals (key))
        setFocusTraversalPolicy ((FocusTraversalPolicy) object);

      key = (String) s.readObject();
    }
}
项目:classpath    文件:Container.java   
/**
 * Deserialize this Container:
 * <ol>
 * <li>Read from the stream the default serializable fields.</li>
 * <li>Read a list of serializable ContainerListeners as optional
 * data.  If the list is null, no listeners will be registered.</li>
 * <li>Read this Container's FocusTraversalPolicy as optional data.
 * If this is null, then this Container will use a
 * DefaultFocusTraversalPolicy.</li>
 * </ol>
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject (ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject ();
  String key = (String) s.readObject ();
  while (key != null)
    {
      Object object = s.readObject ();
      if ("containerL".equals (key))
        addContainerListener((ContainerListener) object);
      // FIXME: under what key is the focus traversal policy stored?
      else if ("focusTraversalPolicy".equals (key))
        setFocusTraversalPolicy ((FocusTraversalPolicy) object);

      key = (String) s.readObject();
    }
}
项目:freeVM    文件:Container.java   
protected void processContainerEvent(ContainerEvent e) {
    // toolkit.lockAWT();
    // try {
    for (Iterator<?> i = containerListeners.getUserIterator(); i.hasNext();) {
        ContainerListener listener = (ContainerListener) i.next();

        switch (e.getID()) {
            case ContainerEvent.COMPONENT_ADDED:
                listener.componentAdded(e);
                break;
            case ContainerEvent.COMPONENT_REMOVED:
                listener.componentRemoved(e);
                break;
        }
    }
    // } finally {
    // toolkit.unlockAWT();
    // }
}
项目:freeVM    文件:Container.java   
protected void processContainerEvent(ContainerEvent e) {
    // toolkit.lockAWT();
    // try {
    for (Iterator<?> i = containerListeners.getUserIterator(); i.hasNext();) {
        ContainerListener listener = (ContainerListener) i.next();

        switch (e.getID()) {
            case ContainerEvent.COMPONENT_ADDED:
                listener.componentAdded(e);
                break;
            case ContainerEvent.COMPONENT_REMOVED:
                listener.componentRemoved(e);
                break;
        }
    }
    // } finally {
    // toolkit.unlockAWT();
    // }
}
项目:openjdk-jdk10    文件:ContainerOperator.java   
/**
 * Maps {@code Container.addContainerListener(ContainerListener)}
 * through queue
 */
public void addContainerListener(final ContainerListener containerListener) {
    runMapping(new MapVoidAction("addContainerListener") {
        @Override
        public void map() {
            ((Container) getSource()).addContainerListener(containerListener);
        }
    });
}
项目:openjdk-jdk10    文件:ContainerOperator.java   
/**
 * Maps {@code Container.removeContainerListener(ContainerListener)}
 * through queue
 */
public void removeContainerListener(final ContainerListener containerListener) {
    runMapping(new MapVoidAction("removeContainerListener") {
        @Override
        public void map() {
            ((Container) getSource()).removeContainerListener(containerListener);
        }
    });
}
项目:openjdk9    文件:ContainerOperator.java   
/**
 * Maps {@code Container.addContainerListener(ContainerListener)}
 * through queue
 */
public void addContainerListener(final ContainerListener containerListener) {
    runMapping(new MapVoidAction("addContainerListener") {
        @Override
        public void map() {
            ((Container) getSource()).addContainerListener(containerListener);
        }
    });
}
项目:openjdk9    文件:ContainerOperator.java   
/**
 * Maps {@code Container.removeContainerListener(ContainerListener)}
 * through queue
 */
public void removeContainerListener(final ContainerListener containerListener) {
    runMapping(new MapVoidAction("removeContainerListener") {
        @Override
        public void map() {
            ((Container) getSource()).removeContainerListener(containerListener);
        }
    });
}
项目:j2se_for_android    文件:Container.java   
public synchronized void addContainerListener(final ContainerListener l) {
    if (l == null) {
        return;
    }

    list.add(ContainerListener.class, l);
}
项目:j2se_for_android    文件:Container.java   
public synchronized void remove(final Component comp) {
    if(components == null){
        return;
    }

    final int index = components.indexOf(comp);
    if (index >= 0) {
        components.remove(index);
        comp.parent = null;

        final ViewGroup layoutView = (ViewGroup)getContainerViewAdAPI();
        final View subView = comp.getPeerAdAPI();
        if(layoutView != null && subView != null){
            ActivityManager.getActivity().runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    layoutView.removeView(subView);
                }
            });
        }

        {
            final ContainerEvent event = new ContainerEvent(this, ContainerEvent.COMPONENT_REMOVED, comp);
            final ContainerListener[] listener = list.getListeners(ContainerListener.class);
            for (int i = 0; i < listener.length; i++) {
                listener[i].componentRemoved(event);
            }
        }
    }

    if (layout != null) {
        layout.removeLayoutComponent(comp);
    }
}
项目:javify    文件:Container.java   
/**
 * Adds the specified container listener to this object's list of
 * container listeners.
 *
 * @param listener The listener to add.
 */
public synchronized void addContainerListener(ContainerListener listener)
{
  if (listener != null)
    {
      containerListener = AWTEventMulticaster.add(containerListener,
                                                  listener);
      newEventsOnly = true;
    }
}
项目:javify    文件:Container.java   
/**
 * @since 1.4
 */
public synchronized ContainerListener[] getContainerListeners()
{
  return (ContainerListener[])
    AWTEventMulticaster.getListeners(containerListener,
                                     ContainerListener.class);
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when a component is added to the container.
 *
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when a component is removed from the container.
 *
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when a component is added to the container.
 *
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when a component is removed from the container.
 *
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
项目:intellij-ce-playground    文件:MnemonicContainerListener.java   
private boolean isAddedTo(Container container) {
  for (ContainerListener listener : container.getContainerListeners()) {
    if (listener == this) {
      return true;
    }
  }
  return false;
}
项目:jvm-stm    文件:Container.java   
/**
 * Adds the specified container listener to this object's list of
 * container listeners.
 *
 * @param listener The listener to add.
 */
public synchronized void addContainerListener(ContainerListener listener)
{
  if (listener != null)
    {
      containerListener = AWTEventMulticaster.add(containerListener,
                                                  listener);
      newEventsOnly = true;
    }
}
项目:jvm-stm    文件:Container.java   
/**
 * @since 1.4
 */
public synchronized ContainerListener[] getContainerListeners()
{
  return (ContainerListener[])
    AWTEventMulticaster.getListeners(containerListener,
                                     ContainerListener.class);
}
项目:jvm-stm    文件:StandaloneAppletWindow.java   
/**
 * This method is called when a component is added to the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
项目:jvm-stm    文件:StandaloneAppletWindow.java   
/**
 * This method is called when a component is removed from the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
项目:jvm-stm    文件:PluginAppletWindow.java   
/**
 * This method is called when a component is added to the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
项目:jvm-stm    文件:PluginAppletWindow.java   
/**
 * This method is called when a component is removed from the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
项目:cn1    文件:AWTEventMulticaster.java   
public void componentAdded(ContainerEvent e) {
    if ((a != null) && (a instanceof ContainerListener)) {
        ((ContainerListener) a).componentAdded(e);
    }
    if ((b != null) && (b instanceof ContainerListener)) {
        ((ContainerListener) b).componentAdded(e);
    }
}
项目:cn1    文件:AWTEventMulticaster.java   
public void componentRemoved(ContainerEvent e) {
    if ((a != null) && (a instanceof ContainerListener)) {
        ((ContainerListener) a).componentRemoved(e);
    }
    if ((b != null) && (b instanceof ContainerListener)) {
        ((ContainerListener) b).componentRemoved(e);
    }
}
项目:cn1    文件:Container.java   
public ContainerListener[] getContainerListeners() {
    // toolkit.lockAWT();
    // try {
    return containerListeners.getUserListeners(new ContainerListener[0]);
    // } finally {
    // toolkit.unlockAWT();
    // }
}
项目:cn1    文件:Container.java   
public void addContainerListener(ContainerListener l) {
    // toolkit.lockAWT();
    // try {
    containerListeners.addUserListener(l);
    // } finally {
    // toolkit.unlockAWT();
    // }
}
项目:cn1    文件:Container.java   
public void removeContainerListener(ContainerListener l) {
    // toolkit.lockAWT();
    // try {
    containerListeners.removeUserListener(l);
    // } finally {
    // toolkit.unlockAWT();
    // }
}
项目:cn1    文件:Container.java   
@SuppressWarnings("unchecked")
@Override
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    // toolkit.lockAWT();
    // try {
    if (ContainerListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getContainerListeners();
    }
    return super.getListeners(listenerType);
    // } finally {
    // toolkit.unlockAWT();
    // }
}
项目:cn1    文件:BasicMenuBarUITest.java   
public void testCreateContainerListener() {
    final ContainerListener containerListener1 = menuBarUI.createContainerListener();
    final ContainerListener containerListener2 = menuBarUI.createContainerListener();
    assertNotNull(containerListener1);
    assertSame(containerListener1, containerListener2);
    assertSame(containerListener1, menuBarUI.createChangeListener());
}
项目:JamVM-PH    文件:Container.java   
/**
 * Adds the specified container listener to this object's list of
 * container listeners.
 *
 * @param listener The listener to add.
 */
public synchronized void addContainerListener(ContainerListener listener)
{
  if (listener != null)
    {
      containerListener = AWTEventMulticaster.add(containerListener,
                                                  listener);
      newEventsOnly = true;
    }
}
项目:JamVM-PH    文件:Container.java   
/**
 * @since 1.4
 */
public synchronized ContainerListener[] getContainerListeners()
{
  return (ContainerListener[])
    AWTEventMulticaster.getListeners(containerListener,
                                     ContainerListener.class);
}
项目:JamVM-PH    文件:StandaloneAppletWindow.java   
/**
 * This method is called when a component is added to the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
项目:JamVM-PH    文件:StandaloneAppletWindow.java   
/**
 * This method is called when a component is removed from the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
项目:JamVM-PH    文件:PluginAppletWindow.java   
/**
 * This method is called when a component is added to the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component
 *          addition
 */
public void componentAdded(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentAdded(event);
    }
}
项目:JamVM-PH    文件:PluginAppletWindow.java   
/**
 * This method is called when a component is removed from the container.
 * 
 * @param event the <code>ContainerEvent</code> indicating component removal
 */
public void componentRemoved(ContainerEvent event)
{
  if (applet != null)
    {
      ContainerListener[] l = applet.getContainerListeners();
      for (int i = 0; i < l.length; i++)
        l[i].componentRemoved(event);
    }
}
项目:classpath    文件:Container.java   
/**
 * Adds the specified container listener to this object's list of
 * container listeners.
 *
 * @param listener The listener to add.
 */
public synchronized void addContainerListener(ContainerListener listener)
{
  if (listener != null)
    {
      containerListener = AWTEventMulticaster.add(containerListener,
                                                  listener);
      newEventsOnly = true;
    }
}