Class: JLDrill::ModifyVocabularyContext::VocabularyView
- Inherits:
-
Context::View
- Object
- Context::View
- JLDrill::ModifyVocabularyContext::VocabularyView
- Defined in:
- lib/jldrill/contexts/ModifyVocabularyContext.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#actionName ⇒ Object
readonly
Returns the value of attribute actionName.
-
#vocabulary ⇒ Object
Returns the value of attribute vocabulary.
Attributes inherited from Context::View
Instance Method Summary collapse
-
#action ⇒ Object
Bind this method to the action button on the UI.
-
#clearVocabulary ⇒ Object
resets the vocabulary variable and clears the UI.
-
#destroy ⇒ Object
Destroy the window.
-
#getVocabulary ⇒ Object
gets the data from the UI and sets the @vocabulary variable.
-
#initialize(context, name) ⇒ VocabularyView
constructor
A new instance of VocabularyView.
-
#showBusy(bool) ⇒ Object
Show the busy cursor in the UI if bool is true.
-
#update(vocabulary) ⇒ Object
update the window with the given vocabulary.
-
#updateSearch ⇒ Object
Search for the vocabulary and update the list of choices.
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
#actionName ⇒ Object (readonly)
Returns the value of attribute actionName.
18 19 20 |
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 18 def actionName @actionName end |
#vocabulary ⇒ Object
Returns the value of attribute vocabulary.
18 19 20 |
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 18 def vocabulary @vocabulary end |
Instance Method Details
#action ⇒ Object
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 |
#clearVocabulary ⇒ Object
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 |
#destroy ⇒ Object
Destroy the window
28 29 30 |
# File 'lib/jldrill/contexts/ModifyVocabularyContext.rb', line 28 def destroy # Please define in the concrete class end |
#getVocabulary ⇒ Object
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 |
#updateSearch ⇒ Object
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 |