Is the ax framework available? I&#39;m only finding axannouncements on squeaksource?<br><br>Regards,<br><br>Bart<br><br><div class="gmail_quote">On Sat, Sep 4, 2010 at 12:23 AM, Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu">leves@elte.hu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div><div></div><div class="h5">On Fri, 3 Sep 2010, C. David Shaffer wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Before I get too far let me say that I don&#39;t know, yet, whether this is<br>
an unnecessary hack or a worthwhile framework.  I&#39;m using it now and<br>
like it but I&#39;d be happy to replace it with something better is people<br>
can tell me what that better thing is :-).<br>
<br>
Here&#39;s the problem: During an AJAX callback (request, update or script)<br>
sometimes a component unrelated to the one making the callback needs to<br>
be repainted.  Normally this happens as the result of an announcement.<br>
While announcements serve to decouple the components they also prevent<br>
the source of the announcement from knowing to cause this other<br>
component to paint.<br>
<br>
Basically this motivates using Comet but I don&#39;t like Comet and find<br>
that I don&#39;t need Comet&#39;s level of &quot;server push&quot; for any of my<br>
applications.  What I need is simply the way tack a little extra<br>
javascript on the end of AJAX calls...<br>
<br>
My solution: Repaintable in the Cincom Public Store Repository.  (This<br>
package uses JQuery.)  It is a very simple framework so easily abandoned<br>
if it is the wrong thing to do :-)  Here&#39;s how it works:  Components<br>
subclass RPRepaintable (or you merge RPRepaintable&#39;s methods into your<br>
component hierarchy if that isn&#39;t possible).  You must also use<br>
RPSession or a subclass as your session class for your application.<br>
When a component wants to append javascript onto the end of the current<br>
response to an AJAX request it:<br>
<br>
   self repaint: &#39;some-jquery-selector&#39; using: [:h | &quot;h is a canvas&quot;]<br>
<br>
The block with be invoked with a canvas.  Paint on it was you normally<br>
would.  Its contents will be loaded by jQuery into the element(s)<br>
indentified by &#39;some-jquery-selector&#39; (normally an element id).<br>
<br>
To simplify things, if the component wants to be able to completely<br>
repaint itself it can implement the following trio of methods:<br>
<br>
renderContentOn: html<br>
   html div<br>
       id: self contentId;<br>
       with: [self paintOn: html]<br>
<br>
contentId<br>
   ^&#39;some-unique-id&#39;<br>
<br>
paintOn: html<br>
<br>
   html text: &#39;Put your normal renderContentOn: stuff here&#39;<br>
<br>
<br>
Then, such a component just has to send itself #repaint to repaint its<br>
contents.  So, suppose you receive an announcement and you want to<br>
repaint yourself.  Just do &quot;self repaint&quot;.  Its that simple.  It works<br>
whether the original AJAX request was &quot;script&quot; or &quot;html&quot; type.  Sending<br>
#repaint (#repaint:using) during a full-page repaint (normal HTTP<br>
request) does nothing...your component will be painted during the render<br>
phase anyway so normally this is not a problem.<br>
<br>
An example is provided in the Public Store Repository<br>
(Repaintable-example).  Some notes:<br>
<br>
1) All AJAX requests must either be dataType &#39;script&#39; or &#39;html&#39;.  This<br>
means that cases when you don&#39;t render anything like:<br>
<br>
html div<br>
   onClick: ((html jQuery: #foo) ajax callback: [self foo])<br>
<br>
will have to modified to<br>
<br>
html div<br>
   onClick: ((html jQuery: #foo) ajax dataType: &#39;script&#39;; callback:<br>
[self foo])<br>
<br>
I think that this this is the result of a bug in Repaintable but I can&#39;t<br>
tell.  In practice 99% of my AJAX requests are either html: or script:<br>
requests anyway.  In those cases you don&#39;t need to send dataType:.<br>
<br>
2) If you are using AJAX for purposes other than sending back HTML or<br>
javascript you might end up with cruft being appended to your responses<br>
:-) as components try to repaint themselves.  This isn&#39;t a problem for<br>
me but it might be for those of you using JSON to transfer data etc.<br>
This could be fixed if it becomes a problem for anyone.<br>
<br>
So, garbage or pure genius (I know the answer already as it took me<br>
three attempts to spell genius)?<br>
</blockquote>
<br></div></div>
:) This is how our AX framework worked (AXAnnouncements were extracted from that). The demo is still available here: <a href="http://axdemo.seasidehosting.st/seaside/ax" target="_blank">http://axdemo.seasidehosting.st/seaside/ax</a><br>
<font color="#888888">
<br>
<br>
Levente</font><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
David<br>
<br>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br>
</blockquote>
_______________________________________________<br>
seaside mailing list<br>
<a href="mailto:seaside@lists.squeakfoundation.org" target="_blank">seaside@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>imagination is more important than knowledge - Albert Einstein<br>Logic will get you from A to B. Imagination will take you everywhere - Albert Einstein<br>Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning. - Albert Einstein<br>
The true sign of intelligence is not knowledge but imagination. - Albert Einstein<br>However beautiful the strategy, you should occasionally look at the results. - Sir Winston Churchill<br>It&#39;s not enough that we do our best; sometimes we have to do what&#39;s required. - Sir Winston Churchill<br>