Browse Source

Fixes for helios sunit
1. Select all button should use the onClick event.
2. The Sunit widget should unregister itself from the global announcers when it is closed.

Ryan Simmons 10 years ago
parent
commit
4cc20a5b56
2 changed files with 92 additions and 5 deletions
  1. 63 4
      support/helios/src/Helios-SUnit.js
  2. 29 1
      support/helios/src/Helios-SUnit.st

+ 63 - 4
support/helios/src/Helios-SUnit.js

@@ -440,15 +440,14 @@ var $1,$2;
 $1=_st(html)._button();
 _st($1)._class_("button");
 _st($1)._with_("Select all");
-$ctx1.sendIdx["with:"]=1;
-$2=_st($1)._with_((function(){
+$2=_st($1)._onClick_((function(){
 return smalltalk.withContext(function($ctx2) {
 return _st(self._model())._selectAllClasses();
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
 return self}, function($ctx1) {$ctx1.fill(self,"renderButtonsOn:",{html:html},globals.HLSUnitClassesListWidget)})},
 args: ["html"],
-source: "renderButtonsOn: html\x0a\x09html button\x0a\x09\x09class: 'button'; \x0a\x09\x09with: 'Select all';\x0a\x09\x09with: [ self model selectAllClasses ]",
-messageSends: ["class:", "button", "with:", "selectAllClasses", "model"],
+source: "renderButtonsOn: html\x0a\x09html button\x0a\x09\x09class: 'button'; \x0a\x09\x09with: 'Select all';\x0a\x09\x09onClick: [ self model selectAllClasses ]",
+messageSends: ["class:", "button", "with:", "onClick:", "selectAllClasses", "model"],
 referencedClasses: []
 }),
 globals.HLSUnitClassesListWidget);
@@ -1045,6 +1044,28 @@ referencedClasses: ["HLSUnitResults"]
 }),
 globals.HLSUnit);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLSUnit.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+$ctx1.sendIdx["unregister"]=1;
+_st([self._packagesListWidget(),self._classesListWidget(),self._resultWidget(),self._errorsWidget(),self._failuresWidget()])._do_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._unregister();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLSUnit)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x0a\x09{ \x0a\x09\x09self packagesListWidget.\x0a\x09\x09self classesListWidget.\x0a\x09\x09self resultWidget.\x0a\x09\x09self errorsWidget.\x0a\x09\x09self failuresWidget\x0a\x09} \x0a\x09\x09do: [ :each | each unregister ]",
+messageSends: ["unregister", "do:", "packagesListWidget", "classesListWidget", "resultWidget", "errorsWidget", "failuresWidget"],
+referencedClasses: []
+}),
+globals.HLSUnit);
+
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -1939,6 +1960,24 @@ referencedClasses: []
 }),
 globals.HLSUnitResultStatus);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLSUnitResultStatus.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+_st(_st(self._model())._announcer())._unsubscribe_(self);
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLSUnitResultStatus)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09self model announcer unsubscribe: self.",
+messageSends: ["unregister", "unsubscribe:", "announcer", "model"],
+referencedClasses: []
+}),
+globals.HLSUnitResultStatus);
+
 
 
 smalltalk.addClass('HLSUnitResults', globals.HLWidget, ['model', 'progressBarWidget', 'resultStatusWidget'], 'Helios-SUnit');
@@ -2122,5 +2161,25 @@ referencedClasses: ["HLSUnitResultStatus"]
 }),
 globals.HLSUnitResults);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "unregister",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+($ctx1.supercall = true, globals.HLSUnitResults.superclass.fn.prototype._unregister.apply(_st(self), []));
+$ctx1.supercall = false;
+$ctx1.sendIdx["unregister"]=1;
+_st(_st(self._model())._announcer())._unsubscribe_(self);
+_st(self._resultStatusWidget())._unregister();
+return self}, function($ctx1) {$ctx1.fill(self,"unregister",{},globals.HLSUnitResults)})},
+args: [],
+source: "unregister\x0a\x09super unregister.\x0a\x09self model announcer unsubscribe: self.\x0a\x09self resultStatusWidget unregister.",
+messageSends: ["unregister", "unsubscribe:", "announcer", "model", "resultStatusWidget"],
+referencedClasses: []
+}),
+globals.HLSUnitResults);
+
 
 });

+ 29 - 1
support/helios/src/Helios-SUnit.st

@@ -163,7 +163,7 @@ renderButtonsOn: html
 	html button
 		class: 'button'; 
 		with: 'Select all';
-		with: [ self model selectAllClasses ]
+		onClick: [ self model selectAllClasses ]
 !
 
 renderItemLabel: aClass on: html
@@ -304,6 +304,21 @@ resultSection
 			with: self errorsWidget)
 ! !
 
+!HLSUnit methodsFor: 'actions'!
+
+unregister
+	super unregister.
+
+	{ 
+		self packagesListWidget.
+		self classesListWidget.
+		self resultWidget.
+		self errorsWidget.
+		self failuresWidget
+	} 
+		do: [ :each | each unregister ]
+! !
+
 !HLSUnit methodsFor: 'keybindings'!
 
 registerBindingsOn: aBindingGroup
@@ -617,6 +632,11 @@ observeModel
 		on: ResultAnnouncement
 		send: #onResultAnnouncement:
 		to: self
+!
+
+unregister
+	super unregister.
+	self model announcer unsubscribe: self.
 ! !
 
 !HLSUnitResultStatus methodsFor: 'printing'!
@@ -685,6 +705,14 @@ resultStatusWidget
 		yourself]
 ! !
 
+!HLSUnitResults methodsFor: 'actions'!
+
+unregister
+	super unregister.
+	self model announcer unsubscribe: self.
+	self resultStatusWidget unregister.
+! !
+
 !HLSUnitResults methodsFor: 'initialization'!
 
 observeModel