Class: JLDrill::ModifyVocabularyContext::VocabularyView

Inherits:
Context::View
  • Object
show all
Defined in:
lib/jldrill/contexts/ModifyVocabularyContext.rb

Direct Known Subclasses

Gtk::VocabularyView, Test::VocabularyView

Instance Attribute Summary collapse

Attributes inherited from Context::View

#context

Instance Method Summary collapse

Methods inherited from Context::View

#addView, #getWidget, #removeView, #removingViewFrom, #viewAddedTo

Constructor Details

#initialize(context, name) ⇒ VocabularyView

Returns a new instance of VocabularyView.



21
22
23
24
25
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 21

def initialize(context, name)
    super(context)
    @vocabulary = Vocabulary.new
    @actionName = name
end

Instance Attribute Details

#actionNameObject (readonly)

Returns the value of attribute actionName.



18
19
20
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 18

def actionName
  @actionName
end

#vocabularyObject

Returns the value of attribute vocabulary.



18
19
20
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 18

def vocabulary
  @vocabulary
end

Instance Method Details

#actionObject

Bind this method to the action button on the UI



67
68
69
70
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 67

def action
    getVocabulary
    @context.doAction(@vocabulary)
end

#clearVocabularyObject

resets the vocabulary variable and clears the UI



50
51
52
53
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 50

def clearVocabulary
    @vocabulary = Vocabulary.new
    # Please define the code to clear the UI in the concrete class
end

#destroyObject

Destroy the window



28
29
30
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 28

def destroy
    # Please define in the concrete class
end

#getVocabularyObject

gets the data from the UI and sets the @vocabulary variable



38
39
40
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 38

def getVocabulary
    # Please define in the concrete class
end

#showBusy(bool) ⇒ Object

Show the busy cursor in the UI if bool is true. This happens during a long event where the user can’t interact with the window



45
46
47
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 45

def showBusy(bool)
    # Please define in the concrete class
end

#update(vocabulary) ⇒ Object

update the window with the given vocabulary. The concrete class should do it’s thing and then call super.



57
58
59
60
61
62
63
64
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 57

def update(vocabulary)
    oldVocab = @vocabulary
    @vocabulary = vocabulary
    # Search for the vocabulary if the reading has changed.
    if !vocabulary.reading.eql?(oldVocab.reading)
        updateSearch
    end
end

#updateSearchObject

Search for the vocabulary and update the list of choices



33
34
35
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 33

def updateSearch
    # Please define in the concrete class
end