protected void removeAllListeners() { // Guaranteed to return a non-null array Object[] list = listeners.getListenerList(); for (int i = list.length - 2; i >= 0; i -= 2) { listeners.remove((Class) list[i], (EventListener) list[i + 1]); } }
/** Remove all registered components from the Solver change event listener list. */ public void removeAllChangeListeners() { EventListener[] listeners = listenerList.getListeners(ChangeListener.class); ChangeListener cl; for (int i = 0; i < listeners.length; i++) { // Added a typecast to pass Xlint: ROS 2/3/05 cl = (ChangeListener) listeners[i]; listenerList.remove(ChangeListener.class, cl); } } // end removeAllChangeListeners
@Override public void entryRemoved(Entry removedEntry, Folder parent, int index) { TreePath path = getPathTo(parent); TreeModelEvent e = new TreeModelEvent( RepositoryTreeModel.this, path, new int[] {index}, new Object[] {removedEntry}); boolean pathSaved = false; final RepositoryTreeUtil treeUtil = new RepositoryTreeUtil(); if (parentTree != null) { pathSaved = createPostRemoveEventSelectionPath(removedEntry, parent, index, path, treeUtil); } for (TreeModelListener l : listeners.getListeners(TreeModelListener.class)) { l.treeNodesRemoved(e); } if (parentTree != null && pathSaved) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { treeUtil.restoreSelectionPath(parentTree); } }); } }
public void fireStateChanged() { ChangeListener[] listeners = listenerList.getListeners(ChangeListener.class); ChangeEvent e = new ChangeEvent(this); for (ChangeListener listener : listeners) { listener.stateChanged(e); } }
/** * Removes the ChangeListener from the FileBase object. * * @param l the ProgressChangeListener object */ public void removeProgressChangeListener(ProgressChangeListener l) { listenerList.remove(ProgressChangeListener.class, l); if (l instanceof ViewJProgressBar) { ((ViewJProgressBar) l).removeActionListener(this); } }
/** * Fire a mouse event to the registered listeners. * * @param eventType * @param button * @param lParam */ private void fireMouseEvent(int eventType, int button, MSLLHOOKSTRUCT lParam) { Logger.trace("fireMouseEvent(eventType={},button={},lParam={})", eventType, button, lParam); MouseListener[] listeners = listenerList.getListeners(MouseListener.class); if (listeners.length > 0) { MouseEvent evt = createMouseEvent(eventType, button, lParam); for (int i = listeners.length - 1; i >= 0; i--) { switch (eventType) { case MouseEvent.MOUSE_PRESSED: listeners[i].mousePressed(evt); break; case MouseEvent.MOUSE_RELEASED: listeners[i].mouseReleased(evt); break; case MouseEvent.MOUSE_ENTERED: listeners[i].mouseEntered(evt); break; case MouseEvent.MOUSE_EXITED: listeners[i].mouseExited(evt); break; } } } }
public void fireStateChanged() { final ChangeEvent event = new ChangeEvent(this); ChangeListener[] changeListeners = listenerList.getListeners(ChangeListener.class); for (ChangeListener changeListener : changeListeners) { changeListener.stateChanged(event); } }
/** * Adds the ProgressChangeListener to this FileBase object. * * @param l the ProgressChangeListener object */ public void addProgressChangeListener(ProgressChangeListener l) { listenerList.add(ProgressChangeListener.class, l); if (l instanceof ViewJProgressBar) { ((ViewJProgressBar) l).addActionListener(this); } }
/** * Notifies all listeners that have registered interest for notification on this event type. * * @param value the value of the progress bar. * @param title the title of the progress dialog. * @param message the message for that specific progress value. */ protected void fireProgressStateChanged(int value, String title, String message) { Object[] listeners = listenerList.getListenerList(); if (listeners == null || listeners.length < 2) { if (title != null) { System.out.print(title + ": "); } if (message != null) { System.out.println(message); } return; } // adjust value based on minProgress and maxProgress if ((value != ViewJProgressBar.PROGRESS_VALUE_UNCHANGED) && (value != ViewJProgressBar.PROGRESS_WINDOW_CLOSING)) { value = ViewJProgressBar.getProgressFromInt(minProgressValue, maxProgressValue, value); } for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == ProgressChangeListener.class) { ProgressChangeEvent event = new ProgressChangeEvent(this, value, title, message); ((ProgressChangeListener) listeners[i + 1]).progressStateChanged(event); } } }
@Override public void entryChanged(Entry entry) { TreeModelEvent e = makeChangeEvent(entry); for (TreeModelListener l : listeners.getListeners(TreeModelListener.class)) { l.treeNodesChanged(e); } }
@Override public void entryAdded(Entry newEntry, Folder parent) { TreeModelEvent e = makeChangeEvent(newEntry); for (TreeModelListener l : listeners.getListeners(TreeModelListener.class)) { l.treeNodesInserted(e); } }
/** * Put an object into the cache specifying both the key to use and the cache groups the object * belongs to. * * @param key Key of the object in the cache * @param groups The cache groups to add the object to * @param content The object to cache * @param policy Object that implements the refresh policy logic */ public void putInCache( String key, Object content, String[] groups, EntryRefreshPolicy policy, String origin) { CacheEntry cacheEntry = this.getCacheEntry(key, policy, origin); boolean isNewEntry = cacheEntry.isNew(); // [CACHE-118] If we have an existing entry, create a new CacheEntry so we can still access the // old one later if (!isNewEntry) { cacheEntry = new CacheEntry(key, policy); } cacheEntry.setContent(content); cacheEntry.setGroups(groups); cacheMap.put(key, cacheEntry); // Signal to any threads waiting on this update that it's now ready for them // in the cache! completeUpdate(key); if (listenerList.getListenerCount() > 0) { CacheEntryEvent event = new CacheEntryEvent(this, cacheEntry, origin); if (isNewEntry) { dispatchCacheEntryEvent(CacheEntryEventType.ENTRY_ADDED, event); } else { dispatchCacheEntryEvent(CacheEntryEventType.ENTRY_UPDATED, event); } } }
/** * Flush all entries with keys that match a given pattern * * @param pattern The key must contain this given value * @param origin The origin of this flush request * @deprecated For performance and flexibility reasons it is preferable to store cache entries in * groups and use the {@link #flushGroup(String, String)} method instead of relying on pattern * flushing. */ public void flushPattern(String pattern, String origin) { // Check the pattern if ((pattern != null) && (pattern.length() > 0)) { String key = null; CacheEntry entry = null; Iterator itr = cacheMap.keySet().iterator(); while (itr.hasNext()) { key = (String) itr.next(); if (key.indexOf(pattern) >= 0) { entry = (CacheEntry) cacheMap.get(key); if (entry != null) { flushEntry(entry, origin); } } } if (listenerList.getListenerCount() > 0) { dispatchCachePatternEvent(CacheEntryEventType.PATTERN_FLUSHED, pattern, origin); } } else { // Empty pattern, nothing to do } }
/** * Flush all entries in the cache on the given date/time. * * @param date The date at which all cache entries will be flushed. * @param origin The origin of this flush request (optional) */ public void flushAll(Date date, String origin) { flushDateTime = date; if (listenerList.getListenerCount() > 0) { dispatchCachewideEvent(CachewideEventType.CACHE_FLUSHED, date, origin); } }
public void executeSQL(String sql) { if (sql != null && sql.trim().length() > 0) { removeErrorPanels(); String origSQL = sql; sql = fireSQLToBeExecutedEvent(sql); // This can happen if an impl of ISQLExecutionListener returns null // from the statementExecuting API method, to indicate that the SQL // shouldn't be executed. if (sql == null) { s_log.info( "executeSQL: An ISQLExecutionListener veto'd execution of " + "the following SQL: " + origSQL); return; } ISQLExecutionListener[] executionListeners = _listeners.getListeners(ISQLExecutionListener.class); ISQLExecutionHandlerListener executionHandlerListener = createSQLExecutionHandlerListener(); new SQLExecutionHandler( (IResultTab) null, _session, sql, executionHandlerListener, executionListeners); } }
protected void fireReaderRemoved(String reader) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == CardReaderChangeListener.class) { ((CardReaderChangeListener) listeners[i + 1]).readerRemoved(reader); } } }
public void fireTableChanged(javax.swing.event.TableModelEvent e) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == javax.swing.event.TableModelListener.class) { ((javax.swing.event.TableModelListener) listeners[i + 1]).tableChanged(e); } } }
private void fireTiledLayerRemoved(TiledLayer layer, int index) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == GlobalRepositoryListener.class) { ((GlobalRepositoryListener) listeners[i + 1]).tiledLayerRemoved(layer, index); } } }
protected void fireEditingStopped() { final CellEditorListener[] listeners = eventListenerList.getListeners(CellEditorListener.class); final ChangeEvent event = new ChangeEvent(this); for (int i = 0; i < listeners.length; i++) { final CellEditorListener listener = listeners[i]; listener.editingStopped(event); } }
/** * Remove a filetree listener. * * @param fl the filetree listener to remove. */ public void removeFileTreeListener(IFileTreeListener fl) { if ((fl == null) || (fileListenerList == null)) { return; } fileListenerList.remove(IFileTreeListener.class, fl); }
protected final void fireChangeEvent(Object source, int oldState, int newState) { if (oldState != newState) { ChangeEvent ev = new ChangeEvent(source); for (ChangeListener listener : listeners.getListeners(ChangeListener.class)) { listener.stateChanged(ev); } } }
void fireRowSorterChanged(RowSorterEvent event) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == RowSorterListener.class) { ((RowSorterListener) listeners[i + 1]).sorterChanged(event); } } }
private void fireSceneRemoved(Scene scene, int index) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == GlobalRepositoryListener.class) { ((GlobalRepositoryListener) listeners[i + 1]).sceneRemoved(scene, index); } } }
private void fireSpriteAdded(Sprite layer, int index) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == GlobalRepositoryListener.class) { ((GlobalRepositoryListener) listeners[i + 1]).spriteAdded(layer, index); } } }
protected void fireCaretEvent() { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i--) { if (listeners[i] == CaretListener.class) { ((CaretListener) listeners[i + 1]).caretUpdate(caretEvent); } } }
private void fireSearch(edu.tufts.vue.fsm.event.SearchEvent evt) { Object[] listeners = listenerList.getListenerList(); for (int i = 0; i < listeners.length; i += 2) { if (listeners[i] == edu.tufts.vue.fsm.event.SearchListener.class) { ((edu.tufts.vue.fsm.event.SearchListener) listeners[i + 1]).searchPerformed(evt); } } }
/** * Löst ein TreeStructureChangedEvent aus. * * @param e Das Event welches an die Listener übergeben wird. */ public void fireTreeStructureChanged(TreeModelEvent e) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == TreeModelListener.class) { ((TreeModelListener) listeners[i + 1]).treeStructureChanged(e); } } }
private void fireImageResourceAdded(ImageResource imgRes) { Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == GlobalRepositoryListener.class) { ((GlobalRepositoryListener) listeners[i + 1]).imageResourceAdded(imgRes); } } }
/** * Fire the event, tell everyone that something has happened. * * @param obj */ public void fireEvolutionComplete(EAsolver obj) { Object[] Listeners = listeners.getListenerList(); // Process each of the event listeners in turn. for (int i = 0; i < Listeners.length; i++) { if (Listeners[i] == EvolutionEventListener.class) { ((EvolutionEventListener) Listeners[i + 1]).onEvolutionComplete(obj); } } }
protected void fireCollectionEvent() { final PropertyChangeListener[] listeners = listenerList.getListeners(PropertyChangeListener.class); for (PropertyChangeListener l : listeners) { l.propertyChange(null); } }