List of usage examples for javax.swing.event ListDataEvent ListDataEvent
public ListDataEvent(Object source, int type, int index0, int index1)
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateRemoveAll() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalRemoved(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_REMOVED, 0, 1))); replay(mock);/*from ww w . j a v a2 s. c o m*/ d_outer.addListDataListener(mock); d_inner.clear(); assertEquals(Collections.emptyList(), d_outer); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateSetNoChangeIncl() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.contentsChanged(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.CONTENTS_CHANGED, 1, 1))); replay(mock);/*from www . j a v a2s . c o m*/ d_outer.addListDataListener(mock); d_inner.set(2, "Kees"); assertEquals(Arrays.asList("Gert", "Kees"), d_outer); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateSetChangeAdd() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalAdded(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_ADDED, 1, 1))); replay(mock);/* w w w.ja va2 s . c o m*/ d_outer.addListDataListener(mock); d_inner.set(1, "Kees"); assertEquals(Arrays.asList("Gert", "Kees", "Jan"), d_outer); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateSetChangeRemove() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalRemoved(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_REMOVED, 1, 1))); replay(mock);/*from w w w . ja v a 2s. com*/ d_outer.addListDataListener(mock); d_inner.set(2, "Paard"); assertEquals(Arrays.asList("Gert"), d_outer); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testSetFilter() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalRemoved(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_REMOVED, 0, 1))); mock.intervalAdded(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_ADDED, 0, 2))); replay(mock);/* w w w. j a va 2 s . c o m*/ d_outer.addListDataListener(mock); d_outer.setFilter(new Predicate<String>() { public boolean evaluate(String str) { return !str.equals("Gert"); } }); assertEquals(Arrays.asList("Daan", "Jan", "Klaas"), d_outer); verify(mock); }
From source file:org.gitools.ui.app.actions.BookmarksDropdown.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (!bookmarks.equals(evt.getNewValue())) { bookmarks.removePropertyChangeListener(this); }//w w w . j a v a 2 s. c o m setBookmarks(getHeatmap().getBookmarks()); bookmarkComboBox.contentsChanged(new ListDataEvent(evt, 0, 0, 0)); bookmarksSelectPanel.revalidate(); bookmarksSelectPanel.repaint(); }
From source file:org.pentaho.reporting.engine.classic.core.modules.gui.commonswing.EncodingComboBoxModel.java
/** * Notifies all registered listeners that the content of the model has changed. *//* w w w .ja v a2 s . co m*/ protected void fireContentsChanged(final int start, final int length) { if (listDataListeners == null) { return; } final ListDataEvent evt = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, start, length); for (int i = 0; i < listDataListeners.size(); i++) { final ListDataListener l = (ListDataListener) listDataListeners.get(i); l.contentsChanged(evt); } }
From source file:org.zaproxy.zap.extension.selenium.ExtensionSelenium.java
/** * Adds the given WebDriver provider./* w ww . j a v a2 s . co m*/ * * @param webDriverProvider the WebDriver provider to add * @throws IllegalArgumentException if the the given WebDriver provider is {@code null} or its * ID is {@code null} or empty. Also, if the ID already exists. * @since 1.1.0 */ public void addWebDriverProvider(SingleWebDriverProvider webDriverProvider) { validateWebDriverProvider(webDriverProvider); if (webDriverProviders.containsKey(webDriverProvider.getId())) { throw new IllegalArgumentException( "A provider with the ID [" + webDriverProvider.getId() + "] already exists."); } webDriverProviders.put(webDriverProvider.getId(), webDriverProvider); ProvidedBrowser providedBrowser = webDriverProvider.getProvidedBrowser(); providedBrowsers.put(providedBrowser.getId(), providedBrowser); ProvidedBrowserUI pbui = new ProvidedBrowserUI(providedBrowser); providedBrowserUIList.add(pbui); Collections.sort(providedBrowserUIList); final int idx = providedBrowserUIList.indexOf(pbui); if (getView() != null) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ListDataEvent ev = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, idx, idx); Iterator<WeakReference<ProvidedBrowsersComboBoxModel>> iter = providedBrowserComboBoxModels .iterator(); while (iter.hasNext()) { WeakReference<ProvidedBrowsersComboBoxModel> wr = iter.next(); ProvidedBrowsersComboBoxModel pb = wr.get(); if (pb == null) { iter.remove(); } else { for (ListDataListener listener : pb.getListDataListeners()) { listener.contentsChanged(ev); } } } } }); } }
From source file:org.zaproxy.zap.extension.selenium.ExtensionSelenium.java
/** * Removes the given WebDriver provider. * * @param webDriverProvider the WebDriver provider to remove * @throws IllegalArgumentException if the the given WebDriver provider is {@code null} or its * ID is {@code null} or empty.//from ww w.ja v a 2 s .c o m * @since 1.1.0 */ public void removeWebDriverProvider(SingleWebDriverProvider webDriverProvider) { validateWebDriverProvider(webDriverProvider); quitWebDrivers(proxiedWebDrivers.remove(webDriverProvider.getId())); webDriverProviders.remove(webDriverProvider.getId()); providedBrowsers.remove(webDriverProvider.getProvidedBrowser().getId()); buildProvidedBrowserUIList(); if (getView() != null) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ListDataEvent ev = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, providedBrowserUIList.size()); Iterator<WeakReference<ProvidedBrowsersComboBoxModel>> iter = providedBrowserComboBoxModels .iterator(); while (iter.hasNext()) { WeakReference<ProvidedBrowsersComboBoxModel> wr = iter.next(); ProvidedBrowsersComboBoxModel pb = wr.get(); if (pb == null) { iter.remove(); } else { for (ListDataListener listener : pb.getListDataListeners()) { listener.contentsChanged(ev); } } } } }); } }
From source file:put.semantic.fcanew.ui.FilesListModel.java
public void add(File f) { if (f == null) { return;//from w w w . ja v a 2s.c o m } data.add(f); int i = data.size() - 1; ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, i, i); for (ListDataListener l : listeners) { l.intervalAdded(e); } }