Sha256: c80b8d1f17dee9771ef49f09e3157fbc00dc488a63d38c2abab0ffdffee65180

Contents?: true

Size: 542 Bytes

Versions: 6

Compression:

Stored size: 542 Bytes

Contents

require 'clevic/swing/delegate'

module Clevic

  class TextDelegate < Delegate
    # TODO check that VK_ENTER stops editing
    def init_component( cell_editor )
      editor.text = edit_value
      editor.select_all
    end
    
    def editor
      @editor ||= javax.swing.JTextField.new.tap do |e|
        e.horizontal_alignment = field.swing_alignment
      end
    end
    
    def value
      editor.text
    end
    
    def minimal_edit
      editor.select_all
    end
    
    def needs_pre_selection?
      true
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
clevic-0.13.0.b9 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b6 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b5 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b3 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b2 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b1 lib/clevic/swing/text_delegate.rb