Module: Java::javafx::collections::ObservableList

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

Overview

JRubyFX DSL extensions for JavaFX ObservableLists

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


87
88
89
90
91
92
93
94
95
96
# File 'lib/jrubyfx/core_ext/observable_value.rb', line 87

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

#index(x) ⇒ Object


98
99
100
# File 'lib/jrubyfx/core_ext/observable_value.rb', line 98

def index(x)
  indexOf(x)
end