Class: JLDrill::Gtk::SearchTable

Inherits:
WordTable
  • Object
show all
Defined in:
lib/jldrill/views/gtk/widgets/SearchTable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from WordTable

#addItem, #attachColumns, #callActionOnActivation, #createListStore, #focusTable, #getNextIter, #getPreviousIter, #getSelectedItem, #hasSelection?, #highlightOnSelection, #markClear, #markCut, #moveDown, #moveUp, #pasteBefore, #removeItem, #search, #searching?, #selectItem, #selectPath, #setItem, #setupSelection, #stopSearching, #toggleSearch, #updateItem

Constructor Details

#initialize(container, kanji, reading) ⇒ SearchTable

Returns a new instance of SearchTable.



10
11
12
13
14
15
16
17
18
# File 'lib/jldrill/views/gtk/widgets/SearchTable.rb', line 10

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

Instance Attribute Details

#kanjiObject (readonly)

Returns the value of attribute kanji.



8
9
10
# File 'lib/jldrill/views/gtk/widgets/SearchTable.rb', line 8

def kanji
  @kanji
end

#readingObject (readonly)

Returns the value of attribute reading.



8
9
10
# File 'lib/jldrill/views/gtk/widgets/SearchTable.rb', line 8

def reading
  @reading
end

Instance Method Details

#getContents(item) ⇒ Object



29
30
31
# File 'lib/jldrill/views/gtk/widgets/SearchTable.rb', line 29

def getContents(item)
    return item
end

#getContentsAsVocab(item) ⇒ Object



33
34
35
# File 'lib/jldrill/views/gtk/widgets/SearchTable.rb', line 33

def getContentsAsVocab(item)
    return item.toVocab
end

#searchEqual(model, column, key, iter) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/jldrill/views/gtk/widgets/SearchTable.rb', line 20

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

#selectClosestMatch(vocab) ⇒ Object



37
38
39
40
41
42
# File 'lib/jldrill/views/gtk/widgets/SearchTable.rb', line 37

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