<?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>odoenet</title>
	<atom:link href="http://odoe.net/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://odoe.net/blog</link>
	<description>where a geographer learns to program</description>
	<lastBuildDate>Fri, 03 Sep 2010 17:21:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Map Legend and Layer Control for ESRI Flex API 2.0</title>
		<link>http://odoe.net/blog/?p=102</link>
		<comments>http://odoe.net/blog/?p=102#comments</comments>
		<pubDate>Fri, 03 Sep 2010 16:55:40 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[arcgis]]></category>
		<category><![CDATA[esri]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[maps]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=102</guid>
		<description><![CDATA[As GIS professionals when we make maps, one of the most critical components to that map has always been the legend. I have head the statement before that If your map needs a legend, there&#8217;s something wrong with your cartography. Yeah right, maybe if you&#8217;re making a street map, but when you are building analysis [...]]]></description>
			<content:encoded><![CDATA[<p>As GIS professionals when we make maps, one of the most critical components to that map has always been the legend. I have head the statement before that <em>If your map needs a legend, there&#8217;s something wrong with your cartography</em>. Yeah right, maybe if you&#8217;re making a street map, but when you are building analysis maps with varying symbology that could represent information contained in a thousand page report, making sure you italicize the labels of water features isn&#8217;t going to cut it.<br />
When we try to represent our mapping information in a web application we can make every effort to simplify symbology, make our cartography as standard and clear as possible to users, but it is inevitable that someone will ask, <em>hey, what&#8217;s that dashed-line for?</em> When ESRI released the Web ADF and we all built those cool, yet clunky web apps that had the map symbology built into the table of contents, we got spoiled. Web ADF is dead, and now you probably moved on to the ESRI Javascript API or the ESRI Flex API. But when you started using these API&#8217;s you realized that one crucial component was missing, legend information. There were some tricky ways to get around this, even a REST service that pulled the legend information from the old school Web ADF SOAP service. Some just said screw it and resorted to taking screenshots of their ArcMap legend and working that into the application (we&#8217;ve all done it, no shame in fake it until you make it).</p>
<p>Recently, my twitter buddy <a href="http://twitter.com/ruprictGeek" target="_blank">ruprictGeek</a> developed a <a href="http://bit.ly/cjE6v0" target="_blank">Legend Resource Application using Sinatra</a> that would generate an image of Legend for a map service using Ruby. This is a pretty awesome tool, and something that I think could prove useful for things like simplified metadata pages of available map services fr organizations, or bringing a quick legend into a web application. It also taught me a little Ruby and how if you are going to do some Ruby dev, you&#8217;re better off not using Windows for it, just my opinion. But I digress, it got me started down a path to build something a little more robust for my Flex Applications.</p>
<p>I had put this implementation on the back burner when I realized how involved creating the symbology in the application would be. Then lo and behold a few weeks back, <a href="http://forums.arcgis.com/members/1920-rscheitlin" target="_blank">Mr. Robert Scheitlin</a> released a <a href="http://www.arcgis.com/home/item.html?id=f60406b9f52340d59eb557bf64136af6" target="_blank">Dynamic Legend Widget for FlexViewer 2.0</a>. Robert has been a big contributor on the ESRI Flex forums and is a wizard of the ESRI Flex API and ESRI FlexViewer. Now, I don&#8217;t use the FlexViewer for various reasons, but he did all of the leg work in his widget that was needed to actually translate the Map Service symbology into something that could be used in Flex. I already had a component that would pull Layers from a Map and allowed you to turn services on and off, as well as individual sub layers. I was pretty happy with it. But the one question I always get asked by my users is, <em>Where&#8217;s the legend? We can&#8217;t release without a legend</em>. As a side note, most developers might have a project with one or two core stakeholders that steer the project, my main project has about a dozen and if I have a dozen people asking for a legend, I listen.</p>
<p>So what I did was incorporate the work done by Mr. Scheitlin into my current Layer Control tool and created a <a href="http://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/components/LegendManager.as" target="_blank">LegendManager</a> component that will display all symbology and allow you to turn layers on and off. I&#8217;m pretty happy with it. This component is part of my <a href="http://github.com/odoe/FlexMapTools/tree/master" target="_blank">FlexMapTools library</a> on github. I&#8217;ve included skins and itemRenderers in FlexMapTools, but feel free to modify these to meet your needs. Skin them up and make them as pretty as you&#8217;d like. You&#8217;ll notice I have not built a skin for the button to expand sub layer details.</p>
<p>An example of the tool in action can be found <a href="http://odoe.net/thelab/flex/maplegend/Index.html" target="_blank">here</a>.</p>
<p>If you have some trouble using the component if you set up your visible layers using a config.xml file, please read the notes in <a href="http://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/components/LayerInfoDetails.as" target="_blank">LayerInfoDetails</a>. You may need to search your visible layers using a string and not an int. It was an odd issue I ran into porting this tool to FlexMapTools.</p>
<p>As always, I am always looking for comments/critiques. I&#8217;m more intermediate, so I&#8217;m always looking to learn more and see how what Ive done stands up to the pros. Thanks again to Robert Scheitlin for tackling how to draw the legend symbology in Flex and thanks to Glenn Goodrich (ruprictGeek) for inspiring me to get this component off the ground.</p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=102</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FlexMapTools and git issues</title>
		<link>http://odoe.net/blog/?p=91</link>
		<comments>http://odoe.net/blog/?p=91#comments</comments>
		<pubDate>Tue, 10 Aug 2010 03:59:58 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[esri]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[actioscript]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=91</guid>
		<description><![CDATA[So I had an oops moment when apparently I navigated to my local git directory using all lowercase letters and pushed my commits this evening. Although the folder structure in my local repo and the folder structure when I pulled my repo from github were identical, the github page had a FlexMapTools and a flexmaptools [...]]]></description>
			<content:encoded><![CDATA[<p>So I had an oops moment when apparently I navigated to my local git directory using all lowercase letters and pushed my commits this evening. Although the folder structure in my local repo and the folder structure when I pulled my repo from github were identical, the github page had a FlexMapTools and a flexmaptools folder, the lowercase folder having my newest commits. Not wanting to dig through my copy of <a href="http://pragprog.com/titles/tsgit/pragmatic-version-control-using-git" target="_blank">Pragmatic Version Control using Git</a>, I decided to just nuke the reop and start over. Since I was doing that, I decided to go ahead and change the name to something a bit more fitting.</p>
<p>Edit: Apparently there is already a <a href="http://maptoolkit.net/" target="_blank">MapToolkit</a> product that I didn&#8217;t see in my previous searches. I&#8217;ll change the repo back to FlexMapTools tonight. My apologies to the MapToolkit folks.</p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=91</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Review: TDD Screencasts</title>
		<link>http://odoe.net/blog/?p=87</link>
		<comments>http://odoe.net/blog/?p=87#comments</comments>
		<pubDate>Sat, 24 Jul 2010 22:04:53 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[Reviews]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=87</guid>
		<description><![CDATA[I was going to title this post TDD Porn, but it seemed inappropriate, still very fitting though. Test-Driven Development is exactly what it says it is. You develop your project with the tests driving you in the desired direction. There’s tons of material on TDD out there, so I won’t cover too many details. The [...]]]></description>
			<content:encoded><![CDATA[<p>I was going to title this post TDD Porn, but it seemed inappropriate, still very fitting though.</p>
<p>Test-Driven Development is exactly what it says it is. You develop your project with the tests driving you in the desired direction. There’s<a href="http://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530" target="_blank"> tons</a> of <a href="http://www.amazon.com/Growing-Object-Oriented-Software-Guided-Tests/dp/0321503627" target="_blank">material</a> on TDD out <a href="http://www.agiledata.org/essays/tdd.html" target="_blank">there</a>, so I won’t cover too many details.</p>
<p>The <a href="http://www.pragprog.com/screencasts/v-kbtdd/test-driven-development" target="_blank">screencasts offered by The Pragmatic Bookshelf </a>are done by <a href="http://www.threeriversinstitute.org/" target="_blank">Mr. Kent Beck</a> himself. Go read about him, he knows a thing or two about this kind of stuff.</p>
<p>A great message I got from the screencasts is that your tests should tell a story. You compose that narrative in steps, so as to not trip yourself up. Many times you are probably required to develop against a backend service or directly with a database. So that&#8217;s how the story starts. Hello Mr. Database, are you there? May I put something in you?</p>
<p>In this case, Mr. Beck is using <a href="http://1978th.net/tokyotyrant/" target="_blank">Tokyo-Tyrant</a> as the database for this example. By the way, my OCD kicked in 5 minutes into the first screencast and I fired up my Ubuntu server, and spent a good 30-45 minutes toying with installing Tokyo-Tyrant. As there is no debian package that I could find and if you are so inclined, follow <a href="http://gissolved.blogspot.com/2009/07/installating-tokyo-cabinet-and-ruby-on.html" target="_blank">these instructions</a> which are good for TokyoCabinet and Tokyo-Tyrant. Or you could not worry about it and just watch the videos like a sensible person might.</p>
<p>Back to our regularly schedule ramblings. I have read a few of the TDD books out there and I try to be a good TDD&#8217;er in my Flex Projects, but I happen to be the type of person that does well with visual aids. I can do all the reading in the world, but something about reinforcing that reading by actually watching someone do it just makes it click. This is probably why pair-programming is such an effective tool (I should try it sometime if I ever meet another Flex developer in person and can trick… I mean convince them to show me how a pro does it). It also helps that although the tutorial is done in Java, the syntax is similar enough to Actionscript that I was pretty comfortable following along. If at first you’re wondering why in the video when tests are run, the video kind of fades, they are trying to highlight the <a href="http://www.junit.org/" target="_blank">JUnit</a> results in the lower-left hand corner. I didn’t figure this out until the second screencast, but chances are you’re not as slow as I am.</p>
<p><strong>Episode 1: Starter Tests</strong> , is a good intro to the adage of TTD, <em>Red, Green, Refactor</em>, which you get to see in action in the screencasts. You write out a test, it fails. You write just enough code to get the test to pass, then you refactor to remove that nasty code smell. For me, the snag is usually in writing a meaning full test. We get to see first-hand how a simple test of connecting and writing to a database clarifies the intent and drives the narrative of the story being told. I know I have some tests that just check to make sure a function accepted an argument, but I don’t test what happens when it does not. I think everyone can take something away from the first screencast alone, and it gets better with each installment.</p>
<p><strong>Episode 2: Isolated Tests</strong>, this is where the motto of the game is <em>leave the world in the same state as you found it</em>. If you’re going to test against a database, it should look exactly the same after your test as it did before you test. After all, you’re going to ideally run your tests for every refactor, so you’d hate to get a nasty phone call from your DB administrator wondering why you populated the database with hundreds of entries of a testDEEZNUTZ value (never happened to me and you can&#8217;t prove it). In this video, Kent Beck gives a good demonstration of building on your current tests, refactoring out the naughty bits and you get to see a Java Class take shape, fully supported by those tests.</p>
<p><strong>Episode 3: Big Feature</strong> is all about building some complex functionality by using TDD to break it down into fun size bites. You start to get some real meat in this screencast and see how Kent Beck handles building on top of tests and the logic behind his decisions.</p>
<p><strong>Episode 4: Finishing</strong> is where we clean up the code and make it presentable. This is also where Kent Beck provides a review of previous screencasts. In the first half of the video you end up with a functional map for Tyrant. The last half of the video is a summary of the series and you get some great insight and tips from a pro point of view on design decisions. Pros always make it seem so easy.</p>
<p>Even if you’re familiar with TDD and have been using it in your projects, I think you’d probably still be able to find some gems of information in these screencasts. You might be able to pick up some tips from Kent Becks style (the guy’s got style) and I would even say there are some great tips in these videos on refactoring your code and cleaning it up.</p>
<p>If you’re new to TDD, you have to start somewhere and I think these videos would be a great starting point before diving into the written material that&#8217;s available out there. I&#8217;m a kid of the 80&#8242;s, I was raised on visual aids.</p>
<p>One of the best things about the videos is that you get the sense that it’s not just a scripted screencast. I’m sure Mr. Beck had an outline, but as he’s writing the tests and implementations you can tell he’s working through problems in his head and is probably crossing his fingers for a passing test as much as you might. This makes the videos very personable and you almost feel like you’re sitting in the chair next to him just trying to soak in the knowledge via proximity osmosis.</p>
<p>The screencast are available for a reasonable price as a <a href="http://www.pragprog.com/screencasts/v-kbtdd/test-driven-development" target="_blank">package deal</a> or separately, but why bother buying just one, <em>gotta catch them all</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=87</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>F&#8217;ing with FMap in FlexMapTools</title>
		<link>http://odoe.net/blog/?p=67</link>
		<comments>http://odoe.net/blog/?p=67#comments</comments>
		<pubDate>Sat, 10 Jul 2010 03:05:58 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[esri]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[actioscript]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=67</guid>
		<description><![CDATA[I&#8217;m going to try to use the next few blog posts to go over how I use the tools I&#8217;ve provided in the FlexMapTools toolbox I put up on github. The first is the FMap component, which extends the ESRI Map component. This component started as a way to control the position of the ESRI [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to try to use the next few blog posts to go over how I use the tools I&#8217;ve provided in the <a href="http://github.com/odoe/FlexMapTools">FlexMapTools</a> toolbox I put up on github.</p>
<p>The first is the <a href="http://github.com/odoe/FlexMapTools/blob/master/src/net/odoe/FlexMapTools/components/FMap.as">FMap</a> component, which extends the <a href="http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/Map.html">ESRI Map</a> component. This component started as a way to control the position of the ESRI logo in the application. In previous releases the <a href="http://help.arcgis.com/en/webapi/flex/index.html">ESRI Flex API</a> and even the beta version of 2.0, the logo fit just perfectly in the layout of one of the main projects I am working on, but in the final 2.0 release it was moved slightly to fit in with the <a href="http://help.arcgis.com/en/webapps/flexviewer/index.html">FlexViewer</a> layout. Now, it&#8217;s easy enough to set the logo visibility to false, ESRI provides this out of the box, but I kind of like the look of the new logo. Being a little annoyed that this little bit in the API was catered to the FlexViewer rather than the other way around, I decided to just extend the Map component and move it myself.</p>
<div class="wp-caption alignnone" style="width: 276px"><img title="logodefault" src="http://www.odoe.net/images/blog/normal_map.jpg" alt="" width="266" height="121" /><p class="wp-caption-text">Default logo position blocked by a toolbar in my application.</p></div>
<div class="wp-caption alignnone" style="width: 193px"><img title="logomoved" src="http://www.odoe.net/images/blog/fmap_inaction.jpg" alt="" width="183" height="83" /><p class="wp-caption-text">Logo position set to fit application layout.</p></div>
<p>ESRI was kind enough to give us access to a staticLayer Group component in the Map that is used to hold the navigation tool, scalebar and the logo. You could pretty much add what you want in here. So all FMap does is add a Number property called logoToBottom that will be used to position the logo.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>logoToBottom <span style="color: #000066; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=uint%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:uint.html"><span style="color: #004993;">uint</span></a> = <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>staticLayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">numChildren</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span>i<span style="color: #000066; font-weight: bold;">;</span> i <span style="color: #000066; font-weight: bold;">&lt;</span> <span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">;</span> i<span style="color: #000066; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// logo should be only image object in staticlayer</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// but this could change in future releases</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>staticLayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getChildAt</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">is</span> Image<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// set the bottom property of the image</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>staticLayer<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">getChildAt</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> Image<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bottom</span> = logoToBottom<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>That&#8217;s pretty simple.</p>
<p>The next thing I decided to do that is pretty common in a lot of applications was to display coordinates. The FMap component assumes you are working with the WebMercator coordinate system that is all the rage these days and also that you want to display normal WGS1984 coordinates, because you do not want a user filling out some permit paperwork using WebMercator coordinates, so be aware of this. If you would like to convert to a different coordinate system, you&#8217;re going to have to handle the math in your application. Sending them to a Geometry Service to process on a MouseMove event will bring your application to a crawl.</p>
<p>I add a showLatLong Boolean property the Map and check that in an override of createChildren.</p>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>showLatLong<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; labelArea = <span style="color: #0033ff; font-weight: bold;">new</span> SkinnableContainer<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; latLong = <span style="color: #0033ff; font-weight: bold;">new</span> Label<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// check for css style name, can be managed in main application</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// with normal font/color styles or a skin</span><br />
&nbsp; &nbsp; labelArea<span style="color: #000066; font-weight: bold;">.</span>styleName = <span style="color: #990000;">&quot;latLongText&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; labelArea<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">bottom</span> = <span style="color: #000000; font-weight:bold;">2</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; labelArea<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">left</span> = <span style="color: #000000; font-weight:bold;">5</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; latLong<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Coordinates&quot;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// add label to group</span><br />
&nbsp; &nbsp; labelArea<span style="color: #000066; font-weight: bold;">.</span>addElement<span style="color: #000000;">&#40;</span>latLong<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// add group to the staticLayer</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>staticLayer<span style="color: #000066; font-weight: bold;">.</span>addElement<span style="color: #000000;">&#40;</span>labelArea<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// update the text with the MouseMove event on the map</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">MOUSE_MOVE</span><span style="color: #000066; font-weight: bold;">,</span> onMouseMove_handler<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<div class="codecolorer-container actionscript3 default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="actionscript3 codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0033ff; font-weight: bold;">protected</span> <span style="color: #339966; font-weight: bold;">function</span> onMouseMove_handler<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">:</span><a href="http://www.google.com/search?q=mouseevent%20inurl:http://livedocs.adobe.com/flex/201/langref/%20inurl:mouseevent.html"><span style="color: #004993;">MouseEvent</span></a><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>spatialReference <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>spatialReference<span style="color: #000066; font-weight: bold;">.</span>wkid == <span style="color: #000000; font-weight:bold;">102113</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; const <span style="color: #004993;">mapPoint</span><span style="color: #000066; font-weight: bold;">:</span>MapPoint = <span style="color: #0033ff; font-weight: bold;">this</span><span style="color: #000066; font-weight: bold;">.</span>toMapFromStage<span style="color: #000000;">&#40;</span>e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageX</span><span style="color: #000066; font-weight: bold;">,</span> e<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">stageY</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; const coord<span style="color: #000066; font-weight: bold;">:</span>MapPoint = WebMercatorUtil<span style="color: #000066; font-weight: bold;">.</span>webMercatorToGeographic<span style="color: #000000;">&#40;</span><span style="color: #004993;">mapPoint</span><span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> MapPoint<span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; latLong<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">text</span> = <span style="color: #990000;">&quot;Lat: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> coord<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">y</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toFixed</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">6</span><span style="color: #000000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">+</span> <span style="color: #990000;">&quot; / Long: &quot;</span> <span style="color: #000066; font-weight: bold;">+</span> coord<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">x</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">toFixed</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">6</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span></div></div>
<p>Notice that the group has a styleName defaulted to &#8220;latLongText&#8221;. This allows you to set the style in your stylesheet. If you have not looked into really using css with your Flex 4 applications, you owe it to yourself to look some stuff up. I&#8217;ve gotten quite a bit of use out of it recently. This allows me to do something like this in my css.</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.latLongText</span> <span style="color: #00AA00;">&#123;</span><br />
skinClass<span style="color: #00AA00;">:</span> ClassReference<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">&quot;spark.skins.spark.SkinnableContainerSkin&quot;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
backgroundColor<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;0xF0F8FF&quot;</span><span style="color: #00AA00;">;</span><br />
backgroundAlpha<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0.8</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span>/</div></div>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.latLongText</span> s|Label <span style="color: #00AA00;">&#123;</span><br />
fontSize<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">10</span><span style="color: #00AA00;">;</span><br />
fontWeight<span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><br />
paddingBottom<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span><br />
paddingTop<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span><br />
paddingLeft<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span><br />
paddingRight<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">2</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></div>
<div class="wp-caption alignnone" style="width: 236px"><img title="coordinates" src="http://www.odoe.net/images/blog/coordinates.jpg" alt="" width="226" height="83" /><p class="wp-caption-text">Coordinates positioned under scalebar.</p></div>
<p>As you can see, css can be a valuable tool in drilling down into the components inside components to manipulate their styles. Remember all this sits in the actual FMap component and can be used from project to project. And because it extends the default Map component, it can be passed into any component/object/function that asks for the default Map component. This should include any widgets you might use in FlexViewer. I also add an eventListener to listen for the REMOVED_FROM_STAGE event, that will handle some cleanup by setting the stuff I added to null. It may be overkill, but I&#8217;ve gotten used to doing this when dealing with custom components.</p>
<p>If there are certain things I did in FMap that don&#8217;t fit your needs, you could always modify it to fit your project workflow. Maybe you want the logo somewhere else, add settings to modify the top/left/right properties of the logo and go nuts.</p>
<p>I&#8217;ll cover some of the other tools in the FlexMapTools toolbox in future postings and if you have any questions, suggestions, critiques, please feel free to share.</p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=67</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlexMapTools for ESRI Flex API</title>
		<link>http://odoe.net/blog/?p=63</link>
		<comments>http://odoe.net/blog/?p=63#comments</comments>
		<pubDate>Thu, 08 Jul 2010 03:54:08 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[esri]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[actioscript]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=63</guid>
		<description><![CDATA[For a couple of years now, I have been working with the ESRI Flex API to build Flex Mapping applications at work. Over that time, I like to think I have learned quite about programming and Flex/Flash in general. I would consider myself an intermediate and I continue to learn more everyday (more like shoehorn [...]]]></description>
			<content:encoded><![CDATA[<p>For a couple of years now, I have been working with the <a href="http://help.arcgis.com/en/webapi/flex/index.html">ESRI Flex API</a> to build Flex Mapping applications at work. Over that time, I like to think I have learned quite about programming and Flex/Flash in general. I would consider myself an intermediate and I continue to learn more everyday (more like shoehorn it in my brain). Developer is not my title, but I do it anyway. I think it was in <a href="http://www.amazon.com/Passionate-Programmer-Remarkable-Development-Pragmatic/dp/1934356344%3FSubscriptionId%3DAKIAJNGGIQXXQR6D2LMA%26tag%3Damazonshowcase-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1934356344">The Passionate Programmer</a> or <a href="http://www.amazon.com/Pragmatic-Thinking-Learning-Refactor-Programmers/dp/1934356050/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1278560654&amp;sr=1-1">Pragmatic Thinking and Learning</a> where I read that one of the tools to learn to program was to share your code and see what others have to say.</p>
<p>So aside from posting little snippets here and there, I decided to put portions of my library file of common tools I use to develop ESRI Flex Mapping applications on github as the <a href="http://github.com/odoe/FlexMapTools">FlexMapTools</a> library.</p>
<p>I&#8217;ll continue to build on this library and hopefully improve my own skills as well as maybe assist some other developers with their projects. There are lots of other items I use not in the library yet, mostly because I think it still needs some cleaning up. I&#8217;m also hoping for some critique. I&#8217;m pretty much flying solo in my learning path when it comes to development, so I don&#8217;t really have a mentor. I just attempt to absorb knowledge via internet osmosis and following smart people on twitter.</p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=63</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom GeocodeProcessor with Swiz</title>
		<link>http://odoe.net/blog/?p=57</link>
		<comments>http://odoe.net/blog/?p=57#comments</comments>
		<pubDate>Wed, 31 Mar 2010 20:01:37 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[esri]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[swiz]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=57</guid>
		<description><![CDATA[One of the interesting features of Swiz 1.0 (still pre-release) is the ability to create custom metadata processors. To get more familiar with the idea, check this docs page. Note that some items from the docs has changed, such as you no longer extend MetadataProcessor, but extend BaseMetadataProcessor. There is a Yahoo Finance Processor, a [...]]]></description>
			<content:encoded><![CDATA[<p>One of the interesting features of Swiz 1.0 (still pre-release) is the ability to create custom metadata processors. To get more familiar with the idea, check this <a href="http://swizframework.org/2009/12/swiz-1-0-reflection-api-and-custom-metadata-processors/" target="_blank">docs page</a>. Note that some items from the docs has changed, such as you no longer extend MetadataProcessor, but extend BaseMetadataProcessor.</p>
<p>There is a <a href="http://soenkerohde.com/2010/03/swiz-yahoo-finance-metadata-processor/" target="_blank">Yahoo Finance Processor</a>, a <a href="http://www.ryancampbell.com/2010/03/26/introducing-the-swiz-urlmapping-metadata-processor/" target="_blank">URLMapping Processor</a> and even a <a href="http://code.google.com/p/foomonger-swizframework/" target="_blank">MediateSignalProcessor</a>. It all looked a bit in depth to me, I&#8217;m still what I would call an intermediate in my dev skills at this point, but I decided to take a crack at it.</p>
<p>Since most of what I do is based on the ESRI Flex API, I decided to try making a GeocodeProcessor. The idea is that you can set up a Processor that would act as your delegate to a geocoding service. This way, you could just move it around different projects using swiz and simplify the task. I pretty much just used the geocode example from the <a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html" target="_blank">samples pages</a>.</p>
<p>You can view an <a href="http://odoe.net/thelab/flex/geocodeprocessor/GeocodeProcessor.html" target="_blank">example here</a> and I also put it on github <a href="http://github.com/odoe/GeocodeProcessor" target="_blank">here</a>. By the way, my first github attempt, and I was quite lost for a bit. I&#8217;ll need to learn how to use it for future projects. As for the application, when you search for an address, click the Center Map button up top. This is a hurdle I&#8217;ll explain shortly.</p>
<p>First off, thank you to those who already created some custom processor examples. I would have been scratching my head for a while trying to find what works and what doesn&#8217;t. First, part of the need to do something like a Geocode Processor requires that you be able to send a new address request to get updated information. I thought of using the idea of copying objects from the Mediate tag that was used in the URLMapping processor, but I couldn&#8217;t figure out how to do that AND send an updated object back to the application.</p>
<p>I went a different route, and one that is probably not recommended and that was to make a public getter/setter in the GeocodeProcessor to hold the Address object that could be updated from my application. In my case, I added the object to my Swiz via binding as can be seen <a href="http://github.com/odoe/GeocodeProcessor/blob/master/src/net/odoe/geocode/views/MainView.mxml" target="_blank">here</a>. Then my processor would listen for changes on the object and run a new geocoding task as can be seen <a href="http://github.com/odoe/GeocodeProcessor/blob/master/src/net/odoe/geocode/processors/GeocodeProcessor.as" target="_blank">here</a>.</p>
<p>As I mentioned before, I had an issue that required I add a Center to Map button. For the life of me, I could not figure out how to let the map know that an address had been added to the map. I&#8217;m sure this is just a matter of finding the proper events to listen to or maybe setting my Swiz initialization, but I couldn&#8217;t figure it out. I thought I should at least mention it.</p>
<p>I was actually a little surprised it worked, but also pretty happy with how simple the concept of using a custom processor is once you go through the process of writing one. For geogeek ESRI Flex devs, I can think of a couple of uses such as maybe a processor for creating a GraphicsLayer set that is commonly used in your organization or possible some other tasks. Like I said earlier, I&#8217;m still not completely happy with having a public variable on the processor that needs to be updated manually, but this was mostly just a proof of concept for me and a learning experience.</p>
<p>So if you&#8217;re interested in the idea of custom processors, I say give it a shot. Go grab your source for Swiz <a href="http://github.com/swiz/" target="_blank">here</a>. Now that I&#8217;ve done it once, I think I may like to try doing some more.</p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=57</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AS3-Signals in Swiz, keepin&#8217; it simple</title>
		<link>http://odoe.net/blog/?p=52</link>
		<comments>http://odoe.net/blog/?p=52#comments</comments>
		<pubDate>Fri, 19 Feb 2010 19:44:44 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[swiz]]></category>
		<category><![CDATA[actioscript]]></category>
		<category><![CDATA[as3-signals]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=52</guid>
		<description><![CDATA[So, previously I had talked about using Swiz and AS3-Signals (Swignalz!). My example was crude and honestly, it was not good. Ben Clinkinbeard did a much better job of showing how easy it was to drop some AS3-Signals around with Swiz. This past week, I have been tinkering around with a project that will be [...]]]></description>
			<content:encoded><![CDATA[<p>So, previously I had talked about using <a href="http://swizframework.org/" target="_blank">Swiz</a> and <a href="http://github.com/robertpenner/as3-signals" target="_blank">AS3-Signals</a> (<a href="http://odoe.net/blog/?p=47" target="_blank">Swignalz!</a>). My example was crude and honestly, it was not good. Ben Clinkinbeard did a much better job of showing how easy it was to drop some <a href="http://www.benclinkinbeard.com/2010/02/swiz-as3-signals-and-inject-ftw/" target="_blank">AS3-Signals around with Swiz</a>.</p>
<p>This past week, I have been tinkering around with a project that will be redone and figured out that if you create a named Bean for a regular Signal, you can then Inject/Autowire that Bean into any Signal in your application.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var mySigBean:Bean = new Bean(new Signal(), &quot;mySignal&quot;);</div></div>
<p>This turns out real nice because then all I have to do anywhere in my application is the following.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;[Inject(&quot;mySignal&quot;)] public var signal:Signal;</div></div>
<p>There&#8217;s no need to create a custom Signal in your application, even if you are going to dispatch a payload. No more signals folder for me. I&#8217;m not sure if there is a performance hit for not defining the type of Object that will be dispatched with your Signal, but so far this has turned out pretty well for me.</p>
<p>I threw together a quick <a href="http://odoe.net/thelab/flex/simpleswignalz/SimpleSwignalz.html" target="_blank">example</a> with source <a href="http://odoe.net/thelab/flex/simpleswignalz/srcview/index.html" target="_blank">here</a>.  I&#8217;d also like to point out that Swiz 1.0 metadata Injecttion into view components is really nice and lets me do cool things like this.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[Inject(source=&quot;mySignal&quot;, destination=&quot;frmSignal&quot;)]</div></div>
<p>That is so cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=52</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Swignalz!</title>
		<link>http://odoe.net/blog/?p=47</link>
		<comments>http://odoe.net/blog/?p=47#comments</comments>
		<pubDate>Tue, 09 Feb 2010 16:54:13 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[swiz]]></category>
		<category><![CDATA[as3-sginals]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=47</guid>
		<description><![CDATA[Recently I decided to take a crack at AS3 Signals. Robert Penner has done some really nice work putting signals together. AS3 Signals is basically meant to replace using custom events to dispatch your payload around. I&#8217;m not sure I&#8217;m entirely sold on the concept of introducing another API into my apps, but I was [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I decided to take a crack at <a href="http://github.com/robertpenner/as3-signals" target="_blank">AS3 Signals</a>. <a href="http://robertpenner.com/flashblog/" target="_blank">Robert Penner</a> has done some really nice work putting signals together. AS3 Signals is basically meant to replace using custom events to dispatch your payload around. I&#8217;m not sure I&#8217;m entirely sold on the concept of introducing another API into my apps, but I was intrigued enough to give it a shot.</p>
<p>Some good resources of getting started with AS3 Signals is <a href="http://pv3d.org/2010/01/21/as3-signals-tutorial/" target="_blank">this video</a> by John Lindquist. I don&#8217;t know about you, but I have found that these screencasts are a great way to get a grasp on an idea. There has also been some <a href="http://alecmce.com/as3/events-and-signals-performance-tests" target="_blank">testing</a> to show that Signals can actually be quicker that Events. This could appeal to you if you are writing a large application that could benefit from the increased performance.</p>
<p>As I see it, you would use Signals in place of creating custom events that would be dispatched to carry a payload. In trying out signals, I began to think of how much I might want a signal to do. Most examples I have seen treat them as value objects, but I suppose you could turn them into full blow mini-controllers. One area I might try playing with signals is in processing raw data from a service into something the rest of my application could use.</p>
<p><span style="background-color: #ffffff;">Joel Hooks already  put together a cool AS3 Signals/Robotlegs <a href="http://joelhooks.com/2010/01/16/robotlegs-image-gallery-example-using-as3-signals-and-the-presentation-model/" target="_blank">example</a> that showed how you could leverage Signals with Robotlegs. So I figured, hey, I&#8217;m going to try Signals with <a href="http://swizframework.org/" target="_blank">Swiz</a>.  I haven&#8217;t really tackled Swiz in a while as my current project uses <a href="http://www.robotlegs.org/" target="_blank">RobotLegs</a>, but with <a href="http://swizframework.org/2009/12/swiz-1-0-0-alpha-released/" target="_blank">Swiz 1.0 Alpha</a> out and 1.0 beta coming up, I thought I&#8217;d give it a shot as I anticipate using Swiz 1.0 in a couple of upcoming projects. I tried some stuff out in the available examples and then put together a small demo app.</span></p>
<p><span style="background-color: #ffffff;"><a href="http://odoe.net/thelab/flex/swignalz/Index.html" target="_blank">Application</a></span></p>
<p><span style="background-color: #ffffff;"><a href="http://odoe.net/thelab/flex/swignalz/srcview/index.html" target="_blank">Source</a></span></p>
<p><span style="background-color: #ffffff;">It&#8217;s not a pretty example, but it shows a couple of ways that you can treat signals in your application.</span></p>
<p><span style="background-color: #ffffff;">I use a couple of value objects with signals in my application model. This way, I can Autowire (the Inject tag is supported in the latest builds, but I already had this alpha build on hand) my model into my controller and assign the listeners that way. With this method, you have the ability to keep your listeners private, which some people might find appealing. A disadvantage here is that some people might not like tying the controller in this manner. I haven&#8217;t tried unit testing a controller like this yet, so I&#8217;m not sure if it would pose a problem.</span></p>
<p><span style="background-color: #ffffff;">Another method is to drop a value object with a signal directly into my BeanProvider and assign a function from a Controller as the listener when you initialize the Bean. The rest is pretty simple, I added some comments where I thought they&#8217;d be useful.</span></p>
<p><span style="background-color: #ffffff;">Swiz 1.0 offers some cool new features like custom metadata processors and virtual beans, which may be able to manage signals is a more efficient manner, but I have not had the opportunity to dive into that much detail in Swiz to be comfortable saying if it would work or not. As for my opinion of Signals, I&#8217;m not sure I&#8217;m entirely sold yet, but as I built the example, I began to think of the possibilities of mapping them out with a decorator pattern or similar. The fact that it got me thinking about it seems like a good sign. I&#8217;m always a little hesitant to add APIs to my applications, but when it comes to being used in the context of the framework of my application, I think I&#8217;d be a bit more comfortable. I expect I&#8217;ll take AS3 Signals for a test drive in the near future.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=47</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Look ma, no wires!</title>
		<link>http://odoe.net/blog/?p=28</link>
		<comments>http://odoe.net/blog/?p=28#comments</comments>
		<pubDate>Fri, 22 Jan 2010 01:19:51 +0000</pubDate>
		<dc:creator>odoe</dc:creator>
				<category><![CDATA[flex]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[swiz]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=28</guid>
		<description><![CDATA[Recently, I have been using Swiz on a couple of smaller projects that are in the works. Swiz is a great little framework that is incredibly light weight. You can see some great examples using Swiz as well as some good discussion in the google groups. I am still using 0.6.4, but the 1.0 alpha [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #000000;">Recently, I have been using </span><a href="http://swizframework.org/docs/"><span style="color: #0000ff;">Swiz</span></a><span style="color: #000000;"> on a couple of smaller projects that are in the works. Swiz is a great little framework that is incredibly light weight. You can see some great </span><a href="http://swizframework.org/examples/"><span style="color: #0000ff;">examples</span></a><span style="color: #000000;"> using Swiz as well as some good discussion in the </span><a href="http://groups.google.com/group/swiz-framework"><span style="color: #0000ff;">google groups</span></a><span style="color: #000000;">. I am still using 0.6.4, but the </span><a href="http://swizframework.org/2009/12/swiz-1-0-0-alpha-released/"><span style="color: #0000ff;">1.0 alpha</span></a><span style="color: #000000;"> is out and offers a new direction for Swiz, especially one that I welcomes that eliminates the need to instantiate Swiz. As I understand it, you just need your </span><a href="http://swizframework.org/docs/ioc-container/"><span style="color: #0000ff;">Beans</span></a><span style="color: #000000;"> and </span><a href="http://swizframework.org/docs/configuration/"><span style="color: #0000ff;">SwizConfig</span></a><span style="color: #000000;">. All other code can be written with the simple use of metadata tags, that Swiz 1.0 alpha will also be offering some </span><a href="http://swizframework.org/2009/12/swiz-1-0-reflection-api-and-custom-metadata-processors/"><span style="color: #0000ff;">neat features</span></a><span style="color: #000000;">.</span></p>
<p><span style="color: #000000;">So as I was working on some items, I remembered a</span><a href="http://www.firemoss.com/index.cfm/2009/10/21/Swiz-in-20-minutes-video--byebye-boilerplate"><span style="color: #000000;"> <span style="color: #0000ff;">20-minute Swiz vide</span></span></a><span style="color: #000000;"><span style="color: #0000ff;">o</span> that Joe Rinheart had posted that helped me out when I first started looking at Swiz. In that video, as a shortcut, Joe had simply binded a service to a delegate inside his BeanLoader to eliminate the need to Autowire an object in a Delegate. This got me thinking about the need to use Autowire with the metadata tag in my applications. When you Autowire an object using Swiz, the object has to be public anyway. The BeanLoader is already an </span><a href="http://martinfowler.com/bliki/InversionOfControl.html"><span style="color: #0000ff;">IoC</span></a><span style="color: #000000;"> container. So why use it? After I had read </span><a href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882"><span style="color: #0000ff;">Clean Code</span></a><span style="color: #000000;">, I began to look at keeping my code as minimal as possible to get the job done. Although, an Autowire metadata tag was no big deal, I just felt like it was one more item I could eliminate from my code.</span></p>
<p><span style="color: #000000;">You could accomplish this in your BeanLoader.</span><br />
<span style="color: #000000;"></p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;controls:RequestController</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;requestController&quot;</span> <span style="color: #000066;">eventDispatcher</span>=<span style="color: #ff0000;">&quot;{ this.dispatcher }&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">service</span>=<span style="color: #ff0000;">&quot;{ mockDelegate }&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></div>
<p></span></p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;services:MockMainServiceDelegate</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;mockDelegate&quot;</span></span><br />
<span style="color: #009900;"><span style="color: #000066;">eventDispatcher</span>=<span style="color: #ff0000;">&quot;{ this.dispatcher }&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></div></div>
<p><span style="color: #000000;">Now I have eliminated the need to Autowire the mockDelegate object in my RequestController.</span></p>
<p><span style="color: #000000;">I have built a simple example that can be found </span><a href="http://odoe.net/thelab/flex/swiznowires/Index.html" target="_blank"><span style="color: #0000ff;">here</span></a><span style="color: #000000;">, with </span><a href="http://odoe.net/thelab/flex/swiznowires/srcview/index.html"><span style="color: #0000ff;">view source</span></a><span style="color: #000000;"> enabled. You&#8217;ll notice that I don&#8217;t use the Autowire metadata tag anywhere, allowing the BeanLoader to do the Autowire for me. Well . . . not quite true. I was not able to get away from using Autowire in a Mediator for my views, even if I tried to add them to my BeanLoader and bind them in there. I used a simplified version of an AbstractMediator class that Brian Riley used in his </span><a href="http://www.webappsolution.com/wordpress/2010/01/06/swiz-passive-view-example-part-1/"><span style="color: #0000ff;">Swiz Passive View example</span></a><span style="color: #000000;">. If anyone has any ideas as to why I had to Autowire this view, I would love to hear it, it was driving me nuts. Anyway, as you can see, all I used in my example was the Mediate metadata tag to mediate my events. That&#8217;s what I call simple and clean. As an aside, I am also using the <a href="http://resources.esri.com/arcgisserver/apis/flex/"><span style="color: #0000ff;">ESRI Flex AP</span>I</a>, with some mock data that is built using the <a href="http://resources.esri.com/help/9.3/arcgisserver/apis/flex/apiref/com/esri/ags/tasks/FeatureSet.html#convertFromJSON()"><span style="color: #0000ff;">FeatureSet.convertFromJSON</span></a> method, which comes in real handy. This is the main API I use for day to day work.</span></p>
<p><span style="color: #000000;">Now is this really necessary? Probably not, but it does keep my MVC code lean. That&#8217;s a great strength for Swiz, is the ability to adapt it to your style. This allows me to really focus on building my custom objects that will really do the grunt work that my MVC will simply delegate.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=28</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learning to program</title>
		<link>http://odoe.net/blog/?p=1</link>
		<comments>http://odoe.net/blog/?p=1#comments</comments>
		<pubDate>Mon, 18 Jan 2010 00:46:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://odoe.net/blog/?p=1</guid>
		<description><![CDATA[This is my new blog, ripe for world domination. Actually, this is where I will catalog my many attempts at developing applications. More specifically, at developing mapping applications. Old blog was imported from blogspot, some errors came over that will need to be fixed. http://odoenet.blogspot.com/]]></description>
			<content:encoded><![CDATA[<p>This is my new blog, ripe for world domination. Actually, this is where I will catalog my many attempts at developing applications. More specifically, at developing mapping applications.</p>
<p>Old blog was imported from blogspot, some errors came over that will need to be fixed.<br />
<a href="http://odoenet.blogspot.com/">http://odoenet.blogspot.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://odoe.net/blog/?feed=rss2&amp;p=1</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
