public void setProperty(final String property) { final String oldValue = this.property; this.property = property; listeners.fire().propertyChange(new PropertyChangeEvent(this, "property", oldValue, property)); }
@Test public void testBindFilteredEventsToMethod() { final MultipleEventSource src = new MultipleEventSource(); final EventCounter counter = new EventCounter(); EventUtils.bindEventsToMethod(counter, "eventOccurred", src, MultipleEventListener.class, "event1"); assertEquals(0, counter.getCount()); src.listeners.fire().event1(new PropertyChangeEvent(new Date(), "Day", Integer.valueOf(0), Integer.valueOf(1))); assertEquals(1, counter.getCount()); src.listeners.fire().event2(new PropertyChangeEvent(new Date(), "Day", Integer.valueOf(1), Integer.valueOf(2))); assertEquals(1, counter.getCount()); }
@Test public void testEventDispatchOrder() throws PropertyVetoException { final EventListenerSupport<VetoableChangeListener> listenerSupport = EventListenerSupport.create(VetoableChangeListener.class); final List<VetoableChangeListener> calledListeners = new ArrayList<>(); final VetoableChangeListener listener1 = createListener(calledListeners); final VetoableChangeListener listener2 = createListener(calledListeners); listenerSupport.addListener(listener1); listenerSupport.addListener(listener2); listenerSupport.fire().vetoableChange(new PropertyChangeEvent(new Date(), "Day", 4, 5)); assertEquals(calledListeners.size(), 2); assertSame(calledListeners.get(0), listener1); assertSame(calledListeners.get(1), listener2); }
@Test public void testRemoveListenerDuringEvent() throws PropertyVetoException { final EventListenerSupport<VetoableChangeListener> listenerSupport = EventListenerSupport.create(VetoableChangeListener.class); for (int i = 0; i < 10; ++i) { addDeregisterListener(listenerSupport); } assertEquals(listenerSupport.getListenerCount(), 10); listenerSupport.fire().vetoableChange(new PropertyChangeEvent(new Date(), "Day", 4, 5)); assertEquals(listenerSupport.getListenerCount(), 0); }
listener.vetoableChange(evt); EasyMock.replay(listener); deserializedListenerSupport.fire().vetoableChange(evt); EasyMock.verify(listener);
private void updateVisible(boolean visible) { boolean oldValue = this.visible; this.visible = visible; if (oldValue != visible) { changeSupport.fire().stateChanged(new ChangeEvent(this)); } }
private void updateFocus(boolean focus) { boolean oldValue = this.focus; this.focus = focus; if (oldValue != visible) { changeSupport.fire().stateChanged(new ChangeEvent(this)); } } }
/** * Fire state changed. */ protected void fireStateChanged() { changeSupport.fire().stateChanged(new ChangeEvent(this)); }
public void setCurrentDocUri(String docUri) { if (!Objects.equal(docUri, currentDocUri)) { currentDocUri = docUri; listenerSupport.fire().onDocumentChange(currentDocUri); } }
private void fireEditorDockFocusGained(CDockable dockable) { EditorDockWindow editor = editorDocks.get(dockable); FocusChangedEvent e = new FocusChangedEvent(editor, true); changeListeners.fire().stateChanged(e); }
private void fireEditorDockFocusLost(CDockable dockable) { EditorDockWindow editor = editorDocks.get(dockable); FocusChangedEvent e = new FocusChangedEvent(editor, false); changeListeners.fire().stateChanged(e); }
public void setGramModel(GramModel gramModel) { if (this.gramModel != null) { throw new UnsupportedOperationException("Can't change a grammatical model"); } this.gramModel = gramModel; // fire event listeners.fire().onGramModelSet(this); }
@Override public void deleteContent(String spaceId, String contentId) throws ContentStoreException { logger.info("Deleting {} from DuraCloud space {}", contentId, spaceId); contentStore.deleteContent(spaceId, contentId); this.listenerList.fire().contentDeleted(this.storeId, this.spaceId, contentId); }
protected void doAddContent(MonitoredFile syncFile, String contentId, String absPath) throws ContentStoreException { logger.debug("Local file {} added, moving to DuraCloud.", absPath); addUpdateContent(contentId, syncFile, syncFile.getAbsolutePath()); this.listenerList.fire().contentAdded(this.storeId, this.spaceId, contentId, absPath); }
private void fireLayoutError(IOException e) { log.loadLayoutError(parent, name, e); listeners.fire().layoutError( new LayoutWorkerErrorEvent(parent, name, e)); }
private void fireLayoutSaved() { log.layoutLoaded(parent, name); listeners.fire().layoutSaved(new LayoutWorkerEvent(parent, name)); } }
private void fireLayoutError(IOException e) { log.loadLayoutError(parent, name, e); listeners.fire().layoutError( new LayoutWorkerErrorEvent(parent, name, e)); }
private void fireLayoutLoaded() { log.layoutLoaded(parent, name); listeners.fire().layoutLoaded(new LayoutWorkerEvent(parent, name)); } }
public void addWordform(String text, Wordform wf) { wf = wf.cloneWithGrammems(internWordformGrammems(wf.getGrammems())); wfByString.put(text, wf); // add complete tag BitSet tag = wf.getGrammems(); tag.or(getLemma(wf.getLemmaId()).getGrammems()); tagset.add(tag); // fire event listeners.fire().onWordformAdded(this, text, wf); }