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, #auto_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_style?, #height, #initialize, #method_missing, #pack_same_size, #post_add_content, #post_initialize_child, #proxy_source_object, #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, #width, #x, #y
Methods included from Custom::Drawable
#add_shape, #clear_shapes, #deregister_shape_painting, #expanded_shapes, #image_buffered_shapes, #paint_pixel_by_pixel, #setup_shape_painting, #shape_at_location, #shapes, #swt_drawable
Methods included from ProxyProperties
#has_attribute?, #has_attribute_getter?, #has_attribute_setter?, #method_missing, #proxy_source_object, #respond_to?
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 48 49 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 45 def date=(date_value) auto_exec do .setDate(date_value.year, date_value.month - 1, date_value.day) end 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
82 83 84 85 86 87 88 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 82 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 65 66 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 62 def month auto_exec do .month + 1 end end |
#month=(new_value) ⇒ Object
68 69 70 71 72 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 68 def month=(new_value) auto_exec do .month = new_value - 1 end end |
#set_attribute(attribute_name, *args) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/glimmer/swt/date_time_proxy.rb', line 74 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 |