Example usage for javax.swing.event ListDataEvent CONTENTS_CHANGED

List of usage examples for javax.swing.event ListDataEvent CONTENTS_CHANGED

Introduction

In this page you can find the example usage for javax.swing.event ListDataEvent CONTENTS_CHANGED.

Prototype

int CONTENTS_CHANGED

To view the source code for javax.swing.event ListDataEvent CONTENTS_CHANGED.

Click Source Link

Document

Identifies one or more changes in the lists contents.

Usage

From source file:blue.mixer.EffectsChain.java

public void propertyChange(PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals("sendChannel")) {
        Object obj = evt.getSource();

        int index = ListUtil.indexOfByRef(effects, obj);

        if (index >= 0) {
            ListDataEvent lde = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index);

            fireContentsChangedEvent(lde);
        }/*  w  w w  .ja  va2s.co m*/
    }
}

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

public void insertElementAt(Object item, int index) {
    itemList.add(index, item);// ww w. j  a  v a 2 s. com
    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);// ww w. j  av a 2s. co 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.
 *//*from   w w w  . j a  va2 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

/**
 * 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 w w  w.j a  v  a2  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);
                        }
                    }
                }
            }
        });
    }
}