PropertyChangeSupport addPropertyChangeListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PropertyChangeSupport addPropertyChangeListener method.

This code example shows how to use the following methods:addPropertyChangeListener
     * @deprecated This service should not be used outside the AS7 codebase itself, as it may be replaced in AS 7.2 
     */ 
    @Deprecated 
    public void addPropertyChangeListener( 
            PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    } 
 
    /** 
     * Removes a previously {@link #addPropertyChangeListener(PropertyChangeListener) registered listener}. 
     * 
     * @param listener the listener 
     * 
     * @deprecated This service should not be used outside the AS7 codebase itself, as it may be replaced in AS 7.2 
     */ 
    @Deprecated 
    public void removePropertyChangeListener( 
            PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    } 
8
CodeRank
This code example shows how to use the following methods:addPropertyChangeListener
This code example shows how to use the following methods:addPropertyChangeListener, hasListeners
public class Test4092905 { 
    private static final String PUBLIC = "public";
    private static final String PRIVATE = "private";
 
    public static void main(String[] args) {
        PropertyChangeSupport pcs = new PropertyChangeSupport(args);
        pcs.addPropertyChangeListener(PUBLIC, new PublicListener());
        pcs.addPropertyChangeListener(PRIVATE, new PrivateListener());
 
        if (!pcs.hasListeners(PUBLIC)) {
            throw new Error("no public listener");
        } 
        if (!pcs.hasListeners(PRIVATE)) {
            throw new Error("no private listener");
        } 
 
        try { 
            // serialize into byte array 
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ObjectOutputStream output = new ObjectOutputStream(baos);
7
CodeRank
This code example shows how to use the following methods:addPropertyChangeListener
        this.name = name;
        this.i = i;
    } 
 
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    } 
 
    public Integer getI() {
        return i;
    } 
 
    public void setI(Integer i) {
        changeSupport.firePropertyChange("i", this.i, this.i = i);
    } 
 
    public String getName() {
        return name;
    } 
 
8
CodeRank
This code example shows how to use the following methods:addPropertyChangeListener
    public long getTotalNumBytesRead() { 
        return totalNumBytesRead;
    } 
 
    public void addPropertyChangeListener(PropertyChangeListener l) {
        propertyChangeSupport.addPropertyChangeListener(l);
    } 
 
    public void removePropertyChangeListener(PropertyChangeListener l) {
        propertyChangeSupport.removePropertyChangeListener(l);
    } 
 
    @Override 
    public int read() throws IOException {
        return (int)updateProgress(super.read()); 
    } 
 
    @Override 
    public int read(byte[] b) throws IOException {
        return (int)updateProgress(super.read(b));
8
CodeRank
This code example shows how to use the following methods:addPropertyChangeListener
        return server;
    } 
 
    public void addPropertyChangeListener(PropertyChangeListener listener)
    { 
        changes.addPropertyChangeListener(listener);
    } 
 
    public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
    { 
        changes.addPropertyChangeListener(propertyName, listener);
    } 
 
    public void removePropertyChangeListener(PropertyChangeListener listener)
    { 
        changes.removePropertyChangeListener(listener);
    } 
 
    public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
    { 
7
CodeRank
This code example shows how to use the following methods:addPropertyChangeListener, fireIndexedPropertyChange, firePropertyChange
    public static void main(String[] args) {
        TestEquals one = new TestEquals(1);
        TestEquals two = new TestEquals(2);
 
        Object source = TestEquals.class;
        PropertyChangeSupport pcs = new PropertyChangeSupport(source);
        pcs.addPropertyChangeListener(PROPERTY, one);
        pcs.addPropertyChangeListener(PROPERTY, two);
 
        PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two);
        pcs.firePropertyChange(event);
        test(one, two, 1); // only one check
        pcs.firePropertyChange(PROPERTY, one, two);
        test(one, two, 2); // because it invokes firePropertyChange(PropertyChangeEvent)
        pcs.fireIndexedPropertyChange(PROPERTY, 1, one, two);
        test(one, two, 2); // because it invokes firePropertyChange(PropertyChangeEvent)
    } 
 
    private static void test(TestEquals v1, TestEquals v2, int amount) {
        int count = v1.count + v2.count;
7
CodeRank
This code example shows how to use the following methods:addPropertyChangeListener
This code example shows how to use the following methods:addPropertyChangeListener
        firePropertyChange(PROPERTY_ADDITIONAL_GEO_BOUNDARIES, oldGeoBoundarys, additionalGeoBoundaryList);
    } 
 
    public void addModelChangeListener(PropertyChangeListener listener) {
        if (changeSupport == null) {
            changeSupport = new PropertyChangeSupport(this);
        } 
        changeSupport.addPropertyChangeListener(listener);
    } 
 
    public void removeModelChangeListener(PropertyChangeListener listener) {
        if (changeSupport != null) {
            changeSupport.removePropertyChangeListener(listener);
        } 
    } 
 
    public void addProduct(Product product) {
        if (!productList.contains(product)) {
            final Product[] oldProducts = getProducts();
            if (productList.add(product)) {
7
CodeRank
This code example shows how to use the following methods:addPropertyChangeListener
                                         oldState,
                                         newState );
    } 
 
    public void addPropertyChangeListener(final PropertyChangeListener l) {
        this.changes.addPropertyChangeListener( l );
    } 
 
    public void removePropertyChangeListener(final PropertyChangeListener l) {
        this.changes.removePropertyChangeListener( l );
    } 
     
    public PropertyChangeListener[] getPropertyChangeListeners() {
        return this.changes.getPropertyChangeListeners();
    } 
 
    public boolean isFlag() { 
        return this.flag;
    } 
 
8
CodeRank
addPropertyChangeListener Method Overview
Add a PropertyChangeListener to the listener list.
See Code Examples for other Java 8 PropertyChangeSupport Methods: