Example usage for javax.swing.event ListDataListener contentsChanged

List of usage examples for javax.swing.event ListDataListener contentsChanged

Introduction

In this page you can find the example usage for javax.swing.event ListDataListener contentsChanged.

Prototype

void contentsChanged(ListDataEvent e);

Source Link

Document

Sent when the contents of the list has changed in a way that's too complex to characterize with the previous methods.

Usage

From source file:blue.soundObject.jmask.Field.java

private void fireContentsChangedEvent(ListDataEvent lde) {
    if (listListeners == null) {
        return;/*  www.j  ava 2  s. c  o m*/
    }

    Iterator iter = new Vector(listListeners).iterator();

    while (iter.hasNext()) {
        ListDataListener listener = (ListDataListener) iter.next();
        listener.contentsChanged(lde);
    }
}

From source file:blue.mixer.EffectsChain.java

private void fireContentsChangedEvent(ListDataEvent lde) {
    if (listeners == null) {
        return;/*from w  w w .  jav a 2s.  com*/
    }

    for (Iterator iter = listeners.iterator(); iter.hasNext();) {
        ListDataListener listener = (ListDataListener) iter.next();
        listener.contentsChanged(lde);
    }
}

From source file:net.pandoragames.far.ui.swing.FindFilePanel.java

public void insertElementAt(Object item, int index) {
    itemList.add(index, item);/* w ww. j a  va 2 s.co  m*/
    ListDataEvent eve = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index);
    for (ListDataListener listener : listenerList) {
        listener.contentsChanged(eve);
    }
}

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);/* w w w  .  j a v  a 2s. 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.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  .j  a  v  a  2s.c om
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.//from w  w  w  .  j a va 2 s . c  om
 *
 * @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.// w  w w  . ja va 2s  . co 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);
                        }
                    }
                }
            }
        });
    }
}