Module: Glimmer::UI::CustomShell

Includes:
CustomWidget
Included in:
EmailShell
Defined in:
lib/glimmer/ui/custom_shell.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary

Attributes included from CustomWidget

#body_root, #options, #parent, #swt_style

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CustomWidget

add_custom_widget_namespaces_for, #add_observer, #async_exec, #attribute_setter, #can_add_observer?, #can_handle_observation_request?, #content, custom_widget_namespaces, for, #get_attribute, #handle_observation_request, #has_attribute?, #has_instance_method?, #has_style?, #local_respond_to?, #method_missing, namespaces_for_class, #post_initialize_child, reset_custom_widget_namespaces, #respond_to?, #set_attribute, #sync_exec

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::UI::CustomWidget

Class Method Details

.encoded_request_parameter_stringObject



58
59
60
# File 'lib/glimmer/ui/custom_shell.rb', line 58

def encoded_request_parameter_string
  `document.location.href`.match(/\?(.*)$/).to_a[1].to_s
end

.included(klass) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/glimmer/ui/custom_shell.rb', line 45

def included(klass)
  klass.extend(CustomWidget::ClassMethods)
  klass.extend(CustomShell::ClassMethods)
  klass.include(Glimmer)
  Glimmer::UI::CustomWidget.add_custom_widget_namespaces_for(klass)
  keyword = klass.name.split(':').last.underscore
  LocalStorage[keyword] = $LOADED_FEATURES.last
end

.request_parameter_stringObject



54
55
56
# File 'lib/glimmer/ui/custom_shell.rb', line 54

def request_parameter_string
  URI.decode_www_form_component(`document.location.href`.match(/\?(.*)$/).to_a[1].to_s)
end

.requested?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/glimmer/ui/custom_shell.rb', line 66

def requested?
  request_parameter_string.include?('custom_shell=')
end

.requested_and_not_handled?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/glimmer/ui/custom_shell.rb', line 62

def requested_and_not_handled?
  requested? && !request_parameter_string.include?('custom_shell_handled=true')
end

Instance Method Details

#centerObject



99
100
101
# File 'lib/glimmer/ui/custom_shell.rb', line 99

def center
  body_root.center
end

#closeObject



87
88
89
# File 'lib/glimmer/ui/custom_shell.rb', line 87

def close
  body_root.close
end

#hideObject



91
92
93
# File 'lib/glimmer/ui/custom_shell.rb', line 91

def hide
  body_root.hide
end

#initialize(parent, args, options, &content) ⇒ Object

Raises:

  • (Error)


71
72
73
74
# File 'lib/glimmer/ui/custom_shell.rb', line 71

def initialize(parent, args, options, &content)
  super(parent, args, options, &content)
  raise Error, 'Invalid custom shell body root! Must be a shell or another custom shell.' unless body_root.is_a?(Glimmer::SWT::ShellProxy) || body_root.is_a?(Glimmer::UI::CustomShell)
end

#openObject

Classes may override



77
78
79
80
# File 'lib/glimmer/ui/custom_shell.rb', line 77

def open
  # TODO consider the idea of delaying rendering till the open method
  body_root.open
end

#showObject

DO NOT OVERRIDE. JUST AN ALIAS FOR ‘#open`. OVERRIDE `#open` INSTEAD.



83
84
85
# File 'lib/glimmer/ui/custom_shell.rb', line 83

def show
  open
end

#start_event_loopObject



103
104
105
# File 'lib/glimmer/ui/custom_shell.rb', line 103

def start_event_loop
  body_root.start_event_loop
end

#visible?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/glimmer/ui/custom_shell.rb', line 95

def visible?
  body_root.visible?
end