class Glimmer::SWT::TableEditor

Emulates SWT's native org.eclipse.swt.custom.TableEditor

Public Instance Methods

cancel!() click to toggle source
# File lib/glimmer/swt/table_editor.rb, line 51
def cancel!
  done!
end
done!() click to toggle source
# File lib/glimmer/swt/table_editor.rb, line 59
def done!
  @table_item.cell_dom_element(@table_column_index).html(@old_value) unless @old_value.nil?
  @old_value = nil
end
editor=(editor_widget, table_item, table_column_index) click to toggle source
# File lib/glimmer/swt/table_editor.rb, line 30
      def editor=(editor_widget, table_item, table_column_index)
        # TODO consider making editor not gain an ID or gain a separate set of IDs to avoid clashing with standard widget predictability of ID
        @table_item = table_item
        @table_column_index = table_column_index
        @editor_widget = editor_widget
        @old_value = table_item.cell_dom_element(table_column_index).html
        table_item.cell_dom_element(table_column_index).html('')
        editor_widget.render(custom_parent_dom_element: table_item.cell_dom_element(table_column_index))
        # TODO tweak the width perfectly so it doesn't expand the table cell
#         editor_widget.dom_element.css('width', 'calc(100% - 20px)')
        editor_widget.dom_element.css('width', "#{minimumWidth}%") # TODO implement property with pixels (and perhaps derive percentage separately from pixels)
        editor_widget.dom_element.css('height', "#{minimumHeight}px")
        editor_widget.dom_element.add_class('table-editor')
        # TODO consider relying on autofocus instead
        editor_widget.dom_element.focus
        # TODO consider doing the following line only for :text editor
        editor_widget.dom_element.select
      end
Also aliased as: set_editor, setEditor
save!() click to toggle source
# File lib/glimmer/swt/table_editor.rb, line 55
def save!
  done!
end
setEditor(editor_widget, table_item, table_column_index)
Alias for: editor=
set_editor(editor_widget, table_item, table_column_index)
Alias for: editor=