<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Saiselva&#039;s Blog</title>
	<atom:link href="http://saiselva.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://saiselva.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 19 Jun 2009 05:53:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='saiselva.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Saiselva&#039;s Blog</title>
		<link>http://saiselva.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://saiselva.wordpress.com/osd.xml" title="Saiselva&#039;s Blog" />
	<atom:link rel='hub' href='http://saiselva.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Creating a Simple Data Management Application</title>
		<link>http://saiselva.wordpress.com/2009/06/19/creating-a-simple-data-management-application/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/creating-a-simple-data-management-application/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:53:31 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=38</guid>
		<description><![CDATA[                                            Step 1: Examine the Assembler Class Using the Data Management Service, changes made to the data at the client-side are automatically sent to a data service running in the application server. The data [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=38&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><strong><span style="font-size:small;">Step 1: Examine the Assembler Class</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;"><font face="Times New Roman,Times New Roman" size="3">Using the Data Management Service, changes made to the data at the client-side are automatically sent to a data service running in the application server. The data service then passes those changes to an object called the</p>
<p></font></span> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">assembler</span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">. The role of the assembler is to pass the changes, in the appropriate format, to your existing business objects, or directly to your persistence layer. The assembler class is the only class that you have to write at the server-side (in addition to your existing business and persistence layer), and is typically a very simple class.1. Make sure Eclipse is in the Java perspective</p>
<p>2. Open ContactAssembler.java in the insync.assembler package of the lcds-server project</p>
<p>Code highlights:</p>
<p>• ContactAssembler extends AbstractAssembler and implements a series of callback methods that the data service invokes when it gets changes from the client application.</p>
<p>• You use the assembler to plug in to your existing business objects or directly to your persistence layer.</p>
<p>• In this simple implementation, we invoke the method corresponding to the type of change in our ContactDAO class.</p>
<p></span></p>
<p><strong><span style="font-size:small;">Step 2: Define the Data Management Destination</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">1. Open data-management-config.xml in the flex folder of the lcds-server project</p>
<p>2. Add the following destination:</p>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2">&lt;destination id=</p>
<p></font></span> </p>
<p><em><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;insync.contact&#8221;</span></em><span style="font-size:x-small;font-family:Courier New,Courier New;">&gt; <font face="Courier New,Courier New" size="2">&lt;adapter ref=</p>
<p></font></span></p>
<p> </p>
<p><em><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;java-dao&#8221;</span></em><span style="font-size:x-small;font-family:Courier New,Courier New;">/&gt;&lt;properties&gt;</p>
<p>&lt;source&gt;insync.assembler.ContactAssembler&lt;/source&gt;</p>
<p>&lt;scope&gt;application&lt;/scope&gt;</p>
<p>&lt;metadata&gt;</p>
<p><font face="Courier New,Courier New" size="2">&lt;identity property=</p>
<p></font></span></p>
<p> </p>
<p><em><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;id&#8221; </span></em><span style="font-size:x-small;font-family:Courier New,Courier New;">undefined-value=</span><em><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;0&#8243;</span></em><span style="font-size:x-small;font-family:Courier New,Courier New;">/&gt;&lt;/metadata&gt;</p>
<p>&lt;/properties&gt;</p>
<p>&lt;channels&gt;</p>
<p><font face="Courier New,Courier New" size="2">&lt;channel ref=</p>
<p></font></span></p>
<p> </p>
<p><em><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;my-rtmp&#8221;</span></em><span style="font-size:x-small;font-family:Courier New,Courier New;">/&gt;&lt;/channels&gt;</p>
<p>&lt;/destination&gt;</p>
<p></span></p>
<p><span style="font-size:small;font-family:Times New Roman,Times New Roman;">This XML fragment maps the logical name for the destination (insync.contact) to an assembler class (insync.assembler.ContactAssembler).</p>
<p>3. Make sure you save data-management-config.xml, and restart the server</p>
<p>20</p>
<p></span><strong><span style="font-size:small;">Step 3: Create the Flex Project</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;"><font face="Times New Roman,Times New Roman" size="3">1. Select</p>
<p></font></span> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">File&gt;New&gt;Project… </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">in the Eclipse menu. <font face="Times New Roman,Times New Roman" size="3">2. Expand Flex Builder, select</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Flex Project </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">and click Next. <font face="Times New Roman,Times New Roman" size="3">3. Specify</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">simplecontact </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">as the project name. <font face="Times New Roman,Times New Roman" size="3">4. Keep the</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">use default location </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">checkbox checked. <font face="Times New Roman,Times New Roman" size="3">5. Select</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Web Application </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">as the application type. <font face="Times New Roman,Times New Roman" size="3">6. Select</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">J2EE </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">as the application server type. <font face="Times New Roman,Times New Roman" size="3">7. Check</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">use remote object access service</span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">.8. Uncheck Create combined Java/Flex project using WTP.</p>
<p><font face="Times New Roman,Times New Roman" size="3">9. Click</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Next</span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">.10. Make sure the root folder for LiveCycle Data Services matches the root folder of your LCDS web application. The settings should look similar to this (you may need to adjust the exact folder based on your own settings):</p>
<p>Root Folder: C:\lcds\tomcat\webapps\lcds Root URL: http://localhost:8400/lcds/ Context Root: /lcds</p>
<p><font face="Times New Roman,Times New Roman" size="3">11. Click</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Validate Configuration</span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">, then </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Finish</span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">. </span></p>
<p><strong><span style="font-size:small;">Step 4: Define the Contact Value Object</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">1. Copy Contact.as from the insync project to the src folder of the simplecontact project</p>
<p><font face="Times New Roman,Times New Roman" size="3">2. Open Contact.as</p>
<p></font></span> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">in the simplecontact project </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">3. Replace the [Bindable] annotation with the [Managed] annotation</p>
<p>The [Managed] annotation indicates that the object should be automatically managed: the object will automatically trigger events when its properties are changed. 21</p>
<p></span><strong><span style="font-size:small;">Step 5: Code the application</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">1. Open simplecontact.mxml and implement the application as follows:</p>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;</p>
<p>&lt;mx:Application xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221; xmlns=&#8221;*&#8221;</p>
<p>applicationComplete=&#8221;ds.fill(contacts)&#8221;&gt;</p>
<p>&lt;mx:DataService id=&#8221;ds&#8221; destination=&#8221;insync.contact&#8221;/&gt;</p>
<p>&lt;mx:ArrayCollection id=&#8221;contacts&#8221;/&gt;</p>
<p>&lt;Contact/&gt;</p>
<p>&lt;mx:DataGrid id=&#8221;dg&#8221; dataProvider=&#8221;{contacts}&#8221; editable=&#8221;true&#8221;</p>
<p>width=&#8221;100%&#8221; height=&#8221;100%&#8221;/&gt;</p>
<p>&lt;mx:Button label=&#8221;Delete&#8221;</p>
<p>click=&#8221;contacts.removeItemAt(dg.selectedIndex)&#8221;/&gt;</p>
<p>&lt;/mx:Application&gt;</p>
<p></span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Code highlights:</p>
<p>• The DataService points to the &#8220;insync.contact&#8221; destination defined earlier in data-management-config.xml.</p>
<p>• In the Application tag’s applicationComplete event, the DataService&#8217;s fill() method populates the &#8220;contacts&#8221; ArrayCollection. When you invoke fill() at the client-side, the assembler’s fill() method is invoked at the server-side. This is where you specify how the data should actually be retrieved. See the fill() method in ContactAssembler.java.</p>
<p>• The DataGrid is bound to the contacts array to display the list of contacts.</p>
<p>2. Test the application</p>
<p>a. Run the application</p>
<p>b. Change some data for a few contacts (do NOT change the value of the id column)</p>
<p>c. Reload the application and notice that your changes have been persisted</p>
<p> </p>
<p>3. Test the automatic client synchronization feature of the application</p>
<p>a. Open a second browser and access the same URL</p>
<p>b. Modify some data in one browser, and notice that the changes automatically appear in the second browser.</p>
<p> </p>
<p>Note: Automatically pushing the changes made by one client to the other clients working on the same data is the default behavior of LCDS. We will see how this default behavior can be changed later in this workshop. 22</p>
<p></span><strong><span style="font-size:small;">Step 6: Control when Changes are Sent to the Server</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">By default, LCDS sends a change message to the server immediately after you change a property of an object. This behavior is appropriate for some applications (for example, a collaborative form-filling application), but might not be desirable in other applications, because:</p>
<p>• It generates too much network traffic</p>
<p>• There may be dependencies between object attributes, and the server may not be able to persist partially filled objects</p>
<p>For these reasons, you often want to programmatically control when the changes are sent to the server.</p>
<p>1. To programmatically control when the changes are sent to the server:</p>
<p><font face="Times New Roman,Times New Roman" size="3">a. In simplecontact.mxml, add</p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">autoCommit=&#8221;false&#8221; </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">to the DataService declarationb. Add an &#8220;Apply Changes&#8221; button defined as follows:</p>
<p> </p>
<p></span></p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;mx:Button label=&#8221;Apply Changes&#8221; click=&#8221;ds.commit()&#8221;</p>
<p>enabled=&#8221;{ds.commitRequired}&#8221;/&gt;</p>
<p></span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">2. Now that we have control over when the changes are sent to the server, we can also handle the creation of new contacts. Add a &#8220;New&#8221; Button defined as follows:</p>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2">&lt;mx:Button label=&#8221;New&#8221; click=&#8221;contacts.addItem(</p>
<p></font></span> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">new </span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">Contact())&#8221;/&gt; </span></p>
<p><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Note: This logic for creating new contacts would have failed with autoCommit set to true (default) because the server-side component would have tried to insert an empty row and some columns of the contact table are defined as not supporting null values.</p>
<p>3. Test the application</p>
<p>a. Run the application</p>
<p>b. Change some data for a few contacts</p>
<p>c. Reload the application and notice that your changes have not been persisted</p>
<p>d. Change some data again and click the Apply Changes button</p>
<p>e. Reload the application and notice that your changes have now been persisted</p>
<p>4. Test the automatic client synchronization feature of the application</p>
<p>a. Open a second browser and access the same URL</p>
<p>b. Modify some data in one session, and notice that, with autoCommit set to false, the changes are not pushed to the second browser session until you click the &#8220;Apply Changes&#8221; button.</p>
<p></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=38&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/creating-a-simple-data-management-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding Contacts</title>
		<link>http://saiselva.wordpress.com/2009/06/19/adding-contacts/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/adding-contacts/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:29:26 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=36</guid>
		<description><![CDATA[    1. Add a Button to the ApplicationControlBar in insync.mxml defined as follows: &#60;mx:Button label=&#8221;New Contact&#8221; click=&#8221;openContact(   new Contact())&#8221;/&#62; 2. In ContactForm.mxml, change the label of the Canvas as follows: label=&#8221;{contact.id&#62;0?contact.firstName+   &#8216; &#8216;+contact.lastName:&#8216;New Contact&#8217;}&#8221; 3. Replace the implementation of the save_resultHandler function with the following implementation: contact.id = event.result.id; 4. Test the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=36&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> </p>
<p> </p>
<p><span style="font-size:small;">1. Add a Button to the ApplicationControlBar in insync.mxml defined as follows:</p>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2">&lt;mx:Button label=&#8221;New Contact&#8221; click=&#8221;openContact(</p>
<p></font></span> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">new </span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">Contact())&#8221;/&gt; </span></p>
<p><span style="font-size:small;">2. In ContactForm.mxml, change the label of the Canvas as follows:</p>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2">label=&#8221;{contact.id&gt;0?contact.firstName+</p>
<p></font></span> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8216; &#8216;</span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">+contact.lastName:</span><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8216;New Contact&#8217;</span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">}&#8221; </span></p>
<p><span style="font-size:small;">3. Replace the implementation of the save_resultHandler function with the following implementation:</p>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;">contact.id = event.result.id;</p>
<p></span><span style="font-size:small;">4. Test the application</p>
<p></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=36&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/adding-contacts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Opening Multiple Contacts</title>
		<link>http://saiselva.wordpress.com/2009/06/19/opening-multiple-contacts/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/opening-multiple-contacts/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:26:36 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=34</guid>
		<description><![CDATA[                        1. In insync.mxml, replace the ContactForm component with a TabNavigator defined as follows: &#60;mx:TabNavigator   id=&#8221;tn&#8221; width=&#8221;70%&#8221; height=&#8221;100%&#8220; /&#62; 2. Add an openContact function defined as follows: public function function openContact(contact:Contact): void { var   form:ContactForm = new ContactForm(); tn.addChild(form); form.contact = contact; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=34&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="left"> </p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><font face="Courier New" size="2" color="#669acd"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p> </p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">1. In insync.mxml, replace the ContactForm component with a TabNavigator defined as follows:</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:TabNavigator</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">tn</span><span style="font-size:x-small;font-family:Courier New;">&#8221; width=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">70%</span><span style="font-size:x-small;font-family:Courier New;">&#8221; height=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">2. Add an openContact function defined as follows:</p>
<p></span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left">public</p>
<p></font><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></strong></span></p>
<p align="left"><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></p>
<p><span style="font-size:x-small;font-family:Courier New;">openContact(contact:Contact):</span></p>
<p align="left"><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">void</span></strong><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">{</p>
<p></span><strong><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#669acd"></p>
<p align="left">var</p>
<p></font></strong></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">form:ContactForm = </span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">new </span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">ContactForm();</p>
<p align="left">tn.addChild(form);</p>
<p align="left">form.contact = contact;</p>
<p align="left">tn.selectedChild = form;</p>
<p align="left">}</p>
<p></span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">3. Enable double-clicking in the DataGrid by adding the following attributes to the DataGrid definition:</p>
<p></span><span style="font-size:x-small;font-family:Courier New;"><font face="Courier New" size="2"></p>
<p align="left">doubleClickEnabled=&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">true</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">doubleClick=&#8221;openContact(dg.selectedItem</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">as </span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">Contact)&#8221;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">4. In ContactForm.mxml, specify the label property of the Canvas as follows:</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Canvas</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">xmlns:mx=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">http://www.adobe.com/2006/mxml</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">width=&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8221; height=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">label=&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">{</span><span style="font-size:x-small;font-family:Courier New;">contact.firstName + </span><strong><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">&#8216; &#8216; </span></strong><span style="font-size:x-small;font-family:Courier New;">+ contact.lastName</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">}</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">5. In ContactForm.mxml, replace the implementation of the deleteItem_resultHandler function with the following implementation:</p>
<p></span><span style="font-size:x-small;font-family:Courier New;"><font face="Courier New" size="2"></p>
<p align="left">parent.removeChild(</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">this</span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">);</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">6. In the HBox at the bottom of ContactForm.mxml, add a Close button defined as follows:</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Button</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">label=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">Close</span><span style="font-size:x-small;font-family:Courier New;">&#8221; click=&#8221;parent.removeChild(</span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">this</span></strong><span style="font-size:x-small;font-family:Courier New;">)&#8221;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">7. Test the application</p>
<p align="left">a. Run the application.</p>
<p align="left">b. Double-click a contact in the DataGrid to open a form and edit this contact in the TabNavigator</p>
<p align="left">c. Double-click another contact to open a second contact in the TabNavigator.</p>
<p align="left">17</p>
<p></span><strong><span style="font-family:Arial;"></p>
<p align="left">Extra Credit</p>
<p></span></strong><span style="font-family:Times New Roman;"></p>
<p align="left">Add some logic to the openContact function to prevent the same contact from being opened multiple times in the TabNavigator. If the user tries to open a contact that is already open, simply activate the corresponding tab vi<span style="font-family:Times New Roman;"></p>
<p align="left">1. In insync.mxml, replace the ContactForm component with a TabNavigator defined as follows:</p>
<p></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><font face="Courier New" size="2" color="#669acd"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p> </p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:TabNavigator</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">tn</span><span style="font-size:x-small;font-family:Courier New;">&#8221; width=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">70%</span><span style="font-size:x-small;font-family:Courier New;">&#8221; height=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">2. Add an openContact function defined as follows:</p>
<p></span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left">public</p>
<p></font><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></strong></span></p>
<p align="left"><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></p>
<p><span style="font-size:x-small;font-family:Courier New;">openContact(contact:Contact):</span></p>
<p align="left"><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">void</span></strong><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">{</p>
<p></span><strong><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#669acd"></p>
<p align="left">var</p>
<p></font></strong></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">form:ContactForm = </span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">new </span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">ContactForm();</p>
<p align="left">tn.addChild(form);</p>
<p align="left">form.contact = contact;</p>
<p align="left">tn.selectedChild = form;</p>
<p align="left">}</p>
<p></span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">3. Enable double-clicking in the DataGrid by adding the following attributes to the DataGrid definition:</p>
<p></span><span style="font-size:x-small;font-family:Courier New;"><font face="Courier New" size="2"></p>
<p align="left">doubleClickEnabled=&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">true</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">doubleClick=&#8221;openContact(dg.selectedItem</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">as </span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">Contact)&#8221;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">4. In ContactForm.mxml, specify the label property of the Canvas as follows:</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Canvas</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">xmlns:mx=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">http://www.adobe.com/2006/mxml</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">width=&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8221; height=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">label=&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">{</span><span style="font-size:x-small;font-family:Courier New;">contact.firstName + </span><strong><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">&#8216; &#8216; </span></strong><span style="font-size:x-small;font-family:Courier New;">+ contact.lastName</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">}</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">5. In ContactForm.mxml, replace the implementation of the deleteItem_resultHandler function with the following implementation:</p>
<p></span><span style="font-size:x-small;font-family:Courier New;"><font face="Courier New" size="2"></p>
<p align="left">parent.removeChild(</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">this</span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">);</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">6. In the HBox at the bottom of ContactForm.mxml, add a Close button defined as follows:</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Button</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">label=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">Close</span><span style="font-size:x-small;font-family:Courier New;">&#8221; click=&#8221;parent.removeChild(</span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">this</span></strong><span style="font-size:x-small;font-family:Courier New;">)&#8221;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">7. Test the application</p>
<p align="left">a. Run the application.</p>
<p align="left">b. Double-click a contact in the DataGrid to open a form and edit this contact in the TabNavigator</p>
<p align="left">c. Double-click another contact to open a second contact in the TabNavigator.</p>
<p align="left">17</p>
<p></span><strong><span style="font-family:Arial;"></p>
<p align="left">Extra Credit</p>
<p></span></strong><span style="font-family:Times New Roman;"></p>
<p align="left">Add some logic to the openContact function to prevent the same contact from being opened multiple times in the TabNavigator. If the user tries to open a contact that is already open, simply activate the corresponding tab in the TabNavigator.</p>
<p><font face="Times New Roman"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p>n the TabNavigator.</strong></p>
<p></strong></p>
<p></span></strong></p>
<p></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=34&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/opening-multiple-contacts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Updating Contacts</title>
		<link>http://saiselva.wordpress.com/2009/06/19/updating-contacts/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/updating-contacts/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:22:17 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=32</guid>
		<description><![CDATA[                                                                          Step 1: Create the Contact Value Object In the application so far, the list of contacts returned by [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=32&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p> </p>
<p> </p>
<p><strong><span style="font-size:small;">Step 1: Create the Contact Value Object</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">In the application so far, the list of contacts returned by the getContactsByName() method is deserialized into dynamic objects. It is sometimes desirable to work with strongly typed objects. To work with typed objects in this application, let’s create the ActionScript version of the Contact class defined in the lcds-server project:</p>
<p><font face="Times New Roman,Times New Roman" size="3">1. Right-click the src folder in the insync project and select</p>
<p></font></span> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">New&gt;ActionScript Class</span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">. Specify </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Contact </span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">as the class name and click Finish. </p>
<p>2. Implement the Contact class as follows:</p>
<p></span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">package</p>
<p></span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">{</p>
<p><font face="Courier New,Courier New" size="2">[</p>
<p></font></span> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">Bindable</span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">] <font face="Courier New,Courier New" size="2">[RemoteClass(alias=</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">"insync.model.Contact"</span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">)] </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public class</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">Contact{</p>
<p></span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">id:int; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">firstName:String; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">lastName:String; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">email:String; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">phone:String; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">address:String; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">city:String; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">state:String; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">public var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">zip:String;}</p>
<p>}</p>
<p></span></p>
<p><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Notice that we use the [RemoteClass(alias="insync.model.Contact")] annotation to map the ActionScript version of the Contact class (Contact.as) to the Java version (Contact.java). As a result, Contact objects returned by the getContactsByName() method of ContactDAO are deserialized into instances of the ActionScript Contact class. Similarly, in the Contact form (see next step), the instance of the ActionScript Contact class passed as an argument to the save method of the RemoteObject is deserialized into an instance of the java version of the Contact class at the server-side. 15</p>
<p></span><strong><span style="font-size:small;">Step 2: Add a Contact Form</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">1. Copy ContactForm.mxml from flex-dataservices-tutorial\insync\flexsrc to the src directory of the insync project in Eclipse.</p>
<p>2. Examine the ContactForm.mxml source code.</p>
<p>3. Modify the insync.mxml application to allow the user to update contacts in the Contact Form. Wrap the DataGrid in an HDividedBox, add and wire the ContactForm component as follows:</p>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;mx:HDividedBox width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:DataGrid id=&#8221;dg&#8221;</p>
<p>dataProvider=&#8221;{contacts}&#8221; width=&#8221;30%&#8221; height=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:columns&gt;</p>
<p>&lt;mx:DataGridColumn</p>
<p>dataField=&#8221;firstName&#8221; headerText=&#8221;First Name&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn</p>
<p>dataField=&#8221;lastName&#8221; headerText=&#8221;Last Name&#8221;/&gt;</p>
<p>&lt;/mx:columns&gt;</p>
<p>&lt;/mx:DataGrid&gt;</p>
<p><font face="Courier New,Courier New" size="2">&lt;ContactForm contact=&#8221;{dg.selectedItem</p>
<p></font></span> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">as </span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">Contact}&#8221; width=&#8221;70%&#8221;/&gt;&lt;/mx:HDividedBox&gt;</p>
<p></span></p>
<p><strong><span style="font-size:small;">Step 3: Test the Application</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">1. Run the application</p>
<p>2. Select a contact in the DataGrid, modify some data in the Contact Form, and click the Save button to save your changes.</p>
<p>3. Select a contact in the DataGrid, and click the Delete button to delete the contact.</p>
<p></span><strong><span style="font-size:small;">Extra Credit</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Implement a strategy to enable the Save button only when data has been modified</p>
<p></span></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=32&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/updating-contacts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the RemoteObject Events</title>
		<link>http://saiselva.wordpress.com/2009/06/19/using-the-remoteobject-events/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/using-the-remoteobject-events/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:18:37 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=30</guid>
		<description><![CDATA[                                                RemoteObject calls are asynchronous. You use the   result and fault events of the RemoteObject component to handle results and errors.1. To make the application more robust and better partitioned, modify [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=30&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p> </p>
<p> </p>
<p> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p> </p>
<p> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;"><font face="Courier New,Courier New" size="2"> </p>
<p></font></span> </p>
<p> </p>
<p><span style="font-size:small;"><font size="3">RemoteObject calls are asynchronous. You use the</p>
<p></font></span> </p>
<p><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">result </span></strong><span style="font-size:small;">and </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">fault </span></strong><span style="font-size:small;">events of the RemoteObject component to handle results and errors.1. To make the application more robust and better partitioned, modify the code as follows:</p>
<p></span></p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;</p>
<p>&lt;mx:Application xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221; xmlns=&#8221;*&#8221;&gt;</p>
<p>&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[</p>
<p></span><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">import</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">mx.rpc.events.FaultEvent; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">import</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">mx.rpc.events.ResultEvent; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">import</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">mx.controls.Alert; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">import</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">mx.collections.ArrayCollection; <font face="Courier New,Courier New" size="2">[</p>
<p></font></span></p>
<p> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">Bindable</span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">] </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">private var</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">contacts:ArrayCollection; </span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">private function</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">resultHandler(event:ResultEvent):</span><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">void </span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">{</p>
<p><font face="Courier New,Courier New" size="2">contacts = event.result</p>
<p></font></span> </p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">as </span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">ArrayCollection;}</p>
<p></span></p>
<p><strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong><font face="Courier New,Courier New" size="2">private function</p>
<p></font></strong></span> </p>
<p><span style="font-size:x-small;font-family:Courier New,Courier New;">faultHandler(event:FaultEvent):</span><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">void </span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;">{</p>
<p>Alert.show(event.fault.faultDetail);</p>
<p>}</p>
<p>]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p>&lt;mx:RemoteObject id=&#8221;ro&#8221; destination=&#8221;contact&#8221;</p>
<p>fault=&#8221;faultHandler(event)&#8221;&gt;</p>
<p>&lt;mx:method name=&#8221;getContactsByName&#8221;</p>
<p>result=&#8221;resultHandler(event)&#8221;/&gt;</p>
<p>&lt;/mx:RemoteObject&gt;</p>
<p>&lt;mx:ApplicationControlBar width=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:TextInput id=&#8221;searchStr&#8221;/&gt;</p>
<p>&lt;mx:Button label=&#8221;Search&#8221;</p>
<p>click=&#8221;ro.getContactsByName(searchStr.text)&#8221;/&gt;</p>
<p>&lt;/mx:ApplicationControlBar&gt;</p>
<p>&lt;mx:DataGrid id=&#8221;dg&#8221; dataProvider=&#8221;{contacts}&#8221;</p>
<p>width=&#8221;100%&#8221; height=&#8221;100%&#8221;/&gt;</p>
<p>&lt;/mx:Application&gt;</p>
<p></span><span style="font-size:small;">2. Run and test the application</p>
<p>14</p>
<p></span></p>
<p></strong></p>
<p></strong></strong></strong></strong></strong></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=30&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/using-the-remoteobject-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Simple Contact Management Application</title>
		<link>http://saiselva.wordpress.com/2009/06/19/creating-a-simple-contact-management-application/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/creating-a-simple-contact-management-application/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:10:35 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=27</guid>
		<description><![CDATA[Using the Remoting Service, you can directly invoke methods of Java objects deployed in your application server, and consume the return value. The return value can be a value of a primitive data type, an object, a collection of objects, an object graph, etc. Java objects returned by server-side methods are deserialized into either dynamic [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=27&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div><span style="font-size:small;">Using the Remoting Service, you can directly invoke methods of Java objects deployed in your application server, and consume the return value. The return value can be a value of a primitive data type, an object, a collection of objects, an object graph, etc. Java objects returned by server-side methods are deserialized into either dynamic or typed ActionScript objects.</span></div>
<p><span style="font-size:small;">In this section, we build a simple contact management application that demonstrates the LCDS Remoting service.</p>
<div><strong><span style="font-size:small;font-family:Arial,Arial;">Step 1: Copy and Examine the Java Classes</span></strong></div>
<p></span><strong><span style="font-size:small;font-family:Arial,Arial;"></p>
<div><span style="font-size:small;">1. Copy</span></div>
<p></span><span style="font-size:small;">2. Copy the</p>
<p>3. Open and examine the</p>
<p>The server-side of the insync application uses the simple Value Object and Data Access Object (DAO) patterns:</p>
<p>• Contacts are transferred between the client and the server using</p>
<p>• The</p>
<div><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">hsqldb.jar </span><span style="font-size:small;">from flex-dataservices-tutorial\hsqldb to the lib directory of the </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">lcds-server </span><span style="font-size:small;">project </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">insync directory </span><span style="font-size:small;">and the </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">insync.properties </span><span style="font-size:small;">file from flex-dataservices-tutorial\contact\javasrc to the src directory of your </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">lcds-server </span><span style="font-size:small;">project </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Contact </span><span style="font-size:small;">class (in the insync.model package) and the </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">ContactDAO </span><span style="font-size:small;">class (in the insync.dao package) </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Contact </span><span style="font-size:small;">value objects. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">ContactDAO </span><span style="font-size:small;">class provides the data access logic to retrieve and update contacts </span><strong><span style="font-size:small;font-family:Arial,Arial;">Step 2: Create the Remoting Destination</span></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></div>
<p></span><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><span style="font-size:small;font-family:Arial,Arial;"></p>
<div><span style="font-size:small;">A Remoting destination exposes a Java class that your Flex application can invoke remotely. The destination id is a logical name that your Flex application uses to refer to the remote class, avoiding a hardcoded reference to the fully qualified Java class name. This logical name is mapped to the Java class name as part of the destination configuration in remoting-config.xml.</span></div>
<p></span><span style="font-size:small;">To create a remoting destination for the ContactDAO class:</p>
<p>1. Open remoting-config.xml located in the flex folder of the lcds-server project.</p>
<p>2. Add a destination called contact defined as follows:</p>
<div><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;destination id=&#8221;contact&#8221;&gt;</span></div>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;properties&gt;</p>
<p>&lt;source&gt;insync.dao.ContactDAO&lt;/source&gt;</p>
<p>&lt;/properties&gt;</p>
<p>&lt;/destination&gt;</p>
<p><span style="font-size:small;font-family:Courier New,Courier New;">12 </span></p>
<div><strong><span style="font-size:small;font-family:Arial,Arial;">Step 3: Create the Flex Project</span></strong></div>
<p></span><strong><span style="font-size:small;font-family:Arial,Arial;"></p>
<div><span style="font-size:small;">1. Select</span></div>
<p></span><span style="font-size:small;">2. Expand Flex Builder, select</p>
<p>3. Specify</p>
<p>4. Keep the</p>
<p>5. Select</p>
<p>6. Select</p>
<p>7. Check</p>
<p>8. Uncheck Create combined Java/Flex project using WTP.</p>
<p>9. Click</p>
<p>10. Make sure the root folder for LiveCycle Data Services matches the root folder of your LCDS web application. The settings should look similar to this (you may need to adjust the exact folder based on your own settings):</p>
<p>Root Folder: C:\lcds\tomcat\webapps\lcds Root URL: http://localhost:8400/lcds/ Context Root: /lcds</p>
<p>11. Click</p>
<div><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">File&gt;New&gt;Project… </span><span style="font-size:small;">in the Eclipse menu. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Flex Project </span><span style="font-size:small;">and click Next. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">insync </span><span style="font-size:small;">as the project name. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">use default location </span><span style="font-size:small;">checkbox checked. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Web Application </span><span style="font-size:small;">as the application type. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">J2EE </span><span style="font-size:small;">as the application server type. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">use remote object access service</span><span style="font-size:small;">. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Next</span><span style="font-size:small;">. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Validate Configuration</span><span style="font-size:small;">, then </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Finish</span><span style="font-size:small;">. </span><strong><span style="font-size:small;font-family:Arial,Arial;">Step 4: Code the Application</span></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></div>
<p></span><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><span style="font-size:small;font-family:Arial,Arial;"></p>
<div><span style="font-size:small;">1. Open insync.mxml located in the src folder of the insync project, and implement the application as follows:</span></div>
<p></span><span style="font-size:small;"></p>
<div><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;</span></div>
<p></span><span style="font-size:x-small;font-family:Courier New,Courier New;">&lt;mx:Application xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221; xmlns=&#8221;*&#8221;&gt;</p>
<p>&lt;mx:RemoteObject id=&#8221;ro&#8221; destination=&#8221;contact&#8221;/&gt;</p>
<p>&lt;mx:ApplicationControlBar width=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:TextInput id=&#8221;searchStr&#8221;/&gt;</p>
<p>&lt;mx:Button label=&#8221;Search&#8221;</p>
<p>click=&#8221;ro.getContactsByName(searchStr.text)&#8221;/&gt;</p>
<p>&lt;/mx:ApplicationControlBar&gt;</p>
<p>&lt;mx:DataGrid id=&#8221;dg&#8221;</p>
<p>dataProvider=&#8221;{ro.getContactsByName.lastResult}&#8221;</p>
<p>width=&#8221;100%&#8221; height=&#8221;100%&#8221;/&gt;</p>
<p>&lt;/mx:Application&gt;</p>
<div><span style="font-size:small;">2. Run and test the application</span></div>
<p></span><span style="font-size:small;"> </p>
<p>• Type a few characters in the search TextInput field and click Search</p>
<p>• To retrieve all the contacts, leave the TextInput field empty and click Search</p>
<p>13</p>
<p> </p>
<p></span></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=27&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/creating-a-simple-contact-management-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a Collaborative Mapping Application</title>
		<link>http://saiselva.wordpress.com/2009/06/19/creating-a-collaborative-mapping-application/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/creating-a-collaborative-mapping-application/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:07:14 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=25</guid>
		<description><![CDATA[Step 1: Create the Flex Project 1. Select 2. Expand Flex Builder, select 3. Specify 4. Keep the 5. Select 6. Select 7. Check 8. Uncheck Create combined Java/Flex project using WTP. 9. Click 10. Make sure the root folder for LiveCycle Data Services matches the root folder of your LCDS web application. The settings [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=25&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size:small;">Step 1: Create the Flex Project</p>
<p></span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">1. Select</p>
<p>2. Expand Flex Builder, select</p>
<p>3. Specify</p>
<p>4. Keep the</p>
<p>5. Select</p>
<p>6. Select</p>
<p>7. Check</p>
<p>8. Uncheck Create combined Java/Flex project using WTP.</p>
<p>9. Click</p>
<p>10. Make sure the root folder for LiveCycle Data Services matches the root folder of your LCDS web application. The settings should look similar to this (you may need to adjust the exact folder based on your own settings):</p>
<p>Root Folder: C:\lcds\tomcat\webapps\lcds Root URL: http://localhost:8400/lcds/ Context Root: /lcds</p>
<p>11. Click</p>
<p><font face="Times New Roman,Times New Roman" size="3"> </p>
<p></font></span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">File&gt;New&gt;Project… </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">in the Eclipse menu. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Flex Project </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">and click Next. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">flexmaps </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">as the project name. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">use default location </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">checkbox checked. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Web Application </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">as the application type. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">J2EE </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">as the application server type. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">use remote object access service</span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Next</span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">. </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Validate Configuration</span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">, then </span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Finish</span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">. </span></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></p>
<p> </p>
<p></strong></p>
<p> </p>
<p> </p>
<p><strong><span style="font-size:small;">Add the Yahoo Map Library to the Project</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">Copy YahooMaps.swc from flex-dataservices-tutorial\YahooMap\YahooMap.swc to the lib directory of your newly created flexmaps project in Eclipse.</p>
<p> </p>
<p><strong><span style="font-size:small;">Step 3: Experiment with the Basic FlexMaps Application</p>
<p></span></strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">1. Copy flexmaps.mxml from flex-dataservices-tutorial\flexmaps to the src directory of your newly created flexmaps project in Eclipse.</p>
<p>2. Open flexmaps.mxml in Eclipse and examine the application.</p>
<p>3. Run the application.</p>
<p>4. Drag the map and notice that, when you release the mouse button, a dialog displays the new map coordinates.</p>
<p>5. Type a valid address in the text input field, and click Search. The map moves to that new location, and the &#8220;New Coordinates&#8221; dialog pops up.</p>
<p> </p>
<p> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><font face="Courier New" size="2" color="#669acd"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><font face="Courier New" size="2" color="#669acd"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><font face="Courier New" size="2" color="#669acd"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><font face="Courier New" size="2" color="#669acd"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p><strong><span style="font-family:Arial;"></p>
<p align="left">Step 4: Enable Collaboration in the FlexMaps Application</p>
<p></span></strong><span style="font-family:Times New Roman;"><font face="Times New Roman"></p>
<p align="left">1. Open</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-family:Times New Roman;">messaging-config.xml </span></strong></p>
<p align="left"><span style="font-family:Times New Roman;">located in the flex folder of the lcds-server project, and add a destination called flexmaps defined as follows:</span></p>
<p><span style="font-size:x-small;color:#008181;font-family:Courier New;"><font face="Courier New" size="2" color="#008181"></p>
<p align="left">&lt;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#3f7f7f;font-family:Courier New;">destination </span><span style="font-size:x-small;color:#7f007f;font-family:Courier New;">id</span><span style="font-size:x-small;font-family:Courier New;">=</span><em><span style="font-size:x-small;color:#2a00ff;font-family:Courier New;">&#8220;flexmaps&#8221;</span></em></p>
<p align="left"><span style="font-size:x-small;color:#008181;font-family:Courier New;">&gt;<font face="Courier New" size="2" color="#008181"></p>
<p align="left">&lt;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#3f7f7f;font-family:Courier New;">channels</span></p>
<p align="left"><span style="font-size:x-small;color:#008181;font-family:Courier New;">&gt;<font face="Courier New" size="2" color="#008181"></p>
<p align="left">&lt;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#3f7f7f;font-family:Courier New;">channel </span><span style="font-size:x-small;color:#7f007f;font-family:Courier New;">ref</span><span style="font-size:x-small;font-family:Courier New;">=</span><em><span style="font-size:x-small;color:#2a00ff;font-family:Courier New;">&#8220;my-rtmp&#8221;</span></em></p>
<p align="left"><span style="font-size:x-small;color:#008181;font-family:Courier New;">/&gt;<font face="Courier New" size="2" color="#008181"></p>
<p align="left">&lt;</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#3f7f7f;font-family:Courier New;">channel </span><span style="font-size:x-small;color:#7f007f;font-family:Courier New;">ref</span><span style="font-size:x-small;font-family:Courier New;">=</span><em><span style="font-size:x-small;color:#2a00ff;font-family:Courier New;">&#8220;my-polling-amf&#8221;</span></em></p>
<p align="left"><span style="font-size:x-small;color:#008181;font-family:Courier New;">/&gt;<font face="Courier New" size="2" color="#008181"></p>
<p align="left">&lt;/</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#3f7f7f;font-family:Courier New;">channels</span></p>
<p align="left"><span style="font-size:x-small;color:#008181;font-family:Courier New;">&gt;<font face="Courier New" size="2" color="#008181"></p>
<p align="left">&lt;/</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#3f7f7f;font-family:Courier New;">destination</span></p>
<p align="left"><span style="font-size:x-small;color:#008181;font-family:Courier New;">&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">2. In flexmaps.mxml, define Producer and Consumer components as follows:</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Producer</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">producer</span><span style="font-size:x-small;font-family:Courier New;">&#8221; destination=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">flexmaps</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;<font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Consumer</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">consumer</span><span style="font-size:x-small;font-family:Courier New;">&#8221; destination=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">flexmaps</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">message=&#8221;messageHandler(event)&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;</span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">3. In the init() function, add a line of code to subscribe to the flexmaps destination:</p>
<p></span><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">consumer.subscribe();</p>
<p></span><span style="font-family:Times New Roman;"></p>
<p align="left">4. Replace the implementation of the handleNewCoordinates function with the following code:</p>
<p></span><strong><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#669acd"></p>
<p align="left">var</p>
<p></font></strong></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">message:AsyncMessage = </span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">new </span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">AsyncMessage();</p>
<p align="left">message.body.latitude = _yahooMap.centerLatLon.lat;</p>
<p align="left">message.body.longitude = _yahooMap.centerLatLon.lon;</p>
<p align="left">producer.send(message);</p>
<p></span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">5. Create a messageHandler function defined as follows:</p>
<p></span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left">private</p>
<p></font><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></strong></span></p>
<p align="left"><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></p>
<p><span style="font-size:x-small;font-family:Courier New;">messageHandler(event:MessageEvent):</span></p>
<p align="left"><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">void</span></strong><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">{</p>
<p></span><strong><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#669acd"></p>
<p align="left">var</p>
<p></font></strong></span></p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">body:Object = event.message.body;<font face="Courier New" size="2"></p>
<p align="left">_yahooMap.centerLatLon =</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">new </span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">LatLon(body.latitude, body.longitude);</p>
<p align="left">}</p>
<p></span></p>
<p><span style="font-family:Times New Roman;"></p>
<p align="left">6. Add the appropriate import statements</p>
<p align="left">7. Test the application:</p>
<p align="left">a. Run the application.</p>
<p align="left">b. Access the same URL in another browser window to open a second instance of the flexmaps application.</p>
<p align="left">c. Move the map in one browser and notice that the position of the map is synchronized in the other browser.</p>
<p align="left">d. You can also look for an address in one browser: the map will move to that address in the two browsers.</p>
<p></span></strong></p>
<p></strong></strong></p>
<p></span></p>
<p><font face="Times New Roman,Times New Roman" size="3"> </p>
<p></font></span></p>
<p> </p>
<p><span> </span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=25&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/creating-a-collaborative-mapping-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Powering Flex Applications(Creating a Chat Application)</title>
		<link>http://saiselva.wordpress.com/2009/06/19/powering-flex-applicationscreating-a-chat-application/</link>
		<comments>http://saiselva.wordpress.com/2009/06/19/powering-flex-applicationscreating-a-chat-application/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 05:04:07 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=23</guid>
		<description><![CDATA[The LCDS Message Service provides a publish/subscribe infrastructure that allows your Flex application to publish messages and subscribe to a set of messaging destinations, enabling the development of real-time data push and collaborative applications. In this section, you build a simple chat application that demonstrates the LCDS Message Service. Step 1: Create the Messaging Destination [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=23&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:small;">The LCDS Message Service provides a publish/subscribe infrastructure that allows your Flex application to publish messages and subscribe to a set of messaging destinations, enabling the development of real-time data push and collaborative applications.</p>
<p>In this section, you build a simple chat application that demonstrates the LCDS Message Service.</p>
<p></span><span style="font-size:small;font-family:Arial,Arial;"><strong>Step 1: Create the Messaging Destination</strong></p>
<p></span><span style="font-size:small;"><strong>A messaging destination represents a topic of real time conversation that interested parties can subscribe (listen) to, or contribute to by posting their own messages.</strong></p>
<p><strong>To define the chat destination for this application:</strong></p>
<p><strong>1. In the</strong></p>
<p><strong>2. Add a destination called chat defined as follows:</strong></p>
<p></span><strong><span style="font-size:small;font-family:Times New Roman,Times New Roman;">lcds-server </span><span style="font-size:small;">project, open </span><span style="font-size:small;font-family:Times New Roman,Times New Roman;">messaging-config.xml </span><span style="font-size:small;">located in the flex folder. </span></strong><span style="font-size:x-small;font-family:Courier New,Courier New;"><strong>&lt;destination id=</strong></p>
<p><strong>&lt;channels&gt;</strong></p>
<p><strong>&lt;channel ref=</strong></p>
<p><strong>&lt;channel ref=</strong></p>
<p><strong>&lt;/channels&gt;</strong></p>
<p><strong>&lt;/destination&gt;</strong></p>
<p></span><em><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;chat&#8221;</span><span style="font-size:x-small;font-family:Courier New,Courier New;">&gt; </span></strong><em><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;my-rtmp&#8221;</span><span style="font-size:x-small;font-family:Courier New,Courier New;">/&gt; </span></strong><em><strong><span style="font-size:x-small;font-family:Courier New,Courier New;">&#8220;my-polling-amf&#8221;</span><span style="font-size:x-small;font-family:Courier New,Courier New;">/&gt; </span></strong><span style="font-size:small;"><strong>This channel configuration indicates that the client will first try to connect to the message service using the my-rtmp channel. If a connection to the server cannot be established using that channel, the client will fall back to the my-polling-amf channel. Channels themselves are configured in services-config.xml.</strong></p>
<p><strong>3. Restart the server</strong></p>
<p> </p>
<p> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"><span style="font-family:Arial;"></p>
<p align="left"><strong>Step 2: Create the Flex Project</strong></p>
<p></span><span style="font-family:Times New Roman;"><font face="Times New Roman"></p>
<p align="left"><strong>1. Select </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>File&gt;New&gt;Project… </strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>in the Eclipse menu.</strong><font face="Times New Roman"></p>
<p align="left"><strong>2. Expand Flex Builder, select </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>Flex Project </strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>and click Next.</strong><font face="Times New Roman"></p>
<p align="left"><strong>3. Specify </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>chat </strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>as the project name.</strong><font face="Times New Roman"></p>
<p align="left"><strong>4. Keep the </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>use default location </strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>checkbox checked.</strong><font face="Times New Roman"></p>
<p align="left"><strong>5. Select </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>Web Application </strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>as the application type.</strong><font face="Times New Roman"></p>
<p align="left"><strong>6. Select </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>J2EE </strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>as the application server type.</strong><font face="Times New Roman"></p>
<p align="left"><strong>7. Check </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>use remote object access service</strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>.</strong></p>
<p align="left"><strong>8. Uncheck Create combined Java/Flex project using WTP.</strong></p>
<p><font face="Times New Roman"></p>
<p align="left"><strong>9. Click </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;"><strong>Next</strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>.</strong></p>
<p align="left"><strong>10. Make sure the root folder for LiveCycle Data Services matches the root folder of your LCDS web application. The settings should look similar to this (you may need to adjust the exact folder based on your own settings):</strong></p>
<p><font face="Times New Roman"></p>
<p align="left"><strong>Root Folder: C:\lcds\tomcat\webapps\lcds Root URL: </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="color:#0000ff;font-family:Times New Roman;"><strong>http://localhost:8400/lcds/ </strong></span></p>
<p align="left"><span style="font-family:Times New Roman;"><strong>Context Root: /lcds</strong><font face="Times New Roman"></p>
<p align="left"><strong>11. Click </strong></p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-family:Times New Roman;">Validate Configuration</span><span style="font-family:Times New Roman;">, then </span><span style="font-family:Times New Roman;">Finish</span></strong></p>
<p> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><font face="Courier New" size="2" color="#669acd"></p>
<p align="left"> </p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p align="left"> </p>
<p> </p>
<p><strong><span style="font-family:Arial;"></p>
<p align="left">Create the Client Application</p>
<p></span></strong><span style="font-family:Times New Roman;"></p>
<p align="left">Open the chat.mxml file located in the src folder of the newly created chat project, and implement the application as follows:</p>
<p></span><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Application</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">xmlns:mx=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">http://www.adobe.com/2006/mxml</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">creationComplete=&#8221;consumer.subscribe()&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">&gt;</span></p>
<p><span style="font-size:x-small;color:#006633;font-family:Courier New;"></p>
<p align="left">&lt;mx:Script&gt;</p>
<p></span><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">&lt;![CDATA[</p>
<p></span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left">import</p>
<p></font></strong></span></p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">mx.messaging.events.MessageEvent;</span></p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left">import</p>
<p></font></strong></span></p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">mx.messaging.messages.AsyncMessage;</span></p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left">private</p>
<p></font><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></strong></span></p>
<p align="left"><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></p>
<p><span style="font-size:x-small;font-family:Courier New;">send():</span></p>
<p align="left"><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">void</span></strong><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">{</p>
<p></span><strong><span style="font-size:x-small;color:#669acd;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#669acd"></p>
<p align="left">var</p>
<p></font></strong></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">message:AsyncMessage = </span><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">new </span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">AsyncMessage();</p>
<p align="left">message.body.chatMessage = msg.text;</p>
<p align="left">producer.send(message);</p>
<p><font face="Courier New" size="2"></p>
<p align="left">msg.text =</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">""</span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">;</p>
<p align="left">}</p>
<p></span></p>
<p><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;"><strong><font face="Courier New" size="2" color="#0033ff"></p>
<p align="left">private</p>
<p></font><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></strong></span></p>
<p align="left"><span style="font-size:x-small;color:#339a66;font-family:Courier New;">function </span></p>
<p><span style="font-size:x-small;font-family:Courier New;">messageHandler(event:MessageEvent):</span></p>
<p align="left"><strong><span style="font-size:x-small;color:#0033ff;font-family:Courier New;">void</span></strong><span style="font-size:x-small;font-family:Courier New;"></p>
<p align="left">{</p>
<p><font face="Courier New" size="2"></p>
<p align="left">log.text += event.message.body.chatMessage +</p>
<p></font></span></p>
<p align="left"> </p>
<p><strong><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">"\n"</span></strong></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">;</p>
<p align="left">}</p>
<p align="left">]]&gt;</p>
<p></span></p>
<p><span style="font-size:x-small;color:#006633;font-family:Courier New;"></p>
<p align="left">&lt;/mx:Script&gt;</p>
<p></span><span style="font-size:x-small;color:#0000ff;font-family:Courier New;"><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Producer</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">producer</span><span style="font-size:x-small;font-family:Courier New;">&#8221; destination=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">chat</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;<font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Consumer</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">consumer</span><span style="font-size:x-small;font-family:Courier New;">&#8221; destination=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">chat</span></p>
<p align="left"><span style="font-size:x-small;font-family:Courier New;">&#8220;<font face="Courier New" size="2"></p>
<p align="left">message=&#8221;messageHandler(event)&#8221;</p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;<font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Panel</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">title=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">Chat</span><span style="font-size:x-small;font-family:Courier New;">&#8221; width=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8221; height=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">&gt;<font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:TextArea</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">log</span><span style="font-size:x-small;font-family:Courier New;">&#8221; width=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8221; height=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8220;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;</p>
<p align="left">&lt;mx:ControlBar&gt;</p>
<p><font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:TextInput</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">id=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">msg</span><span style="font-size:x-small;font-family:Courier New;">&#8221; width=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">100%</span><span style="font-size:x-small;font-family:Courier New;">&#8221; enter=&#8221;send()&#8221;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;<font face="Courier New" size="2" color="#0000ff"></p>
<p align="left">&lt;mx:Button</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-size:x-small;font-family:Courier New;">label=&#8221;</span><span style="font-size:x-small;color:#9a0000;font-family:Courier New;">Send</span><span style="font-size:x-small;font-family:Courier New;">&#8221; click=&#8221;send()&#8221;</span></p>
<p align="left"><span style="font-size:x-small;color:#0000ff;font-family:Courier New;">/&gt;</p>
<p align="left">&lt;/mx:ControlBar&gt;</p>
<p align="left">&lt;/mx:Panel&gt;</p>
<p align="left">&lt;/mx:Application&gt;</p>
<p></span></p>
<p><strong><span style="font-family:Times New Roman;"></p>
<p align="left">Code highlights:</p>
<p></span></strong><span style="font-family:SymbolMT;"><font face="SymbolMT"></p>
<p align="left">•</p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"><span style="font-family:Times New Roman;">At the client-side, the LCDS Message Service API provides two classes, Producer and Consumer, that you use to respectively publish and subscribe to a destination.</span></p>
<p><span style="font-family:SymbolMT;"><font face="SymbolMT"></p>
<p align="left">•</p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"><span style="font-family:Times New Roman;">To subscribe to a destination, you use the subscribe() method of the Consumer class.</span></p>
<p><span style="font-family:SymbolMT;"><font face="SymbolMT"></p>
<p align="left">•</p>
<p></font></span></p>
<p align="left"> </p>
<p><span style="font-family:Times New Roman;">When a message is published to a destination you subscribed to, the </span><strong><span style="font-family:Times New Roman;">message </span></strong></p>
<p align="left"><span style="font-family:Times New Roman;">event is triggered on the Consumer.</p>
<p align="left">7</p>
<p></span></p>
<p><span style="font-family:SymbolMT;"><font face="SymbolMT"></p>
<p align="left">•</p>
<p></font></span></p>
<p align="left"> </p>
<p align="left"><span style="font-family:Times New Roman;">In this example, messages are published by Flex clients. The LCDS message service also provides a Java API that allows a server-side component to publish messages to a LCDS destination. Another option to exchange messages between Flex and Java applications is to map destinations to JMS topics, essentially allowing a Flex client to publish and subscribe to JMS topics.</span></p>
<p><strong><span style="font-family:Arial;"></p>
<p align="left">Step 4: Test the Application</p>
<p></span></strong><span style="font-family:Times New Roman;"></p>
<p align="left">1. Run the application</p>
<p align="left">2. Open the same URL in another browser window to open a second instance of the chat application</p>
<p align="left">3. Type a message in one of the chat clients and click &#8220;Send&#8221;: the message should appear in the two chat clients</p>
<p></span><strong><span style="font-family:Arial;"></p>
<p align="left">Extra Credit</p>
<p></span></strong><span style="font-family:Times New Roman;"></p>
<p align="left">1. Add a simple TextInput to the user interface to allow the user to provide his/her name.</p>
<p align="left">2. Add the user name in the message published to the chat destination.</p>
<p align="left">3. Display the name of the author of the message along with the messvage itself in the chat TextArea.</p>
<p></span></p>
<p></strong></strong></p>
<p></strong></strong></strong></p>
<p align="left"> </p>
<p align="left"><span style="font-family:Times New Roman;"><strong>.</strong></span></p>
<p></span></em></em></em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=23&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/19/powering-flex-applicationscreating-a-chat-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Data Services</title>
		<link>http://saiselva.wordpress.com/2009/06/18/using-data-services/</link>
		<comments>http://saiselva.wordpress.com/2009/06/18/using-data-services/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 12:59:06 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=21</guid>
		<description><![CDATA[This lab further introduces &#60;mx:DataService&#62; which is used to connect to LiveCycle Data Services, seamlessly synchronizing data on both the client and the server. Create New Project Create a new project for this lab: 3. Close any existing Flex Builder projects. 4. Create a new Flex Builder project (using the same steps as used previously) [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=21&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><em><span style="font-size:large;"><span style="font-size:small;">This lab further introduces</p>
<p></span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">&lt;mx:DataService&gt; </span><span style="font-size:small;">which is used to connect to LiveCycle Data Services, seamlessly synchronizing data on both the client and the server. </span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Create New Project</p>
<p></span><span style="font-size:small;">Create a new project for this lab:</p>
<p>3. Close any existing Flex Builder projects.</p>
<p>4. Create a new Flex Builder project (using the same steps as used previously) specifying the following:</p>
<p></span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Project name </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">DataService </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Application type </span><span style="font-size:small;">= </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Web application </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Application server type </span><span style="font-size:small;">= </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">J2EE </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Use remote object access service </span><span style="font-size:small;">= checked </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">LiveCycle Data Services </span><span style="font-size:small;">= checked </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Use default location for local LiveCycle Data Services folder </span><span style="font-size:small;">= unchecked </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Root folder </span><span style="font-size:small;">= the path to the </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">lcds-samples </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Root URL </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">http://localhost:8400/lcds-samples/ </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Context root </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">/lcds-samples </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p> </p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Main Application File </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">Main.mxml </span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Enter Your Code</p>
<p></span><span style="font-size:small;">The newly created</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Main.mxml </span><span style="font-size:small;">file will contain some default code. Replace it with the following code: </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;</p>
<p>&lt;mx:Application xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221;</p>
<p>xmlns=&#8221;*&#8221;</p>
<p>backgroundColor=&#8221;#FFFFFF&#8221;</p>
<p>creationComplete=&#8221;initApp()&#8221;&gt;</p>
<p>&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[</p>
<p>public function initApp():void</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 24 </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">{</p>
<p>ds.fill(products);</p>
<p>}</p>
<p>]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p>&lt;!&#8211; Define ArrayCollection to store data &#8211;&gt;</p>
<p>&lt;mx:ArrayCollection id=&#8221;products&#8221;/&gt;</p>
<p>&lt;!&#8211; Define DataService connection &#8211;&gt;</p>
<p>&lt;mx:DataService id=&#8221;ds&#8221; destination=&#8221;inventory&#8221;/&gt;</p>
<p>&lt;!&#8211; Force Product class to be seen &#8211;&gt;</p>
<p>&lt;Product/&gt;</p>
<p>&lt;mx:DataGrid dataProvider=&#8221;{products}&#8221;</p>
<p>width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:columns&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;name&#8221;</p>
<p>headerText=&#8221;Name&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;category&#8221;</p>
<p>headerText=&#8221;Category&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;price&#8221;</p>
<p>headerText=&#8221;Price&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;image&#8221;</p>
<p>headerText=&#8221;Image&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;description&#8221;</p>
<p>headerText=&#8221;Description&#8221;/&gt;</p>
<p>&lt;/mx:columns&gt;</p>
<p>&lt;/mx:DataGrid&gt;</p>
<p>&lt;/mx:Application&gt;</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 25 </span><span style="font-size:small;">This application refers to a class (or component) named</p>
<p>6. Click on</p>
<p>7. Open the</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product</span><span style="font-size:small;">. That class does not yet exist, so if you try to compile the application now the compiler will generate an error. To create the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product </span><span style="font-size:small;">class: </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">src </span><span style="font-size:small;">in the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">DataService </span><span style="font-size:small;">project </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">File </span><span style="font-size:small;">menu and select </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">New </span><span style="font-size:small;">and then </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">ActionScript Class </span><span style="font-size:small;">8. Here is the code for</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product.as </span><span style="font-size:small;">9. In the</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">New ActionScript Class </span><span style="font-size:small;">dialog, specify the following: </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p> </p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Name </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">Product </span><span style="font-size:small;">10. Click</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Finish </span><span style="font-size:small;">Then update the new</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product.as </span><span style="font-size:small;">file so that it looks like this: </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">package</p>
<p>{</p>
<p>[Managed]</p>
<p>[RemoteClass(alias="flex.samples.product.Product")]</p>
<p>public class Product</p>
<p>{</p>
<p>public function Product()</p>
<p>{</p>
<p>}</p>
<p>public var productId:int;</p>
<p>public var name:String;</p>
<p>public var description:String;</p>
<p>public var image:String;</p>
<p>public var category:String;</p>
<p>public var price:Number;</p>
<p>public var qtyInStock:int;</p>
<p>}</p>
<p>}</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 26 </span><span style="font-size:small;">In this example, a data services destination named</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">inventory </span><span style="font-size:small;">is used by </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">&lt;mx:DataService&gt;</span><span style="font-size:small;">. This destination is defined in </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">data-management-config.xml</span><span style="font-size:small;">. </span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Test Your Code</p>
<p></span><span style="font-size:small;">You can now try out your application:</p>
<p>1. Save your changes.</p>
<p>2. Run the application. Upon startup the application will connect to LiveCycle Data Services, and synchronize the local</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">products </span><span style="font-size:small;">array with the data stored in the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">inventory </span><span style="font-size:small;">destination on the server. </span></strong></strong></em></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em></strong></span></em></strong></p>
<p><span style="font-size:small;">This lab further introduces</p>
<p></span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">&lt;mx:DataService&gt; </span><span style="font-size:small;">which is used to connect to LiveCycle Data Services, seamlessly synchronizing data on both the client and the server. </span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Create New Project</p>
<p></span><span style="font-size:small;">Create a new project for this lab:</p>
<p>3. Close any existing Flex Builder projects.</p>
<p>4. Create a new Flex Builder project (using the same steps as used previously) specifying the following:</p>
<p></span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Project name </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">DataService </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Application type </span><span style="font-size:small;">= </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Web application </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Application server type </span><span style="font-size:small;">= </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">J2EE </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Use remote object access service </span><span style="font-size:small;">= checked </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">LiveCycle Data Services </span><span style="font-size:small;">= checked </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Use default location for local LiveCycle Data Services folder </span><span style="font-size:small;">= unchecked </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Root folder </span><span style="font-size:small;">= the path to the </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">lcds-samples </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Root URL </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">http://localhost:8400/lcds-samples/ </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Context root </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">/lcds-samples </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p> </p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Main Application File </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">Main.mxml </span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Enter Your Code</p>
<p></span><span style="font-size:small;">The newly created</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Main.mxml </span><span style="font-size:small;">file will contain some default code. Replace it with the following code: </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;</p>
<p>&lt;mx:Application xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221;</p>
<p>xmlns=&#8221;*&#8221;</p>
<p>backgroundColor=&#8221;#FFFFFF&#8221;</p>
<p>creationComplete=&#8221;initApp()&#8221;&gt;</p>
<p>&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[</p>
<p>public function initApp():void</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 24 </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">{</p>
<p>ds.fill(products);</p>
<p>}</p>
<p>]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p>&lt;!&#8211; Define ArrayCollection to store data &#8211;&gt;</p>
<p>&lt;mx:ArrayCollection id=&#8221;products&#8221;/&gt;</p>
<p>&lt;!&#8211; Define DataService connection &#8211;&gt;</p>
<p>&lt;mx:DataService id=&#8221;ds&#8221; destination=&#8221;inventory&#8221;/&gt;</p>
<p>&lt;!&#8211; Force Product class to be seen &#8211;&gt;</p>
<p>&lt;Product/&gt;</p>
<p>&lt;mx:DataGrid dataProvider=&#8221;{products}&#8221;</p>
<p>width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:columns&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;name&#8221;</p>
<p>headerText=&#8221;Name&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;category&#8221;</p>
<p>headerText=&#8221;Category&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;price&#8221;</p>
<p>headerText=&#8221;Price&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;image&#8221;</p>
<p>headerText=&#8221;Image&#8221;/&gt;</p>
<p>&lt;mx:DataGridColumn dataField=&#8221;description&#8221;</p>
<p>headerText=&#8221;Description&#8221;/&gt;</p>
<p>&lt;/mx:columns&gt;</p>
<p>&lt;/mx:DataGrid&gt;</p>
<p>&lt;/mx:Application&gt;</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 25 </span><span style="font-size:small;">This application refers to a class (or component) named</p>
<p>6. Click on</p>
<p>7. Open the</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product</span><span style="font-size:small;">. That class does not yet exist, so if you try to compile the application now the compiler will generate an error. To create the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product </span><span style="font-size:small;">class: </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">src </span><span style="font-size:small;">in the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">DataService </span><span style="font-size:small;">project </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">File </span><span style="font-size:small;">menu and select </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">New </span><span style="font-size:small;">and then </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">ActionScript Class </span><span style="font-size:small;">8. Here is the code for</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product.as </span><span style="font-size:small;">9. In the</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">New ActionScript Class </span><span style="font-size:small;">dialog, specify the following: </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p> </p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Name </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">Product </span><span style="font-size:small;">10. Click</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Finish </span><span style="font-size:small;">Then update the new</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Product.as </span><span style="font-size:small;">file so that it looks like this: </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">package</p>
<p>{</p>
<p>[Managed]</p>
<p>[RemoteClass(alias="flex.samples.product.Product")]</p>
<p>public class Product</p>
<p>{</p>
<p>public function Product()</p>
<p>{</p>
<p>}</p>
<p>public var productId:int;</p>
<p>public var name:String;</p>
<p>public var description:String;</p>
<p>public var image:String;</p>
<p>public var category:String;</p>
<p>public var price:Number;</p>
<p>public var qtyInStock:int;</p>
<p>}</p>
<p>}</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 26 </span><span style="font-size:small;">In this example, a data services destination named</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">inventory </span><span style="font-size:small;">is used by </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">&lt;mx:DataService&gt;</span><span style="font-size:small;">. This destination is defined in </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">data-management-config.xml</span><span style="font-size:small;">. </span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Test Your Code</p>
<p></span><span style="font-size:small;">You can now try out your application:</p>
<p>1. Save your changes.</p>
<p>2. Run the application. Upon startup the application will connect to LiveCycle Data Services, and synchronize the local</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">products </span><span style="font-size:small;">array with the data stored in the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">inventory </span><span style="font-size:small;">destination on the server. </span></strong></strong></em></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=21&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/18/using-data-services/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
		<item>
		<title>Producing And Consuming Complex Data (Optional)</title>
		<link>http://saiselva.wordpress.com/2009/06/18/producing-and-consuming-complex-data-optional/</link>
		<comments>http://saiselva.wordpress.com/2009/06/18/producing-and-consuming-complex-data-optional/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 12:49:31 +0000</pubDate>
		<dc:creator>saiselva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://saiselva.wordpress.com/?p=18</guid>
		<description><![CDATA[This optional lab adds functionality to the chat application created in Lab 6, displaying a popup window to prompt for a login, and passing multiple items in the message body. Enter Your Code This lab updates the project created in the previous lab. It requires the creation of a new MXML component in your project. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=18&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:small;">This optional lab adds functionality to the chat application created in Lab 6, displaying a popup window to prompt for a login, and passing multiple items in the message body.</p>
<p></span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Enter Your Code</p>
<p></span><span style="font-size:small;">This lab updates the project created in the previous lab. It requires the creation of a new MXML component in your project. The new component, named</p>
<p>1. Click on</p>
<p>2. Open the</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Login.mxml</span><span style="font-size:small;">, is the popup login window, and is based on </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">&lt;mx:TitleWindow&gt;. </span><span style="font-size:small;">To add this component: </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">src </span><span style="font-size:small;">in the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Chat </span><span style="font-size:small;">project </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">File </span><span style="font-size:small;">menu and select </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">New </span><span style="font-size:small;">and then </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">MXML Component </span><span style="font-size:small;">3. Here is the code for</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Login.mxml </span><span style="font-size:small;">4. In the</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">New MXML Component </span><span style="font-size:small;">dialog, specify the following: </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Filename </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">Login </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Based on </span><span style="font-size:small;">= </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">TitleWindow </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Width </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">300 </span><span style="font-size:small;font-family:Courier New,Courier New;">o</p>
<p> </p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Height </span><span style="font-size:small;">= </span><span style="font-size:small;font-family:Lucida Console,Lucida Console;">150 </span><span style="font-size:small;">5. Click</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Finish </span><span style="font-size:small;">Then update the new</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Login.mxml </span><span style="font-size:small;">component so that it looks like this: </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;utf-8&#8243;?&gt;</p>
<p>&lt;mx:TitleWindow xmlns:mx=&#8221;http://www.adobe.com/2006/mxml&#8221;</p>
<p>width=&#8221;300&#8243; height=&#8221;150&#8243;</p>
<p>title=&#8221;Login&#8221;</p>
<p>creationComplete=&#8221;PopUpManager.centerPopUp(this)&#8221;&gt;</p>
<p>&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[</p>
<p>import mx.managers.PopUpManager;</p>
<p>private function processLogin():void</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 20 </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">{</p>
<p>// Save the handle</p>
<p>parentApplication.nickname=nickname.text;</p>
<p>// Close popup window</p>
<p>PopUpManager.removePopUp(this);</p>
<p>}</p>
<p>]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p>&lt;!&#8211; Login form &#8211;&gt;</p>
<p>&lt;mx:Form width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:FormItem label=&#8221;Name:&#8221; width=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:TextInput id=&#8221;nickname&#8221; width=&#8221;100%&#8221;</p>
<p>enter=&#8221;processLogin();&#8221; /&gt;</p>
<p>&lt;/mx:FormItem&gt;</p>
<p>&lt;mx:FormItem width=&#8221;100%&#8221;&gt;</p>
<p>&lt;mx:Button label=&#8221;Login&#8221;</p>
<p>click=&#8221;processLogin();&#8221; /&gt;</p>
<p>&lt;/mx:FormItem&gt;</p>
<p>&lt;/mx:Form&gt;</p>
<p>&lt;/mx:TitleWindow&gt;</p>
<p></span><span style="font-size:small;">To use this code you will also need to update the</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">&lt;mx:Script&gt; </span><span style="font-size:small;">block in </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Main.mxml</span><span style="font-size:small;">. Here is the updated code (to make editing the code easier, changed code has been highlighted below): </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">&lt;mx:Script&gt;</p>
<p>&lt;![CDATA[</p>
<p>import mx.messaging.messages.AsyncMessage;</p>
<p>import mx.messaging.messages.IMessage;</p>
<p>import mx.managers.PopUpManager;</p>
<p>import mx.core.IFlexDisplayObject;</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 21 </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">// User handle</p>
<p>[Bindable]</p>
<p>public var nickname:String=&#8221;Guest&#8221;;</p>
<p>// On startup</p>
<p>private function initApp():void</p>
<p>{</p>
<p>// Subscribe to chat</p>
<p>consumer.subscribe();</p>
<p>// Create login window</p>
<p>var loginWindow:IFlexDisplayObject =</p>
<p>PopUpManager.createPopUp(this, Login, true);</p>
<p>}</p>
<p>// Send chat message</p>
<p>private function send():void</p>
<p>{</p>
<p>var message:IMessage = new AsyncMessage();</p>
<p>message.body.sender = nickname;</p>
<p>message.body.chatMessage = msg.text;</p>
<p>producer.send(message);</p>
<p>msg.text = &#8220;&#8221;;</p>
<p>}</p>
<p>// Process received chat message</p>
<p>private function messageHandler(message:IMessage):void</p>
<p>{</p>
<p>log.text +=</p>
<p>message.body.sender + &#8220;: &#8221; +</p>
<p>message.body.chatMessage + &#8220;\n&#8221;;</p>
<p></span><span style="font-size:xx-small;">Getting Started With Real Time Flex &amp; AIR Via Live Cycle Data Services Page 22 </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">}</p>
<p>]]&gt;</p>
<p>&lt;/mx:Script&gt;</p>
<p></span><span style="font-size:small;">And finally, in file</p>
<p></span><strong><span style="font-size:small;font-family:Calibri,Calibri;">Main.mxml</span><span style="font-size:small;">, locate the line with the </span><strong><span style="font-size:small;font-family:Calibri,Calibri;">&lt;mx:Panel&gt; </span><span style="font-size:small;">tag. You’ll want to update this so that it shows the name of the logged in user. Update the title attribute so that the tag looks like this: </span><span style="font-size:xx-small;font-family:Lucida Console,Lucida Console;">&lt;mx:Panel title=&#8221;Chat [{nickname}]&#8220;</p>
<p>width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;</p>
<p></span><strong><em><span style="font-size:medium;font-family:Cambria,Cambria;">Test Your Code</p>
<p></span><span style="font-size:small;">You should now try out your application:</p>
<p>1. Save your changes.</p>
<p>2. Run the application twice (you need to be running two or more copies to be able to chat). This time each window will prompt you to login. Any text typed in one chat window is echoed in all other chat windows, and the displayed text will correctly identify the user who sent it.</p>
<p></span></em></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em></strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/saiselva.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/saiselva.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/saiselva.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/saiselva.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/saiselva.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/saiselva.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/saiselva.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/saiselva.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/saiselva.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/saiselva.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/saiselva.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/saiselva.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/saiselva.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/saiselva.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=saiselva.wordpress.com&amp;blog=8179639&amp;post=18&amp;subd=saiselva&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://saiselva.wordpress.com/2009/06/18/producing-and-consuming-complex-data-optional/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/5385dcd2cf6fc2788002b03cbb089186?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">saiselva</media:title>
		</media:content>
	</item>
	</channel>
</rss>
