lib/jldrill/contexts/ShowAllVocabularyContext.rb in jldrill-0.5.1.7 vs lib/jldrill/contexts/ShowAllVocabularyContext.rb in jldrill-0.6.0.1
- old
+ new
@@ -1,5 +1,6 @@
+# encoding: utf-8
require 'Context/Context'
require 'Context/Bridge'
require 'Context/View'
module JLDrill
@@ -52,10 +53,17 @@
# open
def removeItem(item)
# Please define in the concrete class
end
+ # Show the busy cursor in the UI if bool is true.
+ # This happens during a long event where the user can't
+ # interact with the window
+ def showBusy(bool)
+ # Please define in the concrete class
+ end
+
# Close the window
# Closing the window exits the context.
def close
# Please define in the concrete class.
# Run super() after everything is complete.
@@ -82,20 +90,24 @@
@parent.quiz.publisher.subscribe(self, "load")
@parent.quiz.publisher.subscribe(self, "newProblem")
@parent.quiz.publisher.subscribe(self, "problemModified")
@parent.quiz.publisher.subscribe(self, "itemAdded")
@parent.quiz.publisher.subscribe(self, "itemDeleted")
+ @parent.longEventPublisher.subscribe(self, "startLongEvent")
+ @parent.longEventPublisher.subscribe(self, "stopLongEvent")
end
end
def exit
if !@parent.nil? && !@parent.quiz.nil?
@parent.quiz.publisher.unsubscribe(self, "load")
@parent.quiz.publisher.unsubscribe(self, "newProblem")
@parent.quiz.publisher.unsubscribe(self, "problemModified")
@parent.quiz.publisher.unsubscribe(self, "itemAdded")
@parent.quiz.publisher.unsubscribe(self, "itemDeleted")
+ @parent.longEventPublisher.unsubscribe(self, "startLongEvent")
+ @parent.longEventPublisher.unsubscribe(self, "stopLongEvent")
end
super
end
def differs?(item)
@@ -155,7 +167,16 @@
end
def preview(item)
@parent.displayItem(item)
end
+
+ def startLongEventUpdated(source)
+ @mainView.showBusy(true)
+ end
+
+ def stopLongEventUpdated(source)
+ @mainView.showBusy(false)
+ end
+
end
end