Class: JLDrill::LoadQuizContext
Instance Attribute Summary collapse
#mainView, #parent, #viewBridge
Instance Method Summary
collapse
#addView, #exit, #isEntered?, #onExit, #peekAtView, #setupViews
Constructor Details
Returns a new instance of LoadQuizContext.
Instance Attribute Details
#getFilenameContext ⇒ Object
Returns the value of attribute getFilenameContext.
15
16
17
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 15
def getFilenameContext
@getFilenameContext
end
|
Instance Method Details
#createViews ⇒ Object
27
28
29
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 27
def createViews
@mainView = @viewBridge.VBoxView.new(self)
end
|
#destroyViews ⇒ Object
31
32
33
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 31
def destroyViews
@mainView = nil
end
|
#enter(parent, quiz, filename = nil) ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 69
def enter(parent, quiz, filename=nil)
super(parent)
if filename.nil?
filename = @getFilenameContext.enter(self,
GetFilenameContext::OPEN)
end
if filename.nil?
exitLoadQuizContext
else
if !JLDrill::Quiz.drillFile?(filename)
loadAsEdict(quiz, filename)
else
loadAsQuiz(quiz, filename)
end
end
end
|
#exitLoadQuizContext ⇒ Object
35
36
37
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 35
def exitLoadQuizContext
self.exit
end
|
#loadAsEdict(quiz, filename) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 39
def loadAsEdict(quiz, filename)
if quiz.options.language == "Chinese"
edict = CEDictionary.new
else
edict = JEDictionary.new
end
@loadFileContext.onExit do
@loadQuizFromEdictContext.onExit do
exitLoadQuizContext
end
@loadQuizFromEdictContext.enter(self, quiz, edict)
end
@loadFileContext.enter(self, edict, filename)
end
|
#loadAsQuiz(quiz, filename) ⇒ Object
54
55
56
57
58
59
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 54
def loadAsQuiz(quiz, filename)
@loadFileContext.onExit do
exitLoadQuizContext
end
@loadFileContext.enter(self, quiz, filename)
end
|
#startLongEvent ⇒ Object
61
62
63
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 61
def startLongEvent()
@parent.startLongEvent()
end
|
#stopLongEvent ⇒ Object
65
66
67
|
# File 'lib/jldrill/contexts/LoadQuizContext.rb', line 65
def stopLongEvent()
@parent.stopLongEvent()
end
|