Package jsky.util

Examples of jsky.util.ReplaceablePropertyChangeListener


        PropertyChangeEvent evt = new PropertyChangeEvent(eSource,
                propertyName, oldValue, newValue);

        for (int i = 0; i < localListeners.length; i++) {
            ReplaceablePropertyChangeListener target = localListeners[i];
            if (trace) {
                writeDebug("    calling",
                        getObjectIdString(target) + ".propertyChange");
            }
            try {
                target.propertyChange(evt);
            } catch (ReplaceablePropertyVetoException ex) {
                PropertyChangeEvent reverseEvent = new PropertyChangeEvent(eSource,
                        propertyName, newValue, oldValue);
                for (int i2 = i - 1; i2 >= 0; i2--) {
                    ReplaceablePropertyChangeListener reverseTarget = localListeners[i2];
                    if (trace) {
                        writeDebug("    reversing",
                                getObjectIdString(reverseTarget) + ".propertyChange");
                    }
                    try {
                        reverseTarget.propertyChange(reverseEvent);
                    } catch (ReplaceablePropertyVetoException ex2) {
                        writeError(this,
                                "Unexpected ReplaceablePropertyVetoException returned and ignored, " +
                                        ex2.toString());
                    }
View Full Code Here


        ReplaceablePropertyChangeListener[] localListeners = fListeners;
        if (localListeners == null) {
            return;
        }
        ReplaceablePropertyChangeListener target = null;

        int i = 0; // so is accessible in catch phrase
        if (trace) {
            writeDebug(replaceIndent + getObjectIdString(this) + ".fireReplaceObject",
                    "old=" + getObjectIdString(oldObject) + ",new=" + getObjectIdString(newObject));
            replaceIndent = replaceIndent + "  ";
        }

        try {
            ReplacementEvent evt = new ReplacementEvent(oldObject, newObject);

            for (i = 0; i < localListeners.length; i++) {
                target = localListeners[i];
                if (trace) {
                    writeDebug(replaceIndent, getObjectIdString(target));
                }
                notifyEventMonitors(target, evt);
                target.replaceObject(evt);
            }
        } catch (ReplacementVetoException ex) {
            writeDebug(this,
                    "ReplacementVetoException trapped in replaceObject, from " +
                            target.toString());

            try {
                ReplacementEvent reverseEvt = new ReplacementEvent(newObject, oldObject);
                for (int j = i - 1; j >= 0; j--) {
                    target = localListeners[j];
                    if (target != null) {
                        notifyEventMonitors(target, reverseEvt);
                        target.replaceObject(reverseEvt);
                    }
                }
            } catch (ReplacementVetoException ex2) {
                // ignore it
            }
View Full Code Here

TOP

Related Classes of jsky.util.ReplaceablePropertyChangeListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.