Class: Glimmer::SWT::DateTimeProxy
- Inherits:
-
WidgetProxy
- Object
- WidgetProxy
- Glimmer::SWT::DateTimeProxy
- Defined in:
- lib/glimmer/swt/date_time_proxy.rb
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, #finished_add_content, #parent_proxy, #swt_widget
Attributes included from Custom::Drawable
#image_double_buffered, #requires_shape_disposal
Instance Method Summary collapse
- #date ⇒ Object
- #date=(date_value) ⇒ Object
- #date_time ⇒ Object
- #date_time=(date_time_value) ⇒ Object
- #get_attribute(attribute_name) ⇒ Object
- #month ⇒ Object
- #month=(new_value) ⇒ Object
- #set_attribute(attribute_name, *args) ⇒ Object
- #time ⇒ Object
- #time=(time_value) ⇒ Object
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, #disposed?, #ensure_drag_source_proxy, #ensure_drop_target_proxy, #extract_args, #finish_add_content!, flyweight_swt_widget_classes, #handle_observation_request, #has_attribute?, #has_attribute_getter?, #has_attribute_setter?, #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, #timer_exec, underscored_widget_name, widget_exists?, #widget_property_listener_installers, widget_proxy_class
Methods included from Custom::Drawable
#add_shape, #clear_shapes, #deregister_shape_painting, #image_buffered_shapes, #setup_shape_painting, #shapes
Methods included from Properties
attribute_getter, #attribute_getter, attribute_setter, #attribute_setter, normalized_attribute, #normalized_attribute, ruby_attribute_getter, #ruby_attribute_setter, ruby_attribute_setter
Methods included from Packages
Constructor Details
This class inherits a constructor from Glimmer::SWT::WidgetProxy
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 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 45 def date=(date_value) .setDate(date_value.year, date_value.month - 1, 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
76 77 78 79 80 81 82 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 76 def get_attribute(attribute_name) if CUSTOM_ATTRIBUTES.include?(attribute_name.to_s) send(attribute_name) else super(attribute_name) end end |
#month ⇒ Object
60 61 62 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 60 def month .month + 1 end |
#month=(new_value) ⇒ Object
64 65 66 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 64 def month=(new_value) .month = new_value - 1 end |
#set_attribute(attribute_name, *args) ⇒ Object
68 69 70 71 72 73 74 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 68 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
49 50 51 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 49 def time date_time.to_time end |
#time=(time_value) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 53 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 |