Module: Nobbie::Wx::Operations

Defined in:
lib/nobbie/wx/operations.rb

Instance Method Summary collapse

Instance Method Details

#choose(path) ⇒ Object

Chooses the component specified in the path.

Supported components: RadioButton, CheckBox

56
57
58
# File 'lib/nobbie/wx/operations.rb', line 56

def choose(path)
  execute(command_factory.create_choose_command(coerce_path(path)))
end

#chosen?(path) ⇒ Boolean

Determines if the component specified in the path is chosen.

Supported components: RadioButton, CheckBox

Returns:

  • (Boolean)

62
63
64
# File 'lib/nobbie/wx/operations.rb', line 62

def chosen?(path)
  execute(command_factory.create_is_chosen_command(coerce_path(path)))
end

#click(path) ⇒ Object

Clicks the component specified in the path.

Supported components: Button

25
26
27
# File 'lib/nobbie/wx/operations.rb', line 25

def click(path)
  execute(command_factory.create_click_on_command(coerce_path(path)))
end

#command_factoryObject

Creates an instance of the default command factory. Override this method if you wish to provide an alternative command factory.


81
82
83
# File 'lib/nobbie/wx/operations.rb', line 81

def command_factory
  Command::Factory.new
end

#component(path) ⇒ Object

Returns the component specified in the path. Useful for performing operations that Nobbie does not currently support.

Supported components: Any

32
33
34
# File 'lib/nobbie/wx/operations.rb', line 32

def component(path)
  execute(command_factory.create_get_component_command(coerce_path(path)))
end

#enabled?(path) ⇒ Boolean

Determines if the component specified in the path is currently enabled.

Supported components: Any

Returns:

  • (Boolean)

68
69
70
# File 'lib/nobbie/wx/operations.rb', line 68

def enabled?(path)
  execute(command_factory.create_is_enabled_command(coerce_path(path)))
end

#execute(command) ⇒ Object


85
86
87
# File 'lib/nobbie/wx/operations.rb', line 85

def execute(command)
  Command::Executor.execute(command)
end

#in_(name) ⇒ Object

Creates an instance of the default path builder. Override this method if you wish to provide an alternative default path builder (because coerce_path uses in_() internally).


75
76
77
# File 'lib/nobbie/wx/operations.rb', line 75

def in_(name)
  ElementPathBuilder.new(name)
end

#options(path) ⇒ Object

Retrieves available options for the component specified in the path.

Supported components: Notebook, ComboBox, ListBox, Choice

50
51
52
# File 'lib/nobbie/wx/operations.rb', line 50

def options(path)
  execute(command_factory.create_get_options_command(coerce_path(path)))
end

#select(value, path) ⇒ Object

Selects the given value for the component specified in the path.

Supported components: Notebook, Menu, ComboBox, ListBox, Choice

38
39
40
# File 'lib/nobbie/wx/operations.rb', line 38

def select(value, path)
  execute(command_factory.create_select_command(coerce_path(path), value))
end

#selected_value(path) ⇒ Object

Retrieves the currently selected value for the component specified in the path.

Supported components: Notebook, ComboBox, ListBox, Choice

44
45
46
# File 'lib/nobbie/wx/operations.rb', line 44

def selected_value(path)
  execute(command_factory.create_get_selected_values_command(coerce_path(path)))
end

#text(path) ⇒ Object

Returns the text in the component specified in the path.

Supported components: TextCtrl, ComboBox

18
19
20
21
# File 'lib/nobbie/wx/operations.rb', line 18

def text(path)
  component = component(path)
  component.nil? ? nil : component.value
end

#type(text, path) ⇒ Object

Types text into the component specified in the path.

Supported components: TextCtrl, ComboBox

12
13
14
# File 'lib/nobbie/wx/operations.rb', line 12

def type(text, path)
  execute(command_factory.create_type_into_command(coerce_path(path), text))
end