<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
	<channel>
		<title>Codestore Activity Log</title>
		<description>Latest ten updates to codestore, be they blogs or articles.</description>
		<language>en-gb</language>
		<link>http://www.codestore.net</link>
		<lastBuildDate>Fri, 5 Feb 2010 03:45:15 -0500</lastBuildDate>
		<atom:link href="http://www.codestore.net/store.nsf/rss.xml" rel="self" type="application/rss+xml" />

		<item>
			<title>Flex App Basics 10: The Form Container | Blog</title>
			<pubDate>Fri, 5 Feb 2010 03:45:15 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>We've talked about how to create <a href="http://www.codestore.net/store.nsf/unid/BLOG-20100115-0307">a View component</a> so it follows that we need a Form component to compliment it. </p> <p>Let's take another look at the src folder of our Flex app. Notice I've added a folder called "forms" to keep each different form in -- one for the documents in the contacts view and one for the companies view. </p> <p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/0F7CB15A8A671B1A862576C100359426/$file/image_2a92ad6f-2834-4332-801a-1131d6393264.png" width="303" height="392"> </p> <p>These two forms are based on the Form.mxml component that you can see in the net.codestore.flex.* package/folder. This Form component contains all the things common between both the forms based on it. Things like the layout of the fixed-position button bar, the validation routine, the HTTP service to fetch and post the data from the server. </p> <p>Let's look at the Contact.mxml code, as below: </p> <p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/F4E197EB3193A2F9862576C1003594CA/$file/image_6ffa4ef7-7d40-4c75-bb13-9a0885fe611d.png" width="567" height="557">&nbsp; </p> <p>Notice how the main root tag is a Form. This means it is based on the Form component I mentioned. In the Form component I've defined 3 different objects that can be used to define the form -- content, buttons and the validators. Using these three properties of the Form we can quickly build a form without worrying about adding all the bits that are already in Form.mxml.</p> <p>It's inside Form.mxml that we add the buttons and content in to the right place. It's also where we loop the array of validators at the point the form is submitted and prevent submission on failure.</p> <p>Here's the code that runs when the Form element is first opened:</p><pre class="code2">[Bindable]
public <span class="TPkeyword2">var </span>validators:<span class="TPkeyword2">Array</span>;

[Bindable]
public <span class="TPkeyword2">var </span><span class="TPkeyword5">content</span>:Container;

[Bindable]
public <span class="TPkeyword2">var </span>buttons:<span class="TPkeyword2">Array</span>;

private <span class="TPkeyword2">function </span>initForm<span class="TPbracket">()</span>:<span class="TPkeyword1">void</span><span class="TPbracket">{</span>

 <span class="TPcomment">//Add each of the buttons passed to the form in to the action bar</span>
 buttons.forEach<span class="TPbracket">(</span><span class="TPkeyword2">function</span><span class="TPbracket">(</span>element:<span class="TPoperator">*</span>, <span class="TPkeyword5">index</span>:int, arr:<span class="TPkeyword2">Array</span><span class="TPbracket">)</span>:<span class="TPkeyword1">void</span><span class="TPbracket">{</span>
  bar.addChild<span class="TPbracket">(</span>element<span class="TPbracket">)</span>;
 <span class="TPbracket">})</span>;

 <span class="TPcomment">//Add the main form container in to the right place.</span>
 formContainer.addChild<span class="TPbracket">(</span><span class="TPkeyword5">content</span><span class="TPbracket">)</span>;
<span class="TPbracket">}</span>
</pre>
<p>That should give you an idea how it works. Notice the three public bindable properties, which we used to define the main elements of the form. </p>
<h4>How To Open a Form</h4>
<p>From some place in our script, say in the double-click event of the view, all we have to do in order to open a document using one of our forms is run code like this:</p><pre class="code2">import <span class="TPkeyword2">forms</span>.<span class="TPoperator">*</span>;

