Search in sources :

Example 1 with QualifierListener

use of com.ramussoft.common.event.QualifierListener in project ramus by Vitaliy-Yakovchuk.

the class OtherElementPlugin method setFramework.

@Override
public void setFramework(GUIFramework framework) {
    super.setFramework(framework);
    final QualifierListener listener = new QualifierAdapter() {

        @Override
        public void qualifierDeleted(QualifierEvent event) {
            RowSetValue value = sets.get(event.getOldQualifier());
            if (value != null) {
                value.rowSet.close();
                sets.remove(event.getOldQualifier());
            }
        }
    };
    framework.getEngine().addQualifierListener(listener);
    framework.addCloseMainFrameListener(new CloseMainFrameAdapter() {

        @Override
        public void closed() {
            for (RowSetValue value : sets.values()) {
                try {
                    value.rowSet.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            sets.clear();
            OtherElementPlugin.this.framework.getEngine().removeQualifierListener(listener);
        }
    });
}
Also used : QualifierAdapter(com.ramussoft.common.event.QualifierAdapter) CloseMainFrameAdapter(com.ramussoft.gui.common.event.CloseMainFrameAdapter) QualifierListener(com.ramussoft.common.event.QualifierListener) QualifierEvent(com.ramussoft.common.event.QualifierEvent)

Aggregations

QualifierAdapter (com.ramussoft.common.event.QualifierAdapter)1 QualifierEvent (com.ramussoft.common.event.QualifierEvent)1 QualifierListener (com.ramussoft.common.event.QualifierListener)1 CloseMainFrameAdapter (com.ramussoft.gui.common.event.CloseMainFrameAdapter)1