Sha256: b0ded10a6f47ba561570b72b3ce0c6e37897848c9e578f15610ad589220c4eee

Contents?: true

Size: 1.49 KB

Versions: 1

Compression:

Stored size: 1.49 KB

Contents

# encoding: utf-8
require 'Context/Context'
require 'Context/Context'
require 'Context/Bridge'
require 'jldrill/model/Config'
require 'jldrill/contexts/LoadFileContext'

module JLDrill

    # Load the Tanaka examples file
	class LoadTanakaContext < Context::Context
		
		def initialize(viewBridge)
			super(viewBridge)
            @loadFileContext = LoadFileContext.new(@viewBridge)
		end

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

        def destroyViews
            @mainView = nil
        end

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

        # Returns the filename of the dictionary including the path
        def getFilename(options)
            return Config::resolveDataFile(dictionaryName(options))
        end

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

        def exitLoadTanakaContext
            self.exit
        end

        def startLongEvent()
            @parent.startLongEvent()
        end

        def stopLongEvent()
            @parent.stopLongEvent()
        end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.6.0.1 lib/jldrill/contexts/LoadTanakaContext.rb