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

The following examples show how to use javax.swing.event.ListDataListener#contentsChanged() . 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: 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 2
Source File: ApplicationLocationPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void fireContentsChanged(int index) {
    final ListDataListener[] clone;
    synchronized (listeners) {
        clone = listeners.toArray(new ListDataListener[listeners.size()]);
    }
    
    final ListDataEvent event = new ListDataEvent(
            this,
            ListDataEvent.CONTENTS_CHANGED,
            index,
            index);
    
    for (ListDataListener listener: clone) {
        listener.contentsChanged(event);
    }
}
 
Example 3
Source File: NbCustomizeSelectionDialog.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void fireRowChanged(int index) {
    final ListDataListener[] clone;
    synchronized (listeners) {
        clone = listeners.toArray(new ListDataListener[listeners.size()]);
    }
    
    final ListDataEvent event = new ListDataEvent(
            this,
            ListDataEvent.CONTENTS_CHANGED,
            index,
            index);
    
    for (ListDataListener listener: clone) {
        listener.contentsChanged(event);
    }
}
 
Example 4
Source File: CDebuggerComboModel.java    From binnavi with Apache License 2.0 5 votes vote down vote up
@Override
public void removedDebugger(
    final IDebuggerContainer container, final DebuggerTemplate debugger) {
  updateElements();

  for (final ListDataListener listener : modelListeners) {
    listener.contentsChanged(new ListDataEvent(
        CDebuggerComboModel.this, ListDataEvent.CONTENTS_CHANGED, 0, getSize()));
  }
}
 
Example 5
Source File: SWFListModel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called when data in a replacement changed
 *
 * @param index Index of which SWF changed
 */
public void dataChanged(int index) {
    if (index == -1) {
        return;
    }
    for (ListDataListener l : listeners) {
        l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, index, index));
    }
}
 
Example 6
Source File: UserDefPage.java    From Spark-Reader with GNU General Public License v3.0 5 votes vote down vote up
public void update()
{
    //TODO don't be lazy on listDataEvent here
    ListDataEvent event = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, getSize());
    for(ListDataListener listener:listeners)
    {
        listener.contentsChanged(event);
    }
}
 
Example 7
Source File: LineSelectUI.java    From Spark-Reader with GNU General Public License v3.0 5 votes vote down vote up
public void update()
{
    ListDataEvent event = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, getSize());
    for(ListDataListener ldl:listeners)
    {
        ldl.contentsChanged(event);
    }
}
 
Example 8
Source File: KeyedComboBoxModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Notifies all registered list data listener of the given event.
 *
 * @param evt the event.
 */
protected synchronized void fireListDataEvent( final ListDataEvent evt ) {
  if ( tempListeners == null ) {
    tempListeners = listdatalistener.toArray
      ( new ListDataListener[ listdatalistener.size() ] );
  }

  final ListDataListener[] listeners = tempListeners;
  for ( int i = 0; i < listeners.length; i++ ) {
    final ListDataListener l = listeners[ i ];
    l.contentsChanged( evt );
  }
}
 
Example 9
Source File: ExceptionsListModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void fireListUpdate() {
  final ListDataListener[] listDataListeners = listenerList.getListeners( ListDataListener.class );
  final ListDataEvent event = new ListDataEvent( this, ListDataEvent.CONTENTS_CHANGED, -1, -1 );
  for ( int i = 0; i < listDataListeners.length; i++ ) {
    final ListDataListener listener = listDataListeners[ i ];
    listener.contentsChanged( event );
  }
}
 
Example 10
Source File: EncodingComboBoxModel.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Notifies all registered listeners that the content of the model has changed.
 */
protected void fireContentsChanged( final int start, final int length ) {
  if ( listDataListeners == null ) {
    return;
  }
  final ListDataEvent evt = new ListDataEvent( this, ListDataEvent.CONTENTS_CHANGED, start, length );
  for ( int i = 0; i < listDataListeners.size(); i++ ) {
    final ListDataListener l = (ListDataListener) listDataListeners.get( i );
    l.contentsChanged( evt );
  }
}
 
Example 11
Source File: JavaPlatformComponentFactory.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void fireChange() {
    ListDataEvent ev = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, 0);
    for (ListDataListener l : new ArrayList<ListDataListener>(listeners)) {
        l.contentsChanged(ev);
    }
}
 
Example 12
Source File: ElementOrderer.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
private void fireEvent(int min, int max) {
    ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, min, max);
    for (ListDataListener l : listener)
        l.contentsChanged(e);
}
 
Example 13
Source File: GrowingComboBox.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void fireDataChanged() {
    int stop = getSize() - 1;
    for(ListDataListener l : listeners) {
        l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, stop));
    }
}
 
Example 14
Source File: ElementOrderer.java    From Digital with GNU General Public License v3.0 4 votes vote down vote up
private void fireEventDeleted(int item) {
    ListDataEvent e = new ListDataEvent(this, ListDataEvent.INTERVAL_REMOVED, item, item);
    for (ListDataListener l : listener)
        l.contentsChanged(e);
}
 
Example 15
Source File: FilenamePatternsComboBoxModel.java    From TwitchDownloader with GNU General Public License v3.0 4 votes vote down vote up
private void notifyListDataListeners() {
    for(ListDataListener listener: listDataListeners) {
        listener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, getSize()-1));
    }
}
 
Example 16
Source File: AndroidPlatformCustomizer.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void fireClassPathAdded() {
    for (ListDataListener listener : classListeners) {
        listener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, aPackage.getBootPaths().size() - 2, aPackage.getBootPaths().size() - 1));
    }
}
 
Example 17
Source File: AndroidPlatformCustomizer.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void fireClassPathRemoved() {
    for (ListDataListener listener : classListeners) {
        listener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, aPackage.getBootPaths().size() - 1, aPackage.getBootPaths().size() - 1));
    }
}
 
Example 18
Source File: HistoryComboBoxModel.java    From snap-desktop with GNU General Public License v3.0 4 votes vote down vote up
private void fireContentChanged() {
    final ListDataListener[] listDataListeners = listenerList.getListeners(ListDataListener.class);
    for (ListDataListener listener : listDataListeners) {
        listener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, 0));
    }
}
 
Example 19
Source File: AndroidPlatformCustomizer.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void fireJavadocAdded() {
    for (ListDataListener listener : javadocListeners) {
        listener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, aPackage.getJavadocPaths().size() - 2, aPackage.getJavadocPaths().size() - 1));
    }
}
 
Example 20
Source File: AndroidPlatformCustomizer.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
private void fireJavadocRemoved() {
    for (ListDataListener listener : javadocListeners) {
        listener.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, aPackage.getJavadocPaths().size() - 1, aPackage.getJavadocPaths().size() - 1));
    }
}