Java Code Examples for javax.swing.event.ListDataListener#intervalAdded()
The following examples show how to use
javax.swing.event.ListDataListener#intervalAdded() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilteredListModel.java From netbeans with Apache License 2.0 | 6 votes |
private void fireChange (ListDataEvent ev) { if (list.getListenerCount () == 0) { return ; } Object[] arr = list.getListenerList (); for (int i = arr.length - 1; i >= 0; i -= 2) { ListDataListener l = (ListDataListener)arr[i]; switch (ev.getType ()) { case ListDataEvent.CONTENTS_CHANGED: l.contentsChanged (ev); break; case ListDataEvent.INTERVAL_ADDED: l.intervalAdded (ev); break; case ListDataEvent.INTERVAL_REMOVED: l.intervalRemoved (ev); break; default: throw new IllegalArgumentException ("Unknown type: " + ev.getType ()); } } }
Example 2
Source File: LogDevicesComboBoxSupport.java From NBANDROID-V2 with Apache License 2.0 | 6 votes |
private void fireListDataEvent(int type, int index1, int index2) { ListDataEvent event = new ListDataEvent(this, type, index1, index2); for (ListDataListener listener : dataListeners) { switch (type) { case ListDataEvent.CONTENTS_CHANGED: { listener.contentsChanged(event); break; } case ListDataEvent.INTERVAL_ADDED: { listener.intervalAdded(event); break; } case ListDataEvent.INTERVAL_REMOVED: { listener.intervalRemoved(event); break; } } } }
Example 3
Source File: BasicReceiver.java From pumpernickel with MIT License | 6 votes |
@Override public void add(T... elements) { if (elements.length == 0) return; int index1, index2; synchronized (this) { // to describe the event: index1 = list.size(); index2 = index1 + elements.length - 1; for (T t : elements) { list.add(t); } for (Receiver<T> receiver : receivers) { receiver.add(elements); } } for (ListDataListener listener : listeners) { listener.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index1, index2)); } }
Example 4
Source File: ObservableList.java From pumpernickel with MIT License | 6 votes |
protected void fireListDataListeners(ListDataEvent event) { for (ListDataListener listener : listDataListeners) { switch (event.getType()) { case ListDataEvent.CONTENTS_CHANGED: listener.contentsChanged(event); break; case ListDataEvent.INTERVAL_ADDED: listener.intervalAdded(event); break; case ListDataEvent.INTERVAL_REMOVED: listener.intervalRemoved(event); break; default: throw new IllegalArgumentException("Unsupported event: " + event); } } }
Example 5
Source File: ObjectTree.java From FastDMM with GNU General Public License v3.0 | 6 votes |
public void addInstance(ObjInstance instance) { if(instances.contains(instance)) return; instances.add(instance); Collections.sort(instances, (o1, o2) -> { if(o1 instanceof Item) return -1; if(o2 instanceof Item) return 1; return o1.toString().compareToIgnoreCase(o2.toString()); }); int index = instances.indexOf(instance); ListDataEvent event = new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, index, index); for(ListDataListener l : listeners) { l.intervalAdded(event); } }
Example 6
Source File: BaseList.java From bigtable-sql with Apache License 2.0 | 5 votes |
private void onIntervalAdded(ListDataEvent evt) { _list.setSelectedIndex(evt.getIndex0()); // select the one just added. for (ListDataListener listener : _listeners.toArray(new ListDataListener[0])) { listener.intervalAdded(evt); } }
Example 7
Source File: SWFListModel.java From jpexs-decompiler with GNU General Public License v3.0 | 5 votes |
/** * Adds url to the list * * @param replacement URL to add */ public void addURL(Replacement replacement) { int sizeBefore = replacements.size(); replacements.add(replacement); for (ListDataListener l : listeners) { l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, sizeBefore, sizeBefore)); } }
Example 8
Source File: QueryDialogComboBoxModel.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
protected void fireIntervalAddedEvent( ListDataEvent event ) { ListDataListener[] listeners1 = listeners.getListeners( ListDataListener.class ); for ( int i = listeners1.length - 1; i >= 0; i -= 1 ) { ListDataListener l = listeners1[i]; l.intervalAdded( event ); } }
Example 9
Source File: RuntimeComboBox.java From netbeans with Apache License 2.0 | 4 votes |
private void fireDataAdded(int start, int stop) { if (stop <= start) return; for(ListDataListener l : listeners) { l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, start, stop)); } }
Example 10
Source File: GrowingComboBox.java From netbeans with Apache License 2.0 | 4 votes |
private void fireDataAdded(int start, int stop) { if (stop <= start) return; for(ListDataListener l : listeners) { l.intervalAdded(new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, start, stop)); } }