use of com.revolsys.beans.PropertyChangeSupportProxy in project com.revolsys.open by revolsys.
the class AbstractConnectionRegistry method removeConnection.
protected synchronized boolean removeConnection(final String name, final Connection connection) {
if (connection != null && name != null) {
final String lowerName = name.toLowerCase();
final C existingConnection = this.connections.get(lowerName);
if (existingConnection == connection) {
final int index = getConnectionIndex(name);
this.connectionNames.remove(lowerName);
this.connections.remove(lowerName);
if (connection instanceof PropertyChangeSupportProxy) {
final PropertyChangeSupportProxy proxy = (PropertyChangeSupportProxy) connection;
final PropertyChangeSupport propertyChangeSupport = proxy.getPropertyChangeSupport();
if (propertyChangeSupport != null) {
propertyChangeSupport.removePropertyChangeListener(this);
}
}
this.propertyChangeSupport.fireIndexedPropertyChange("connections", index, connection, null);
this.propertyChangeSupport.fireIndexedPropertyChange("children", index, connection, null);
if (this.directory != null && !this.readOnly) {
final Path file = existingConnection.getConnectionFile();
Paths.deleteDirectories(file);
}
return true;
}
}
return false;
}
use of com.revolsys.beans.PropertyChangeSupportProxy in project com.revolsys.open by revolsys.
the class AbstractConnectionRegistry method addConnection.
protected synchronized void addConnection(final String name, final C connection) {
if (connection != null && name != null) {
final String lowerName = name.toLowerCase();
final C existingConnection = this.connections.get(lowerName);
removeConnection(existingConnection);
this.connectionNames.put(lowerName, name);
this.connections.put(lowerName, connection);
if (connection instanceof PropertyChangeSupportProxy) {
final PropertyChangeSupportProxy proxy = (PropertyChangeSupportProxy) connection;
final PropertyChangeSupport propertyChangeSupport = proxy.getPropertyChangeSupport();
if (propertyChangeSupport != null) {
propertyChangeSupport.addPropertyChangeListener(this);
}
}
final int index = getConnectionIndex(name);
this.propertyChangeSupport.fireIndexedPropertyChange("connections", index, null, connection);
this.propertyChangeSupport.fireIndexedPropertyChange("children", index, null, connection);
}
}
use of com.revolsys.beans.PropertyChangeSupportProxy in project com.revolsys.open by revolsys.
the class PropertyChangeArrayList method removeListener.
protected void removeListener(final Object object) {
if (object instanceof PropertyChangeSupportProxy) {
final PropertyChangeSupportProxy proxy = (PropertyChangeSupportProxy) object;
final PropertyChangeSupport propertyChangeSupport = proxy.getPropertyChangeSupport();
if (propertyChangeSupport != null) {
propertyChangeSupport.removePropertyChangeListener(this);
}
}
}
use of com.revolsys.beans.PropertyChangeSupportProxy in project com.revolsys.open by revolsys.
the class PropertyChangeArrayList method addListener.
protected void addListener(final Object object) {
if (object instanceof PropertyChangeSupportProxy) {
final PropertyChangeSupportProxy proxy = (PropertyChangeSupportProxy) object;
final PropertyChangeSupport propertyChangeSupport = proxy.getPropertyChangeSupport();
if (propertyChangeSupport != null) {
propertyChangeSupport.addPropertyChangeListener(this);
}
}
}
use of com.revolsys.beans.PropertyChangeSupportProxy in project com.revolsys.open by revolsys.
the class Property method removeAllListeners.
static void removeAllListeners(final Object object) {
if (object instanceof Component) {
final Component component = (Component) object;
removeAllListeners(component);
}
if (object instanceof PropertyChangeSupportProxy) {
final PropertyChangeSupportProxy proxy = (PropertyChangeSupportProxy) object;
final PropertyChangeSupport propertyChangeSupport = proxy.getPropertyChangeSupport();
for (final PropertyChangeListener listener : propertyChangeSupport.getPropertyChangeListeners()) {
if (listener instanceof PropertyChangeListenerProxy) {
final PropertyChangeListenerProxy listenerProxy = (PropertyChangeListenerProxy) listener;
final String propertyName = listenerProxy.getPropertyName();
propertyChangeSupport.removePropertyChangeListener(propertyName, listener);
}
propertyChangeSupport.removePropertyChangeListener(listener);
}
}
}
Aggregations