Class: Glimmer::SWT::DateTimeProxy
Overview
Proxy for org.eclipse.swt.widgets.DateTime
Follows the Proxy Design Pattern
Constant Summary
collapse
- CUSTOM_ATTRIBUTES =
%w[date_time date time month]
Constants inherited
from WidgetProxy
WidgetProxy::DEFAULT_INITIALIZERS, WidgetProxy::DEFAULT_STYLES, WidgetProxy::KEYWORD_ALIASES
Instance Attribute Summary
Attributes inherited from WidgetProxy
#drag_source_proxy, #drag_source_style, #drag_source_transfer, #drop_target_proxy, #drop_target_transfer, #parent_proxy, #swt_widget
Instance Method Summary
collapse
Methods inherited from WidgetProxy
#add_observer, #async_exec, #can_add_observer?, #can_handle_drag_observation_request?, #can_handle_drop_observation_request?, #can_handle_observation_request?, #content, create, #dispose, #ensure_drag_source_proxy, #ensure_drop_target_proxy, #extract_args, #handle_observation_request, #has_attribute?, #has_style?, #initialize, #method_missing, #pack_same_size, #post_add_content, #post_initialize_child, #remove_observer, #respond_to?, swt_widget_class_for, swt_widget_class_manual_entries, #sync_exec, underscored_widget_name, widget_exists?, #widget_property_listener_installers, widget_proxy_class
Methods included from Packages
included
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Glimmer::SWT::WidgetProxy
Instance Method Details
#date ⇒ Object
41
42
43
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 41
def date
date_time.to_date
end
|
#date=(date_value) ⇒ Object
45
46
47
48
49
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 45
def date=(date_value)
self.year = date_value.year
self.month = date_value.month
self.day = date_value.day
end
|
#date_time ⇒ Object
33
34
35
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 33
def date_time
DateTime.new(year, month, day, hours, minutes, seconds)
end
|
#date_time=(date_time_value) ⇒ Object
37
38
39
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 37
def date_time=(date_time_value)
self.time = date_time_value.to_time
end
|
#get_attribute(attribute_name) ⇒ Object
78
79
80
81
82
83
84
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 78
def get_attribute(attribute_name)
if CUSTOM_ATTRIBUTES.include?(attribute_name.to_s)
send(attribute_name)
else
super(attribute_name)
end
end
|
#month ⇒ Object
62
63
64
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 62
def month
swt_widget.month + 1
end
|
#month=(new_value) ⇒ Object
66
67
68
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 66
def month=(new_value)
swt_widget.month = new_value - 1
end
|
#set_attribute(attribute_name, *args) ⇒ Object
70
71
72
73
74
75
76
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 70
def set_attribute(attribute_name, *args)
if CUSTOM_ATTRIBUTES.include?(attribute_name.to_s)
send(ruby_attribute_setter(attribute_name), args.first)
else
super(attribute_name, *args)
end
end
|
#time ⇒ Object
51
52
53
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 51
def time
date_time.to_time
end
|
#time=(time_value) ⇒ Object
55
56
57
58
59
60
|
# File 'lib/glimmer/swt/date_time_proxy.rb', line 55
def time=(time_value)
self.date = time_value.to_date
self.hours = time_value.hour
self.minutes = time_value.min
self.seconds = time_value.sec
end
|