Sha256: 9955507e9f2f9dc519860d2519a79827c1468556f944d679138a10640d8db15c

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

# encoding: utf-8
require 'Context/Context'
require 'Context/Bridge'
require 'Context/View'

module JLDrill

	class DisplayQuizStatusContext < Context::Context
				
		def initialize(viewBridge)
			super(viewBridge)
		end

        class QuizStatusView < Context::View
            def initialize(context)
                super(context)
            end

            def update(quiz)
                # Should be overridden in the concrete class
            end	
        end
		
		def createViews
            @mainView = @viewBridge.QuizStatusView.new(self)
        end

        def destroyViews
            @mainView = nil
        end		    
		
		def enter(parent)
		    super(parent)
		    quizUpdated(@parent.quiz)
		    @parent.quiz.subscribe(self)
		end
		
		def exit
            @parent.quiz.unsubscribe(self)
		    super
		end
		
		def quizUpdated(quiz)
		    @mainView.update(quiz)
		end
				
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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