2 Replies Latest reply: Jun 26, 2014 12:38 AM by user2932712 RSS

    Remove all listeners and/or all bindings?

    user2932712

      Hi

      Is there any way in JavaFX 8 to remove all change/invalidation listeners on an observable?

      And is there any way to remove all bindings on a property?

      thanks

      graham

        • 1. Re: Remove all listeners and/or all bindings?
          aidreamer

          Is there any way in JavaFX 8 to remove all change/invalidation listeners on an observable?

          When parameterListener is passed to removeListener(), the implementation goes through the list of all change/invalidation listeners. It will call parameterListener.equals on each of the listeners in the list and remove the first one it returns true for. As such, the answer is technically yes. However, you cannot access the list of listeners directly and it is not recommended that you remove any listener you did not yourself add.

           

          And is there any way to remove all bindings on a property?

          If you know everything that was bound to it. But I don't think you have access to the internal list of all things bound.

          • 2. Re: Remove all listeners and/or all bindings?
            user2932712

            Ah, clever. Thanks for the trick.