<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EclipseSource Blog</title>
	<atom:link href="http://eclipsesource.com/blogs/category/syndicate/feed/?author_name=tim" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Fri, 17 May 2013 13:50:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How to use multiple browser tabs in your RAP 2.1 Application</title>
		<link>http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/</link>
		<comments>http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/#comments</comments>
		<pubDate>Fri, 10 May 2013 09:26:37 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[kepler]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15710</guid>
		<description><![CDATA[You can now download RAP 2.1 M2, the final milestone of RAP before the 2.1 (Kepler) release in June. This milstone adds quite a few nice features like bézier curves for Canvas, background-position and -repeat for CSS theming, and (especially) improved multi-tab browsing: It is now possible to host multiple UI-Sessions within the same HTTP-Session, <a href="http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>You can now <a href="http://eclipse.org/rap/downloads/">download RAP 2.1 M2</a>, the final milestone of RAP before the 2.1 (Kepler) release in June.</p>
<p>This milstone adds quite a few <a href="http://eclipse.org/rap/noteworthy/2.1/?build=M2">nice features</a> like bézier curves for Canvas, background-position and -repeat for CSS theming, and (especially) improved <b>multi-tab browsing</b>: It is now possible to host multiple UI-Sessions within the same HTTP-Session, meaning that there are no more tricks required to use multiple tabs with RAP applications in the same browser. Lets look at an example how multiple browser tabs can be used within a RAP application by integrating it with the <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=markup.html&#038;version=2.0#markup">markup</a> and <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=navigation.html&#038;version=2.0">BrowserNavigation</a> features. </p>
<p>Assuming our application lets the user select a person from a database to edit, the typical setup would be a TableViewer that opens a Dialog on a DefaultSelection event. We want to give the user the additional option to open this dialog in a new browser tab. This tab may run the same EntryPoint, or in this case one designed for this specific purpose only. </p>
<p><img src="http://download.eclipsesource.com/~tbuschto/multitab.png" title="How to use multiple browser tabs in your RAP 2.1 Application" alt="multitab How to use multiple browser tabs in your RAP 2.1 Application" /></p>
<p>We create a TableViewer with markup support:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">viewer <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TableViewer<span style="color: #009900;">&#40;</span> parent <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
viewer.<span style="color: #006633;">getTable</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">setData</span><span style="color: #009900;">&#40;</span> RWT.<span style="color: #006633;">MARKUP_ENABLED</span>, <span style="color: #003399;">Boolean</span>.<span style="color: #000066; font-weight: bold;">TRUE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Then we insert a link in the last cell of each row, whereby &#8220;edit&#8221; is the name of another EntryPoint:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">viewer.<span style="color: #006633;">setLabelProvider</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> CellLabelProvider<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> update<span style="color: #009900;">&#40;</span> ViewerCell cell <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Person person <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> Person <span style="color: #009900;">&#41;</span>cell.<span style="color: #006633;">getElement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span> cell.<span style="color: #006633;">getColumnIndex</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">case</span> COLUMN_FIRST_NAME<span style="color: #339933;">:</span>
        cell.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> person.<span style="color: #006633;">name</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">case</span> COLUMN_PLACE_OF_BIRTH<span style="color: #339933;">:</span>
        cell.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> person.<span style="color: #006633;">nation</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">case</span> COLUMN_LINKS<span style="color: #339933;">:</span>
        <span style="color: #003399;">String</span> url <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;edit#person/&quot;</span> <span style="color: #339933;">+</span> persons.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span> person <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        cell.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>  
          <span style="color: #0000ff;">&quot;&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> 
          <span style="color: #339933;">+</span> url 
          <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> target=<span style="color: #000099; font-weight: bold;">\&quot;</span>_blank<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;edit&lt;/a&gt;&quot;</span> 
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In the other EntryPoint, we add deep-link support like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">BrowserNavigation bn 
  <span style="color: #339933;">=</span> RWT.<span style="color: #006633;">getClient</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getService</span><span style="color: #009900;">&#40;</span> BrowserNavigation.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
bn.<span style="color: #006633;">addBrowserNavigationListener</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> BrowserNavigationListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> navigated<span style="color: #009900;">&#40;</span> BrowserNavigationEvent event <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">String</span> state <span style="color: #339933;">=</span> event.<span style="color: #006633;">getState</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> state.<span style="color: #006633;">startsWith</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;person/&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">int</span> index <span style="color: #339933;">=</span> <span style="color: #003399;">Integer</span>.<span style="color: #006633;">parseInt</span><span style="color: #009900;">&#40;</span> state.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">7</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      editPerson<span style="color: #009900;">&#40;</span> persons.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span> index <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Done. You could also use the <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=navigation.html&#038;version=2.0#launcher">URLLauncher</a> service to open the tab without using a &#8220;real&#8221; link.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=How+to+use+multiple+browser+tabs+in+your+RAP+2.1+Application&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/&amp;t=How+to+use+multiple+browser+tabs+in+your+RAP+2.1+Application" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/#comments">2 Comments</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/kepler/' title='kepler Tag'>kepler</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tutorial/' title='tutorial Tag'>tutorial</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/kepler/' title='kepler Tag'>kepler</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tutorial/' title='tutorial Tag'>tutorial</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/05/10/rap-2-1-m2-multi-browser-tabs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The D.I.Y. RAP Client Construction Kit</title>
		<link>http://eclipsesource.com/blogs/2013/04/12/rap-lite/</link>
		<comments>http://eclipsesource.com/blogs/2013/04/12/rap-lite/#comments</comments>
		<pubDate>Fri, 12 Apr 2013 13:01:58 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Editors choice]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[eclipseRT]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Single Sourcing]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15155</guid>
		<description><![CDATA[Since RAP 2.0 has fully implemented the JSON-based RAP Protocol I was eager to test it&#8217;s full potential myself. The Tabris clients for Android and iOS already exist and others may follow, but as I&#8217;m mostly at home in the browser that&#8217;s where I would like to use it. The Vision My idea was to <a href="http://eclipsesource.com/blogs/2013/04/12/rap-lite/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Since RAP 2.0 has <a href="http://eclipsesource.com/blogs/2012/10/05/rap-2-0-m2-json-protocol-migration-complete/">fully implemented</a> the JSON-based <a href="http://wiki.eclipse.org/RAP/Protocol">RAP Protocol</a> I was eager to test it&#8217;s full potential myself. The <a href="http://eclipsesource.com/en/products/tabris/">Tabris</a> clients for Android and iOS already exist and others may follow, but as I&#8217;m mostly at home in the browser that&#8217;s where I would like to use it.</p>
<h2>The Vision</h2>
<p>My idea was to create a highly modular and especially flexible client that supports only a minimal subset of RAP features, but can very easily be extended and customized. RAP 2.0 introduced a simple JavaScript API for creating custom widgets. This client would go one step further and also allow you to change the presentation of existing widgets to your liking (also using JavaScript). For that you don&#8217;t have to implement a new Java API, the client-server communication is already in place, as is the internal logic of the widget (like selection management). Also, the widget will still be single-sourcing capable. Any RAP widgets or features that you might miss in the client you should easily be able to implement yourself after reading the documentation. It would basically be a D.I.Y. RAP Client construction kit, and not a replacement for the full-blown existing WebClient.</p>
<p>Another noticeable feature of this client would also be its ability to adapt to (and take advantage of) different environments. This would also mean that it breaks with RAPs paradigm of looking and working identically on all supported browsers. If you want to take advantage of exciting HTML5/CSS3 features you can but it won&#8217;t work/look like the same older browser. You could also create a very different presentation if you are on a touchscreen device, or if you want to optimize for performance on older hardware. You could even create a presentation built entirely on SVG, or for other environments than a browser, as long as they run JavaScript.</p>
<p>By the way, most custom widgets and ClientScripting components written for the default WebClient should also still work with this client.</p>
<p>So I went ahead and built a <b>proof-of-concept/experimental</b> version of this web client for RAP. It currently supports 5 widgets and is appropriately titled &#8220;RAP Lite&#8221;. The code can be viewed <a href="https://github.com/tbuschto/rap-lite">here</a>. You can also download it and run the demo but remember that this is strictly a research project and only barely functional.</p>
<h2>What can it currently do?</h2>
<p>First of all, here are two screenshots of the <strong>Demo</strong> application included:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/rap-lite-vs1.png"><img class="aligncenter size-full wp-image-15269" alt="rap lite vs1 The D.I.Y. RAP Client Construction Kit" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/rap-lite-vs1.png" width="647" height="325" title="The D.I.Y. RAP Client Construction Kit" /></a></p>
<p>The screenshot on the left is the default WebClient, while the one on the right is RAP Lite. The first 5 buttons all only change the Label at the top.<br />
So far it looks and works mainly in the same way, except that RAP Lite starts up faster.</p>
<p>&#8220;Visit the other side&#8221; brings a List widget to the front using a nice CSS3 animation in the latest FireFox and Chrome browsers:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/ani.png"><img class="aligncenter size-full wp-image-15273" alt="ani The D.I.Y. RAP Client Construction Kit" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/ani.png" width="600" height="461" title="The D.I.Y. RAP Client Construction Kit" /></a></p>
<p>Clicking on &#8220;Scroll&#8221; will animate the scroll position of the List to a random value. In a modern browser the scrollbar is a subwidget (iScroll) that looks the same on any OS. Let&#8217;s compare that with IE8:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/scrollbars.png"><img class="aligncenter size-full wp-image-15275" alt="scrollbars The D.I.Y. RAP Client Construction Kit" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/scrollbars.png" width="601" height="331" title="The D.I.Y. RAP Client Construction Kit" /></a></p>
<p>In IE (on the right), the List now uses the traditional OS-native scrollbar without animation because the iScroll widget is not supported in IE. Also, the gradients are gone because RAP Lite will not go to the same lengths as the default client to render them. Lets modify the demo to tell the client to use another presentation for buttons:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/win7buttons.png"><img class="aligncenter size-full wp-image-15278" alt="win7buttons The D.I.Y. RAP Client Construction Kit" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/win7buttons.png" width="286" height="312" title="The D.I.Y. RAP Client Construction Kit" /></a></p>
<p>Now RAP Lite uses the native HTML form elements for push buttons, which aren&#8217;t as flexible, but look somewhat better than flat rectangles.</p>
<p>Finally, lets have a look at a cool feature that I didn&#8217;t mention before at all: The ability to run RAP Lite inside of a traditional, static HTML website:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/raplite-website.png"><img class="aligncenter size-full wp-image-15281" style="border: 1px solid black; padding: 3px;" alt="raplite website The D.I.Y. RAP Client Construction Kit" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/raplite-website.png" width="653" height="512" title="The D.I.Y. RAP Client Construction Kit" /></a></p>
<p>This is not RAP running in an iframe. Instead, there is a simple script within that static HTML site that assigns the RAP application a div to run in. However, that&#8217;s not all. Let&#8217;s assume you want to embedd RAP in your website, with some static content <i>between</i> the RAP components. You can do that too. The button at the bottom of the demo opens another Shell which now looks like this:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/raplite-website2.png"><img class="aligncenter size-full wp-image-15282" style="border: 1px solid black; padding: 3px;" alt="raplite website2 The D.I.Y. RAP Client Construction Kit" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/raplite-website2.png" width="650" height="514" title="The D.I.Y. RAP Client Construction Kit" /></a></p>
<p>Notice that the text flows around the new Shell, and even adapts when it changes it size.</p>
<h2>How does it work?</h2>
<p>RAP Lite can be separated into three layers (+libaries):</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/architecture.png"><img class="aligncenter size-full wp-image-15197" alt="architecture The D.I.Y. RAP Client Construction Kit" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/architecture.png" width="1449" height="442" title="The D.I.Y. RAP Client Construction Kit" /></a></p>
<p>The first layer provides the core infrastructure for communicating with a RAP server. The code is taken directly from the existing WebClient and could be used to build any kind of JavaScript-based RAP client on top. (This is not quite the case yet, but almost).</p>
<p>The second layer provides the widget data models and internal logic, and connects the models with the first layer. It does not, however, include any HTML/CSS rendering or DOM event handling. As such it should, like the first layer, be able to run in any JavaScript environment, even non-browser.</p>
<p>The third and final layer does the actual presentation. Each widget model is assigned one <b>or more</b> (alternative) views that can render their content. The views use HTML templates and/or subwidgets (standalone widgets not based on a model) to generate the widget representation. DOM Events are pre-processed by the view, then forwarded to the model. The theming is applied using central CSS rules generated at runtime, and every view can contribute it&#8217;s own rules. Most changes in the model are either reflected by adding/removing CSS classes, or by re-rendering all or most of the HTML. While more incremental changes may be more efficient in some cases, this approach keeps the code very simple and the number of DOM operations small.</p>
<p><span style="font-size: 1.5em;">What does it all mean?</span></p>
<p>There are currently no concrete plans for a more &#8220;official&#8221; version of this client. The fact that is&#8217;s based on underscore.js sadly means that it can not become part of the RAP project for legal reasons. However, if I&#8217;m ever involved in creating another web client for RAP, it will most likely look a lot like this experiment.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=The+D.I.Y.+RAP+Client+Construction+Kit&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/04/12/rap-lite/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/04/12/rap-lite/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/04/12/rap-lite/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/04/12/rap-lite/&amp;t=The+D.I.Y.+RAP+Client+Construction+Kit" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/04/12/rap-lite/#comments">Leave a Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/eclipsert/' title='eclipseRT Tag'>eclipseRT</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/single-sourcing/' title='Single Sourcing Tag'>Single Sourcing</a>, <a href='http://eclipsesource.com/blogs/tag/eclipsert/' title='eclipseRT Tag'>eclipseRT</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/single-sourcing/' title='Single Sourcing Tag'>Single Sourcing</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/04/12/rap-lite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing JavaScript Tests with Jasmine for RAP</title>
		<link>http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/</link>
		<comments>http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/#comments</comments>
		<pubDate>Tue, 02 Apr 2013 08:44:35 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[jasmine]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=14233</guid>
		<description><![CDATA[If you are writing unit tests for your Java code, then you should also write them for any other code you wrote for the same project. Otherwise these tests only give you a false sense of security. RAP 2.0 provides a new JavaScript API to extend the framework with custom components, as you can read <a href="http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-14336 alignright" alt="rapjasmine trnsp Writing JavaScript Tests with Jasmine for RAP" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/rapjasmine_trnsp.png" width="356" height="240" title="Writing JavaScript Tests with Jasmine for RAP" /></p>
<p>If you are writing unit tests for your Java code, then you should also write them for any other code you wrote for the same project. Otherwise these tests only give you a false sense of security. RAP 2.0 provides a new JavaScript API to extend the framework with custom components, as you can read <a href="http://eclipsesource.com/blogs/2013/02/11/rap-2-0-countdown-55/">here</a>. Using third party JavaScript libaries (<a href="http://jquery.com/">jQuery</a>, <a href="http://d3js.org/">D3</a>, etc) or widgets/applications (like <a href="http://rap.eclipsesource.com/rapdemo/examples#gmaps">GMaps</a>, <a href="http://ckeditor.com/demo">CKEditor</a>&#8230; ) makes the task manageable even if you are not an HTML/CSS/JavaScript expert. But what about tests?</p>
<p>As Java/RCP/RAP developer you may be used to JUnit, and perhaps Mockito (if not: read <a href="http://eclipsesource.com/blogs/2011/09/19/effective-mockito-part-1/">this</a>). Now, Java/JavaScript differences aside, I like <a href="http://pivotal.github.com/jasmine/">Jasmine</a> even better. I used it to test my JavaScript code when porting the CKEditor add-on for RAP (<a href="http://rap.eclipsesource.com/rapdemo/examples#ckeditor">demo</a>, <a href="https://github.com/eclipsesource/rap-ckeditor">download</a>) to RAP 2.0. In this article I will use this project to demonstrate one way to use Jasmine with RAP.<br />
You can look at the editors <a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor/src/com/eclipsesource/widgets/ckeditor/CKEditor.java">Java implementation</a> here, and at the <a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor/src/resources/handler.js">JavaScript code</a> we want to test here.</p>
<h3>Remote API Basics</h3>
<p>To fully understand the examples i&#8217;ll show here, you should be familiar with the RAP Remote API, but you&#8217;ll get the gist of it either way. If you want, you can jump straight to the next chapter.</p>
<p>A brief introduction to Remote API is also given <a href="http://eclipsesource.com/blogs/2013/02/11/rap-2-0-countdown-55/">here</a>. Basically, each side (client and server) have one &#8220;half&#8221; of the custom widget, and a representation of the other side&#8217;s &#8220;half&#8221; as an instance of <code>RemoteObject</code>:</p>
<p><a href="http://eclipsesource.com/blogs/2013/02/01/rap-2-0-countdown-15/"><img class="aligncenter size-full wp-image-14008" alt="half objects Writing JavaScript Tests with Jasmine for RAP" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/half-objects.png" width="601" height="215" title="Writing JavaScript Tests with Jasmine for RAP" /></a></p>
<p>Therefore RAP includes a <code>RemoteObject</code> <a href="http://download.eclipse.org/rt/rap/doc/2.0/guide/reference/api/org/eclipse/rap/rwt/remote/RemoteObject.html">implementation for Java</a> and <a href="http://download.eclipse.org/rt/rap/doc/2.0/guide/reference/jsdoc/symbols/RemoteObject.html">one for JavaScript</a>. The main difference is that the server can create new remote objects&#8230;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">Connection</span> connection <span style="color: #339933;">=</span> RWT.<span style="color: #006633;">getUISession</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">RemoteObject</span> remoteObject 
  <span style="color: #339933;">=</span> connection.<span style="color: #006633;">createRemoteObject</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;MyWidget&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>&#8230; while the client can only get existing ones:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">  <span style="color: #000066; font-weight: bold;">var</span> remoteObject <span style="color: #339933;">=</span> rap.<span style="color: #660066;">getRemoteObject</span><span style="color: #009900;">&#40;</span> widgetInstance <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>In addition, the Server can also <a href="http://download.eclipse.org/rt/rap/doc/2.0/guide/reference/api/org/eclipse/rap/rwt/remote/RemoteObject.html#setHandler%28org.eclipse.rap.rwt.remote.OperationHandler%29"> receive remote operations</a> via the remote object, while the client object has to implement methods (especially setter) that can be directly called by the framework.</p>
<p>Typically, a simple custom widgets client-side life cycle looks like this:</p>
<ul>
<li id="typehandler">The client component has to <a href="http://download.eclipse.org/rt/rap/doc/2.0/guide/reference/jsdoc/symbols/rap.html#.registerTypeHandler">register a TypeHandler</a> (once). This is basically the glue between your custom widget and the framework. The type handler consist of a factory for the client object, and a list of properties, methods and events it supports.</li>
<li>The server side creates an <code>RemoteObject</code> instance. With this, a &#8220;create&#8221; operation is send to the client and invokes the type handler&#8217;s factory.</li>
<li>Using the id of a <code>Composite</code> (which the server typically provides in a &#8220;set&#8221; operation), the custom widget can obtain the client side instance and attach itself to it: <code style="white-space: nowrap;">rap.getObject( parentId ).append( htmlElement );</code></li>
<li>All invocations of &#8220;set&#8221; or &#8220;call&#8221; on the server side <code>RemoteObject</code> will cause the matching methods of the client widget to be called. To send messags back, the client widget can itself obtain a <code>RemoteObject</code> to send operations to the server.</li>
<li>When the server remote object is destroyed, so is the client object.</li>
</ul>
<h3>Jasmine at a glance</h3>
<p>The Jasmine project site already gives a good <a href="http://pivotal.github.com/jasmine/">tutorial</a>, so I&#8217;ll try to keep this short. Jasmine allows for Behavior-Driven Development (BDD), which is similar to Test-Driven Development (TDD). It basically means that your tests will read <a href="http://en.wikipedia.org/wiki/Behavior-driven_development#Behavioral_specifications">like a &#8220;story&#8221;</a> written in plain English. (Or any other language, <a href="http://eclipsesource.com/blogs/2012/09/03/js-i18n/">if you&#8217;re crazy</a>.)</p>
<p>For example, a traditional test in JUnit&#8230;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Math_Test <span style="color: #000000; font-weight: bold;">extends</span> TestCase
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> test_RoundsUp2Point5<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    assertEquals<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">3</span>, <span style="color: #003399;">Math</span>.<span style="color: #006633;">round</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">2.5</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>&#8230; may look like this in Jasmine:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">describe<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Math&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  it<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;should round 2.5 to 3&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    expect<span style="color: #009900;">&#40;</span> <span style="">Math</span>.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">2.5</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toBe</span><span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">3</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>As you can see it&#8217;s not that different at first, except it&#8217;s easier to describe what exactly you are testing. The &#8220;describe&#8221; function seems similar to a test class (it is called a &#8220;Suite&#8221;), &#8220;it&#8221; to a test method (actually a &#8220;Spec&#8221;), and &#8220;expect&#8221; looks a bit like Mockitos &#8220;verify&#8221;. The &#8220;setUp&#8221; and &#8220;tearDown&#8221; methods in JUnit would be &#8220;beforeEach&#8221; and &#8220;afterEach&#8221; functions in Jasmine.</p>
<p>However, the advantage is that unlike JUnit tests, &#8220;describe&#8221; functions can be nested. And what I personally love about that, is that each can have it&#8217;s very own beforeEach/afterEach functions, and they are executed for all the &#8220;describe&#8221; functions the &#8220;it&#8221; is in. That made my tests a lot more readable. In JUnit I would often have a lot of similar setup code at the beginning for each test, and multiple asserts the end. Sure, there ways to reduce it, but I think it&#8217;s a pain. My Jasmine Specs on the other hand are usually around three lines only.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/jasminegraph.png"><img class="aligncenter size-full wp-image-14429" alt="jasminegraph Writing JavaScript Tests with Jasmine for RAP" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/jasminegraph.png" width="761" height="496" title="Writing JavaScript Tests with Jasmine for RAP" /></a></p>
<h3>What to test?</h3>
<p>There may be several parts to your JavaScript component. The RAP <a href="#typehandler">type handler</a> has little to no logic of it&#8217;s own, and would require a &#8220;real&#8221; RAP client to be tested. Therefore we omit it, and only test the widget <a href="http://en.wikipedia.org/wiki/Prototype-based_programming">&#8220;class&#8221;</a> itself.</p>
<p>If your custom widget is basically a wrapper for an existing JavaScript app (like CKEditor), then you might want to test <i>only</i> the wrapper. If so, you can also replace the app with your own mock, though you have to know the app&#8217;s API really well for that to work. In my case, I first did a untested prototype to figure out how to get the CKEditor to cooperate with RAP. Then I started again from scratch, writing tests first using a <a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor.test/js/CKEditorMock.js">CKEditor mock</a> I created myself.</p>
<p>If you are writing the entire widget yourself, you should of course test all of it, not just the part that connects to RAP.</p>
<h3>Setting Up Jasmine with a RAP enviroment</h3>
<p>Download the Jasmine <a href="http://pivotal.github.com/jasmine/#section-Downloads">Standalone Release</a> and unzip it to a folder in your test project. You don&#8217;t need the included examples, so delete the <code>src</code> and <code>specs</code> folder. Open the <code>SpecRunner.html</code> in an editor. We are interested in the <code>&lt;script&gt;</code> tags only. Remove those that point to the deleted files. Then get the &#8220;<a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor.test/js/rap-mock.js">rap-mock.js</a> from our GitHub repository and include it with a new script tag. This is key, as the file contains a mock implementation of the RAP JavaScript API, so that your custom component can be tested outside an actual RAP application.</p>
<p><i>Below</i> the rap-mock.js, add the JavaScript file(s) from your own RAP JavaScript component. If they are in another bundle, it may have to look like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="html" style="font-family:monospace;">&lt;script 
  type=&quot;text/javascript&quot; 
  src=&quot;../../com.eclipsesource.widgets.ckeditor/src/resources/handler.js&quot;&gt;
&lt;/script&gt;</pre></td></tr></table></div>

<p><span/><br />
Finally, create a new JavaScript file like &#8220;<a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor.test/js/specs/CKEditorSpec.js">CKEditorSpec.js</a>&#8221; and also include it in the HTML file. This is where we will put the tests.</p>
<p>The rap mock is initialized automatically by including the file itself, but to be sure that everything is reset with each test, your outmost &#8220;beforeEach&#8221; should look like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"> beforeEach<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  rap <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> RapMock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>In addition to the <a href="http://download.eclipse.org/rt/rap/doc/2.0/guide/reference/jsdoc/symbols/rap.html">official API of the &#8220;rap&#8221; object</a>, this one has two fields &#8220;fakeRemoteObject&#8221; and &#8220;fakeComposite&#8221;. Like &#8220;rap&#8221; itself, they are only empty implementations of the <code>RemoteObject</code> and <code>Composite</code> types, which are returned if <code>rap.getRemoteObject()</code> or <code>rap.getObject()</code> (respectively) are called. That makes it a lot easier to test interactions with these objects later on. (Note that it always returns the <i>same</i> instances, but since they dont have any state it shouldn&#8217;t matter.)</p>
<h3>My First Spec</h3>
<p>Since variables have function scope in JavaScript, and all Suites and Specs are functions, you can freely define variables within any suite and share them with the contained Specs. I would suggest to do so for your outmost Suite for the instance of your custom widget. For me, it looks like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">describe<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;eclipsesource.CKEditor&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">var</span> editor<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">var</span> createEditor <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    editor <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> eclipsesource.<span style="color: #660066;">CKEditor</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;parent&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;w2&quot;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
  beforeEach<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    rap <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">new</span> RapMock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    editor <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  afterEach<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    editor <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  ...
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>I&#8217;m not creating an instance in the outer Suite because we will sometimes need to do some setup <i>before</i> calling the constructor. This is where <a href="https://github.com/pivotal/jasmine/wiki/Spies">spies</a> come into play. Remember, our rap mock (and in this case CKEditor mock) does absolutely nothing itself (except preventing crashes). To write meaningful tests, we need to spy on it.</p>
<p>Spies replace methods with stubs, which can later be checked for invocations Mockito-style. They can also return any value, capture arguments, or execute arbitrary code. Read more about them <a href="https://github.com/pivotal/jasmine/wiki/Spies">here</a>. Spies are automatically removed after each <code>it</code>.</p>
<p>Now we dive right into it, and test that the widget adds itself (specifically it&#8217;s element) to the parent:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">  describe<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;The Constructor&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    it<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;should get a Composite with the parent id&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      spyOn<span style="color: #009900;">&#40;</span> rap<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;getObject&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">andCallThrough</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      createEditor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      expect<span style="color: #009900;">&#40;</span> rap.<span style="color: #660066;">getObject</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toHaveBeenCalledWith</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;w2&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    it<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;should add an element to the composite&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      spyOn<span style="color: #009900;">&#40;</span> rap.<span style="color: #660066;">fakeComposite</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;append&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      createEditor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      expect<span style="color: #009900;">&#40;</span> rap.<span style="color: #660066;">fakeComposite</span>.<span style="color: #660066;">append</span> <span style="color: #009900;">&#41;</span>
       .<span style="color: #660066;">toHaveBeenCalledWith</span><span style="color: #009900;">&#40;</span> editor.<span style="color: #660066;">element</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>It is a common pattern to prefix &#8220;private&#8221; fields of JavaScript objects with a &#8220;_&#8221;. For the CKEditor wrapper I completely abstained from creating private fields and made everything &#8220;public&#8221;, including the HTML element. If I hadn&#8217;t, I would either have to access a private field, or examine the contents of the element that was given to the fake composite. Since i&#8217;m not interested in testing the CKEditor itself, I chose this simpler solution.</p>
<p>Most other aspects of the constructor and the editor/wrapper are tested in similar ways, as you can read in the <a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor.test/js/specs/CKEditorSpec.js">full Spec file</a>. However, there are a few more special cases I like to discuss in detail.</p>
<h3>Testing events</h3>
<p>The CKEditor wrapper registers events listener on the CKEditor itself and on the &#8220;rap&#8221; object, e.g. to check for changes before a request is send to the server. There are various ways to test them. The &#8220;cleanest&#8221; one would likely be to obtain the listener with a spy and execute it:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">describe<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;The send listener&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">var</span> onSendListener<span style="color: #339933;">;</span>
&nbsp;
  beforeEach<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    spyOn<span style="color: #009900;">&#40;</span> rap<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;on&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">andCallFake</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span> event<span style="color: #339933;">,</span> listener <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> event <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;send&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        onSendListener <span style="color: #339933;">=</span> listener<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    createEditor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  describe<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;of an editor that has not changed&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    it<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;sends nothing&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      spyOn<span style="color: #009900;">&#40;</span> rap.<span style="color: #660066;">fakeRemoteObject</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;set&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      onSendListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      expect<span style="color: #009900;">&#40;</span> rap.<span style="color: #660066;">fakeRemoteObject</span>.<span style="color: #000066; font-weight: bold;">set</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">not</span>.<span style="color: #660066;">toHaveBeenCalled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>With the &#8220;beforeEach&#8221; function this does not bloat your code all that much, but it&#8217;s still a couple of lines. So instead I simply made the listener &#8220;public&#8221; (like with the HTML element) and called it <i>after checking it was registered</i>. This is part of the &#8220;contructor&#8221; Suite show above:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">it<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;should add a send listener&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  spyOn<span style="color: #009900;">&#40;</span> rap<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;on&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  createEditor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  expect<span style="color: #009900;">&#40;</span> rap.<span style="color: #660066;">on</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toHaveBeenCalledWith</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;send&quot;</span><span style="color: #339933;">,</span> editor.<span style="color: #660066;">onSend</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span/></p>
<p>Now I can simply invoke <code>editor.onSend</code> whenever I want, since I now it has been registered with the RAP client, which I trust to work correctly. <b>But</b>, there is one important bit: You should <b>not</b> simply write <code>editor.onSend()</code>, because this would mean that <code>editor</code> will be the context (<code>this</code>) of the invokation. This is not automatically given when working with JavaScript callbacks, and I know it is not the case with <code>rap.on</code>. (To see how I solved that issue for the CKEditor, look at the <code>bindAll</code> function in the <a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor/src/resources/handler.js">source code</a>.) Instead, you can write <code>editor.onSend.call();</code>, which executes it without context.</p>
<h3>The Clock makes &#8220;tick&#8221;</h3>
<p>A common issue with JavaScript testing are asynchronously executed function. This custom widget has one of those for setting the editors font, which happens with a small delay using the JavaScript <code>setTimeout</code> function. This means I can not simply call <code>editor.setFont</code> and check the results right away. Jasmine includes two different solutions for this issue. If you want or need your test to emulate the actual runtime scenario, you need to <a href="http://pivotal.github.com/jasmine/#section-Asynchronous_Support">wrap the code</a> of your Spec in <code>runs</code> and <code>waitsFor</code> functions. </p>
<p>Since I use only a mock CKEditor I had no such requirement, and used the alternative: Simply mocking the JavaScript timer.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">describe<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;The setFont function&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #000066; font-weight: bold;">var</span> body<span style="color: #339933;">;</span>
&nbsp;
   beforeEach<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    jasmine.<span style="color: #660066;">Clock</span>.<span style="color: #660066;">useMock</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    createEditor<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    body <span style="color: #339933;">=</span> editor.<span style="color: #660066;">editor</span>.<span style="color: #660066;">document</span>.<span style="color: #660066;">getBody</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    spyOn<span style="color: #009900;">&#40;</span> body<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;setStyle&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    editor.<span style="color: #660066;">setFont</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;13px Arial&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  it<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;calls body.setStyle on a ready event&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    editor.<span style="color: #660066;">onReady</span>.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    jasmine.<span style="color: #660066;">Clock</span>.<span style="color: #660066;">tick</span><span style="color: #009900;">&#40;</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    expect<span style="color: #009900;">&#40;</span> body.<span style="color: #660066;">setStyle</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toHaveBeenCalledWith</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">&quot;font&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;13px Arial&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>Feedback&#8230;</h3>
<p>&#8230;would be welcome, especially if you have trouble writing tests for RAP custom widgets. I did not touch on some topics like sending events to the server (which the CKEditor doesn&#8217;t do), or how to test DOM changes, but that would have completely burst the scope of this article. (<a href="http://eclipsesource.com/blogs/2012/08/14/debugging-javascript-on-android-and-ios/">I sometimes have issus keeping things short&#8230;</a>) Also, on testing the server side: RAP includes a Fixture (not official API) which allows testing the Remote API, but we might change it soon, so I didn&#8217;t want to write about it now. If you are curious, look at <a href="https://github.com/eclipsesource/rap-ckeditor/blob/master/com.eclipsesource.widgets.ckeditor.test/src/com/eclipsesource/widgets/ckeditor/CKEditor_Test.java"><code>CKEditor_Test.java</code></a>.</p>
<h3>Final Words</h3>
<p>Jasmine is awesome. Go use it for something.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Writing+JavaScript+Tests+with+Jasmine+for+RAP&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/&amp;t=Writing+JavaScript+Tests+with+Jasmine+for+RAP" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/#comments">Leave a Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/jasmine/' title='jasmine Tag'>jasmine</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/testing/' title='testing Tag'>testing</a>, <a href='http://eclipsesource.com/blogs/tag/tutorial/' title='tutorial Tag'>tutorial</a>, <a href='http://eclipsesource.com/blogs/tag/jasmine/' title='jasmine Tag'>jasmine</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/testing/' title='testing Tag'>testing</a>, <a href='http://eclipsesource.com/blogs/tag/tutorial/' title='tutorial Tag'>tutorial</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/04/02/rap-and-jasmine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keyboard Controls in RAP: Next Step Mnemonics</title>
		<link>http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/</link>
		<comments>http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/#comments</comments>
		<pubDate>Fri, 15 Mar 2013 11:20:13 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Editors choice]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[kepler]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=14913</guid>
		<description><![CDATA[Applications built with RAP are often designed for high productivity: The faster you can control the app, the more work you can get done. In many cases, keyboard controls are significantly faster than mouse controls. Consequentially, RAP has continually improved keyboard controls since it&#8217;s inception. What are Mnemonics? Should you not know, Mnemonics are the <a href="http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Applications built with RAP are often designed for high productivity: The faster you can control the app, the more work you can get done. In many cases, keyboard controls are significantly faster than mouse controls. Consequentially, RAP has <a href="http://eclipse.org/rap/noteworthy/1.2/#Workbench">continually</a> <a href="http://eclipsesource.com/blogs/2011/04/27/key-bindings-in-rap/">improved</a> <a href="http://eclipsesource.com/blogs/2012/03/08/using-key-events-effectively-in-rap/">keyboard</a> <a href="http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/">controls</a> since it&#8217;s inception.</p>
<h3>What are Mnemonics?</h3>
<p>Should you not know, Mnemonics are the characters that get underlined in some widgets (especially the menu bar) if you hold down the ALT key. Mac users may scratch their heads right now, because <a href="https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html#//apple_ref/doc/uid/TP40001909-212166-TPXREF146">those aren&#8217;t supported in OS X</a>. Their exact behavior differs a bit between the other platforms, but as long as you hold ALT and press of the underlined character on your keyboard, the widget gets selected. What I like about that is that, unlike normal shortcuts, you do not need to remember Mnemonics, and they can change all the time depending on what&#8217;s on screen. </p>
<h3>Mnemonics in RAP 2.1M1</h3>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/03/mnemonics.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2013/03/mnemonics.png" alt="mnemonics Keyboard Controls in RAP: Next Step Mnemonics " width="429" height="147" class="aligncenter size-full wp-image-14926" title="Keyboard Controls in RAP: Next Step Mnemonics " /></a><br />
As of M2 (or the current <a href="http://eclipse.org/rap/downloads/">nightly build</a>), RAP will support Mnemonics on Menus, Buttons, ToolItems, TabItems, Labels and Groups. (Also CTabItem and CLabel.) To enable them, you first need to set the modifier that makes the Mnemonics visible. While you could use ALT, it&#8217;s strongly discouraged, because that would activate the <em>actual</em> Mnemonics of your browser with unpredictable results. I recommend using CTRL+ALT, and reserve CTRL and CTRL+SHIFT for global shortcuts/Key Bindings. The combo can be set with just one line:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">display.<span style="color: #006633;">setData</span><span style="color: #009900;">&#40;</span> RWT.<span style="color: #006633;">MNEMONIC_ACTIVATOR</span>, <span style="color: #0000ff;">&quot;CTRL+ALT&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Now all you need to do is to put a &#8220;&#038;&#8221; before a character in a widgets text, and you already have a working Mnemonic. Example:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">tabItem.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Tab Item &amp;1&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Since this is a relatively complex new feature, I would love for developers to grab RAP 2.1M1 when it&#8217;s available next week and try it in their application so that we can get some feedback.</p>
<p>Coming soon: <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=403206">Full Accelerator support</a>.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Keyboard+Controls+in+RAP%3A+Next+Step+Mnemonics&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/&amp;t=Keyboard+Controls+in+RAP%3A+Next+Step+Mnemonics" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/#comments">Leave a Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/api/' title='api Tag'>api</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/kepler/' title='kepler Tag'>kepler</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a>, <a href='http://eclipsesource.com/blogs/tag/api/' title='api Tag'>api</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/kepler/' title='kepler Tag'>kepler</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/03/15/rap-mnemonics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RAP 2.0 RC1 published</title>
		<link>http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/</link>
		<comments>http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 12:30:48 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[New]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=13620</guid>
		<description><![CDATA[The RAP team wishes everyone a Happy New Year and proudly presents the first release candidate for RAP 2.0. When you look at our New and Noteworthy log for RAP 2.0 RC1, you&#8217;ll notice that we are going to live up our new name: The brand new RAP &#8220;Remote&#8221; API on Server and Client makes <a href="http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The RAP team wishes everyone a Happy New Year and proudly presents the <a href="http://eclipse.org/rap/downloads/">first release candidate for RAP 2.0</a>.</p>
<p>When you look at our <a href="http://eclipse.org/rap/noteworthy/2.0/?build=RC1">New and Noteworthy</a> log for RAP 2.0 RC1, you&#8217;ll notice that we are going to <a href="http://eclipsesource.com/blogs/2012/11/26/rap-becomes-the-remote-application-platform/">live up our new name</a>: The brand new RAP &#8220;Remote&#8221; API on Server and Client makes custom widget development much simpler than it ever was. This is also the first time we publish official JavaScript API, making JavaScript components much more future-poof.</p>
<p>This build also introduces simplified EntryPoints, which can safe you a nice bit of typing when starting new RWT applications or snippets:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloEntryPoint <span style="color: #000000; font-weight: bold;">extends</span> AbstractEntryPoint <span style="color: #009900;">&#123;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> createContents<span style="color: #009900;">&#40;</span> <span style="color: #003399;">Composite</span> parent <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">Button</span> button <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Button</span><span style="color: #009900;">&#40;</span> parent, SWT.<span style="color: #006633;">PUSH</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    button.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Hello World!&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>We encourage everyone to <a href="http://eclipse.org/rap/downloads/">download and install RC1</a>, and report any issues you may find to the RAP Newsgroup or Bugzilla. RAP 2.0 will be released on February 11. </p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=RAP+2.0+RC1+published&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/&amp;t=RAP+2.0+RC1+published" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/new/' title='New Tag'>New</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/new/' title='New Tag'>New</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/01/18/rap-2-0-rc1-published/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RAP ClientServices explained</title>
		<link>http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/</link>
		<comments>http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/#comments</comments>
		<pubDate>Mon, 17 Dec 2012 14:28:38 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12966</guid>
		<description><![CDATA[One of the bigger changes in the RAP 2.0 API is the introduction of client services. These are features that interact with the client, but aren&#8217;t directly related to the widget toolkit. Since there are now multiple types of clients that can be connected (mainly our default WebClient, Tabris for iOS and Tabris for Android), <a href="http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>One of the bigger changes in the <a href="eclipse.org/rap/noteworthy/2.0/">RAP 2.0 API</a> is the introduction of client services. These are features that interact with the client, but aren&#8217;t directly related to the widget toolkit. Since there are now multiple types of clients that can be connected (mainly our default WebClient, <a href="http://developer.eclipsesource.com/tabris/">Tabris for iOS and Tabris for Android</a>), as well as different environments (browser, OS version, hardware), not all of these features may be available at all times.</p>
<p><a href="http://eclipsesource.com/blogs/?attachment_id=" rel="attachment wp-att-13007"><img class="aligncenter size-full wp-image-13007" style="margin-left: auto; margin-right: auto;" alt="clientervices RAP ClientServices explained" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/12/clientervices.png" width="405" height="360" title="RAP ClientServices explained" /></a></p>
<p>The client service API accounts for that. In RAP 2.0, the client is represented by a class implementing the <code>Client</code> interface (<code>WebClient</code> by default). An instance of this class can be obtained from <code>RWT.getClient()</code>, which selects an implementation that matches the currently connected client. This implementation then provides the client services via the <code>getService</code> method. For example:<br />



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">MyService service <span style="color: #339933;">=</span> RWT.<span style="color: #006633;">getClient</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getService</span><span style="color: #009900;">&#40;</span> MyService.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>


</p>
<p>If the client connected to the current session supports the service, an instance is returned, otherwise null. (Also, within one session it will always return the same instance for the same service.) If you can be certain that the service is supported by all clients you are targeting, you can use it immediately, otherwise you should check for null first.</p>
<p>Right now, all services that are part of RAP are supported by the WebClient at all times. Some of them provide features that already existed in RAP 1.x in some form, some of them are completely new. There will certainly be even more in the future, especially ones that are based on HTML5-only features. As such, their availability at runtime may depend on the currently connected browser.</p>
<p>For now there is:</p>
<ul>
<li><b>ClientInfo</b>: Provides you with the clients timezone offset and locale setting.</li>
<li><b>BrowserNavigation</b>: Allows you to support the browser&#8217;s back/forward button and deep linking.</li>
<li><b>ExitConfirmation</b>: Lets you set a message that is displayed if the users tries to close the window or navigate to another website.</li>
<li><b>UrlLauncher</b>: Open any given URL without leaving the application or influencing the client. May be used to open other websites, view files, start mailing or calling a specific person. May also support opening save dialogs in the future.</li>
<li><b>JavaScriptLoader</b>: This new feature allows the server to add JavaScript to an already running client. The service also keeps track of which files have already been loaded. This makes it easy to develop custom widgets/components that are loaded as they are needed, keeping the initial loading time for the user as short as possible. (Fittingly, we also introduce a new custom component API in 2.0).</li>
<li><b>JavaScriptExecuter</b>: This service allows you access the client directly. If there is a simple, client-related task that RAP does not provide any Java API for (yet), this may be a way around that. Of course one should be <em>very</em> careful with this feature. Using it incorrectly may disrupt or even crash the entire client. Just make sure your script can not throw any exceptions and does not mess with any clients internals.</li>
</ul>
<p><b>Update:</b> You can try all services in the <a href="http://rap.eclipsesource.com/controlsdemo/controls#ClientServices">updated Controls Demo</a>.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=RAP+ClientServices+explained&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/&amp;t=RAP+ClientServices+explained" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/html5/' title='html5 Tag'>html5</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/html5/' title='html5 Tag'>html5</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/12/17/rap-clientservices-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse RAP on Windows 8: First Impressions</title>
		<link>http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/</link>
		<comments>http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/#comments</comments>
		<pubDate>Mon, 12 Nov 2012 12:57:22 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[kepler]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12501</guid>
		<description><![CDATA[Along with the release of Windows 8 also came the new Internet Explorer 10. (It has not yet been released for Windows 7.) While IE9 was an impressive (but overdue) technical improvement over IE8, IE10 is &#8211; naturally &#8211; a much smaller step forward. Significant for RAP are especially the improvements in CSS3 support, and <a href="http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Along with the release of Windows 8 also came the new Internet Explorer 10. (It has not yet been released for Windows 7.) While IE9 was an impressive (but overdue) technical improvement over IE8, IE10 is &#8211; naturally &#8211; a much smaller step forward. Significant for <a href="http://developer.eclipsesource.com/technology/crossplatform/#rap">RAP</a> are especially the improvements in CSS3 support, and the new touchscreen controls when running IE in its &#8220;modern app&#8221; (Metro) mode. Google Chrome also <a href="http://support.google.com/chrome/bin/answer.py?hl=en&amp;answer=2762879">already supports</a> the new windows 8 UI, so we will take a look at that too. Firefox only runs in desktop mode, but I also tried it shortly.</p>
<p>I did all my testing with the upcoming <a href="http://eclipse.org/rap/downloads/">RAP 2.0M3</a> on a 64Bit Intel version of Windows 8. I currently have no WinRT tablet available for testing.</p>
<h3>IE 10, Desktop mode</h3>
<p>RAP basically runs like it would on IE9. That means that it takes advantage of modern features like HTML5, but not to the same degree as on Firefox and Chrome/Safari. One shortcoming of IE9 was its limited support of CSS3, which is why RAP used some SVG in the UI to compensate for that. Since IE10 is currently running as IE9, this is still the case.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/ie10_svg.png"><img class="alignnone size-large wp-image-12504" title="ie10_svg" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/ie10_svg-1024x739.png" alt="ie10 svg 1024x739 Eclipse RAP on Windows 8: First Impressions" width="1024" height="739" /></a></p>
<p>After 5 minutes of hacking I got RAP to only use CSS3 in IE10. While it generally works, there seems to be an issue with gradients having an incorrect orientation. If it turns out to be an easy fix, we might be able to render the UI with CSS3 only in RAP 2.x/IE10.</p>
<h3>IE 10, App mode</h3>
<p>For IE to run in app mode, it has to be set as the default browser. It took me a while to figure that out. It&#8217;s like IE is offended that I dared to install another browser.</p>
<p>The UI seems to work like in desktop mode, but we are here to look at the controls. Using the mouse already causes some issue: Usually a right-click is used to bring up the URL-bar, which is hidden by default. However, that does not work while running a RAP application. It should not be hard to fix, assuming there is a way to detect IEs app-mode with JavaScript. Using fingers (swipe from bottom) or keyboard (CTRL+L) works fine though.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/ie10_metro_css3.png"><img class="alignnone  wp-image-12506" title="ie10_metro_css3" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/ie10_metro_css3-1024x575.png" alt="ie10 metro css3 1024x575 Eclipse RAP on Windows 8: First Impressions" width="1024" height="575" /></a></p>
<p style="text-align: center;"><small><em>Running fullscreen, the RAP theming fits quite well with the metro design.</em></small></p>
<p>Using fingers to press buttons and menus, or select items also works flawlessly, as does editing text. Double-tapping zooms into the application, a feature which we usually suppress on iOS and Android to allow quick selections and double-clicks. Touch-scrolling does not work at all except on multi-line textfields. Dragging any other items (like scrollbar thumbs) is also not possible.</p>
<p>RAP already supports all of this on iOS and Android (within limitations), but that code was written specifically for webkit browser and does not seem to work on IE10. We will likely have to put some effort into getting IE10 to the same level. Amusingly, the IE10-gesture of swiping left/right to navigate back/forward works very well with the more advanced BrowserHistory feature of RAP, as can be tested with the <a href="http://rap.eclipsesource.com/rapdemo/examples#input">Examples Demo</a>.</p>
<h3>Google Chrome 23</h3>
<p>Even though RAP does not detect Chrome on Windows as a touch-enabled browser, touch-controls work pretty good. Even scrolling trees and tables works, which was a huge issue on Android and iOS. Double-tapping does not zoom, but correctly fires a double-click event.<br />
Fixing the touch-detecting in RAP improves the touch-scrolling a bit, but changes nothing else.</p>
<h3>Firefox 17 beta</h3>
<p>Firefox is also not detected as a touch-device. Emulating simple clicks works fine, but that&#8217;s about it. Clicking in textfields does not bring up the keyboard. Touch-scrolling works, but is very much broken. However, since this version of Firefox is not yet a &#8220;real&#8221; Windows 8 app, let&#8217;s hope for an improved version soon.</p>
<h3>Conclusion</h3>
<p>Overall RAP is usable with touchscreens on Windows 8, though not quite yet at the same level as in iOS. However, support is noticeably better than it initially was with the first iOS/Android devices, so it should be not quite as hard for RAP to get there.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Eclipse+RAP+on+Windows+8%3A+First+Impressions&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/&amp;t=Eclipse+RAP+on+Windows+8%3A+First+Impressions" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/ajax/' title='ajax Tag'>ajax</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/kepler/' title='kepler Tag'>kepler</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/windows-8/' title='windows 8 Tag'>windows 8</a>, <a href='http://eclipsesource.com/blogs/tag/ajax/' title='ajax Tag'>ajax</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/kepler/' title='kepler Tag'>kepler</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/windows-8/' title='windows 8 Tag'>windows 8</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/11/12/eclipse-rap-on-windows-8-first-impressions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to deal with whitespaces in the Eclipse IDE</title>
		<link>http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/</link>
		<comments>http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/#comments</comments>
		<pubDate>Mon, 08 Oct 2012 09:27:13 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=11286</guid>
		<description><![CDATA[Whatever your project&#8217;s specific policy on whitespaces is (tabs vs. spaces, etc), the most important rule should always be consistency. Not just to make your code look nice, but also to avoid issues with patches and your version control system. Changes to whitespaces may be more or less invisible to the naked eye, but Git <a href="http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Whatever your project&#8217;s specific policy on whitespaces is (tabs vs. spaces, etc), the most important rule should always be consistency. Not just to make your code look nice, but also to avoid issues with patches and your version control system. Changes to whitespaces may be more or less invisible to the naked eye, but Git and co. register them anyway.</p>
<p>Here are some simple ways to automate how you deal with whitespaces in Eclipse.</p>
<p>First, if you don&#8217;t want to have trailing spaces in your java code (why would you), you can remove them automatically:<br />
<a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/10/spaces1e.png"><img class="alignnone size-full wp-image-11288" style="margin-top: 10px; margin-bottom: 10px;" title="spaces1e" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/10/spaces1e.png" alt="spaces1e How to deal with whitespaces in the Eclipse IDE" width="697" height="599" /></a><br />
If you use JSDT, there also is an option available to turn this feature on for javascript.</p>
<p>Second, if you want to be sure not to miss any unwanted whitespaces, you can configure Eclipse to show them as characters. Since doing this for all whitespaces can make the code harder to read, you can choose to show only those you don&#8217;t want to have in your code:<br />
<a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/10/spaces2e1.png"><img class="alignnone size-full wp-image-11293" style="margin-top: 10px; margin-bottom: 10px;" title="spaces2e" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/10/spaces2e1.png" alt="spaces2e1 How to deal with whitespaces in the Eclipse IDE" width="713" height="733" /></a><br />
This setting affects all text files, including java, javascript and HTML. Sadly, there is no option yet that shows only two or more enclosed spaces.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=How+to+deal+with+whitespaces+in+the+Eclipse+IDE&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/&amp;t=How+to+deal+with+whitespaces+in+the+Eclipse+IDE" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/clean-code/' title='clean code Tag'>clean code</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/git/' title='git Tag'>git</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a>, <a href='http://eclipsesource.com/blogs/tag/clean-code/' title='clean code Tag'>clean code</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/git/' title='git Tag'>git</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/10/08/how-to-deal-with-whitespaces-in-the-eclipse-ide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The new and improved RAP Developer&#8217;s Guide</title>
		<link>http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/</link>
		<comments>http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/#comments</comments>
		<pubDate>Tue, 26 Jun 2012 13:55:36 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipse juno]]></category>
		<category><![CDATA[eclipseRT]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[swt]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=8413</guid>
		<description><![CDATA[Behold, finally a big update to the RAP Developer&#8217;s Guide! After neglecting it a bit in the last release, the RAP team worked hard to get it in shape for Juno. With a lof of the information on RAP scattered around in blogbosts, forum entries, wiki pages and javadocs, newcomer (and in some case experts) <a href="http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Behold, finally a big update to the RAP Developer&#8217;s Guide! After neglecting it a bit in the last release, the RAP team worked hard to get it in shape for Juno. With a lof of the information on RAP scattered around in blogbosts, forum entries, wiki pages and javadocs, newcomer (and in some case experts) might have a hard time to puzzle out how this or that works in RAP. I would find it really annoying if we alienated potential adopers because of this, or if some of RAPs features would go stale because nearly no one knows about them.</p>
<p>In my opinion, even with a complex piece of software like RAP, a good documentation should make it easy for any seasoned Java developer to pick it up and quickly use it to its fullest. I think we are a lot closer to this now. And best of all, the guide can finally be <a href="http://eclipse.org/rap/developers-guide/">viewed </a>on the RAP homepage.</p>
<p>Here are some of the major additions:</p>
<ul>
<li>New chapters &#8220;<a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=getting-started/setup-ide.html">Setting up the Eclipse IDE</a>&#8221; and &#8220;<a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=getting-started/target-install.html">Installing a RAP Target</a>&#8220;, explaining in more detail and simple terms the different ways to to setup the IDE and target platform.</li>
<li>There is a new section &#8220;RAP Widget Toolkit&#8221;. It explains <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=rwt/intro.html">what RWT is</a>, what it can do <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=rwt/differences.html">more than SWT</a> and what its limitations are. There are also detailed discussions on <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=rwt/key-and-mouse-events.html">key and mouse events</a>, and on the <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=rwt/scopes.html">different scopes</a> used in RAP.</li>
<li>Certainly among the most important additions: The article <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=advanced/application-setup.html">&#8220;Choosing an Application Setup&#8221;</a> explains the different modes and environments RAP can run in. <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=advanced/application-configuration.html">&#8220;Application Configuration&#8221;</a> and <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=advanced/rwt-standalone.html">&#8220;RWT Standalone&#8221;</a> (and the retained <a href="http://eclipse.org/rap/developers-guide/devguide.php?topic=advanced/branding.html">&#8220;Branding&#8221;</a>) then build on that and go into more detail.</li>
</ul>
<p>Most of the other articles have also been slightly revised.</p>
<p>These changes are part of an ongoing effort to improve the environment and overall presentation of the RAP project. You might have noticed that the RAP homepage has been improved several times in the last months, (adding some content to the <a href="http://eclipse.org/rap/">landing page</a> just a few days ago), and the <a href="http://wiki.eclipse.org/RAP">Wiki</a> was also cleaned up a bit. Finally, we plan to <a href="http://eclipsesource.com/blogs/tag/rap/">blog</a> and <a href="https://twitter.com/#!/EclipseRAP/">twitter</a> more to keep everyone up to date and interested.</p>
<p>&nbsp;</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=The+new+and+improved+RAP+Developer%26%238217%3Bs+Guide&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/&amp;t=The+new+and+improved+RAP+Developer%26%238217%3Bs+Guide" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/documentation/' title='documentation Tag'>documentation</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/juno/' title='eclipse juno Tag'>eclipse juno</a>, <a href='http://eclipsesource.com/blogs/tag/eclipsert/' title='eclipseRT Tag'>eclipseRT</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/swt/' title='swt Tag'>swt</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a>, <a href='http://eclipsesource.com/blogs/tag/documentation/' title='documentation Tag'>documentation</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/juno/' title='eclipse juno Tag'>eclipse juno</a>, <a href='http://eclipsesource.com/blogs/tag/eclipsert/' title='eclipseRT Tag'>eclipseRT</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/swt/' title='swt Tag'>swt</a>, <a href='http://eclipsesource.com/blogs/tag/tips/' title='tips Tag'>tips</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/06/26/the-new-and-improved-rap-developers-guide/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Client-Side input validation with RAP ClientScripting</title>
		<link>http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/</link>
		<comments>http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 16:41:34 +0000</pubDate>
		<dc:creator>Tim Buschtöns</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ClientScripting]]></category>
		<category><![CDATA[eclipse juno]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=7202</guid>
		<description><![CDATA[The RAP team started working on a new feature called ClientScripting. It&#8217;s still in it&#8217;s infancy and will not (yet) be part of the core framework , but its already very useable. The goal is to allow adding pieces of behavior to the client-components of RAP widgets. This makes it possible to have swift, dynamic <a href="http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>The RAP team started working on a new feature called ClientScripting. It&#8217;s still in it&#8217;s infancy and will not (yet) be part of the core framework , but its already very useable.<strong> The goal is to allow adding pieces of behavior to the client-components of RAP widgets.</strong> This makes it possible to have swift, dynamic user feedback in situations that require a certain amout of logic &#8211; so far a problematic scenario for RAP applications. It can be considered an alternative to custom widget development in many cases, and might also save some network traffic. We currently focus on the scenario of validating text input while typing, and will expand from there. Interactions <em>between</em> widgets are not yet possible, but is planned.</p>
<p><strong>As you can <a href="http://rap.eclipsesource.com/rapdemo/examples#validation">test for yourself</a>, the difference between server-side and client-side validation is quite noticeable.<a href="http://rap.eclipsesource.com/rapdemo/examples#validation"><br />
</a></strong></p>
<p>When using ClientScripting, you will need to know very little JavaScript, and all API is as close to SWT as possible. The project has a <a href="http://wiki.eclipse.org/RAP/ClientScripting">wiki page</a> with all further information you might need (including where to get the code). Note that you need <a href="http://eclipsesource.com/blogs/2012/03/23/m6-brings-markup-text-support-to-rap/">RAP 1.5M6</a> or newer to use it. If you try it out, please consider giving some feedback, report bugs or file enhancement requests. <em><br />
</em></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Client-Side+input+validation+with+RAP+ClientScripting&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/&amp;t=Client-Side+input+validation+with+RAP+ClientScripting" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/ajax/' title='ajax Tag'>ajax</a>, <a href='http://eclipsesource.com/blogs/tag/clientscripting/' title='ClientScripting Tag'>ClientScripting</a>, <a href='http://eclipsesource.com/blogs/tag/juno/' title='eclipse juno Tag'>eclipse juno</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/ajax/' title='ajax Tag'>ajax</a>, <a href='http://eclipsesource.com/blogs/tag/clientscripting/' title='ClientScripting Tag'>ClientScripting</a>, <a href='http://eclipsesource.com/blogs/tag/juno/' title='eclipse juno Tag'>eclipse juno</a>, <a href='http://eclipsesource.com/blogs/tag/javascript/' title='javascript Tag'>javascript</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/03/23/client-side-input-validation-with-rap-clientscripting/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
