CONTENTS_CHANGED源码实例Demo

javax.swing.event.ListDataEvent#CONTENTS_CHANGED源码实例Demo

下面列出了javax.swing.event.ListDataEvent#CONTENTS_CHANGED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: CXTouch   文件: RowHeaderList.java
private void mainModelChanged(ListDataEvent e) {
    RowNumberListModel listModel = (RowNumberListModel) getModel();
    int listRowCount = listModel.getSize();
    int mainRowCount = RowHeaderList.this.getModel().getSize();
    if (mainRowCount == listRowCount) {
        if ( e.getType() == ListDataEvent.CONTENTS_CHANGED ) {
            listModel.fireContentsChanged(e.getIndex0(), e.getIndex1());
        }
        return;
    }

    listModel.setSize(mainRowCount);
    if (mainRowCount == 0) {
        return;
    }

    Insets insets = getInsets();
    ListCellRenderer cellRender = getCellRenderer();
    int with = (int) cellRender.getListCellRendererComponent(this, null, mainRowCount - 1, false, false)
            .getPreferredSize().getWidth() + insets.left + insets.right;
    setFixedCellWidth(with);
}
 
源代码2 项目: pentaho-reporting   文件: KeyedComboBoxModel.java
/**
 * Replaces the data in this combobox model. The number of keys must be equals to the number of values.
 *
 * @param keys   the keys
 * @param values the values
 */
public void setData( final K[] keys, final V[] values ) {
  if ( values.length != keys.length ) {
    throw new IllegalArgumentException( "Values and text must have the same length." );
  }

  data.clear();
  data.ensureCapacity( keys.length );

  for ( int i = 0; i < values.length; i++ ) {
    add( keys[ i ], values[ i ] );
  }

  selectedItemIndex = -1;
  final ListDataEvent evt = new ListDataEvent
    ( this, ListDataEvent.CONTENTS_CHANGED, 0, data.size() - 1 );
  fireListDataEvent( evt );
}
 
源代码3 项目: netbeans   文件: NbCustomizeSelectionDialog.java
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);
    }
}
 
源代码4 项目: netbeans   文件: DefaultTabDataModel.java
@Override
public void setTab(int index, TabData data) {
    if (!data.equals(getTab(index))) {
        TabData olddata = getTab(index);
        boolean txtChg = data.getText().equals(olddata.getText());
        boolean compChg = data.getUserObject() != olddata.getUserObject();
        list.set(index, data);
        ComplexListDataEvent lde = new ComplexListDataEvent(this,
                                                            ListDataEvent.CONTENTS_CHANGED,
                                                            index, index,
                                                            txtChg,
                                                            compChg);
        lde.setAffectedItems(new TabData[]{data});
        fireContentsChanged(lde);
    }
}
 
源代码5 项目: netbeans   文件: LicenseComboBoxModel.java
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);
    }
}
 
源代码6 项目: netbeans   文件: ServerWizardVisual.java
@Override
public final void resultChanged(LookupEvent ev) {
    List<WizardAdapter> fresh = new ArrayList<WizardAdapter>();
    for (ServerWizardProvider wizard : result.allInstances()) {

        // safety precaution shouldn't ever happen - used because of bridging
        if (wizard.getInstantiatingIterator() != null) {
            fresh.add(new WizardAdapter(wizard));
        }
    }
    Collections.sort(fresh);

    synchronized (serverWizards) {
        serverWizards.clear();
        serverWizards.addAll(fresh);
    }

    ListDataEvent event = new ListDataEvent(this,
                ListDataEvent.CONTENTS_CHANGED, 0, fresh.size() - 1);
    for (ListDataListener l : listeners) {
        l.contentsChanged(event);
    }
}
 
源代码7 项目: netbeans   文件: FilteredListModel.java
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 ());
        }
    }
}
 
源代码8 项目: NBANDROID-V2   文件: LogDevicesComboBoxSupport.java
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;
            }
        }

    }
}
 
源代码9 项目: ccu-historian   文件: KeyedComboBoxModel.java
/**
 * Replaces the data in this combobox model. The number of keys must be
 * equals to the number of values.
 *
 * @param keys   the keys
 * @param values the values
 */
public void setData(final Object[] keys, final Object[] values)
{
  if (values.length != keys.length)
  {
    throw new IllegalArgumentException("Values and text must have the same length.");
  }

  this.data.clear();
  this.data.ensureCapacity(keys.length);

  for (int i = 0; i < values.length; i++)
  {
    add(keys[i], values[i]);
  }

  this.selectedItemIndex = -1;
  final ListDataEvent evt = new ListDataEvent
      (this, ListDataEvent.CONTENTS_CHANGED, 0, this.data.size() - 1);
  fireListDataEvent(evt);
}
 