private <span class="TPkeyword2">function </span>openDocumentInTab<span class="TPbracket">(</span><span class="TPkeyword5">id</span>:<span class="TPkeyword2">String</span><span class="TPbracket">)</span>:<span class="TPkeyword1">void</span><span class="TPbracket">{</span>
 <span class="TPkeyword2">var </span><span class="TPkeyword5">form</span>:Contact <span class="TPoperator">= </span><span class="TPkeyword2">new </span>Contact<span class="TPbracket">()</span>;
 <span class="TPkeyword5">form</span>.isNewDoc <span class="TPoperator">= </span><span class="TPkeyword1">false</span>;
 <span class="TPkeyword5">form</span>.documentUnid  <span class="TPoperator">= </span><span class="TPkeyword5">id</span>;
 
 <span class="TPcomment">//Add it to the tabbed navigator</span>
 tabs.addChild<span class="TPbracket">(</span><span class="TPkeyword5">form</span><span class="TPbracket">)</span>;
<span class="TPbracket">}</span>
</pre>
<p>Because we've told it to import everything in the src/forms/ folder we can then create objects of the type "Content" (or "Company") as if they were built-in components. Thus we have access to the public properties of the objects, such as isNewDoc and documentUnid.</p>
<p>Obviously there's more to it than this, but hopefully you'll get the idea? The concept it quite simple and works quite well. If you need to alter the behaviour of the underlying Form element then you can do and the change will apply to all "forms" built on it.</p>
<h4>What Next?</h4>
<p>I think I've had enough of this Flex App Basics series of articles and I'm sure you probably have. I'm not even sure they've followed enough of a pattern to call them a series anything. They're more like random jottings that don't really piece together too well. Hopefully they'll have given you ideas on different methodologies though.</p>
<p>On Monday I'll package all the Contact Manager code together and upload it here. While it's nowhere near being a finished app it's good enough for you to rip apart and learn from. If I get the time to I'll try to keep adding on top of it.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100205-0345?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100205-0345</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100205-0345</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100205-0345?Open#comments</comments>
			<slash:comments>3</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100205-0345</wfw:commentRss>
		</item>
		<item>
			<title>Flex App Basics 9: Creating an Icon Library | Blog</title>
			<pubDate>Thu, 4 Feb 2010 03:31:19 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>To include an icon in a Flex component you can simply embed it like below:</p><code>&lt;mx:LinkButton label="Button with an Icon" icon="@Embed('../images/anicon.png')" /&gt;</code>  <p>While this works, it can get messy and cumbersome maintaining the set of icon files. Especially if you change your folder structure and all embedded images break. Not only that but if you embed the same icon in more than one place it takes up extra space (or so I believe) as each instance of the image is stored separately in the SWF.</p> <p>A better idea is to have an icon library. This an idea I've adapted <a href="http://www.russback.com/adobe-flex/creating-an-image-asset-library.html">from this one</a>. Once you get used to using a "library" there's no going back.</p> <p>Here's the folder structure for <a href="http://www.codestore.net/apps/contacts.nsf">the Contact Manager app</a>. Notice the folder structure for the net/codestore/flex package, which contains all the reusable custom components I've come up with, such as the <a href="http://www.codestore.net/store.nsf/unid/BLOG-20100115-0307">View</a>, <a href="http://www.codestore.net/store.nsf/unid/BLOG-20090916-1558?OpenDocument">SearchField</a> and <a href="http://www.codestore.net/store.nsf/unid/BLOG-20100125-0327">FileManager</a>. </p> <p>Within this "codestore" package is a resources folder, which contains an icons folder, which, in turn, contains the silk folder with all 700+ <a href="http://www.famfamfam.com/lab/icons/silk/">Silk icons from FamFamFam</a>. </p> <p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/9DB4ECB867619FEC862576C000344E4F/$file/image_2167e6a4-7e26-4ffe-a31c-31361f333cec.png" width="324" height="476"></p> <p>Then there's the IconLibrary.as file, which looks a bit like this:</p><pre class="code2">package net.codestore.flex
