Class: JLDrill::LoadReferenceContext
Overview
Load the reference dictionary
Instance Attribute Summary
#mainView, #parent, #viewBridge
Instance Method Summary
collapse
#addView, #exit, #isEntered?, #onExit, #peekAtView, #setupViews
Constructor Details
Returns a new instance of LoadReferenceContext.
12
13
14
15
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 12
def initialize(viewBridge)
super(viewBridge)
@loadFileContext = LoadFileContext.new(@viewBridge)
end
|
Instance Method Details
#createViews ⇒ Object
17
18
19
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 17
def createViews
@mainView = @viewBridge.VBoxView.new(self)
end
|
#destroyViews ⇒ Object
21
22
23
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 21
def destroyViews
@mainView = nil
end
|
#dictionaryName(options) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 25
def dictionaryName(options)
if !options.nil? && !options.dictionary.nil?
return options.dictionary
else
return Config::DICTIONARY_FILE
end
end
|
#enter(parent, reference, deinflect, options) ⇒ Object
78
79
80
81
82
83
84
85
86
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 78
def enter(parent, reference, deinflect, options)
super(parent)
if (options.language == "Chinese")
parent.reference = CEDictionary.new
else
parent.reference = JEDictionary.new
end
loadReference(parent.reference, deinflect, getFilename(options))
end
|
#exitLoadReferenceContext ⇒ Object
66
67
68
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 66
def exitLoadReferenceContext
self.exit
end
|
#getDeinflectionFilename ⇒ Object
#getFilename(options) ⇒ Object
Returns the filename of the dictionary including the path
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 34
def getFilename(options)
dictFilename = File.join(Config::DICTIONARY_DIR,
dictionaryName(options))
retVal = Config::resolveDataFile(dictFilename)
if retVal.nil?
retVal = Config::resolveDataFile(dictionaryName(options))
end
return retVal
end
|
#loadDeinflection(deinflect, filename) ⇒ Object
52
53
54
55
56
57
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 52
def loadDeinflection(deinflect, filename)
@loadFileContext.onExit do
exitLoadReferenceContext
end
@loadFileContext.enter(self, deinflect, filename)
end
|
#loadReference(reference, deinflect, filename) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 59
def loadReference(reference, deinflect, filename)
@loadFileContext.onExit do
loadDeinflection(deinflect, getDeinflectionFilename)
end
@loadFileContext.enter(self, reference, filename)
end
|
#startLongEvent ⇒ Object
70
71
72
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 70
def startLongEvent()
@parent.startLongEvent()
end
|
#stopLongEvent ⇒ Object
74
75
76
|
# File 'lib/jldrill/contexts/LoadReferenceContext.rb', line 74
def stopLongEvent()
@parent.stopLongEvent()
end
|