Tabnine Logo
CollectionEvent
Code IndexAdd Tabnine to your IDE (free)

How to use
CollectionEvent
in
com.ochafik.util.listenable

Best Java code snippets using com.ochafik.util.listenable.CollectionEvent (Showing top 7 results out of 315)

origin: com.nativelibs4java/ochafik-util

  public void collectionChanged(CollectionEvent<T> e) {
    if (listeners != null && !listeners.isEmpty()) {
      Collection<T> filteredElements = e.getElements();
      CollectionEvent<T> filteredEvent = new CollectionEvent<T>(FilteredListenableCollection.this, filteredElements, e.getType(), e.getFirstIndex(), e.getLastIndex());
      for (CollectionListener<T> listener : listeners) {
        listener.collectionChanged(filteredEvent);
      }
    }
  }
});
origin: com.nativelibs4java/ochafik-util

  public void collectionChanged(CollectionEvent<T> e) {
    switch (e.getType()) {
    case ADDED:
      fireIntervalAdded(this, e.getFirstIndex(), e.getLastIndex());
      break;
    case REMOVED:
      fireIntervalRemoved(this, e.getFirstIndex(), e.getLastIndex());
      break;
    case UPDATED:
      fireContentsChanged(this, e.getFirstIndex(), e.getLastIndex());
      break;
    }
  }
});
origin: jtrfp/terminal-recall

@Override
public void collectionChanged(CollectionEvent<T> e) {
  switch(e.getType()){
  case ADDED:
  ls.fireAdded(CompoundListenableCollection.this, e.getElements());
  break;
  case REMOVED:
  ls.fireRemoved(CompoundListenableCollection.this, e.getElements());
  break;
  case UPDATED:
  ls.fireUpdated(CompoundListenableCollection.this, e.getElements());
  break;
  default:
  break;
  }//end EventTypes
}};
private final CollectionListener<ListenableCollection<T>> outerListener = new CollectionListener<ListenableCollection<T>>(){
origin: com.nativelibs4java/ochafik-util

ListenableCollection<T> source = e.getSource(), recipient = source == a ? b : a;
for (T t : e.getElements()) {
  switch (e.getType()) {
  case ADDED:
    add(t, source, recipient);
origin: com.nativelibs4java/ochafik-util

public void fireEvent(ListenableCollection<T> source, Collection<T> elements, CollectionEvent.EventType type, int firstIndex, int lastIndex) {
  if (listeners == null || listeners.isEmpty() || elements.isEmpty()) 
    return;
  
  CollectionEvent<T> event = new CollectionEvent<T>(source,elements,type, firstIndex, lastIndex);
  for (CollectionListener<T> listener : listeners) {
    listener.collectionChanged(event);
  }
}

origin: jtrfp/terminal-recall

@Override
public void collectionChanged(CollectionEvent<ListenableCollection<T>> e) {
  switch(e.getType()){
  case ADDED:
  for(ListenableCollection<T> coll:e.getElements()){
    delegate.addComponent(coll);
    coll.addCollectionListener(innerListener);
    ls.fireAdded(CompoundListenableCollection.this, coll);
  }//end for(collections added)
  break;
  case REMOVED:
  for(ListenableCollection<T> coll:e.getElements()){
    delegate.removeComponent(coll);
    coll.removeCollectionListener(innerListener);
    ls.fireRemoved(CompoundListenableCollection.this, coll);
  }//end for(collections removed)
  break;
  case UPDATED:
  // ????
  break;
  default:
  break;
  }//end EventTypes
}};
origin: com.nativelibs4java/ochafik-util

  public void collectionChanged(CollectionEvent<U> e) {
    // Do not propagate the event if we triggered it
    if (currentlyCausingChange)
      return;
    
    // Only propagate if someone is listening (CollectionSupport already tries not to fire anything when there is no listener, but here we are trying to avoid to create the wrapped elements collection)
    if (collectionSupport == null || !collectionSupport.hasListeners())
      return;
    
    // Adapt the collection of changed / added / removed elements in the event
    collectionSupport.fireEvent(
      AdaptedCollection.this, 
      new AdaptedCollection<U, V>(e.getElements(), AdaptedCollection.this.forwardAdapter, AdaptedCollection.this.backwardAdapter), 
      e.getType(), 
      e.getFirstIndex(), 
      e.getLastIndex());
  }
});
com.ochafik.util.listenableCollectionEvent

Javadoc

Event that represents a modification of a listenable collection.
An event can be of three types : addition, removal and update.
Multiple elements can be packed in the same event instance.
For instance, if a listenable collection is cleared then it may issue no more than a single REMOVED event with all of its elements as argument.


The UPDATED event type is here to notify the listeners that something changed about the elements referred to by the event.
It is typically triggered when one adds an existing element to a ListenableSet.

Most used methods

  • getElements
    Get the elements affected by the event.
  • getType
    Get the event type
  • <init>
  • getFirstIndex
    Get the index of the first affected element in the source, or -1 if not applicable
  • getLastIndex
    Get the index of the last affected element in the source, or -1 if not applicable
  • getSource

Popular in Java

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • getSharedPreferences (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • JTable (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now