<span class="TPbracket">{</span>
    [Bindable]
    public class IconLibrary
    <span class="TPbracket">{               </span>
                        
        [Embed <span class="TPbracket">(</span>source<span class="TPoperator">=</span><span class="TPstring">"resources/icons/silk/disk.png"</span>)]
        public static const SAVE_ICON:Class;
        
        [Embed <span class="TPbracket">(</span>source<span class="TPoperator">=</span><span class="TPstring">"resources/icons/silk/bullet_disk.png"</span>)]
        public static const SAVE_SMALL_ICON:Class;
        
        [Embed <span class="TPbracket">(</span>source<span class="TPoperator">=</span><span class="TPstring">"resources/icons/silk/cross.png"</span>)]
        public static const CROSS_ICON:Class;
        
        [Embed <span class="TPbracket">(</span>source<span class="TPoperator">=</span><span class="TPstring">"resources/icons/silk/exclamation.png"</span>)]
        public static const ERROR_ICON:Class;
        
        [Embed <span class="TPbracket">(</span>source<span class="TPoperator">=</span><span class="TPstring">"resources/icons/silk/error.png"</span>)]
        public static const WARNING_ICON:Class;
        
        [Embed <span class="TPbracket">(</span>source<span class="TPoperator">=</span><span class="TPstring">"resources/icons/silk/information.png"</span>)]
        public static const INFO_ICON:Class;
    <span class="TPbracket">}</span>
<span class="TPbracket">}</span></pre>
<p>What this gives us a quick and easy way to get to just the Silk icons we want. The LinkButton from above would now look like this:</p><code>&lt;mx:LinkButton label="Button with an Icon" icon="{IconLibrary.CROSS_ICON}" /&gt;</code> 
<p>No need to remember if they're there or what they're called as Flex provides us with type-ahead on the IconLibrary class. If the icon you're after isn't in the library you just add a new entry for it in the IconLibrary.as file. It's then available across the whole app.</p>
<h4>Taking it Further</h4>
<p>You're not limited to the Silk icons, of course. Remember the attachment manager component I talked about? Notice how each file has an associated icon:</p>
<p><img src="http://www.codestore.net/store.nsf/rsrc/1FD34C10503DD8A0862576B60033F43D/$file/image_8ea886d3-6d9d-4c3f-a8c4-a5a7b365cafe.png"></p>
<p>To do this I added a set of icons to a "filetypes" folder you can see above -- one for each of the common files types. In the library code I then added a method called getIconForFileName() which looks a bit like this:</p><pre class="code2">public static <span class="TPkeyword2">function </span>getIconForFileType<span class="TPbracket">(</span><span class="TPkeyword5">type</span>:<span class="TPkeyword2">String</span><span class="TPbracket">)</span>:Class<span class="TPbracket">{</span>
 <span class="TPkeyword2">var </span>icon:Class;
 <span class="TPkeyword5">type </span><span class="TPoperator">= </span><span class="TPkeyword5">type</span>.<span class="TPkeyword5">toUpperCase</span><span class="TPbracket">()</span>;
                
 <span class="TPkeyword2">if </span><span class="TPbracket">(</span><span class="TPkeyword5">type</span><span class="TPoperator">==</span><span class="TPstring">"DOC" </span><span class="TPoperator">|| </span><span class="TPkeyword5">type</span><span class="TPoperator">==</span><span class="TPstring">"DOCX"</span><span class="TPbracket">){</span>
  icon <span class="TPoperator">= </span>IconLibrary.FILE_DOC_ICON;     
 <span class="TPbracket">} </span><span class="TPkeyword2">else if </span><span class="TPbracket">(</span><span class="TPkeyword5">type</span><span class="TPoperator">==</span><span class="TPstring">"XLS" </span><span class="TPoperator">|| </span><span class="TPkeyword5">type</span><span class="TPoperator">==</span><span class="TPstring">"XLSX" </span><span class="TPbracket">){</span>
  icon <span class="TPoperator">= </span>IconLibrary.FILE_XLS_ICON;     
 <span class="TPbracket">} </span><span class="TPkeyword2">else </span><span class="TPbracket">{</span>
  icon <span class="TPoperator">= </span>IconLibrary.FILE_DEFAULT_ICON;
 <span class="TPbracket">}</span>
                
 <span class="TPkeyword2">return </span>icon;   
<span class="TPbracket">} </span>

