All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cedarsoft.utils.AbstractChildDetector Maven / Gradle / Ivy

The newest version!
package com.cedarsoft.utils;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;

/**
 * Abstract base class for child detectors
 */
public abstract class AbstractChildDetector implements ChildDetector {
  @NotNull
  private final List> listeners = new ArrayList>();

  /**
   * Notifies the listeners that the children have been changed for the given parent
   *
   * @param parent the parent
   */
  protected void notifyChildrenChangedFor( @NotNull P parent ) {
    for ( ChildChangeListener

listener : new ArrayList>( listeners ) ) { listener.notifyChildrenChangedFor( parent ); } } public void addChangeListener( @NotNull ChildChangeListener

changeListener ) { listeners.add( changeListener ); } public void removeChangeListener( @NotNull ChildChangeListener

changeListener ) { listeners.remove( changeListener ); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy