Class: Lebowski::Foundation::Views::View

Inherits:
SCObject show all
Includes:
Lebowski::Foundation, Mixins::DelegateSupport, Mixins::UserActions, Lebowski::Foundation::Views
Defined in:
lib/lebowski/foundation/views/view.rb

Direct Known Subclasses

Panes::Pane, ButtonView, CheckboxView, CollectionView, ContainerView, LabelView, ListItemView, MenuItemView, RadioView, SegmentedView, SelectButtonView, SelectFieldView, TextFieldView, WebView, SCUI::Views::ColorWellView, SCUI::Views::ComboBoxView, SCUI::Views::DatePickerView, SCUI::Views::SelectFieldTabView

Constant Summary

Constant Summary

Constants included from Mixins::StallSupport

Mixins::StallSupport::DEFAULT_KEY_STALLS, Mixins::StallSupport::DEFAULT_STALL

Constants included from Lebowski::Foundation

SC_BRANCH_CLOSED, SC_BRANCH_OPEN, SC_BUTTON1_STATUS, SC_BUTTON2_STATUS, SC_BUTTON3_STATUS, SC_LEAF_NODE, SC_MIXED_STATE, SC_PICKER_FIXED, SC_PICKER_MENU, SC_PICKER_POINTER, SC_T_ARRAY, SC_T_BOOL, SC_T_CLASS, SC_T_ERROR, SC_T_FUNCTION, SC_T_HASH, SC_T_NULL, SC_T_NUMBER, SC_T_OBJECT, SC_T_STRING, SC_T_UNDEFINED

Constants included from Mixins::WaitActions

Mixins::WaitActions::DEFAULT_TIMEOUT

Instance Attribute Summary

Attributes inherited from ProxyObject

#driver, #name, #parent, #rel_path

Instance Method Summary (collapse)

Methods included from Mixins::DelegateSupport

#get_delegate_property

Methods included from Mixins::UserActions

#basic_click, #click, #click_at, #double_click, #double_click_at, #drag, #drag_after, #drag_before, #drag_on_to, #drag_to, #drag_to_end_of, #drag_to_start_of, #focus, #key_down, #key_up, #mouse_down, #mouse_down_at, #mouse_move, #mouse_move_at, #mouse_up, #mouse_up_at, #mouse_wheel_delta_x, #mouse_wheel_delta_y, #right_click, #right_click_at, #right_mouse_down, #right_mouse_down_at, #right_mouse_up, #right_mouse_up_at, #type, #type_key

Methods included from Mixins::StallSupport

adjust_all_stalls, adjust_default_key_stall, adjust_default_stall, reset, #stall

Methods included from Mixins::KeyCheck

#key_down?, #key_up?

Methods included from Mixins::PositionedElement

#position_relative_to

Methods inherited from SCObject

#has_represented_sc_class?, #kind_of_represented_sc_class?, represented_sc_class, #represented_sc_class, representing_sc_class

Methods inherited from ProxyObject

#==, #[], #abs_path_with, #define, #define_proxy, #init_ext, #initialize, #method_missing, #none?, #object?, #proxy, #represent_as, #sc_all_classes, #sc_class, #sc_guid, #sc_kind_of?, #sc_path_defined?, #sc_type_of, #unravel_relative_path

Methods included from Mixins::DefinePathsSupport

#define_path, #define_paths_for, #defined_path, #defined_paths, #path_defined?, #root_defined_path_part, #root_defined_path_part=

Methods included from Mixins::WaitActions

#wait_until

Constructor Details

This class inherits a constructor from Lebowski::Foundation::ProxyObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Lebowski::Foundation::ProxyObject

Instance Method Details

- (Object) abs_path



29
30
31
32
# File 'lib/lebowski/foundation/views/view.rb', line 29

def abs_path()
  return rel_path if assigned_layer_id?
  return super
end

- (Object) action_locator_args



35
36
37
# File 'lib/lebowski/foundation/views/view.rb', line 35

def action_locator_args()
  return [abs_path]
end

- (Object) action_target



40
41
42
# File 'lib/lebowski/foundation/views/view.rb', line 40

def action_target()
  return :view
end

- (Boolean) assigned_layer_id?

Returns:

  • (Boolean)


25
26
27
# File 'lib/lebowski/foundation/views/view.rb', line 25

def assigned_layer_id?()
  return (not (rel_path =~ /^#/).nil?)
end

- (Object) child_views



117
118
119
120
121
122
# File 'lib/lebowski/foundation/views/view.rb', line 117

def child_views()
  if @child_views.nil?
    @child_views = ObjectArray.new self, 'childViews', 'length'
  end
  return @child_views
end

- (Object) core_query(selector = nil)

Obtain a core query object from the view.

Parameters:

  • selector (String) (defaults to: nil)

    a CSS selector that the core query object will use

Returns:

  • returns an instance of Lebowski::Foundation::CoreQuery



112
113
114
115
# File 'lib/lebowski/foundation/views/view.rb', line 112

def core_query(selector=nil)
  cq = Lebowski::Foundation::CoreQuery.new abs_path, selector, @driver
  return cq
end

- (Lebowski::Rect) frame

Gets the frame for this view.

Returns:



60
61
62
# File 'lib/lebowski/foundation/views/view.rb', line 60

def frame()
  return @driver.get_sc_view_frame(abs_path)
end

- (Object) height



75
76
77
# File 'lib/lebowski/foundation/views/view.rb', line 75

def height()
  return frame.height
end

- (Object) layer

Gets the string representing of the view's layer. The layer in SproutCore is the root DOM element of the view. This method will return an HTML string representation of the entire layer that is equivalent to the following:

view.get('layer').outerHTML


101
102
103
104
# File 'lib/lebowski/foundation/views/view.rb', line 101

def layer() 
  value = @driver.get_sc_view_layer(abs_path)
  return value
end

- (Object) layer_id

Gets the remote layer ID for this view

See Also:

  • SC.View.layerId


49
50
51
52
53
# File 'lib/lebowski/foundation/views/view.rb', line 49

def layer_id()
  # We only need to fetch the layer ID once since it never changes for a given instance
  @layer_id = @driver.get_sc_property_string_value(abs_path, "layerId") if @layer_id.nil?
  return @layer_id
end

- (Object) position



65
66
67
# File 'lib/lebowski/foundation/views/view.rb', line 65

def position()
  return @driver.get_sc_element_window_position(action_target, *action_locator_args)
end

- (Object) scroll_to_visible



80
81
82
# File 'lib/lebowski/foundation/views/view.rb', line 80

def scroll_to_visible()
  @driver.sc_view_scroll_to_visible(abs_path)
end

- (Object) scrollable_parent_view

Gets the parent view of this view that is scrollable. If this view has no parent that is scrollable then null is returned



88
89
90
91
92
# File 'lib/lebowski/foundation/views/view.rb', line 88

def scrollable_parent_view()
  layer_id = @driver.get_sc_scrollable_parent_view_layer_id(abs_path)
  app = Util::get_root_application_object(self)
  return app["##{layer_id}"] if (not layer_id.nil?)
end

- (Object) width



70
71
72
# File 'lib/lebowski/foundation/views/view.rb', line 70

def width()
  return frame.width
end