Class: Rfm::Metadata::FieldControl
- Defined in:
- lib/rfm/metadata/field_control.rb
Overview
The FieldControl object represents a field on a FileMaker layout. You can find out what field style the field uses, and the value list attached to it.
Attributes
-
name is the name of the field
-
style is any one of:
-
:edit_box - a normal editable field
-
-
:scrollable - an editable field with scroll bar
-
-
:popup_menu - a pop-up menu
-
-
:checkbox_set - a set of checkboxes
-
-
:radio_button_set - a set of radio buttons
-
-
:popup_list - a pop-up list
-
-
:calendar - a pop-up calendar
-
-
value_list_name is the name of the attached value list, if any
-
value_list is an array of strings representing the value list items, or nil if this field has no attached value list
Constant Summary collapse
- FIELD_CONTROL_STYLE_MAP =
{ 'EDITTEXT' => :edit_box, 'POPUPMENU' => :popup_menu, 'CHECKBOX' => :checkbox_set, 'RADIOBUTTONS' => :radio_button_set, 'POPUPLIST' => :popup_list, 'CALENDAR' => :calendar, 'SCROLLTEXT' => :scrollable, }
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#style ⇒ Object
readonly
Returns the value of attribute style.
-
#value_list_name ⇒ Object
readonly
Returns the value of attribute value_list_name.
Instance Method Summary collapse
-
#element_close_handler ⇒ Object
(_cursor).
-
#initialize(meta) ⇒ FieldControl
constructor
def initialize(_attributes, meta) puts [“nFieldControl#initialize”, “_attributes: #_attributes”, “meta: #metameta.class”] self.layout_meta = meta _attach_as_instance_variables(_attributes) if _attributes self end.
-
#value_list ⇒ Object
def translate_value_list_key(raw) ‘valuelist’=>‘value_list_name’ || raw end.
Constructor Details
#initialize(meta) ⇒ FieldControl
def initialize(_attributes, meta)
puts ["\nFieldControl#initialize", "_attributes: #{_attributes}", "meta: #{.class}"]
self. =
_attach_as_instance_variables(_attributes) if _attributes
self
end
45 46 47 48 49 |
# File 'lib/rfm/metadata/field_control.rb', line 45 def initialize() #puts ["\nFieldControl#initialize", "meta: #{meta.class}"] self. = self end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/rfm/metadata/field_control.rb', line 25 def name @name end |
#style ⇒ Object (readonly)
Returns the value of attribute style.
25 26 27 |
# File 'lib/rfm/metadata/field_control.rb', line 25 def style @style end |
#value_list_name ⇒ Object (readonly)
Returns the value of attribute value_list_name.
25 26 27 |
# File 'lib/rfm/metadata/field_control.rb', line 25 def value_list_name @value_list_name end |
Instance Method Details
#element_close_handler ⇒ Object
(_cursor)
77 78 79 80 |
# File 'lib/rfm/metadata/field_control.rb', line 77 def element_close_handler #(_cursor) @type = FIELD_CONTROL_STYLE_MAP[@type] || @type .receive_field_control(self) end |
#value_list ⇒ Object
def translate_value_list_key(raw) ‘valuelist’=>‘value_list_name’ || raw end
73 74 75 |
# File 'lib/rfm/metadata/field_control.rb', line 73 def value_list .value_lists[value_list_name] end |