Sha256: 449ff0ede60a8fae69e8ed8442baa4b3c255bb28bfbf8857bfdd25c378cb5fbf

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

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_NAME
            end
        end

        # Returns the filename of the dictionary including the path
        def getFilename(options)
            return File.expand_path(dictionaryName(options), 
                                    Config::TANAKA_DIR)
        end

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

        def exitLoadTanakaContext
            self.exit
        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.5.1.7 lib/jldrill/contexts/LoadTanakaContext.rb