Example usage for javax.swing.event ListDataListener intervalAdded

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

Introduction

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

Prototype

void intervalAdded(ListDataEvent e);

Source Link

Document

Sent after the indices in the index0,index1 interval have been inserted in the data model.

Usage

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  av a2  s .  co 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:put.semantic.fcanew.ui.FilesListModel.java

public void add(File f) {
    if (f == null) {
        return;/*w  w  w. ja v  a2s .  com*/
    }
    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);
    }
}

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

public void add(File[] files) {
    if (files == null || files.length == 0) {
        return;//w  w w. j  av a 2  s  .  c o  m
    }
    int begin = data.size();
    data.addAll(Arrays.asList(files));
    int end = data.size() - 1;
    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, begin, end);
    for (ListDataListener l : listeners) {
        l.intervalAdded(e);
    }
}

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

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