List of usage examples for javax.swing.event ListDataEvent ListDataEvent
public ListDataEvent(Object source, int type, int index0, int index1)
From source file:net.pandoragames.far.ui.swing.FindFilePanel.java
public void insertElementAt(Object item, int index) { itemList.add(index, item);//from w ww .j ava 2s. c om ListDataEvent eve = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index); for (ListDataListener listener : listenerList) { listener.contentsChanged(eve); } }
From source file:net.pandoragames.far.ui.swing.FindFilePanel.java
public void removeElement(Object item) { if (itemList.contains(item)) { int index = itemList.indexOf(item); itemList.remove(index);// w w w. ja v a 2s .c o m ListDataEvent eve = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index); for (ListDataListener listener : listenerList) { listener.intervalRemoved(eve); } } }
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 va2 s .com 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 testContentsUpdateAddStart() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalAdded(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_ADDED, 0, 0))); replay(mock);//from ww w. java2s.c om d_outer.addListDataListener(mock); d_inner.add(0, "Bart"); assertEquals("Bart", d_outer.get(0)); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateAddEnd() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalAdded(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_ADDED, 2, 2))); replay(mock);/* w w w . j a va 2 s . c om*/ d_outer.addListDataListener(mock); d_inner.add("Bart"); assertEquals("Bart", d_outer.get(2)); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateAddIndex() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalAdded(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_ADDED, 1, 1))); replay(mock);/*from w ww . ja va2 s. co m*/ d_outer.addListDataListener(mock); d_inner.add(2, "Henk"); assertEquals(Arrays.asList("Gert", "Henk", "Jan"), d_outer); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateAddAllIndex() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalAdded(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_ADDED, 1, 2))); replay(mock);/* www.j a v a 2 s . c o m*/ d_outer.addListDataListener(mock); d_inner.addAll(2, Arrays.asList("Henk", "Bart")); assertEquals(Arrays.asList("Gert", "Henk", "Bart", "Jan"), d_outer); verify(mock); }
From source file:org.drugis.common.beans.FilteredObservableListTest.java
@Test public void testContentsUpdateAddAllEnd() { ListDataListener mock = createStrictMock(ListDataListener.class); mock.intervalAdded(ListDataEventMatcher .eqListDataEvent(new ListDataEvent(d_outer, ListDataEvent.INTERVAL_ADDED, 2, 3))); replay(mock);/*from www.java 2 s . c o m*/ d_outer.addListDataListener(mock); d_inner.addAll(Arrays.asList("Henk", "Bart")); assertEquals(Arrays.asList("Gert", "Jan", "Henk", "Bart"), d_outer); verify(mock); }
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);//from w w w . j a va 2 s. c om 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 w ww .j a va2 s .co m d_outer.addListDataListener(mock); d_inner.remove("Gert"); assertEquals(Arrays.asList("Jan"), d_outer); verify(mock); }