![JAR search and dependency download from the Maven repository](/logo.png)
com.extjs.gxt.ui.client.data.ChangeEventSupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gxt Show documentation
Show all versions of gxt Show documentation
Rich Internet Application Framework for GWT
/*
* Sencha GXT 2.3.1 - Sencha for GWT
* Copyright(c) 2007-2013, Sencha, Inc.
* [email protected]
*
* http://www.sencha.com/products/gxt/license/
*/
package com.extjs.gxt.ui.client.data;
import java.util.ArrayList;
import java.util.List;
/**
* Default implementation of the ChangeEventSource
interface.
*/
public class ChangeEventSupport implements ChangeEventSource {
protected List listeners;
protected boolean silent;
public void addChangeListener(ChangeListener... listener) {
if (listeners == null) {
listeners = new ArrayList();
}
for (int i = 0; i < listener.length; i++) {
listeners.add(listener[i]);
}
}
public boolean isSilent() {
return silent;
}
public void notify(ChangeEvent event) {
if (!silent && listeners != null) {
//make a copy of it because of ConcurrentModificationException
List l = new ArrayList(listeners);
for (int i = 0, len = l.size(); i< len; i++) {
ChangeListener listener = l.get(i);
listener.modelChanged(event);
}
}
}
public void removeChangeListener(ChangeListener... listener) {
if (listeners != null) {
for (int i = 0; i < listener.length; i++) {
listeners.remove(listener[i]);
}
}
}
public void setSilent(boolean silent) {
this.silent = silent;
}
public void removeChangeListeners() {
if (listeners != null) {
listeners.clear();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy