<?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>Mastering WAVE &#187; code</title>
	<atom:link href="http://www.masteringwave.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.masteringwave.com</link>
	<description>Google Wave Made Easy</description>
	<lastBuildDate>Sun, 08 Aug 2010 13:46:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<cloud domain='www.masteringwave.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>WaveCalender 5: Wave Code Prettifier</title>
		<link>http://www.masteringwave.com/2009/12/wavecalender-5-wave-code-prettifier/</link>
		<comments>http://www.masteringwave.com/2009/12/wavecalender-5-wave-code-prettifier/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 14:33:41 +0000</pubDate>
		<dc:creator>Daniel Graversen</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[WaveCalender]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[gadget]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.masteringwave.com/?p=582</guid>
		<description><![CDATA[In wave you would often like to show some code to get some feed back on it. A gadget which can help with it is wave code prettifier by Milan Andrejevic . It is a gadget you can put into your Wave and you can then get formatted code in your wave. The code gets [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.masteringwave.com%2F2009%2F12%2Fwavecalender-5-wave-code-prettifier%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.masteringwave.com%2F2009%2F12%2Fwavecalender-5-wave-code-prettifier%2F&amp;source=masteringwave&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>In wave you would often like to show some code to get some feed back on it. A gadget which can help with it is <a href="http://wave-samples-gallery.appspot.com/about_app?app_id=70046">wave code prettifier</a> by Milan Andrejevic . It is a gadget you can put into your Wave and you can then get formatted code in your wave.<br />
The code gets highlighted as you type. The language is determinate automatically, or you can overwrite the control.</p>
<p>The gadget XML can be found <a href="http://wave-code-prettifier.googlecode.com/svn/trunk/prettifier.xml">hire</a>.</p>
<p><img class="alignnone size-full wp-image-583" title="codeprettyfier" src="http://www.masteringwave.com/wp-content/uploads/2009/12/codeprettyfier.png" alt="codeprettyfier" width="450" height="341" /></p>
<p>You can enter you non formatted text on the top in the small window, and then the formatted text will be showed in the button panel. The buttum panel will be expanded as a result of data typed.</p>
<p>When you type something data is directly shared to the other users. If you type fast on a large text you are sometime send to the buttom of the field and complete the text at the end.</p>
<p>I would also like to see that gadget to have difference between edit mode and view mode. That way you would only see the formatted text as an ordinary user.</p>
<p>The gadget is written in Javascript and Jquery and uses a lot of standard libraries for code highlighting. The code in the gadget is only 29 lines. That is impressive.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.masteringwave.com/2009/12/wavecalender-5-wave-code-prettifier/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Gadget and Robots interaction</title>
		<link>http://www.masteringwave.com/2009/09/gadget-and-robots-interaction/</link>
		<comments>http://www.masteringwave.com/2009/09/gadget-and-robots-interaction/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 20:09:19 +0000</pubDate>
		<dc:creator>Daniel Graversen</dc:creator>
				<category><![CDATA[Beginner]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[gadget]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[robots]]></category>
		<category><![CDATA[wave]]></category>

		<guid isPermaLink="false">http://www.masteringwave.com/?p=174</guid>
		<description><![CDATA[In some instances you want to have the robots and gadgets to interact. A scenario where it could make sense is, when the user wants information about a site. The page which could be showed could be the sales report of the customer or some other information which is of interest to the participants. This [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.masteringwave.com%2F2009%2F09%2Fgadget-and-robots-interaction%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.masteringwave.com%2F2009%2F09%2Fgadget-and-robots-interaction%2F&amp;source=masteringwave&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>In some instances you want to have the robots and gadgets to interact. A scenario where it could make sense is, when the user wants information about a site. The page which could be showed could be the sales report of the customer or some other information which is of interest to the participants.
</p>
<p>This tutorial has basis in the <a href="http://www.masteringwave.com/2009/08/creating-a-simple-inline-gadget-to-show-external-web-applications/">Creating A Simple Inline Gadget To Show External Web Applications</a>, which shows how to inline a page into the a wave using a gadget. There is a robot which creates a form for entering the url of the page. When the user press submit the robot adds a gadget which inline the specified url.
</p>
<p>First the robot which inserts the gadget.
</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> EmbedUrlRobotServlet <span style="color: #000000; font-weight: bold;">extends</span> AbstractRobotServlet <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> URLFIELD <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;URL_FIELD&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> processEvents<span style="color: #009900;">&#40;</span>RobotMessageBundle bundle<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Wavelet wavelet <span style="color: #339933;">=</span> bundle.<span style="color: #006633;">getWavelet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> creator <span style="color: #339933;">=</span> wavelet.<span style="color: #006633;">getCreator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>bundle.<span style="color: #006633;">wasSelfAdded</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><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Blip blip <span style="color: #339933;">=</span> wavelet.<span style="color: #006633;">appendBlip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TextView textView <span style="color: #339933;">=</span> blip.<span style="color: #006633;">getDocument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; textView.<span style="color: #006633;">appendMarkup</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;p&gt;&lt;b&gt;Inline the url&lt;/b&gt;&lt;/p&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aformview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">FormView</span></a> form <span style="color: #339933;">=</span> textView.<span style="color: #006633;">getFormView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; form.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FormElement<span style="color: #009900;">&#40;</span>ElementType.<span style="color: #006633;">INPUT</span>, URLFIELD,<span style="color: #0000ff;">&quot;http://&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; form.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> FormElement<span style="color: #009900;">&#40;</span>ElementType.<span style="color: #006633;">BUTTON</span>, <span style="color: #0000ff;">&quot;submit&quot;</span>, <span style="color: #0000ff;">&quot;INSERT&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aevent+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Event</span></a> e <span style="color: #339933;">:</span> bundle.<span style="color: #006633;">getEvents</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><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #006633;">getType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> EventType.<span style="color: #006633;">FORM_BUTTON_CLICKED</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Blip blip <span style="color: #339933;">=</span> e.<span style="color: #006633;">getBlip</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aformview+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">FormView</span></a> form <span style="color: #339933;">=</span> blip.<span style="color: #006633;">getDocument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getFormView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FormElement urlElement <span style="color: #339933;">=</span> form.<span style="color: #006633;">getFormElement</span><span style="color: #009900;">&#40;</span>URLFIELD<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GadgetView gadgetView<span style="color: #339933;">=</span> blip.<span style="color: #006633;">getDocument</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getGadgetView</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gadgetView.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Gadget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://pollenvarsel.appspot.com/gadget?url=&quot;</span><span style="color: #339933;">+</span>urlElement.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>
 </p>
<p>The robots listens for two event. First the SELF_ADDED which creates the URL form with a text box and a submit button. When the button is pressed a gadget is inserted in to the Blip, with the url of the gadget + the target URL. Probably something should be performed to ensure that the submitted URL is valid and can be sent as a query parameter. Probably a URL encoding should be performed or save the data in the datastorage.
</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> doGet<span style="color: #009900;">&#40;</span>HttpServletRequest req, HttpServletResponse resp<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">throws</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aioexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">IOException</span></a> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; resp.<span style="color: #006633;">setContentType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Aprintwriter+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">PrintWriter</span></a> out<span style="color: #339933;">=</span> resp.<span style="color: #006633;">getWriter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; out.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;?xml version=<span style="color: #000099; font-weight: bold;">\&quot;</span>1.0<span style="color: #000099; font-weight: bold;">\&quot;</span> encoding=<span style="color: #000099; font-weight: bold;">\&quot;</span>UTF-8<span style="color: #000099; font-weight: bold;">\&quot;</span>?&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;Module&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;ModulePrefs title=<span style="color: #000099; font-weight: bold;">\&quot;</span>inline_external_page<span style="color: #000099; font-weight: bold;">\&quot;</span> height=<span style="color: #000099; font-weight: bold;">\&quot;</span>400<span style="color: #000099; font-weight: bold;">\&quot;</span> width=<span style="color: #000099; font-weight: bold;">\&quot;</span>800<span style="color: #000099; font-weight: bold;">\&quot;</span>/&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;Content type=<span style="color: #000099; font-weight: bold;">\&quot;</span>html<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;![CDATA[ &quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; &lt;div id=<span style="color: #000099; font-weight: bold;">\&quot;</span>main<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&lt;!--Main container for the iframe--&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; &lt;iframe name=<span style="color: #000099; font-weight: bold;">\&quot;</span>check<span style="color: #000099; font-weight: bold;">\&quot;</span> id=<span style="color: #000099; font-weight: bold;">\&quot;</span>check<span style="color: #000099; font-weight: bold;">\&quot;</span> height=<span style="color: #000099; font-weight: bold;">\&quot;</span>100%<span style="color: #000099; font-weight: bold;">\&quot;</span> src =<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a><span style="color: #009900;">&#41;</span>req.<span style="color: #006633;">getParameter</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;url&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span> width=<span style="color: #000099; font-weight: bold;">\&quot;</span>100%<span style="color: #000099; font-weight: bold;">\&quot;</span> frameborder=<span style="color: #000099; font-weight: bold;">\&quot;</span>0<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;p&gt;Your browser does not support iframes .&lt;/p&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;/iframe&gt; &lt;!-- this is where contents of the links are displayed --&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;/div&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;]]&gt;&lt;/Content&gt;&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&lt;/Module&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></div>
<p>The code is the same in the original blog it has just been placed into a servlet, to make it possible to have parameters inside. It just inserts the query parameter into the gadget XML.
</p>
<p>The code can be found at <a href="http://code.google.com/p/masteringwave/source/browse/">code.google.com</a>. </p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.masteringwave.com/2009/09/gadget-and-robots-interaction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

