@Test public void testListenerCascade() { final CountingObservableElementList<JComponent> list = new CountingObservableElementList<>(new BasicEventList<JComponent>(), GlazedLists.beanConnector(JComponent.class)); final JLabel listElement = new JLabel(); list.add(listElement); assertEquals(0, list.elementChangeCount); listElement.setText("booblah"); assertEquals(1, list.elementChangeCount); listElement.setText("whippleback"); assertEquals(2, list.elementChangeCount); list.clear(); listElement.setText("booblah"); assertEquals(2, list.elementChangeCount); }
public BeanConnector(Class<E> beanClass) { final Method[] methods = beanClass.getMethods(); for (int m = 0; m < methods.length; m++) { if(methods[m].getParameterTypes().length != 1) continue; if(methods[m].getParameterTypes()[0] != PropertyChangeListener.class) continue; if(methods[m].getName().startsWith("add")) this.addListenerMethod = methods[m]; if(methods[m].getName().startsWith("remove")) this.removeListenerMethod = methods[m]; } if (this.addListenerMethod == null || this.removeListenerMethod == null) throw new IllegalArgumentException("Couldn't find listener methods for " + beanClass.getName()); }
BeanConnector implements ObservableElementList.Connector<E> { public BeanConnector(Class<E> beanClass) { final Method[] methods = beanClass.getMethods(); for (int m = 0; m < methods.length; m++) { if(methods[m].getParameterTypes().length != 1) continue; if(methods[m].getParameterTypes()[0] != PropertyChangeListener.class) continue; if(methods[m].getName().startsWith("add")) this.addListenerMethod = methods[m]; if(methods[m].getName().startsWith("remove")) this.removeListenerMethod = methods[m]; } if (this.addListenerMethod == null || this.removeListenerMethod == null) throw new IllegalArgumentException("Couldn't find listener methods for " + beanClass.getName()); } }
BeanConnector implements ObservableElementList.Connector<E> { public BeanConnector(Class<E> beanClass) { final Method[] methods = beanClass.getMethods(); for (int m = 0; m < methods.length; m++) { if(methods[m].getParameterTypes().length != 1) continue; if(methods[m].getParameterTypes()[0] != PropertyChangeListener.class) continue; if(methods[m].getName().startsWith("add")) this.addListenerMethod = methods[m]; if(methods[m].getName().startsWith("remove")) this.removeListenerMethod = methods[m]; } if (this.addListenerMethod == null || this.removeListenerMethod == null) throw new IllegalArgumentException("Couldn't find listener methods for " + beanClass.getName()); } BeanConnector(Class<E> beanClass);  BeanConnector(Class<E> beanClass, Matcher<PropertyChangeEvent> eventMatcher);  BeanConnector(Class<E> beanClass, String addListenerMethodName, String removeListenerMethodName);  BeanConnector(Class<E> beanClass, String addListenerMethodName,
            String removeListenerMethodName, Matcher<PropertyChangeEvent> eventMatcher); }
BeanConnector implements ObservableElementList.Connector<E> { public BeanConnector(Class<E> beanClass) { final Method[] methods = beanClass.getMethods(); for (int m = 0; m < methods.length; m++) { if(methods[m].getParameterTypes().length != 1) continue; if(methods[m].getParameterTypes()[0] != PropertyChangeListener.class) continue; if(methods[m].getName().startsWith("add")) this.addListenerMethod = methods[m]; if(methods[m].getName().startsWith("remove")) this.removeListenerMethod = methods[m]; } if (this.addListenerMethod == null || this.removeListenerMethod == null) throw new IllegalArgumentException("Couldn't find listener methods for " + beanClass.getName()); } BeanConnector(Class<E> beanClass);  BeanConnector(Class<E> beanClass, Matcher<PropertyChangeEvent> eventMatcher);  BeanConnector(Class<E> beanClass, String addListenerMethodName, String removeListenerMethodName);  BeanConnector(Class<E> beanClass, String addListenerMethodName,
            String removeListenerMethodName, Matcher<PropertyChangeEvent> eventMatcher); @Override EventListener installListener(E element); @Override void uninstallListener(E element, EventListener listener); @Override void setObservableElementList(ObservableElementChangeHandler<? extends E> list); final Matcher<PropertyChangeEvent> getEventMatcher(); }
BeanConnector implements ObservableElementList.Connector<E> { public BeanConnector(Class<E> beanClass) { final Method[] methods = beanClass.getMethods(); for (int m = 0; m < methods.length; m++) { if(methods[m].getParameterTypes().length != 1) continue; if(methods[m].getParameterTypes()[0] != PropertyChangeListener.class) continue; if(methods[m].getName().startsWith("add")) this.addListenerMethod = methods[m]; if(methods[m].getName().startsWith("remove")) this.removeListenerMethod = methods[m]; } if (this.addListenerMethod == null || this.removeListenerMethod == null) throw new IllegalArgumentException("Couldn't find listener methods for " + beanClass.getName()); } BeanConnector(Class<E> beanClass);  BeanConnector(Class<E> beanClass, Matcher<PropertyChangeEvent> eventMatcher);  BeanConnector(Class<E> beanClass, String addListenerMethodName, String removeListenerMethodName);  BeanConnector(Class<E> beanClass, String addListenerMethodName,
            String removeListenerMethodName, Matcher<PropertyChangeEvent> eventMatcher); @Override EventListener installListener(E element); @Override void uninstallListener(E element, EventListener listener); @Override void setObservableElementList(ObservableElementChangeHandler<? extends E> list); final Matcher<PropertyChangeEvent> getEventMatcher();  }