123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>Jtalk Smalltalk - documentation</title>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <meta name="author" content="Nicolas Petton" />
- <link rel="stylesheet" type="text/css" href='css/style.css' />
- <link rel="stylesheet" type="text/css" href='css/syntax.css' />
- <script type='text/javascript' src='js/jquery-1.4.4.min.js'></script>
- <script type='text/javascript' src='js/jquery-ui-1.8.9.custom.min.js'></script>
- <script type='text/javascript' src='js/jquery.textarea.js'></script>
- <script type='text/javascript' src='js/jtalk.js'></script>
- <link rel="stylesheet" type="text/css" href="css/jtalk.css"/>
- <script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-2246313-6']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
- </script>
- </head>
- <body>
- <script type="text/javascript">
- jQuery(window).scroll(function() {
- if(jQuery(window).scrollTop() > 210) {
- jQuery('#menu')
- .css('position', 'fixed')
- .css('top', '0px')
- } else {
- jQuery('#menu')
- .css('position', 'absolute')
- .css('top', '210px')
- }
- });
- </script>
- <a href="http://github.com/NicolasPetton/jtalk"><img style="position: absolute; top: 0; lef
- t: 0; border: 0;" src="https://assets.github.com/img/bec6c51521dcc8148146135149fe06a9cc737577?repo=&url=http%3A%2F%2Fs3.amazonaws.com%2Fgithub%2Fribbons%2Fforkme_left_darkblue_121621.png&path=" alt="Fork me on GitHub"></a>
- <div id="wrapper">
- <div id="header">
- <div class="main">
- <img alt="Jtalk, the Smalltalk for web developers" src="images/text_header.png"/>
- </div>
- </div>
-
- <div id="menu">
- <ul>
- <li><a href="index.html">Overview</a></li> ·
- <li><a href="index.html#download">Download</a></li> ·
- <li><a href="documentation.html">Documentation</a></li> ·
- <li><a target="_blank" href="https://github.com/NicolasPetton/jtalk">Source</a></li>
- </ul>
- </div>
- <div id="content">
- <div class="main">
- <div class="box last doc" id="documentation">
- <h2>Documentation</h2>
- <div class="content">
- <h3>Disclaimer</h3>
- <p class="warning">This documentation is a work in progress. If you find an error in the documentation, please <a href="https://github.com/NicolasPetton/jtalk/issues">file an issue</a>.</p>
-
- <p>This documentation <strong>doesn't aim to teach Smalltalk</strong>. Knowledge of Smalltalk is needed to understand the topics covered in this documentation. If you want to learn the Smalltalk language, you can read the excellent <a target="_blank" href="http://pharobyexamle.org">Pharo By Example</a> book.</p>
- <h3>Introduction</h3>
- <p class="information">Jtalk is a young piece of code and evolves quickly. Some features are still incomplete and you may very well encounter bugs, in which case you can <a href="https://github.com/NicolasPetton/jtalk/issues">file an issue</a> or a pull request on the <a href="https://github.com/NicolasPetton/jtalk">repository</a>.</p>
- <p>Jtalk is an implementation of the Smalltalk-80 language. It allows developers to write client-side heavy web applications in Smalltalk. Jtalk includes an integrated development environment with a class browser, workspace and transcript.</p>
- <p>Jtalk includes the following features:</p>
- <ol>
- <li>It is semantically and syntaxically equivalent to <a href="http://www.pharo-project.org">Pharo Smalltalk</a> (the implementation considered as the reference)</li>
- <li>It is written in itself and compiles into efficient JavaScript</li>
- <li>A canvas API similar to <a href="http://www.seaside.st">Seaside</a> to generate HTML</li>
- <li>A <a href="http://www.jquery.com">jQuery</a> binding</li>
- </ol>
- <h3>Differences with other Smalltalk implementations</h3>
- <h3>Committing changes to disk with the web-based IDE</h3>
-
- <p>The class browser is able to commit changes to disk. The <code>commit category</code> button will send a PUT request with the compiled JavaScript code of all classes in the selected class category in a file named <code>js/CATEGORY.js</code>.</p>
- <p>The easiest way to enable committing is probably to setup a webdav with Apache.</p>
- <p class="information">The following steps explain how to setup a webdav for Jtalk with Debian, but the setup on OSX and other Linux distros should be similar.</p>
- <h4>Installing Apache and enabling the dav module</h4>
- <p>Evaluate the following as root:</p>
- <pre><span class="prompt">~#</span> <span class="kbd">apt-get install</span> <span class="kbd var">apache2</span>
- <span class="prompt">~#</span> <span class="kbd">a2enmod</span> <span class="kbd var">dav</span>
- <span class="prompt">~#</span> <span class="kbd">a2enmod</span> <span class="kbd var">dav_fs</span></pre>
- <h4>Creating a password for the webdav</h4>
- <pre><span class="prompt">~#</span> <span class="kbd">htpasswd -c /etc/apache2/htpasswd-webdav <span class="kbd var">USERNAME</span></span></pre>
- <h4>Setting up the webdav directory</h4>
- <p>Add the following lines to the default vhost (in <code>/etc/apache2/sites-available/default</code>):</p>
- <pre>Alias /jtalk/ "/path/to/jtalk/"
- <Directory "/path/to/jtalk/">
- Options Indexes MultiViews FollowSymLinks
- DirectoryIndex index.html
- AllowOverride None
- Order allow,deny
- allow from all
- Dav on
- AuthType Basic
- AuthName "jtalk"
- AuthUserFile /etc/apache2/htpasswd-webdav
- <LimitExcept GET OPTIONS>
- Require valid-user
- </LimitExcept>
- </Directory></pre>
- <p>Make sure the group <code>www-data</code> has required rights to make changes to files in the webdav directory.</p>
-
- <h4>Restarting Apache</h4>
- <p>To restart Apache, evaluate the following: </p>
- <pre><span class="prompt">~#</span> <span class="kbd">/etc/init.d/apache2</span> <span class="kbd var">restart</span></pre>
- <p>and go to <code>http://localhost/jtalk/</code>.</p>
- <p>The class browser should now be able to commit changes to disk.</p>
- <h3>The counter example</h3>
- <p>The following example is the traditional Seaside-like multi-counter application. The buttons at the bottom of each counter increase or decrease the counter.</p>
- <div id="counters"></div>
- <script type="text/javascript">
- jQuery(document).ready(function() {'#counters'._asJQuery()._append_(smalltalk.Counter._new())._append_(smalltalk.Counter._new())});
- </script>
- <p>Open a <button onclick="smalltalk.Browser._openOn_(smalltalk.Counter);">browser</button> on the <code>Counter</code> class in the <code>Canvas</code> class category.
- <p>Each Jtalk widget is a subclass of <code>Widget</code>. A widget is a graphical component. The <code>#renderOn:</code> method is used to generate HTML using the HTML canvas.</p>
- <p class="information">Rendering methods should be placed in the <code>rendering</code> method protocol, and action methods in the <code>actions</code> protocol.</p>
- <div class="highlight"><pre><code class="smalltalk"><span class="nf">renderOn:</span> <span class="nv">html</span>
- <span class="nv">html</span> <span class="nf">h1</span> <span class="nf">with:</span> <span class="nv">count</span> <span class="nf">asString</span><span class="p">.</span>
- <span class="nv">html</span> <span class="nf">button</span>
- <span class="nf">with:</span> <span class="s">'++'</span><span class="p">;</span>
- <span class="nf">onClick:</span> [<span class="bp">self</span> <span class="nf">increase</span>]<span class="p">.</span>
- <span class="nv">html</span> <span class="nf">button</span>
- <span class="nf">with:</span> <span class="s">'--'</span><span class="p">;</span>
- <span class="nf">onClick:</span> [<span class="bp">self</span> <span class="nf">decrease</span>]
- </code></pre>
- </div>
- <h3>The HTML canvas</h3>
- <h3>Widgets</h3>
- <h3>jQuery</h3>
- </div>
- </div>
- <!-- Add ids and anchors to doc titles -->
- <script type="text/javascript">
- jQuery.each(jQuery('.doc h3'), function(i, heading) {
- jQuery(heading).attr({'id': jQuery(heading).text().replace(/ /g,"_")})
- jQuery(heading).html(
- i + ". " +
- jQuery(heading).html() +
- " <a href='#" + jQuery(heading).attr('id') + "'>¶</a>");
- });
- </script>
- </div>
- </div>
-
- <div id="footer">
- <div class="main">
- <p>Copyright © 2011 <a href="https://github.com/NicolasPetton">Nicolas Petton</a>. The content of this website in licensed under <a href="http://creativecommons.org/licenses/by-nc/3.0/">CC-BY-NC 3.0</a>.</p>
- <p>Jtalk is an opensource project sponsored by <a href="http://www.objectfusion.fr">objectfusion</a>.</p>
- <p>The design of this website was provided by <a href="mailto:neomie.thirion@gmail.com">Noémie Thirion</a>.</p>
- </div>
- </div>
-
- </body>
- </html>
|