Class: JLDrill::LoadKanjiContext

Inherits:
Context::Context show all
Defined in:
lib/jldrill/contexts/LoadKanjiContext.rb

Overview

Load the kanji, radicals and kana files one after another.

Instance Attribute Summary collapse

Attributes inherited from Context::Context

#mainView, #parent, #viewBridge

Instance Method Summary collapse

Methods inherited from Context::Context

#addView, #exit, #isEntered?, #onExit, #peekAtView, #setupViews

Constructor Details

#initialize(viewBridge) ⇒ LoadKanjiContext

Returns a new instance of LoadKanjiContext.



15
16
17
18
19
20
21
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 15

def initialize(viewBridge)
	super(viewBridge)
    @kanjiFile = Config::resolveDataFile(Config::KANJI_FILE)
          @radicalsFile = Config::resolveDataFile(Config::RADICAL_FILE)
          @kanaFile = Config::resolveDataFile(Config::KANA_FILE)
          @loadFileContext = LoadFileContext.new(@viewBridge)
end

Instance Attribute Details

#kanaFileObject

Returns the value of attribute kanaFile.



12
13
14
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 12

def kanaFile
  @kanaFile
end

#kanjiFileObject

Returns the value of attribute kanjiFile.



12
13
14
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 12

def kanjiFile
  @kanjiFile
end

#radicalsFileObject

Returns the value of attribute radicalsFile.



12
13
14
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 12

def radicalsFile
  @radicalsFile
end

Instance Method Details

#createViewsObject



23
24
25
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 23

def createViews
    @mainView =  @viewBridge.VBoxView.new(self)
end

#destroyViewsObject



27
28
29
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 27

def destroyViews
    @mainView = nil
end

#enter(parent, kanji, radicals, kana) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 64

def enter(parent, kanji, radicals, kana)
    super(parent)
    @kanji = kanji
    @radicals = radicals
    @kana = kana
    loadKanji 
end

#exitLoadKanjiContextObject



52
53
54
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 52

def exitLoadKanjiContext
    self.exit
end

#loadKanaObject



45
46
47
48
49
50
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 45

def loadKana
    @loadFileContext.onExit do
       exitLoadKanjiContext 
    end
    @loadFileContext.enter(self, @kana, @kanaFile)
end

#loadKanjiObject



31
32
33
34
35
36
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 31

def loadKanji
    @loadFileContext.onExit do
        loadRadicals
    end
    @loadFileContext.enter(self, @kanji, @kanjiFile)
end

#loadRadicalsObject



38
39
40
41
42
43
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 38

def loadRadicals
    @loadFileContext.onExit do
        loadKana
    end
    @loadFileContext.enter(self, @radicals, @radicalsFile)
end

#startLongEventObject



56
57
58
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 56

def startLongEvent()
    @parent.startLongEvent()
end

#stopLongEventObject



60
61
62
# File 'lib/jldrill/contexts/LoadKanjiContext.rb', line 60

def stopLongEvent()
    @parent.stopLongEvent()
end