/** * Notifies all the {@link ListDataListener} that the data changed * * @param event */ private void notifyListeners(ListDataEvent event) { switch (event.getType()) { case ListDataEvent.CONTENTS_CHANGED: for (ListDataListener listener : dataListeners) { listener.contentsChanged(event); } case ListDataEvent.INTERVAL_ADDED: for (ListDataListener listener : dataListeners) { listener.intervalAdded(event); } case ListDataEvent.INTERVAL_REMOVED: for (ListDataListener listener : dataListeners) { listener.intervalRemoved(event); } } }
private void fireListEvent(ListDataEvent lde) { if (listeners == null) { return; } for (Iterator it = listeners.iterator(); it.hasNext(); ) { ListDataListener listener = (ListDataListener) it.next(); switch (lde.getType()) { case ListDataEvent.INTERVAL_ADDED: listener.intervalAdded(lde); break; case ListDataEvent.INTERVAL_REMOVED: listener.intervalRemoved(lde); break; case ListDataEvent.CONTENTS_CHANGED: listener.contentsChanged(lde); break; } } }
private static void assertEvent( String description, int eventType, int index0, int index1, ListDataEvent event) { assertEquals("Type: " + description, eventType, event.getType()); assertEquals("Index0: " + description, index0, event.getIndex0()); assertEquals("Index1: " + description, index1, event.getIndex1()); }