Example usage for javax.swing.event ListDataEvent INTERVAL_REMOVED

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

Introduction

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

Prototype

int INTERVAL_REMOVED

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

Click Source Link

Document

Identifies the removal of one or more contiguous items from the list

Usage

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

public void removeElementAt(int index) {
    if (index < 0 || index >= itemList.size())
        return;//from  w  ww.j  a va 2s .c o  m
    itemList.remove(index);
    ListDataEvent eve = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index);
    for (ListDataListener listener : listenerList) {
        listener.intervalRemoved(eve);
    }
}

From source file:org.drugis.common.beans.FilteredObservableListTest.java

@Test
public void testContentsUpdateRemoveEnd() {
    ListDataListener mock = createStrictMock(ListDataListener.class);
    mock.intervalRemoved(ListDataEventMatcher
            .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_REMOVED, 1, 1)));
    replay(mock);// ww  w  . j a  va 2 s . com
    d_outer.addListDataListener(mock);
    d_inner.remove("Jan");
    assertEquals(Arrays.asList("Gert"), d_outer);
    verify(mock);
}

From source file:org.drugis.common.beans.FilteredObservableListTest.java

@Test
public void testContentsUpdateRemoveStart() {
    ListDataListener mock = createStrictMock(ListDataListener.class);
    mock.intervalRemoved(ListDataEventMatcher
            .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_REMOVED, 0, 0)));
    replay(mock);//from ww w .j a va2 s  .c  o  m
    d_outer.addListDataListener(mock);
    d_inner.remove("Gert");
    assertEquals(Arrays.asList("Jan"), d_outer);
    verify(mock);
}

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  w ww . j ava  2 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 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  .j  a v a 2s .c  o  m*/
    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);/*from   w  w  w . ja  v a2 s .com*/
    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:put.semantic.fcanew.ui.FilesListModel.java

public void remove(int index) {
    data.remove(index);// w  w w  .  j av a 2s. c  o m
    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index);
    for (ListDataListener l : listeners) {
        l.intervalAdded(e);
    }
}

From source file:put.semantic.fcanew.ui.FilesListModel.java

public void clear() {
    if (!data.isEmpty()) {
        ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 0, data.size() - 1);
        data.clear();/* www  .j a v a 2  s .  c o  m*/
        for (ListDataListener l : listeners) {
            l.intervalRemoved(e);
        }
    }
}