public void listChanged(ListEvent le) { System.out.println("List changed."); countLabel.setText("" + filteredList.size());
/** * @param source the raw elements that will be tested by the given * <code>matcher</code> * @param matcher the logic which determines whether an element is counted * in the value reported by this Calculation */ public ConditionalCount(EventList<E> source, Matcher<E> matcher) { super(new Integer(0)); // the user should ideally know nothing about this FilterList, so we // lock the pipeline during its construction so the calling code need // not consider concurrency, which is really an implementation detail source.getReadWriteLock().readLock().lock(); try { filtered = new FilterList<E>(source, matcher); filtered.addListEventListener(this); setValue(new Integer(filtered.size())); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * @param source the raw elements that will be tested by the given * <code>matcher</code> * @param matcher the logic which determines whether an element is counted * in the value reported by this Calculation */ public ConditionalCount(EventList<E> source, Matcher<E> matcher) { super(new Integer(0)); // the user should ideally know nothing about this FilterList, so we // lock the pipeline during its construction so the calling code need // not consider concurrency, which is really an implementation detail source.getReadWriteLock().readLock().lock(); try { filtered = new FilterList<E>(source, matcher); filtered.addListEventListener(this); setValue(new Integer(filtered.size())); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * @param source the raw elements that will be tested by the given * <code>matcher</code> * @param matcher the logic which determines whether an element is counted * in the value reported by this Calculation */ public ConditionalCount(EventList<E> source, Matcher<E> matcher) { super(new Integer(0)); // the user should ideally know nothing about this FilterList, so we // lock the pipeline during its construction so the calling code need // not consider concurrency, which is really an implementation detail source.getReadWriteLock().readLock().lock(); try { filtered = new FilterList<E>(source, matcher); filtered.addListEventListener(this); setValue(new Integer(filtered.size())); } finally { source.getReadWriteLock().readLock().unlock(); } }
/** * Handles a constraining of the filter to a degree that guarantees no * values can be matched. That is, the filter list will act as a total * filter and not match any of the elements of the wrapped source list. */ private void matchNone() { // all of these changes to this list happen "atomically" updates.beginEvent(); // fire all the elements in the list as deleted for(int i = 0; i < size(); i++) { updates.elementDeleted(0, get(i)); } // reset the flaglist to all white (which matches nothing) flagList.clear(); flagList.addWhite(0, source.size()); // commit the changes and notify listeners updates.commitEvent(); }
/** * Handles a constraining of the filter to a degree that guarantees no * values can be matched. That is, the filter list will act as a total * filter and not match any of the elements of the wrapped source list. */ private void matchNone() { // all of these changes to this list happen "atomically" updates.beginEvent(); // fire all the elements in the list as deleted for(int i = 0; i < size(); i++) { updates.elementDeleted(0, get(i)); } // reset the flaglist to all white (which matches nothing) flagList.clear(); flagList.addWhite(0, source.size()); // commit the changes and notify listeners updates.commitEvent(); }
/** * Handles a constraining of the filter to a degree that guarantees no * values can be matched. That is, the filter list will act as a total * filter and not match any of the elements of the wrapped source list. */ private void matchNone() { // all of these changes to this list happen "atomically" updates.beginEvent(); // fire all the elements in the list as deleted for(int i = 0; i < size(); i++) { updates.elementDeleted(0, get(i)); } // reset the flaglist to all white (which matches nothing) flagList.clear(); flagList.addWhite(0, source.size()); // commit the changes and notify listeners updates.commitEvent(); }