Sha256: 6b9fde0bd6ed266d77e24dd55d4d1e286aea34a388aecebd531820726c3973c9

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'jldrill/views/gtk/widgets/ItemTable'
require 'jldrill/model/items/ItemFactory'
require 'jldrill/model/items/JWord'

module JLDrill::Gtk
    class SearchTable < WordTable

        attr_reader :kanji, :reading

        def initialize(container, kanji, reading)
            @container = container
            @reading = reading
            @kanji = kanji
            candidates = @container.search(kanji, reading)
            super(candidates, JLDrill::ItemFactory.find(JLDrill::JWord)) do |item|
                @container.searchActivated(item)
            end
        end

        def searchEqual(model, column, key, iter)
            retVal = true
            vocab = iter[0]
            if !vocab.nil?
                retVal = !vocab.startsWith?(key)
            end
            return retVal
        end

        def getContents(item)
            return item
        end

        def getContentsAsVocab(item)
            return item.toVocab
        end

        def selectClosestMatch(vocab)
            super(vocab)
            if hasSelection?
                focusTable
            end
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.5.1.7 lib/jldrill/views/gtk/widgets/SearchTable.rb