源代码10 项目: pentaho-reporting   文件: KeyedComboBoxModel.java
public void update( final int index, final K key, final V cbitem ) {
  final ComboBoxItemPair<K, V> con = new ComboBoxItemPair<K, V>( key, cbitem );
  data.set( index, con );
  final ListDataEvent evt = new ListDataEvent
    ( this, ListDataEvent.CONTENTS_CHANGED, index, index );
  fireListDataEvent( evt );
}
 
源代码11 项目: pentaho-reporting   文件: ExceptionsListModel.java
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 );
  }
}
 
源代码12 项目: Spark-Reader   文件: UserDefPage.java
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);
    }
}
 
源代码13 项目: Spark-Reader   文件: LineSelectUI.java
public void update()
{
    ListDataEvent event = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, getSize());
    for(ListDataListener ldl:listeners)
    {
        ldl.contentsChanged(event);
    }
}
 
源代码14 项目: blog   文件: ListModelHolder.java
@Override
public void propertyChange(PropertyChangeEvent evt) {
	ListModelHolder<?> listModelHolder = (ListModelHolder<?>) evt.getSource();
	ListModel<?> listModel = listModelHolder.getModel();
	int size = listModel.getSize();

	ListDataEvent contentsChanged = new ListDataEvent(listModel, ListDataEvent.CONTENTS_CHANGED, 0, size);

	List<ListDataListener> listDataListeners = listModelHolder.getListDataListeners();
	for (ListDataListener listDataListener : listDataListeners) {
		listDataListener.contentsChanged(contentsChanged);
	}

}
 
源代码15 项目: commons-bcel   文件: VerifierFactoryListModel.java
@Override
public synchronized void update(final String s) {
    final Verifier[] verifiers = VerifierFactory.getVerifiers();
    final int num_of_verifiers = verifiers.length;
    cache.clear();
    for (final Verifier verifier : verifiers) {
        cache.add(verifier.getClassName());
    }
    for (final ListDataListener listener : listeners) {
        final ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, num_of_verifiers - 1);
        listener.contentsChanged(e);
    }
}
 
源代码16 项目: netbeans   文件: JavaPlatformComponentFactory.java
private void fireChange() {
    ListDataEvent ev = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, 0);
    for (ListDataListener l : new ArrayList<ListDataListener>(listeners)) {
        l.contentsChanged(ev);
    }
}
 
源代码17 项目: pumpernickel   文件: ReplaceElementsEvent.java
@Override
protected ListDataEvent createListDataEvent() {
	return new ListDataEvent(getSource(), ListDataEvent.CONTENTS_CHANGED,
			0, newElements.size() - 1);
}
 
源代码18 项目: Digital   文件: ROMEditorDialog.java
private void fireChanged(int i) {
    ListDataEvent ev = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, i, i);
    for (ListDataListener l : listeners)
        l.contentsChanged(ev);
}
 
源代码19 项目: Digital   文件: ElementOrderer.java
private void fireEvent(int min, int max) {
    ListDataEvent e = new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, min, max);
    for (ListDataListener l : listener)
        l.contentsChanged(e);
}
 
源代码20 项目: clearvolume   文件: ChannelFilterSink.java
@Override
public void sendVolume(Volume pVolume)
{
	synchronized (mLock)
	{
		final int lChannelID = pVolume.getChannelID();
		final String lChannelName = pVolume.getChannelName();

		if (mChanneltoVolumeMap.get(lChannelID) != null)
			if (mVolumeSinkForFilteredVolumes != null)
				mVolumeSinkForFilteredVolumes.sendVolume(mChanneltoVolumeMap.get(lChannelID));
		mChanneltoVolumeMap.put(lChannelID, pVolume);

		if (!mSeenChannelList.contains(lChannelID))
		{
			mSeenChannelList.add(lChannelID);
			mActiveChannelMap.put(lChannelID, true);
			final ListDataListener[] lListeners = mChannelListModel.getListeners(ListDataListener.class);
			for (final ListDataListener lListDataListener : lListeners)
			{
				final ListDataEvent lListDataEvent = new ListDataEvent(	lListDataListener,
																		ListDataEvent.CONTENTS_CHANGED,
																		0,
																		mSeenChannelList.size());
				SwingUtilities.invokeLater(new Runnable()
				{

					@Override
					public void run()
					{
						lListDataListener.contentsChanged(lListDataEvent);
					};
				});

			}
		}
		mSeenChannelIdToNameMap.put(lChannelID, lChannelName);

		sendVolumeInternal(lChannelID);
	}
}
 
源代码评论
动弹
沙发等你来抢