class Glimmer::DataBinding::ListSelectionBinding

SWT List element selection binding

Constants

PROPERTY_EVALUATORS
PROPERTY_TYPE_UPDATERS

Attributes

element_proxy[R]

Public Class Methods

new(element_proxy, property_type) click to toggle source

Initialize with list element and property_type property_type :string represents default list single selection property_type :array represents list multi selection

# File lib/glimmer/data_binding/list_selection_binding.rb, line 32
def initialize(element_proxy, property_type)
  property_type = :string if property_type.nil? or property_type == :undefined
  @element_proxy = element_proxy
  @property_type = property_type
  @element_proxy.on_widget_disposed do |dispose_event|
    unregister_all_observables
  end
end

Public Instance Methods

call(value) click to toggle source
# File lib/glimmer/data_binding/list_selection_binding.rb, line 41
def call(value)
  PROPERTY_TYPE_UPDATERS[@property_type].call(@element_proxy, value) unless !evaluate_property.is_a?(Array) && evaluate_property == value
end
evaluate_property() click to toggle source
# File lib/glimmer/data_binding/list_selection_binding.rb, line 45
def evaluate_property
  selection_array = @element_proxy.selection.to_a #TODO refactor send('selection') into proper method invocation
  PROPERTY_EVALUATORS[@property_type].call(selection_array)
end