Sha256: 88292a815e220d3e12431f114c73a30d145365b7157b21c01517148ecb77b069

Contents?: true

Size: 526 Bytes

Versions: 10

Compression:

Stored size: 526 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

10 entries across 10 versions & 1 rubygems

Version Path
clevic-0.14.6 lib/clevic/swing/text_delegate.rb
clevic-0.14.5 lib/clevic/swing/text_delegate.rb
clevic-0.14.4 lib/clevic/swing/text_delegate.rb
clevic-0.14.3 lib/clevic/swing/text_delegate.rb
clevic-0.14.2 lib/clevic/swing/text_delegate.rb
clevic-0.14.1 lib/clevic/swing/text_delegate.rb
clevic-0.14.0 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b12 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b11 lib/clevic/swing/text_delegate.rb
clevic-0.13.0.b10 lib/clevic/swing/text_delegate.rb