Methods Summary |
---|
public void | addSystemListener(T listener)Adds system listener to this list.
if (systemList == null) {
systemList = new ArrayList<T>();
}
systemList.add(listener);
|
public void | addUserListener(T listener)Adds user (public) listener to this list.
if (listener == null) {
return;
}
// transactionally replace old list
synchronized (this) {
if (userList == null) {
userList = new ArrayList<T>();
userList.add(listener);
return;
}
ArrayList<T> newList = new ArrayList<T>(userList);
newList.add(listener);
userList = newList;
}
|
private static java.util.ArrayList | getOnlySerializable(java.util.ArrayList list)
if (list == null) {
return null;
}
ArrayList<Object> result = new ArrayList<Object>();
for (Iterator<?> it = list.iterator(); it.hasNext();) {
Object obj = it.next();
if (obj instanceof Serializable) {
result.add(obj);
}
}
return (result.size() != 0) ? result : null;
|
public java.util.Iterator | getSystemIterator()Gets iterator for system listeners.
return systemList.iterator();
|
public java.util.List | getSystemListeners()
synchronized (this) {
if (systemList == null || systemList.isEmpty()) {
return Collections.emptyList();
}
return new ArrayList<T>(systemList);
}
|
public java.util.Iterator | getUserIterator()Gets iterator for user listeners.
synchronized (this) {
if (userList == null) {
List<T> emptyList = Collections.emptyList();
return emptyList.iterator();
}
return new ReadOnlyIterator<T>(userList.iterator());
}
|
public AT[] | getUserListeners(AT[] emptyArray)Gets all user (public) listeners in one array.
synchronized (this) {
return (userList != null ? userList.toArray(emptyArray) : emptyArray);
}
|
public java.util.List | getUserListeners()Gets all user (public) listeners in one list.
synchronized (this) {
if (userList == null || userList.isEmpty()) {
return Collections.emptyList();
}
return new ArrayList<T>(userList);
}
|
private void | readObject(java.io.ObjectInputStream stream)
stream.defaultReadObject();
systemList = (ArrayList<T>)stream.readObject();
userList = (ArrayList<T>)stream.readObject();
|
public void | removeUserListener(java.lang.Object listener)Removes user (public) listener to this list.
if (listener == null) {
return;
}
// transactionally replace old list
synchronized (this) {
if (userList == null || !userList.contains(listener)) {
return;
}
ArrayList<T> newList = new ArrayList<T>(userList);
newList.remove(listener);
userList = (newList.size() > 0 ? newList : null);
}
|
private void | writeObject(java.io.ObjectOutputStream stream)
stream.defaultWriteObject();
stream.writeObject(getOnlySerializable(systemList));
stream.writeObject(getOnlySerializable(userList));
|