Java Code Examples for javax.swing.event.ListDataListener#intervalRemoved()

The following examples show how to use javax.swing.event.ListDataListener#intervalRemoved() . 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 vote down vote up
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 vote down vote up
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: ObservableList.java    From pumpernickel with MIT License 6 votes vote down vote up
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 4
Source File: BaseList.java    From bigtable-sql with Apache License 2.0 6 votes vote down vote up
private void onIntervalRemoved(ListDataEvent evt)
{
   int nextIdx = evt.getIndex0();
   int lastIdx = _list.getModel().getSize() - 1;
   if (nextIdx > lastIdx)
   {
      nextIdx = lastIdx;
   }
   _list.setSelectedIndex(nextIdx);


   for (ListDataListener listener : _listeners.toArray(new ListDataListener[0]))
   {
      listener.intervalRemoved(evt);
   }
}
 
Example 5
Source File: IconChooser.java    From constellation with Apache License 2.0 5 votes vote down vote up
public void remove(final int index) {
    names.remove(index);
    iconValue.remove(index);
    for (ListDataListener l : listeners) {
        l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
    }
}
 
Example 6
Source File: ObjectTree.java    From FastDMM with GNU General Public License v3.0 5 votes vote down vote up
public void removeInstance(ObjInstance instance) {
	int index = instances.indexOf(instance);
	if(index == -1)
		return;
	instances.remove(instance);
	ListDataEvent event = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index);
	for(ListDataListener l : listeners) {
		l.intervalRemoved(event);
	}
}
 
Example 7
Source File: SWFListModel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Removes replacement with specified index from the list
 *
 * @param index Index of replacement to remove
 * @return Removed replacement
 */
public Replacement removeURL(int index) {
    if (index == -1) {
        return null;
    }
    if (index < replacements.size()) {
        Replacement r = replacements.remove(index);
        for (ListDataListener l : listeners) {
            l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, index, index));
        }
        return r;
    }
    return null;
}
 
Example 8
Source File: SWFListModel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Clears url list
 */
public void clear() {
    int size = replacements.size();
    if (size == 0) {
        return;
    }
    replacements.clear();
    for (ListDataListener l : listeners) {
        l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, 0, size - 1));
    }
}
 
Example 9
Source File: QueryDialogComboBoxModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void fireIntervalRemovedEvent( ListDataEvent event ) {
  ListDataListener[] listeners1 = listeners.getListeners( ListDataListener.class );
  for ( int i = listeners1.length - 1; i >= 0; i -= 1 ) {
    ListDataListener l = listeners1[i];
    l.intervalRemoved( event );
  }
}
 
Example 10
Source File: RuntimeComboBox.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void fireDataRemoved(int start, int stop) {
    for(ListDataListener l : listeners) {
        l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, start, stop));
    }
}
 
Example 11
Source File: GrowingComboBox.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void fireDataRemoved(int start, int stop) {
    for(ListDataListener l : listeners) {
        l.intervalRemoved(new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, start, stop));
    }
}