
org.nuiton.jaxx.application.bean.JavaBeanObject Maven / Gradle / Ivy
package org.nuiton.jaxx.application.bean;
/*
* #%L
* JAXX :: Application API
* %%
* Copyright (C) 2008 - 2014 CodeLutin
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import java.beans.PropertyChangeListener;
/**
* Created on 8/12/14.
*
* @author Tony Chemit - [email protected]
* @since 2.10
*/
public interface JavaBeanObject {
/**
* Add a PropertyChangeListener to the listener list.
* The listener is registered for all properties.
* The same listener object may be added more than once, and will be called
* as many times as it is added.
* If listener
is null, no exception is thrown and no action
* is taken.
*
* @param listener The PropertyChangeListener to be added
*/
void addPropertyChangeListener(PropertyChangeListener listener);
/**
* Remove a PropertyChangeListener from the listener list.
* This removes a PropertyChangeListener that was registered
* for all properties.
* If listener
was added more than once to the same event
* source, it will be notified one less time after being removed.
* If listener
is null, or was never added, no exception is
* thrown and no action is taken.
*
* @param listener The PropertyChangeListener to be removed
*/
void removePropertyChangeListener(PropertyChangeListener listener);
/**
* Returns an array of all the listeners that were added to the
* PropertyChangeSupport object with addPropertyChangeListener().
*
* If some listeners have been added with a named property, then
* the returned array will be a mixture of PropertyChangeListeners
* and PropertyChangeListenerProxy
s. If the calling
* method is interested in distinguishing the listeners then it must
* test each element to see if it's a
* PropertyChangeListenerProxy
, perform the cast, and examine
* the parameter.
*
*
* PropertyChangeListener[] listeners = bean.getPropertyChangeListeners();
* for (int i = 0; i < listeners.length; i++) {
* if (listeners[i] instanceof PropertyChangeListenerProxy) {
* PropertyChangeListenerProxy proxy =
* (PropertyChangeListenerProxy)listeners[i];
* if (proxy.getPropertyName().equals("foo")) {
* // proxy is a PropertyChangeListener which was associated
* // with the property named "foo"
* }
* }
* }
*
*
* @return all of the PropertyChangeListeners
added or an
* empty array if no listeners have been added
* @see java.beans.PropertyChangeListenerProxy
*/
PropertyChangeListener[] getPropertyChangeListeners();
/**
* Add a PropertyChangeListener for a specific property. The listener
* will be invoked only when a call on firePropertyChange names that
* specific property.
* The same listener object may be added more than once. For each
* property, the listener will be invoked the number of times it was added
* for that property.
* If propertyName
or listener
is null, no
* exception is thrown and no action is taken.
*
* @param propertyName The name of the property to listen on.
* @param listener The PropertyChangeListener to be added
*/
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
/**
* Remove a PropertyChangeListener for a specific property.
* If listener
was added more than once to the same event
* source for the specified property, it will be notified one less time
* after being removed.
* If propertyName
is null, no exception is thrown and no
* action is taken.
* If listener
is null, or was never added for the specified
* property, no exception is thrown and no action is taken.
*
* @param propertyName The name of the property that was listened on.
* @param listener The PropertyChangeListener to be removed
*/
void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
/**
* Returns an array of all the listeners which have been associated
* with the named property.
*
* @param propertyName The name of the property being listened to
* @return all of the PropertyChangeListeners
associated with
* the named property. If no such listeners have been added,
* or if propertyName
is null, an empty array is
* returned.
*/
PropertyChangeListener[] getPropertyChangeListeners(String propertyName);
void firePropertyChanged(String propertyName,
Object oldValue,
Object newValue);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy