Sha256: b785e0d13fd27260321f7b2ed54bc672fa9a0364438017b1f111f35c97a9ca87

Contents?: true

Size: 888 Bytes

Versions: 1

Compression:

Stored size: 888 Bytes

Contents

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.5.1.7 lib/jldrill/contexts/DisplayQuizStatusContext.rb