Class: JLDrill::LoadTanakaContext

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

Overview

Load the Tanaka examples file

Instance Attribute Summary

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) ⇒ LoadTanakaContext

Returns a new instance of LoadTanakaContext.



13
14
15
16
# File 'lib/jldrill/contexts/LoadTanakaContext.rb', line 13

def initialize(viewBridge)
	super(viewBridge)
          @loadFileContext = LoadFileContext.new(@viewBridge)
end

Instance Method Details

#createViewsObject



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

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

#destroyViewsObject



22
23
24
# File 'lib/jldrill/contexts/LoadTanakaContext.rb', line 22

def destroyViews
    @mainView = nil
end

#dictionaryName(options) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/jldrill/contexts/LoadTanakaContext.rb', line 26

def dictionaryName(options)
    if !options.nil? && !options.tanaka.nil?
        return options.tanaka
    else
        return Config::TANAKA_FILE
    end
end

#enter(parent, tanaka, options) ⇒ Object



58
59
60
61
# File 'lib/jldrill/contexts/LoadTanakaContext.rb', line 58

def enter(parent, tanaka, options)
    super(parent)
    loadTanaka(tanaka, getFilename(options))
end

#exitLoadTanakaContextObject



46
47
48
# File 'lib/jldrill/contexts/LoadTanakaContext.rb', line 46

def exitLoadTanakaContext
    self.exit
end

#getFilename(options) ⇒ Object

Returns the filename of the dictionary including the path



35
36
37
# File 'lib/jldrill/contexts/LoadTanakaContext.rb', line 35

def getFilename(options)
    return Config::resolveDataFile(dictionaryName(options))
end

#loadTanaka(tanaka, filename) ⇒ Object



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

def loadTanaka(tanaka, filename)
    @loadFileContext.onExit do
       exitLoadTanakaContext 
    end
    @loadFileContext.enter(self, tanaka, filename)
end

#startLongEventObject



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

def startLongEvent()
    @parent.startLongEvent()
end

#stopLongEventObject



54
55
56
# File 'lib/jldrill/contexts/LoadTanakaContext.rb', line 54

def stopLongEvent()
    @parent.stopLongEvent()
end