CHAPTER 6 DECOUPLED NAVIGATION PATTERN 177 parameters,

CHAPTER 6 DECOUPLED NAVIGATION PATTERN 177 parameters, as illustrated by the example that had the OnClickfunction call either InjectHTML or InjectTextbox. So let s look at those lines in more detail: var obj = new Object() obj.event = evt; obj.parent = this; obj.element = elem; obj.state = new Object() obj.presentation = presentation; The variable obj is the common object that is shared by the action, data, and presentation function references. The idea is to convert the parameters gathered by the example function OnClick and to convert them into an object instance. Based on that idea, the action function implementation manipulates obj and assigns the state. The state is then manipulated and processed by the data function reference. The state structures can be anything, and most likely will partially resemble the parameters used to call the example InjectHTMLor InjectTextbox functions. It is essential that the action, data, and presentation function implementations know what the structure of the state is. The advantage of manipulating an object structure is that the calling code as illustrated by OnClick does not need to be modified. Only the functions that modify the object structure need to be modified, preserving a proven and testing naviga tion structure. Getting back to the explanation of the obj properties, event and element reference the HTML event and source HTML element, respectively. The property stateis the state that is E B V N manipulated by the various functionalities. The reason for using the state property is to provide an entry point for the common state that will not conflict with the other properties of obj. And the reference obj.presentation is required if a remote call is made; this need will be illustrated in a little bit. Going back a bit further in the example source code, let s look at the implementation of DecoupledNavigation_call. After obj has been instantiated, the calling of the action function reference is called, as illustrated again here: if( (action) != null) if( action( obj) != true) return false; Before the actionfunction reference can be called, a decision is made that ensures that the action variable is not null. If the action variable is null, there is no implementation for the Action functionality. This is useful, for example, if you re creating a splash screen and you don t need to generate a state but only some presentation information when the document has finished loading. If the action variable is not null, the action function reference is called, where the param eter is the common object obj. The action function implementation can query and manipulate obj, and then return either a true or false. If the action function implementation is successful, true is returned. Returning false indicates a failure, which will cause DecoupledNavigation_ local to return false, causing the event bubbling to quit, if applicable.
From our experience, we can recommend PHP5 Web Hosting services, if you need affordable webhost to host and run your web application.

Leave a Reply