Class: Rfm::Metadata::FieldControl

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(meta) ⇒ FieldControl

def initialize(_attributes, meta)

puts ["\nFieldControl#initialize", "_attributes: #{_attributes}", "meta: #{meta.class}"]
self.layout_meta = meta
_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(meta)
  #puts ["\nFieldControl#initialize", "meta: #{meta.class}"]
	self.layout_meta = meta
	self
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



25
26
27
# File 'lib/rfm/metadata/field_control.rb', line 25

def name
  @name
end

#styleObject (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_nameObject (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_handlerObject

(_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
  layout_meta.receive_field_control(self)
end

#value_listObject

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
	layout_meta.value_lists[value_list_name]
end