public static <span class="TPkeyword2">function </span>getIconForFileName<span class="TPbracket">(</span>fileName:<span class="TPkeyword2">String</span><span class="TPbracket">)</span>:Class<span class="TPbracket">{</span>
 <span class="TPkeyword2">var </span>tmp:<span class="TPkeyword2">Array </span><span class="TPoperator">= </span>fileName.<span class="TPkeyword5">split</span><span class="TPbracket">(</span><span class="TPstring">"."</span><span class="TPbracket">)</span>;   
 <span class="TPkeyword2">return </span>getIconForFileType<span class="TPbracket">(</span>tmp[tmp.<span class="TPkeyword5">length</span><span class="TPoperator">-</span>1]);
<span class="TPbracket">}</span>
</pre>
<p>The Repeater that displays attachments on the form then has an easy way of getting an icon to show for the tile it represents. </p>
<p>You could take it even further than this if needed. I know I probably will. </p>
<p>Don't leave home without your IconLibrary!</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100204-0331?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100204-0331</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100204-0331</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100204-0331?Open#comments</comments>
			<slash:comments>1</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100204-0331</wfw:commentRss>
		</item>
		<item>
			<title>Flex App Basics 8: Display Column Values As Icons | Blog</title>
			<pubDate>Wed, 3 Feb 2010 03:00:59 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>As Notes/Domino developers we're used to being able to display icons in Views fairly easily. You just tick a box on the column properties and make sure the column value equals a number, which ties to the icon you want to show.</p> <p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/B5AED51425A6EE1D862576BF00318692/$file/image_9aaad446-a7c1-43e8-88a3-81eee8ad7835.png" width="454" height="276"> </p> <p>Not sure why I bored you with that bit. You all knew that already, didn't you.</p> <h4>Flex Alternative</h4> <p>How do we do implement a column icon in Flex though? Using a custom column renderer, that's how.</p> <p>First thing to do is create a new custom Component. I created a file in Flex Builder at /src/net/codestore/flex/ColumnIconRenderer.mxml. The content of the file is below:</p><pre class="code2"><span class="TPkeyword1">&lt;</span>?xml version=<span class="TPstring">"1.0" </span><span class="TPkeyword1">encoding</span>=<span class="TPstring">"utf-8"</span>?<span class="TPkeyword1">&gt;</span>
<span class="TPkeyword1">&lt;</span>mx:Box xmlns:mx=<span class="TPstring">"http://www.adobe.com/2006/mxml" </span>verticalAlign=<span class="TPstring">"middle" </span>horizontalAlign=<span class="TPstring">"center"</span><span class="TPkeyword1">&gt;</span>

        <span class="TPkeyword1">&lt;</span>mx:Script<span class="TPkeyword1">&gt;</span>
        &lt;![CDATA[
                import net.codestore.flex.IconLibrary;
                
                [Bindable]
                private var _columnName:String;
                        
                public function set columnName(colName:String):void{
                	_columnName = colName;
                }
                        
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
                	super.updateDisplayList(unscaledWidth, unscaledHeight);
             
                	var tmp:Class = IconLibrary[data[_columnName].toString().toUpperCase()+'_ICON'];
                 
                	if (tmp is Class){
                         img.visible=true;
                         img.source = tmp;
                	} else { //Icon doesn't exist in library
                         img.visible = false;
                	}
                   
                }
        ]]&gt;
    <span class="TPkeyword1">&lt;</span>/mx:Script<span class="TPkeyword1">&gt;</span>
    
    <span class="TPkeyword1">&lt;</span>mx:Image id=<span class="TPstring">"img" </span>/<span class="TPkeyword1">&gt;</span>
<span class="TPkeyword1">&lt;</span>/mx:Box<span class="TPkeyword1">&gt;</span>
</pre>
<p>The component is nothing more than a Box with an Image in the middle of it. We use the (very useful) method updateDisplayList which (as I understand it) gets called each time Flex renders or refreshes the display. In this method we look for an icon resource that matches the name specified in the column to which the renderer is tied. If the IconLibrary (more on that tomorrow) doesn't contain the icon specified we just hide the image.</p>
<p>Here's an example of the XML I'm sending to the Contact Manager database to use an Icon Column:</p>
<p>&nbsp;<img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/29C8E107B74838F5862576BF003186FF/$file/image_e58bfa70-85bd-42de-81c5-831af622593a.png" width="556" height="250"> </p>
<p>Notice the parts I've highlighted. I've defined a column called "Attachments" to go at the end of the view, which is of type "icon" and is tied to the &lt;file_icon&gt; node of each document. For any document that has an attachment the value will be paper_clip and the result looks like this:</p>
<p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/326AB22EB0FB3A0F862576BF00318761/$file/image_c7c53853-f679-4a34-846d-0b00644fe280.png" width="345" height="231"> </p>
<p>The only other part to this is that you need to apply this new custom column renderer to the column of the grid. To do this, in the ActionScript that loads the XML and creates all the columns there's the following bit of code:</p><pre class="code2"><span class="TPkeyword2">if </span><span class="TPbracket">(</span>column.hasOwnProperty<span class="TPbracket">(</span><span class="TPstring">"@type"</span><span class="TPbracket">) </span><span class="TPoperator">&amp;&amp; </span>column.@<span class="TPkeyword5">type</span><span class="TPoperator">==</span><span class="TPstring">"icon"</span><span class="TPbracket">){</span>
 <span class="TPkeyword2">var </span>iconRenderer:ClassFactory <span class="TPoperator">= </span><span class="TPkeyword2">new </span>ClassFactory<span class="TPbracket">(</span>net.codestore.flex.ColumnIconRenderer<span class="TPbracket">)</span>;
 iconRenderer.properties <span class="TPoperator">= </span><span class="TPbracket">{</span>
  columnName: column.<span class="TPkeyword5">valueOf</span><span class="TPbracket">()</span>
 <span class="TPbracket">}</span>;
 
 col.itemRenderer <span class="TPoperator">= </span>iconRenderer;
 col.<span class="TPkeyword5">width</span><span class="TPoperator">=</span><span class="TPnumber">20</span>;
 col.resizable<span class="TPoperator">=</span><span class="TPkeyword1">false</span>;
