Class: Mxrb::Compiler::LegacyDataGridCompiler

Inherits:
Object
  • Object
show all
Includes:
ModelValues
Defined in:
lib/mxrb/compiler/legacy_data_grid_compiler.rb

Overview

rubocop:disable Metrics/AbcSize, Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/MethodLength Compiles the built-in Data Grid 1 widget to the Dojo web-client contract.

Constant Summary collapse

SOURCE_TYPES =
{
  'Forms$GridDatabaseSource' => 'database',
  'Forms$NewGridDatabaseSource' => 'database',
  'Forms$GridXPathSource' => 'xpath',
  'Forms$MicroflowSource' => 'microflow'
}.freeze
BUTTON_FUNCTIONS =
{
  'Forms$GridSearchButton' => 'ToggleSearch',
  'Forms$DataGridSelectButton' => 'ReturnSelection',
  'Forms$GridNewButton' => 'InsertNew',
  'Forms$GridEditButton' => 'EditSelection',
  'Forms$GridDeleteButton' => 'DeleteSelection',
  'Forms$GridActionButton' => 'InvokeAction'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, page_name, widget, language:, sequence:) ⇒ LegacyDataGridCompiler

Returns a new instance of LegacyDataGridCompiler.



29
30
31
32
33
34
35
36
# File 'lib/mxrb/compiler/legacy_data_grid_compiler.rb', line 29

def initialize(source, page_name, widget, language:, sequence:)
  @source = source
  @page_name = page_name
  @widget = widget
  @language = language
  @sequence = sequence
  @unsupported = []
end

Instance Attribute Details

#unsupportedObject (readonly)

Returns the value of attribute unsupported.



27
28
29
# File 'lib/mxrb/compiler/legacy_data_grid_compiler.rb', line 27

def unsupported
  @unsupported
end

Instance Method Details

#htmlObject



38
39
40
41
42
43
44
45
# File 'lib/mxrb/compiler/legacy_data_grid_compiler.rb', line 38

def html
  props = JSON.generate(properties)[1..-2]
  attributes = {
    'data-mendix-id' => widget_id, 'data-mendix-type' => 'mxui.widget.DataGrid',
    'data-mendix-props' => props, 'class' => css_class, 'tabindex' => @widget['TabIndex'].to_i
  }
  "<div #{attributes.map { |key, value| "#{key}='#{escape(value)}'" }.join(' ')}></div>"
end