1
0
فهرست منبع

Making sure noone has to wonder how to try the Counter class ever again.

Göran Krampe 13 سال پیش
والد
کامیت
f8bafa3bcf
3فایلهای تغییر یافته به همراه45 افزوده شده و 0 حذف شده
  1. 11 0
      js/Examples.deploy.js
  2. 17 0
      js/Examples.js
  3. 17 0
      st/Examples.st

+ 11 - 0
js/Examples.deploy.js

@@ -50,4 +50,15 @@ return self;}
 smalltalk.Counter);
 
 
+smalltalk.addMethod(
+unescape('_tryExample'),
+smalltalk.method({
+selector: unescape('tryExample'),
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_new", []), "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
+return self;}
+}),
+smalltalk.Counter.klass);
+
 

+ 17 - 0
js/Examples.js

@@ -1,5 +1,6 @@
 smalltalk.addPackage('Examples', {});
 smalltalk.addClass('Counter', smalltalk.Widget, ['count', 'header'], 'Examples');
+smalltalk.Counter.comment=unescape('This%20is%20a%20trivial%20Widget%20example%20mimicking%20the%20classic%20Counter%20example%20in%20Seaside.%20%0AIn%20order%20to%20play%20with%20it%2C%20just%20select%20the%20doit%20below%20and%20press%20the%20Do%20it%20button%20in%20the%20far%20right%20corner.%0AThen%20take%20a%20look%20in%20the%20HTML%20document%20above%20the%20IDE.%0A%0A%20%20%20%20%20%20%20%20Counter%20new%20appendToJQuery%3A%20%27body%27%20asJQuery')
 smalltalk.addMethod(
 unescape('_decrease'),
 smalltalk.method({
@@ -70,4 +71,20 @@ referencedClasses: []
 smalltalk.Counter);
 
 
+smalltalk.addMethod(
+unescape('_tryExample'),
+smalltalk.method({
+selector: unescape('tryExample'),
+category: 'example',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_new", []), "_appendToJQuery_", [smalltalk.send("body", "_asJQuery", [])]);
+return self;},
+args: [],
+source: unescape('tryExample%0A%09%22In%20order%20to%20play%20with%20the%20Counter%2C%20just%20select%20the%0A%09doit%20below%20and%20press%20the%20Do%20it%20button.%20Then%20take%20a%0A%09look%20in%20the%20HTML%20document%20above%20the%20IDE.%22%0A%0A%09%22Counter%20tryExample%22%0A%20%20%20%20%20%20%20%20self%20new%20appendToJQuery%3A%20%27body%27%20asJQuery%20'),
+messageSends: ["appendToJQuery:", "new", "asJQuery"],
+referencedClasses: []
+}),
+smalltalk.Counter.klass);
+
 

+ 17 - 0
st/Examples.st

@@ -2,6 +2,12 @@ Smalltalk current createPackage: 'Examples' properties: #{}!
 Widget subclass: #Counter
 	instanceVariableNames: 'count header'
 	package: 'Examples'!
+!Counter commentStamp!
+This is a trivial Widget example mimicking the classic Counter example in Seaside. 
+In order to play with it, just select the doit below and press the Do it button in the far right corner.
+Then take a look in the HTML document above the IDE.
+
+        Counter new appendToJQuery: 'body' asJQuery!
 
 !Counter methodsFor: 'actions'!
 
@@ -36,3 +42,14 @@ renderOn: html
 	onClick: [self decrease]
 ! !
 
+!Counter class methodsFor: 'example'!
+
+tryExample
+	"In order to play with the Counter, just select the
+	doit below and press the Do it button. Then take a
+	look in the HTML document above the IDE."
+
+	"Counter tryExample"
+        self new appendToJQuery: 'body' asJQuery
+! !
+