Example usage for java.beans PropertyChangeSupport addPropertyChangeListener

List of usage examples for java.beans PropertyChangeSupport addPropertyChangeListener

Introduction

In this page you can find the example usage for java.beans PropertyChangeSupport addPropertyChangeListener.

Prototype

public void addPropertyChangeListener(PropertyChangeListener listener) 

Source Link

Document

Add a PropertyChangeListener to the listener list.

Usage

From source file:org.eclipsetrader.directa.internal.core.connector.StreamingConnector.java

@Override
public IFeedSubscription subscribe(IFeedIdentifier identifier) {
    synchronized (symbolSubscriptions) {
        IdentifierType identifierType = IdentifiersList.getInstance().getIdentifierFor(identifier);
        FeedSubscription subscription = symbolSubscriptions.get(identifierType.getSymbol());
        if (subscription == null) {
            subscription = new FeedSubscription(this, identifierType);

            PropertyChangeSupport propertyChangeSupport = (PropertyChangeSupport) identifier
                    .getAdapter(PropertyChangeSupport.class);
            if (propertyChangeSupport != null) {
                propertyChangeSupport.addPropertyChangeListener(this);
            }/*from   w ww.j  a v a  2s  .  co  m*/

            symbolSubscriptions.put(identifierType.getSymbol(), subscription);
            subscriptionsChanged = true;
        }
        if (identifierType.getIdentifier() == null) {
            identifierType.setIdentifier(identifier);

            PropertyChangeSupport propertyChangeSupport = (PropertyChangeSupport) identifier
                    .getAdapter(PropertyChangeSupport.class);
            if (propertyChangeSupport != null) {
                propertyChangeSupport.addPropertyChangeListener(this);
            }
        }
        if (subscription.incrementInstanceCount() == 1) {
            subscriptionsChanged = true;
        }
        return subscription;
    }
}

From source file:org.eclipsetrader.directa.internal.core.connector.StreamingConnector.java

@Override
public IFeedSubscription2 subscribeLevel2(IFeedIdentifier identifier) {
    FeedSubscription subscription;/*from w w w. java2 s.c  o  m*/
    IdentifierType identifierType;

    synchronized (symbolSubscriptions) {
        identifierType = IdentifiersList.getInstance().getIdentifierFor(identifier);
        subscription = symbolSubscriptions.get(identifierType.getSymbol());
        if (subscription == null) {
            subscription = new FeedSubscription(this, identifierType);

            PropertyChangeSupport propertyChangeSupport = (PropertyChangeSupport) identifier
                    .getAdapter(PropertyChangeSupport.class);
            if (propertyChangeSupport != null) {
                propertyChangeSupport.addPropertyChangeListener(this);
            }

            symbolSubscriptions.put(identifierType.getSymbol(), subscription);
            subscriptionsChanged = true;
        }
        if (subscription.incrementInstanceCount() == 1) {
            subscriptionsChanged = true;
        }
    }

    synchronized (symbolSubscriptions2) {
        FeedSubscription2 subscription2 = symbolSubscriptions2.get(identifierType.getSymbol());
        if (subscription2 == null) {
            subscription2 = new FeedSubscription2(this, subscription);
            symbolSubscriptions2.put(identifierType.getSymbol(), subscription2);
            subscriptionsChanged = true;
        }
        if (subscription.incrementLevel2InstanceCount() == 1) {
            subscriptionsChanged = true;
        }
        return subscription;
    }
}

From source file:org.eclipsetrader.kdb.internal.core.connector.SnapshotConnector.java

@Override
public IFeedSubscription subscribe(IFeedIdentifier identifier) {
    synchronized (symbolSubscriptions) {
        IdentifierType identifierType = IdentifiersList.getInstance().getIdentifierFor(identifier);
        FeedSubscription subscription = symbolSubscriptions.get(identifierType.getSymbol());
        if (subscription == null) {
            subscription = new FeedSubscription(this, identifierType);

            PropertyChangeSupport propertyChangeSupport = (PropertyChangeSupport) identifier
                    .getAdapter(PropertyChangeSupport.class);
            if (propertyChangeSupport != null) {
                propertyChangeSupport.addPropertyChangeListener(this);
            }//from   w w w. j  av  a  2 s.  c o m

            symbolSubscriptions.put(identifierType.getSymbol(), subscription);
            setSubscriptionsChanged(true);
        }
        subscription.incrementInstanceCount();
        return subscription;
    }
}