<span class="TPbracket">}</span>
</pre>
<p>In this bit of code the column object represents the &lt;column&gt; node I mentioned above, where type="icon". Notice that we're passing column.valueOf() to the columnName property of the renderer. The valueOf() the column node will be "file_icon" in this case and tells the renderer which child node to get its value from for each document.</p>
<p>All we need to do then is set the column's width and make it fixed. Hey, presto. It works.</p>
<p>It goes without saying, you're not limited to one type of icon per column or one icon column per view. You can have as many columns showing as many different icons as you choose -- just like in Notes! The beauty of this componentized, server-based XML approach being that it's all controlled from within your NSF and doesn't involve re-compiling any Flash SWFs.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100203-0300?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100203-0300</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100203-0300</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100203-0300?Open#comments</comments>
			<slash:comments>4</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100203-0300</wfw:commentRss>
		</item>
		<item>
			<title>Flex: Bug In SummaryRow When Using XMLListCollections | Blog</title>
			<pubDate>Tue, 2 Feb 2010 03:01:19 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>Having just spent the best part of a day re-working a near-complete Flex app to use ArrayCollections instead of XMLListCollections as the data providers for an AdvancedDataGrid I have a simple piece of advice -- make your choice between the two wisely and make the choice before you start.</p> <p>There's a bug in Flex which means you can't use SummaryRows with data grids that use an XMLListCollection as the data provider. Well, at least it seems like a bug to me. I've read a few people mention it online, but had no response to <a href="http://forums.adobe.com/thread/565759">a question I posted</a> on the topic or seen anything official on the matter.</p> <p>Here's a demo to show what I mean. Use the buttons to load the <em>same</em> data but with different collection types:</p> <p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
			id="ArrayVSXML" width="520" height="450"
			codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">  			<param name="movie" value="/flex/SummaryRowBug/ArrayVSXML.swf" />  			<param name="quality" value="high" />  			<param name="bgcolor" value="#869ca7" />  			<param name="allowScriptAccess" value="sameDomain" />  			<embed src="/flex/SummaryRowBug/ArrayVSXML.swf" quality="high" bgcolor="#869ca7" width="520" height="450" name="ArrayVSXML" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">  			</embed>  	</object></p> <p>Notice how the donation column only gets summarised for the ArrayCollection and <strong>not</strong> the XMLListCollection. To me this smells like a bug whereby Flex isn't casting the XML strings to a number properly when leaving it as XML, but it does when it converts the XML to Objects.</p> <p>Retro-fitting an ArrayCollection can be a pain. If there's even the slimmest chance you you'll need to use SummaryRows then make sure to use an ArrayCollection from the off.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100202-0301?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100202-0301</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100202-0301</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100202-0301?Open#comments</comments>
			<slash:comments>2</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100202-0301</wfw:commentRss>
		</item>
		<item>
			<title>Mystery Of the Missing Java Agents | Blog</title>
			<pubDate>Fri, 29 Jan 2010 05:27:38 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>Something weird is happening with my Java Agents. Notes keeps randomly dropping it's "handle" on them.</p> <p>If I create a WebQuerySave agent in Java it all works well until out of the blue I'll get an error like this:</p><code>HTTP Web Server: Lotus Notes Exception - Entry not found in index [/path.nsf/0/DOCID?SaveDocument]</code>  <p>If I remove the name of the Java agent from the Form it works fine. It seems to me like Domino is just forgetting the agent exists. Although, obviously, it does still exist. I can see/edit it in Designer.</p> <p>The only solution I've found is to create a new Agent and paste the code from the forgotten agent to the new one and change the WQS event in the Form to the name of the new Agent. Simple renaming the old Agent doesn't work.</p> <p>Needless to say this is very annoying. I'm starting to wonder why I didn't just stick with doing everything in LotusScript.</p> <p>Anybody seen this behaviour before? I'm using Domino Designer 8.5.1 and the server is Domino 6.5.</p> <p>To rub salt in the wound it's now happening with a Scheduled Java Agent which is telling me "Entry not found in index" in its log. Again, I had to create the agent from scratch. </p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100129-0527?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100129-0527</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100129-0527</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100129-0527?Open#comments</comments>
			<slash:comments>16</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100129-0527</wfw:commentRss>
		</item>
		<item>
			<title>Flex App Basics 7: Alert Is To Flex as MessageBox Is To LotusScript | Blog</title>
			<pubDate>Wed, 27 Jan 2010 03:47:28 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>If you look at again at <a href="http://www.codestore.net/apps/contacts.nsf">the Contact Manager app</a> you'll see I added context menus to the View, as below, where you can see an edit and a delete option for each row:</p> <p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/A883BD8214F6F749862576B80035C856/$file/image_4df87dc1-84b5-428a-af25-58d8025281f7.png" width="487" height="282"> </p> <p>The edit option simply dispatches the View's custom "openDocument" event back to the parent application, which is where we handle opening the document.</p> <p>For now the delete option is handled by the View object itself. Although it doesn't work yet I added it in as an example of using the Alert object for more than a simple "Ok" message. As you can see below if you choose the delete option you see an "advanced" Alert.</p> <p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/0A8B2D4F4DB0C253862576B80035C8BA/$file/image_e6638d88-86e5-40bf-a3ac-04a5cef1412f.png" width="479" height="234"> </p> <p></p> <p></p> <h4>How did I do this?</h4> <p>Until yesterday I'd assumed that the flex Alert did nothing more than show a popup prompt with a message and an Ok button. </p> <p>I presumed that, to do anything like asking a Yes/No question, it would involve creating custom components based on the TitleWindow. Doh. Turns out that Flex's Alert is akin to LotusScript's Messagebox. Here's the code for the above delete confirmation prompt:</p><pre class="code2">Alert.yesButton<span class="TPoperator">=</span><span class="TPstring">"Delete"</span>;
