Module: Java::javafx::collections::ObservableMap

Defined in:
lib/jrubyfx/core_ext/observable_value.rb

Overview

JRubyFX DSL extensions for JavaFX ObservableMaps

Instance Method Summary collapse

Instance Method Details

#add_change_listener(&block) ⇒ Object

call-seq:

add_change_listener { |change| block }

Add a ruby block to call when the property changes changes



117
118
119
120
121
122
123
124
125
126
# File 'lib/jrubyfx/core_ext/observable_value.rb', line 117

def add_change_listener(&block)
  old_verbose = $VERBOSE
  begin
    $VERBOSE = nil
    addListener(MapChangeListener.impl {|name, x|block.call(x)})
  ensure
    # always re-set to old value, even if block raises an exception
    $VERBOSE = old_verbose
  end
end