Connection property changed listener

Contains useful source code for specific use cases.

Connection property changed listener

Postby Development@SIB » Thu Jan 22, 2015 3:41 pm

It's easy to listen on connection property changed events:
Syntax: [ Download ] [ Hide ]
MasterConnection appcon = new MasterConnection(createConnection());
appcon.addPropertyChangedListener("Application.mode", new IConnectionPropertyChangedListener()
{
    public void propertyChanged(PropertyEvent pEvent)
    {
        liProps.add(pEvent.getPropertyName() + " = " + pEvent.getNewValue());
    }
});

Above listener will be invoked whenever the connection property Application.mode will be changed.

It's also possible to listen on all properties, with following snippet:
Syntax: [ Download ] [ Hide ]
MasterConnection appcon = new MasterConnection(createConnection());
appcon.addPropertyChangedListener(null, new IConnectionPropertyChangedListener()
{
    public void propertyChanged(PropertyEvent pEvent)
    {
        liProps.add(pEvent.getPropertyName() + " = " + pEvent.getNewValue());
    }
});
User avatar
Development@SIB
 
Posts: 311
Joined: Mon Sep 28, 2009 1:54 pm

Return to Code snippets