/** * Return the set of container listeners associated with this Container. * If this Container has no registered container listeners, a zero-length * array is returned. */ @Override public ContainerListener[] findContainerListeners() { ContainerListener[] results = new ContainerListener[0]; return listeners.toArray(results); }
/** * Notify all container event listeners that a particular event has * occurred for this Container. The default implementation performs * this notification synchronously using the calling thread. * * @param type Event type * @param data Event data */ @Override public void fireContainerEvent(String type, Object data) { if (listeners.size() < 1) return; ContainerEvent event = new ContainerEvent(this, type, data); // Note for each uses an iterator internally so this is safe for (ContainerListener listener : listeners) { listener.containerEvent(event); } }
public ListenersInfo(Container container, ContainerListener[] containerListeners, LifecycleListener[] lifecycleListeners) { this.container = container; this.containerListeners = containerListeners; this.lifecycleListeners = lifecycleListeners; }
/** * Add a container event listener to this component. * * @param listener The listener to add */ public void addContainerListener(ContainerListener listener) { synchronized (listeners) { listeners.add(listener); } }
/** * Return the set of container listeners associated with this Container. * If this Container has no registered container listeners, a zero-length * array is returned. */ public ContainerListener[] findContainerListeners() { synchronized (listeners) { ContainerListener[] results = new ContainerListener[listeners.size()]; return ((ContainerListener[]) listeners.toArray(results)); } }
/** * Remove a container event listener from this component. * * @param listener The listener to remove */ public void removeContainerListener(ContainerListener listener) { synchronized (listeners) { listeners.remove(listener); } }
/** * Notify all container event listeners that a particular event has * occurred for this Container. The default implementation performs * this notification synchronously using the calling thread. * * @param type Event type * @param data Event data */ public void fireContainerEvent(String type, Object data) { if (listeners.size() < 1) return; ContainerEvent event = new ContainerEvent(this, type, data); ContainerListener list[] = new ContainerListener[0]; synchronized (listeners) { list = (ContainerListener[]) listeners.toArray(list); } for (int i = 0; i < list.length; i++) ((ContainerListener) list[i]).containerEvent(event); }
/** * Notify all container event listeners that a particular event has occurred * for this Container. The default implementation performs this notification * synchronously using the calling thread. * * @param type * Event type * @param data * Event data */ @Override public void fireContainerEvent(String type, Object data) { if (listeners.size() < 1) return; ContainerEvent event = new ContainerEvent(this, type, data); // Note for each uses an iterator internally so this is safe for (ContainerListener listener : listeners) { listener.containerEvent(event); } }
/** * Add a container event listener to this component. * * @param listener The listener to add */ @Override public void addContainerListener(ContainerListener listener) { synchronized (listeners) { listeners.add(listener); } }
/** * Return the set of container listeners associated with this Container. * If this Container has no registered container listeners, a zero-length * array is returned. */ @Override public ContainerListener[] findContainerListeners() { synchronized (listeners) { ContainerListener[] results = new ContainerListener[listeners.size()]; return listeners.toArray(results); } }
/** * Remove a container event listener from this component. * * @param listener The listener to remove */ @Override public void removeContainerListener(ContainerListener listener) { synchronized (listeners) { listeners.remove(listener); } }
/** * Notify all container event listeners that a particular event has * occurred for this Container. The default implementation performs * this notification synchronously using the calling thread. * * @param type Event type * @param data Event data */ @Override public void fireContainerEvent(String type, Object data) { if (listeners.size() < 1) return; ContainerEvent event = new ContainerEvent(this, type, data); ContainerListener list[] = new ContainerListener[0]; synchronized (listeners) { list = listeners.toArray(list); } for (int i = 0; i < list.length; i++) list[i].containerEvent(event); }
@Override @SuppressWarnings("unchecked") public final T addContainerListener(ContainerListener listener) { LOGGER.log(Level.FINE, "addContainerListener({0})", listener.getClass().getName()); container.addContainerListener(listener); return (T) this; }
@Override public void addContainerListener(ContainerListener listener) { /* NO-OP */ }
@Override public ContainerListener[] findContainerListeners() { return null; }
@Override public void removeContainerListener(ContainerListener listener) { /* NO-OP */ }
@Override public void addContainerListener(ContainerListener listener) { // NO-OP }
@Override public void removeContainerListener(ContainerListener listener) { // NO-OP }