<?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>Program your code</title>
	<atom:link href="http://expresscode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://expresscode.wordpress.com</link>
	<description></description>
	<lastBuildDate>Tue, 08 Mar 2011 18:40:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='expresscode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Program your code</title>
		<link>http://expresscode.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://expresscode.wordpress.com/osd.xml" title="Program your code" />
	<atom:link rel='hub' href='http://expresscode.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Reusable Custom HeaderRenderer for AdvancedDataGrid control</title>
		<link>http://expresscode.wordpress.com/2008/12/05/reusable-custom-headerrenderer-for-advanceddatagrid-control/</link>
		<comments>http://expresscode.wordpress.com/2008/12/05/reusable-custom-headerrenderer-for-advanceddatagrid-control/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 14:21:32 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[adobe]]></category>
		<category><![CDATA[AdvancedDataGrid]]></category>
		<category><![CDATA[custom controls]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[headerRenderer]]></category>
		<category><![CDATA[itemrenderer]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/?p=69</guid>
		<description><![CDATA[Problem Statement: Create a custom headerRender for the AdvancedDataGrid column with a checkbox control embeded and adhering to the following functional requirements support(retain) the column sort functionality must be a reusable component (no tight coupling) easy to extend and plugin to use in any other grid control Use Case: Provide the Select All rowItems functionality [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=69&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Problem Statement:</strong></p>
<p>Create a custom headerRender for the AdvancedDataGrid column with a checkbox control embeded and adhering to the following functional requirements</p>
<ul>
<li>support(retain) the column sort functionality</li>
<li>must be a reusable component (no tight coupling)</li>
<li>easy to extend and plugin to use in any other grid control</li>
</ul>
<p><strong>Use Case:</strong></p>
<p>Provide the <em>Select All</em> rowItems functionality for the grid column. Each row item will have a checkbox to allow its (un)selection.</p>
<p><strong>Solution:</strong></p>
<p>The Select All functionality for all the row items in the grid is a very common requirement for any application, but however before implementing we need to be clear about the dataProvider as well.</p>
<p><em>Will the dataProvider for the grid have dataFields, which can be binded to the state of the checkbox in the column header and for each of the row items?</em></p>
<p>If the dataProvider contains dataFields which can be binded to the UI it is fairly simple to handle the use case, but if the SelectAll is purely a UI operation for populating the list of selected items for further processing, then it becomes little more challenging.</p>
<p>One more challenge here is to preserve the sort functionality for the column, as any custom implementation of the headerRenderer or any component being used as the headerRenderer will strip off the sort functionality for the column. Check it out for yourself if you dont believe it.</p>
<p>Here is the approach that I followed to address the constraint on</p>
<p>&gt;ReUsability: Program to an interface and avoid tight coupling with the parentDocument while handling the communication and binding with the grid.</p>
<p>&gt;Extensibility: Encapsulate the behaviour in the class as a separate .as file extending UIComponent and provide the customizable behaviour in the  virtual methods which cane be overriden if required by the derived classes.</p>
<p>There are two approaches to implement the checkbox headerRenderer</p>
<p><strong>Appraoch 1: </strong>Specify any implementation of UIComponent (say CustomCheckbox) as a headerRenderer for the grid column</p>
<p>But then you need to be prepared to handle the layout and rendering of the sortItemRenderer inorder to provide the sort functionality on the column. Also you need to be prepared to hook onto the instance of the headerRenderer for communication with the grid as you will be stumped to discover that the grid creates a new instance of the headerRenderer every now and then. Possible work around for this is to create the instance of the headerRenderer as an instance of the classFactory and store it as a bindable value in the parentDocument. After managing all of it you still need to be able to differentiate between a click to Sort and click to SelectAll by putting in vague logic based on the position of mouse click. I hope you agree that it cant get simpler than this <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Approach 2:</strong> Implement the custom headerRenderer by extending the default AdvancedDataGridHeaderRender implementation and specify it in the grid column</p>
<p>This approach looks the obvious natural choice but then you need to know how and where to insert the custom implementation. Refer to <a href="http://expresscode.wordpress.com/2008/12/05/creating-a-custom-flex-uicomponent/" target="_self">my pos</a>t on creating custom Flex controls for more info on it. Also you need to be able to differentiate between a click to Sort and click to SelectAll, which I managed it by controling the sort property of the column in response to mouse hover <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  . Look below for the <em>OnMouseRollOver </em>method<em>.</em></p>
<p><span style="color:#99cc00;"><strong>Show me the source code:</strong></span><span id="more-69"></span></p>
<p><strong>Here is the code for CheckboxHeaderRender.as:</strong></p>
<p><pre class="brush: java;">
import flash.display.DisplayObject;
	import flash.events.MouseEvent;

	import mx.controls.AdvancedDataGrid;
	import mx.controls.CheckBox;
	import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
	import mx.controls.advancedDataGridClasses.AdvancedDataGridHeaderRenderer;
	import mx.core.UITextField;

	//Customizes the default AdvancedDataGridHeaderRenderer by displaying the checkbox in the header to
	//provide the SelectAll functionality in the grid. It uses the default sortItemRenderer of the grid, if not specified.
	public class CheckboxHeaderRenderer extends AdvancedDataGridHeaderRenderer
	{
		//stores the associated column
		private var _gridColumn:AdvancedDataGridColumn;
		//the checkBox control to be added as a child control
		private var checkBox:CheckBox;
		//stores the parentDocument(HostControl)
		private var _hostControl:IGridHostControl=null;
		//stores the default leftPadding for the checkbox control
		private const LEFT_PADDING:int = 5;

		//constructor
		public function CheckboxHeaderRenderer()
		{

			super();

			this.id = &quot;checkboxHeaderRenderer&quot;;
			//initialize the checkbox control
			checkBox = new CheckBox();
			checkBox.label=&quot;&quot;;		 

			//BindingUtils.bindProperty(checkBox,&quot;selected&quot;,HostControl,&quot;allSelected&quot;);

			//subscribe to the events of interest...
			checkBox.addEventListener(MouseEvent.CLICK,OnCheckboxClick);
			addEventListener(MouseEvent.ROLL_OVER,OnMouseRollOver);
		}

		//gets the associated dataGrid column
		private function get gridColumn():AdvancedDataGridColumn{
			if(_gridColumn == null){
				_gridColumn = data as AdvancedDataGridColumn;
			}
			return _gridColumn;
		}

		////////////////////// EVENT Handlers ////////////////////////////

		//Response to Mouse RollOver event
		private function OnMouseRollOver(event:MouseEvent):void{

			//control the sortable property of the column
			if(event.localX &gt; checkBox.x + checkBox.measuredWidth){
				if(gridColumn != null){
					gridColumn.sortable = true;
				}
			}
			else{
				if(gridColumn != null){
					gridColumn.sortable = false;
				}
			}
		}

		//response to the click event on the checkbox
		private function OnCheckboxClick(event:MouseEvent):void{

			//(un)select the items
			if(HostControl != null){

				HostControl.ToggleSelectionList(checkBox.selected);
			} 

			//refresh the UI
			if(listData != null){

				var grid:AdvancedDataGrid = listData.owner as AdvancedDataGrid;
				if(grid != null){
					grid.invalidateList();
				}
			}
		}

		////////////////////// VIRTUAL Methods ////////////////////////////

		//gets the associated HostControl(ParentDocument)
		//The ParentDocument control hosting the AdvancedDataGrid must implement IGridHostControl
		//Returns Null, if the HostControl(ParentDocument) doesn't implement IGridHostControl
		public virtual function get HostControl():IGridHostControl{

			if(_hostControl == null){
				_hostControl = this.parentDocument as IGridHostControl;
			}
			return _hostControl;
		}	 

		//gets the left padding for the checkbox in the header
		public virtual function get LeftPadding():int{

			if(HostControl != null){

				return HostControl.LeftPadding_CheckboxHeaderColumn;
			}

			return LEFT_PADDING;
		}

		////////////////////// OVERRIDEN Methods ////////////////////////////

		//overriden to add the custom components
		override protected function createChildren():void{

			super.createChildren();

			addChild(checkBox);

		}

		//performs the layout of the child controls
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void{

			super.updateDisplayList(unscaledWidth,unscaledHeight);

			var textLabel:UITextField;
			var n:int = numChildren;
            for (var i:int = 0; i &lt; n; i++)
            {
                var c:DisplayObject = getChildAt(i);

                if (c is CheckBox)
                {
                    c.x = LeftPadding;
                    c.y = (unscaledHeight - c.height)/2;                    

                }else if(c is UITextField){

                	textLabel = c as UITextField;
                }
            }

            //check to avoid overllaping of text on the checkbox
            var xMin_text:int = checkBox.x + checkBox.measuredWidth;
            if(textLabel !=null &amp;&amp; textLabel.x &lt; xMin_text){

            	textLabel.x = xMin_text;
            	textLabel.truncateToFit();

            }

		}

		//override to bind the checkbox state
		override protected function commitProperties():void{

			//set the properties of the checkBox
			if(HostControl != null){
				checkBox.selected = HostControl.AllSelected;
			}
			super.commitProperties();
		}

	}
</pre></p>
<p><strong>Here is the code for IGridHostControl.as:</strong></p>
<p><pre class="brush: java;">
//Contract that must be implemented by the UIComponent hosting(i.e, acting as a parentDocument for)
 //the AdvancedDataGrid(ADG) control that intends to use the CheckboxHeaderRenderer implementation
 //as a customHeader for its ADG column.
 public interface IGridHostControl
 {

 //gets the value of the Binding variable for the checkBox state in the custom header of the ADG
 function get AllSelected():Boolean;

 //sets the value of the Binding variable for the checkBox state in the custom header of the ADG
 function set AllSelected(value:Boolean):void;

 //Adds/Removes all the items to/from the selection list
 function ToggleSelectionList(selectedState:Boolean):void;

 //synchronize the header checkBox with its binding variable
 //This method is used to synchronize the checkBox in the header, when its binding variable is changed
 function UpdateHeaderSelection(selectedState:Boolean):void;

 //gets the Left padding to be associated with the checkbox control in the column header renderer
 function get LeftPadding_CheckboxHeaderColumn():int;

}
</pre></p>
<p>The parentDocument must implement the IGridHostControl interface to use CheckboxHeaderRenderer as the headerRenderer for the grid column.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=69&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2008/12/05/reusable-custom-headerrenderer-for-advanceddatagrid-control/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a custom component in Flex</title>
		<link>http://expresscode.wordpress.com/2008/12/05/creating-a-custom-flex-uicomponent/</link>
		<comments>http://expresscode.wordpress.com/2008/12/05/creating-a-custom-flex-uicomponent/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 09:36:03 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[adobe]]></category>
		<category><![CDATA[custom controls]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/?p=54</guid>
		<description><![CDATA[In this post I intend to provide pointers to appropriate methods in order to customize a specific UIComponent implementation. As all controls extend the UIComponent class,  hence some of the common methods you might want to override are createChildren(): Add the child controls in the custom control here. More Info commitProperties(): Update/Bind the properties of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=54&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="summarySignature">In this post I intend to provide pointers to appropriate methods in order to customize a specific <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html" target="_blank">UIComponent </a>implementation.</div>
<div class="summarySignature">As all controls extend the <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html" target="_blank">UIComponent</a> class,  hence some of the common methods you might want to override are</div>
<p class="summarySignature">
<div class="summarySignature">
<p><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#createChildren%28%29">createChildren</a>(): Add the child controls in the custom control here. <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&amp;file=ascomponents_advanced_148_11.html" target="_blank">More Info<br />
</a></p>
<p><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#commitProperties%28%29">commitProperties</a>(): Update/Bind the properties of the child controls in the custom control here. This is the last method to be called before rendering, hence it is a good place to update the properties of the child controls to acheive the binding . <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&amp;file=ascomponents_advanced_148_12.html" target="_blank">More Info<br />
</a></p>
<p><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#measure%28%29">measure</a>(): Handle the computation of the min/max values of the width, height and other dimensions of the custom component here. <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&amp;file=ascomponents_advanced_148_13.html" target="_blank">More Info<br />
</a></p>
<div class="summarySignature">
<div class="summarySignature">
<p><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#updateDisplayList%28%29">updateDisplayList</a>(): Specify the location(co-ordinates) of the child controls and handle the programmatic drawing here. <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_Parts&amp;file=ascomponents_advanced_148_16.html" target="_blank">More Info<br />
</a></div>
<p>We would not require to make an explict call to any of the methods above as they are called by the Flex framework itself, we only need to plugin in the custom code in the invocation sequence appropriately. Refer to the link &#8220;<em>More Info</em>&#8221; for a comprehensive documentation of the usage of the methods.</p>
<p>We may not need to override all of them, but it is important to know the appropriate method to be overriden. Also do not forget to call the implementation of the base class unless you are really sure to do so.</p></div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=54&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2008/12/05/creating-a-custom-flex-uicomponent/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Let&#8217;s master the Flex Controls</title>
		<link>http://expresscode.wordpress.com/2008/12/05/lets-master-the-flex-controls/</link>
		<comments>http://expresscode.wordpress.com/2008/12/05/lets-master-the-flex-controls/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 06:33:08 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[adobe]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/?p=48</guid>
		<description><![CDATA[All Flex controls extend the UIComponent, hence understanding the initialization and rendering of the UIComponent will be very useful for customizing and making all other flex controls work for you. The first obvious step would be to look at the source code implementation located at &#60;Flex 3.1.0 SDK Installation Directory\frameworks\projects\framework\src\mx\core\UIComponent.as&#62; In my opinion the most [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=48&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>All Flex controls extend the <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html" target="_blank">UIComponent</a>, hence understanding the initialization and rendering of the <a title="opens in new window" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html" target="_blank">UIComponent</a> will be very useful for customizing and making all other flex controls work for you.</p>
<p>The first obvious step would be to look at the source code implementation located at <strong><em>&lt;Flex 3.1.0 SDK Installation Directory\frameworks\projects\framework\src\mx\core\UIComponent.as&gt;</em></strong></p>
<p>In my opinion<strong><em> </em></strong>the most effective approach for creating your own custom controls is to extend them from the base controls and customize by overriding and digging into the source code of the base controls.</p>
<p>Some of the common methods, that you might want to override in your custom component are</p>
<div class="summarySignature">
<ul>
<li><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#createChildren%28%29">createChildren</a>():<a href="http://livedocs.adobe.com/flex/201/langref/specialTypes.html#void">void<br />
</a></li>
<li>
<div class="summarySignature"><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#commitProperties%28%29">commitProperties</a>():<a href="http://livedocs.adobe.com/flex/201/langref/specialTypes.html#void">void</a></div>
</li>
<li>
<div class="summarySignature"><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#measure%28%29">measure</a>():<a href="http://livedocs.adobe.com/flex/201/langref/specialTypes.html#void">void</a></div>
</li>
<li>
<div class="summarySignature"><a class="signatureLink" href="http://livedocs.adobe.com/flex/201/langref/mx/core/UIComponent.html#updateDisplayList%28%29">updateDisplayList</a>(unscaledWidth:<a href="http://livedocs.adobe.com/flex/201/langref/Number.html">Number</a>, unscaledHeight:<a href="http://livedocs.adobe.com/flex/201/langref/Number.html">Number</a>):<a href="http://livedocs.adobe.com/flex/201/langref/specialTypes.html#void">void</a></div>
</li>
</ul>
</div>
<p>Refer to the <a href="http://expresscode.wordpress.com/2008/12/05/creating-a-custom-flex-uicomponent/" target="_self">next post</a> for creating the custom flex UIComponent</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=48&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2008/12/05/lets-master-the-flex-controls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting started with Flex development</title>
		<link>http://expresscode.wordpress.com/2008/12/04/getting-started-with-flex-development/</link>
		<comments>http://expresscode.wordpress.com/2008/12/04/getting-started-with-flex-development/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 10:11:44 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/?p=36</guid>
		<description><![CDATA[Best Practices related to : Flex project and workspace: http://www.adobe.com/devnet/flex/articles/best_practices_pt1.html Flex Development: http://www.adobe.com/devnet/flex/articles/best_practices_pt2.html Coding Conventions: http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions If you are new to Flex and coming from a .NET background, you might want to map the coding guidelines and FlexBuilder(eclipse) environment to that of the msdn guidelines and VS IDE. Best Practices help you in getting the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=36&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Best Practices related to :</p>
<ul>
<li>Flex project and workspace:</li>
</ul>
<p style="padding-left:30px;"><a title="opens in new window" href="http://www.adobe.com/devnet/flex/articles/best_practices_pt1.html" target="_blank">http://www.adobe.com/devnet/flex/articles/best_practices_pt1.html</a></p>
<ul>
<li>Flex Development:</li>
</ul>
<p style="padding-left:30px;"><span style="color:#c0c0c0;"><span style="font-family:Calibri;font-size:11pt;"> </span></span><a title="opens in new window" href="http://www.adobe.com/devnet/flex/articles/best_practices_pt2.html" target="_blank"></a><a title="http://www.adobe.com/devnet/flex/articles/best_practices_pt2.html" href="http://www.adobe.com/devnet/flex/articles/best_practices_pt2.html">http://www.adobe.com/devnet/flex/articles/best_practices_pt2.html</a></p>
<ul>
<li>Coding Conventions:</li>
</ul>
<p style="padding-left:30px;"><a title="opens in new window" href="http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions" target="_blank">http://opensource.adobe.com/wiki/display/flexsdk/Coding+Conventions</a></p>
<p class="MsoNormal">
<p class="MsoNormal">If you are new to Flex and coming from a .NET background, you might want to map the coding guidelines and FlexBuilder(eclipse) environment to that of the msdn guidelines and VS IDE.</p>
<p class="MsoNormal">Best Practices help you in getting the fundamentals right and are extremely useful especially when you are just getting started with flex. Also clarity in concepts related to workspace and flex project environment  will save you a lot of effort in overcoming the small yet annoying problems.</p>
<p class="MsoNormal">
<p class="MsoNormal">
<p class="MsoNormal"><span style="color:#c0c0c0;"><span style="font-family:Calibri;font-size:11pt;"><br />
</span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=36&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2008/12/04/getting-started-with-flex-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Source Code for Flex 3</title>
		<link>http://expresscode.wordpress.com/2008/12/03/source-code-flex3/</link>
		<comments>http://expresscode.wordpress.com/2008/12/03/source-code-flex3/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 09:36:56 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[adobe]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/?p=22</guid>
		<description><![CDATA[You might want to check out Flex opensource If you have the FlexBuilder already installed, you would be pleasantly surprised to discover it on your hard disk All the action script files for flex controls can be found at &#60;FlexBuilder installation directory\ Flex Builder 3\sdks\3.1.0\frameworks\projects\framework\src\mx\controls&#62; &#60;FlexBuilder installation directory\Flex Builder 3\sdks\3.1.0\fbpro\projects\datavisualization\src\mx\controls&#62; If you want to start [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=22&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You might want to check out <a title="opens in new window" href="http://opensource.adobe.com/wiki/display/flexsdk/Get+Source+Code" target="_blank">Flex opensource</a></p>
<p>If you have the FlexBuilder already installed, you would be pleasantly surprised to discover it on your hard disk <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>All the action script files for flex controls can be found at</p>
<ul>
<li>&lt;FlexBuilder installation directory\ Flex Builder 3\sdks\3.1.0\frameworks\projects\framework\src\mx\controls&gt;</li>
<li>&lt;FlexBuilder installation directory\Flex Builder 3\sdks\3.1.0\fbpro\projects\datavisualization\src\mx\controls&gt;</li>
</ul>
<p>If you want to start using and customizing the flex controls, the source code of the base controls is your saviour.</p>
<p>In my opinion, reference to the source code of the base controls must be the first step for anybody trying to customize the base controls. It was really surprising that I have not come across any documentation or pointers for locating the source code of the flex controls or probably I havent spent enough time in exploring what packages along with the flex sdk.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=22&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2008/12/03/source-code-flex3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Building RIA using Flex 3</title>
		<link>http://expresscode.wordpress.com/2008/12/02/getting-started-with-ria/</link>
		<comments>http://expresscode.wordpress.com/2008/12/02/getting-started-with-ria/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 13:02:57 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/?p=19</guid>
		<description><![CDATA[I had an opportunity to explore Adobe Flex 3 for a couple of weeks. I would be sharing my experience and findings in the posts to follow here&#8230; Initial feeling is that it is really cool technology for web development because &#62;of its very rich UI &#62;its open source, the entire source code is available [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=19&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I had an opportunity to explore Adobe Flex 3 for a couple of weeks. I would be sharing my experience and findings in the posts to follow here&#8230;</p>
<p>Initial feeling is that it is really cool technology for web development because</p>
<p>&gt;of its very rich UI</p>
<p>&gt;its open source, the entire source code is available</p>
<p>&gt;development is independent of the browser, as the Flash player takes care of all the issues relating to the  browser</p>
<p>But then the not so attractive things are</p>
<p>&gt;its not as developer friendly as the tools from Microsoft</p>
<p>&gt;Flex 3 doesnt have the strong type casting</p>
<p>&gt;the UI controls are not as intutive and object oriented as the windows controls. Dont be surprised to find out that the Tree control doesnt really have any nodes and the Grid doesnt have any rows.</p>
<p>&gt;the documentation and IDE, when compared to msdn and VS.NET IDE</p>
<p>But the availability of the source code makes it comforting for you to dig down and get the job done.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=19&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2008/12/02/getting-started-with-ria/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Challenges in implementing the Undo Redo functionality</title>
		<link>http://expresscode.wordpress.com/2007/06/17/challenges-in-implementing-the-undo-redo-functionality/</link>
		<comments>http://expresscode.wordpress.com/2007/06/17/challenges-in-implementing-the-undo-redo-functionality/#comments</comments>
		<pubDate>Sun, 17 Jun 2007 18:32:22 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Undo/Redo]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/2007/06/17/challenges-in-implementing-the-undo-redo-functionality/</guid>
		<description><![CDATA[Here are some of the points to be noted Undo/Redo is an EDIT operation Operation1 + Undo(on Operation1) = 2 Edit operations. This will mean that the state of the object(lastModified) is changed even though there is no change in the content. Hence any mechanism to know whether there are any changes made to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=13&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here are some of the points to be noted</p>
<ul>
<li>Undo/Redo is an <b>EDIT</b> operation</li>
</ul>
<p>Operation1 + Undo(on Operation1) =  2 Edit operations.</p>
<p>This will mean that the state of the object(lastModified) is changed even though there is no change in the content.</p>
<p>Hence any mechanism to know whether there are any changes made to the ObjectModel state must be based on the difference in the content and cannot just be based on its lastModified info.</p>
<ul>
<li> Maintaining the edits in a Stack(FirstInLastOut behaviour) will enforce the undo/redo implementation to be sequential in the  reverse order in which the operations were performed.  It cannot offer the  flexibility to offer  the  undo/redo  functionality for the  edits  which need not correspond to the latest edit operation.</li>
</ul>
<ul>
<li>Each edit must implement the CanUndo() and CanRedo()  to validate the undo/redo operation. This is very essential to ensure that the object model on which edit operation is performed via the undo/redo implementation does not push the underlying object model to an Invalid state.</li>
</ul>
<p>Each edit might have a cached object instance associated with it when the edit is initialized. When trying to perform the Undo/Redo operation using the cached object, validation is must to ensure that using the cached object doesnt push the underlying object model to an Invalid State, resulting in a total disaster.</p>
<ul>
<li>Each edit must implement  Dispose() to ensure that objects cached in the edit are disposed and they don&#8217;t eat up the memory.</li>
</ul>
<p><i>In addition to all these, for a robust implementation of undo/redo here are some tips</i></p>
<p>1. Undo Redo for an edit operation on the objectModel should only be dependent on the objects in the objectModel. It should never be dependent on the objects used in the UI which are used for displaying the content of the objectModel.</p>
<p>2.  Always update the object model before updating the UI, so that the UI displayed will always truly represents the object model.</p>
<p>3. The undo/redo implementation will deal with cached instance of the object model but working with caching instances of the UI objects should be avoided and instead the UI objects which represent the object model must be retreived at run time.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/expresscode.wordpress.com/13/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/expresscode.wordpress.com/13/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=13&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2007/06/17/challenges-in-implementing-the-undo-redo-functionality/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Implementing Undo/Redo</title>
		<link>http://expresscode.wordpress.com/2007/06/17/implementing-undoredo/</link>
		<comments>http://expresscode.wordpress.com/2007/06/17/implementing-undoredo/#comments</comments>
		<pubDate>Sun, 17 Jun 2007 17:24:23 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Undo/Redo]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/2007/06/17/implementing-undoredo/</guid>
		<description><![CDATA[Here is a code snippet for implementing the Undo/Redo. Sample Code<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=12&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is a code snippet for implementing the Undo/Redo.</p>
<p><span style="text-decoration:underline;"><strong>Sample Code </strong></span></p>
<p><pre class="brush: csharp;">&lt;/pre&gt;
//interface defining the edit
 &lt;strong&gt; public interface IUndoableEdit&lt;/strong&gt;
 {

//Perform the Undo operation
 bool Undo();

//Perform the Redo operation
 bool Redo();

//validates whether Undo operation can be performed on this edit   //in the current context
 bool CanUndo();

//validates whether Redo operation can be performed on this edit   //in the current context
 bool CanRedo();

void Dispose();

}

//Class providing the infrastructure for manging the IUndoableEdits
 &lt;strong&gt; public class UndoStack&lt;/strong&gt;
 {
 //stack is used to store the edits..First In Last Out

private Stack undoStack;
 private Stack redoStack;

public UndoStack()
 {
 //initialize the stack
 redoStack = new Stack(100);
 undoStack = new Stack(100);
 }

public void AddEdit(IUndoableEdit  edit)
 {
 //validate input arguments
 undoStack.Push(edit);
 }

//Clear all the edits stored in the Stack.
 public void ClearAll()
 {
 undoStack.Clear();
 redoStack.Clear();
 }

public void Undo()
 {
 if(undoStack.Count == 0)
 {
 Console.Beep();
 return;
 }

IUndoableEdit edit = undoStack.Pop();

if(edit.CanUndo() &amp;&amp; edit.Undo())
 {
 if(edit.CanRedo() )
 {
 redoStack.Push(edit)
 }
 }
 else
 {
 edit.Dispose();
 }

}

public void Redo()
 {
 if(redoStack.Count == 0)
 {
 Console.Beep();
 return;
 }

IUndoableEdit edit = redoStack.Pop();

if(edit.CanRedo() &amp;&amp; edit.Redo())
 {
 if(edit.CanUndo() )
 {
 undoStack.Push(edit)
 }
 }
 else
 {
 edit.Dispose();
 }

}

}
&lt;pre&gt;</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/expresscode.wordpress.com/12/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/expresscode.wordpress.com/12/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/12/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/12/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/12/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=12&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2007/06/17/implementing-undoredo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Explore the Undo/Redo &#8211; Part II</title>
		<link>http://expresscode.wordpress.com/2007/05/20/explore-the-undoredo-part-ii/</link>
		<comments>http://expresscode.wordpress.com/2007/05/20/explore-the-undoredo-part-ii/#comments</comments>
		<pubDate>Sun, 20 May 2007 16:10:22 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Undo/Redo]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/2007/05/20/explore-the-undoredo-part-ii/</guid>
		<description><![CDATA[Here is the list of the types and variations of the Undo/Redo functionalty. 1.Blind Undo/Redo The Undo/Redo functionality without specifying the operation which will be performed. 2.Instructional Undo/Redo The menu item offering the Undo/Redo functionality also displays the operation which will performed. This makes use of the DisplayName of the edit to be performed. 3.Single [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=11&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is the list of the types and variations of the Undo/Redo functionalty.</p>
<p><strong>1.Blind Undo/Redo</strong></p>
<p>The Undo/Redo functionality without specifying the operation which will be performed.</p>
<p><strong>2.Instructional Undo/Redo</strong></p>
<p>The menu item offering the Undo/Redo functionality also displays the operation which will performed. This makes use of the DisplayName of the edit to be performed.</p>
<p><strong>3.Single Undo/Redo</strong></p>
<p>The typical notepad style supporting Undo/Redo only for the last operation performed.</p>
<p><strong>4.Multiple Undo/Redo</strong></p>
<p>Multiple Undo/Redo supports unlimited no of edits for all the opertaions performed.</p>
<p><strong>5.Multiple Undo/Redo with the UI to choose the number of edits.</strong></p>
<p><em>Its the typical MS word style</em>. The UI(toolBar Button) shows the DisplayName of  all the edits in the Undo/Redo stack providing the option to choose the multiple edits to be performed. This provides the option of performing Undo on the last N opertaion at one shot.</p>
<p>More sophisticated implementation would be allow the user to choose the edit which need not correspond to the last edit operation.</p>
<p>For Eg:</p>
<p>Operation 1- Delete a line</p>
<p>OPeration2- Find Replace operation performed for a particular word</p>
<p>What if user wants to perform Undo for operation1 but NOT for operation2?</p>
<p>My next post will be on the Challenges that I faced in implementing Multiple (Instructional) Undo/Redo .<em><br />
</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/expresscode.wordpress.com/11/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/expresscode.wordpress.com/11/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=11&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2007/05/20/explore-the-undoredo-part-ii/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
		<item>
		<title>Explore the Undo/Redo &#8211; Part I</title>
		<link>http://expresscode.wordpress.com/2007/05/14/explore-the-undoredo-part-i/</link>
		<comments>http://expresscode.wordpress.com/2007/05/14/explore-the-undoredo-part-i/#comments</comments>
		<pubDate>Mon, 14 May 2007 03:09:35 +0000</pubDate>
		<dc:creator>Pavan</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Undo/Redo]]></category>

		<guid isPermaLink="false">http://expresscode.wordpress.com/2007/05/14/explore-the-undoredo-part-i/</guid>
		<description><![CDATA[Imagine preparing your project report in MS Word without having to use Ctrl Z/Y. You will bulb for sure, its going to be very very painful. That&#8217;s the power of Undo/Redo. We take it for granted in any standard, user-friendly software. It acts as a Saviour, during the times of distress It makes the learning [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=9&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Imagine preparing your project report in MS Word without having to use Ctrl Z/Y. You will bulb for sure, its going to be very very painful.</p>
<p>That&#8217;s the power of Undo/Redo. We take it for  <em>granted </em>in any  standard, user-friendly software.</p>
<ul>
<li>It acts as a Saviour, during the times of distress</li>
<li>It makes the learning process like a ride on a Highway.</li>
<li>It allows the users to explore the software with a confidence that he can always recover easily from the mistakes, during the learning process.</li>
</ul>
<p>Q. But why does a computer application need the Undo/Redo functionality, when the underlying piece of code will never ever go wrong it its output. You run the same operation 1000 times with the same inputs you are  guaranteed to get the same output every time?</p>
<p>Ans. The Undo/Redo is meant for the User and not the application itself. Yes the computer program never makes a mistake but humans do. They are by default error prone.</p>
<p>What the designed applications treats as an invalid input for an operation might be  a perfectly valid input from the users side.</p>
<p>The role of Undo/Redo comes into picture when an error(s) is made and the user realises it and express a strong intent to recover from the mistake(s) made.</p>
<p>The application must always assume that the user is always right.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/expresscode.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/expresscode.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/expresscode.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/expresscode.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/expresscode.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/expresscode.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/expresscode.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/expresscode.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/expresscode.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/expresscode.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/expresscode.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/expresscode.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/expresscode.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/expresscode.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/expresscode.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/expresscode.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=expresscode.wordpress.com&amp;blog=910876&amp;post=9&amp;subd=expresscode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://expresscode.wordpress.com/2007/05/14/explore-the-undoredo-part-i/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/467adf83ccbe943418b46edb9692cfe1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Pavan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