Alert.noButton<span class="TPoperator">=</span><span class="TPstring">"Cancel"</span>;
Alert.<span class="TPkeyword6">show</span><span class="TPbracket">(</span>
  <span class="TPstring">"Are you sure you want to delete this document?"</span>, 
  <span class="TPstring">"Delete"</span>, 
  Alert.YES<span class="TPoperator">|</span>Alert.NO, 
  <span class="TPkeyword2">this</span>, 
  <span class="TPkeyword2">function</span><span class="TPbracket">(</span><span class="TPkeyword2">event</span>:CloseEvent<span class="TPbracket">)</span>:<span class="TPkeyword1">void</span><span class="TPbracket">{</span>
    Alert.<span class="TPkeyword6">show</span><span class="TPbracket">(</span><span class="TPstring">"You pressed " </span><span class="TPoperator">+ </span><span class="TPbracket">((</span><span class="TPkeyword2">event</span>.detail<span class="TPoperator">==</span>Alert.YES<span class="TPbracket">)</span>?<span class="TPstring">"delete"</span>:<span class="TPstring">"cancel"</span><span class="TPbracket">))</span>;
  <span class="TPbracket">}</span>,
  IconLibrary.WARNING_ICON
<span class="TPbracket">)</span>;
</pre>
<p>Notice that before we show the Alert we've changed the labels on the yes and no button. So, in fact it's a bit more powerful than Messagebox ever was.</p>
<p>I can't believe I got this far with Flex without realising this. Things just got a lot easier.</p>
<h4>Download?</h4>
<p>The download of all the code will come at some point. Be patient. There's just a bit more I want to squeeze in there first. </p>
<p>If you really want a pre-release version then visit <a href="http://www.amazon.co.uk/exec/obidos/registry/KFNOFA8OFOHB/">my Amazon Wishlist</a> and I'll send a copy over.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100127-0347?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100127-0347</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100127-0347</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100127-0347?Open#comments</comments>
			<slash:comments>3</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100127-0347</wfw:commentRss>
		</item>
		<item>
			<title>Four Generations of Howlett Ladies | Blog</title>
			<pubDate>Tue, 26 Jan 2010 07:37:41 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>It's not very often I get a chance to take a photo of the four generations of Howlett ladies, but my Nana turned 90 years old on Saturday and we had a party to celebrate.</p> <p><img style="border-bottom: 0px; border-left: 0px; margin: 10px 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_8880" border="0" alt="IMG_8880" src="http://www.codestore.net/store.nsf/rsrc/BC044B06C38886FF862576B7004ADC81/$file/IMG_8880.jpg" width="504" height="337"> </p> <p>In age order we have my daughter, my wife, my mother and my grandmother. Their initials just happen to be M, K, M and K. Maybe there's even another Howlett lady inside Karen. Who knows.</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100126-0737?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100126-0737</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100126-0737</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100126-0737?Open#comments</comments>
			<slash:comments>7</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100126-0737</wfw:commentRss>
		</item>
		<item>
			<title>Flex App Basics 6: Multiple File Uploads | Blog</title>
			<pubDate>Mon, 25 Jan 2010 03:27:29 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>On Friday I added a <a href="http://www.codestore.net/store.nsf/unid/BLOG-20100122-1015">"file management" area</a> to the contact form in <a href="http://www.codestore.net/apps/contacts.nsf">the app I'm working</a>. Not long after, as I expected, a couple of you asked for the "killer feature" of being able to upload more than one file at a time.</p> <p>Ask and thou shalt receive!</p> <p><img style="border-bottom: 0px; border-left: 0px; margin: 10px 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/1FD34C10503DD8A0862576B60033F43D/$file/image_8ea886d3-6d9d-4c3f-a8c4-a5a7b365cafe.png" width="504" height="309"> </p> <p>The vertical lists of files on the left is the "queue".&nbsp; Files shown there have been selected and are waiting to be uploaded. </p> <p>Notice that, if you press the Select Files button, the file dialog that appears allow you to select more than one file at a time - unlike with the counterpart HTML file upload control.</p> <p>Pressing the Upload button sends them, one-by-one, to the backend document. As each file is uploaded it gets removed from the queue and added to the list on the right.</p> <p>Notice also, that the tiles for existing attachments on the right now include a "Save As" link. Whereas clicking the icon for the file lets the browser decide what to do, the Save As button lets you simply save it to your disk.</p> <p>It needs a little more refinement, but I think it's ready for you guys to test it. </p> <h4>Replacement For ActiveX?</h4> <p>On Friday Curt Carlson said:</p> <blockquote> <p>Now if you could choose to upload multiple files in one shot, that would be something Domino has refused to do without active x or some other non-native functionality.</p></blockquote> <p>This got me thinking. While this FileManager Flex component is a part of <a href="http://www.codestore.net/apps/contacts.nsf">its containing Flex app</a>, there's no reason it can't be used standalone in a normal HTML page.</p> <p>Rather than needing to install/sign/embed a 3rd party ActiveX component and restrict your users to IE you could just add this component as a Flash SWF file and let it interact with your backend Domino document in the same way you can see it doing in the Flex demo.</p> <p>If you're interested I'll create a SWF and demo?</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100125-0327?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100125-0327</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100125-0327</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100125-0327?Open#comments</comments>
			<slash:comments>24</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100125-0327</wfw:commentRss>
		</item>
		<item>
			<title>Flex App Basics 5: Managing Document Attachments | Blog</title>
			<pubDate>Fri, 22 Jan 2010 10:15:51 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>The eagle-eyed among you noticed there was no way of adding/removing attachments in <a href="http://www.codestore.net/apps/contacts.nsf">the Contact Manager demo</a>. That's no longer the case. I present to you my brand spanking new "Flex Attachment Manager" component for Domino:</p> <p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.codestore.net/store.nsf/rsrc/3A2D55E675A2F451862576B300595771/$file/image_54be92e1-8639-4959-8809-4dfef415fe24.png" width="504" height="338"></p> <p>Think that looks good? Wait till you see it in action! Forgive me for saying so, but I think it's quite slick. </p> <p>Open <a href="http://www.codestore.net/apps/contacts.nsf">the database</a> and then open an existing document from the view (it could work on a new document, in theory, but doesn't yet). Scroll a bit down the document and you should see the Attachments area. Browse your PC and upload files (size limit of 100kb). </p> <p>Notice that when you click upload (after a brief pause) the list of file icons should update to include your new one. this isn't trickery - it's actually POSTed the file to the server and then received an updated list of attachments in return. If you see an icon for it on the document then it exists on the backend document. Click to open it if you don't believe me.</p> <p>In a similar fashion, when you click remove it will update the remove the file from the backend document and receives an updated list of files, which re-renders on the right-hand-side. Not sure I like how final the remove button is. Press it and the file's gone! In the real world I think an "Are you sure?" prompt might be in order.</p> <p>Note that with both uploading and removing you don't actually need to save the document in order to commit the changes.</p> <p>With it being a component, adding all this functionality to your form is as easy as this: </p><pre class="code2"><span class="TPkeyword1">&lt;</span>mx:FormHeading label=<span class="TPstring">"Attachments"</span>/<span class="TPkeyword1">&gt;</span>
<span class="TPkeyword1">&lt;</span>mx:FormItem width=<span class="TPstring">"100%"</span><span class="TPkeyword1">&gt;</span>
 <span class="TPkeyword1">&lt;</span>form:FileManager docPath=<span class="TPstring">"{parentApplication.basePath + '0/'+this.doc.@id}"
   </span>files=<span class="TPstring">"{XML(this.doc.files)}" </span>width=<span class="TPstring">"100%" </span>fileSizeLimit=<span class="TPstring">"100000"</span><span class="TPkeyword1">&gt;</span>
  <span class="TPkeyword1">&lt;</span>form:fileFilters<span class="TPkeyword1">&gt;</span>
    <span class="TPkeyword1">&lt;</span>mx:Object extension=<span class="TPstring">"*.pdf;*.txt;*.doc*;*.xls*" </span>description=<span class="TPstring">"Documents"</span>/<span class="TPkeyword1">&gt;</span>
    <span class="TPkeyword1">&lt;</span>mx:Object extension=<span class="TPstring">"*.jpg;*.gif;*.png" </span>description=<span class="TPstring">"Images"</span>/<span class="TPkeyword1">&gt;</span>
    <span class="TPkeyword1">&lt;</span>mx:Object extension=<span class="TPstring">"*.zip;*.jar" </span>description=<span class="TPstring">"Archives"</span>/<span class="TPkeyword1">&gt;</span>
  <span class="TPkeyword1">&lt;</span>/form:fileFilters<span class="TPkeyword1">&gt;</span>
 <span class="TPkeyword1">&lt;</span>/form:FileManager<span class="TPkeyword1">&gt;</span>
<span class="TPkeyword1">&lt;</span>/mx:FormItem<span class="TPkeyword1">&gt;</span></pre>
<p>Here we're adding a new object derived from the FileManager component and passing in to it an array of file types it will allow the user to upload, as well as telling it what files exist now and what the maximum allowed file size is. All the code itself lives inside the component, making it easy to add the same functionality to more than one form.</p>
<p>The code for uploading the files is something <a href="http://www.codestore.net/store.nsf/unid/BLOG-20090819?OpenDocument">I've talked about before</a> and relies on the DominoDisableFileUploadChecks=1 Notes.ini parameter.&nbsp; The code for removing files uses the %%Detach trick, which <a href="http://www.codestore.net/store.nsf/unid/DOMM-4T8HRL?OpenDocument">I first wrote about</a> exactly 9 years ago to the day (now there's a spooky coincidence!).</p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100122-1015?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100122-1015</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100122-1015</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100122-1015?Open#comments</comments>
			<slash:comments>7</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100122-1015</wfw:commentRss>
		</item>
		<item>
			<title>Data Input Personnel Wanted | Blog</title>
			<pubDate>Thu, 21 Jan 2010 10:33:37 -0500</pubDate>
			<author>Jake Howlett</author>
			<description><![CDATA[ <p>Anybody with a bit of time to kill could help out and add some new documents to the <a href="http://www.codestore.net/apps/contacts.nsf">Contact Manager demo</a>. </p> <p>Bug reports welcome. As are suggestions for enhancements. It's got some way to got but I think it's stable enough for use. </p>
<p><a href="http://www.codestore.net/store.nsf/unid/BLOG-20100121-1033?open#post"><img border="0" src="http://www.codestore.net/store.nsf/images/rss_reply.gif" alt="Click here to post a response" /></a></p> 		]]></description>
			<link>http://www.codestore.net/store.nsf/unid/BLOG-20100121-1033</link>
			<guid isPermaLink="true">http://www.codestore.net/store.nsf/unid/BLOG-20100121-1033</guid>
			<comments>http://www.codestore.net/store.nsf/unid/BLOG-20100121-1033?Open#comments</comments>
			<slash:comments>24</slash:comments>
			<wfw:commentRss>http://www.codestore.net/store.nsf/blog.xml?Open=20100121-1033</wfw:commentRss>
		</item>


	</channel>
</rss> 
