Changes between Initial Version and Version 1 of ReferenceMaterials/EventApi

Show
Ignore:
Timestamp:
04/15/09 19:43:31 (17 years ago)
Author:
trac (IP: 127.0.0.1)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ReferenceMaterials/EventApi

    v1 v1  
     1[[PageOutline]] 
     2 
     3= Event API = 
     4 
     5When a function in a controller is called as a result of a <message-listener> tag, it is passed an instance of the !ModelGlue.unity.eventrequest.!EventContext CFC. 
     6 
     7This CFC contains a series of functions known as the Event API that are useful to getting and setting values in the viewstate as well as event-related utilities. 
     8 
     9== !AddResult(name:string) == 
     10 
     11Adds a result by the given name. If a <result> tag exists in the currently executing <event-handler> whose NAME attribute matches the value passed, the <event-handler> declared in its DO attribute will be added to the request. 
     12 
     13==== Returns: ==== 
     14 
     15Void 
     16 
     17==== Arguments: ==== 
     18 
     19Name (Required) - The name of the result to add 
     20 
     21== !ArgumentExists(string:name) == 
     22 
     23==== Description: ==== 
     24 
     25Does a value of the given name exist in the current message tag's arguments block? 
     26 
     27==== Returns: ==== 
     28 
     29Boolean 
     30 
     31==== Arguments: ==== 
     32 
     33Name (required) - The name of the argument to check 
     34 
     35== Forward(eventhandler:string [, append:list]) == 
     36 
     37==== Description: ==== 
     38 
     39Immediately redirects the request to the event handler named. All values in the viewstate are maintained across the redirect if session is enabled. 
     40 
     41==== Returns: ==== 
     42 
     43Void. The function call never completes - a <cflocation> interrupts its execution. 
     44 
     45==== Arguments: ==== 
     46 
     47!EventHandler (Required) - The name of the event handler to redirect to 
     48 
     49Append (Optional) - Will append the list of values passed in append to the resultant URL. 
     50 
     51==== Example: ==== 
     52 
     53{{{ 
     54<!--- Results in a url with a query string of ?event=article.view&articleId=2 ---> 
     55 
     56<cfset arguments.event.setValue("articleId", 2) /> 
     57 
     58<cfset arguments.event.forward("article.view", "articleId") /> 
     59}}} 
     60 
     61== !GetAllArguments() == 
     62 
     63==== Description: ==== 
     64 
     65Returns the structure that contains all argument members ''by reference''. 
     66 
     67==== Returns: ==== 
     68 
     69Struct 
     70 
     71==== Arguments: ==== 
     72 
     73None 
     74 
     75== !GetAllValues() == 
     76 
     77==== Description: ==== 
     78 
     79Returns the structure that contains all viewstate members ''by reference''. 
     80 
     81==== Returns: ==== 
     82 
     83Struct 
     84 
     85==== Arguments: ==== 
     86 
     87None 
     88 
     89== !GetArgument(name:string [, default:any]) == 
     90 
     91==== Description: ==== 
     92 
     93Returns a value from the current message tag's arguments block. 
     94 
     95==== Returns: ==== 
     96 
     97Any 
     98 
     99==== Arguments: ==== 
     100 
     101Name (required) - The name of the argument to retrieve 
     102 
     103Default (optional) - If the argument does not exist, a default value to return. It is ''not'' set into the argument collection - the collection is read-only. 
     104 
     105==== Example: ==== 
     106 
     107{{{ 
     108<!-- ModelGlue.xml ---> 
     109 
     110<event-handler name="argumentExample"> 
     111 
     112<broadcasts> 
     113 
     114<message name="example"> 
     115 
     116<argument name="someArgument" value="someValue" /> 
     117 
     118</message> 
     119 
     120</broadcasts> 
     121 
     122</event-handler> 
     123 
     124<!--- In a message listener function ---> 
     125 
     126<cfset var argumentValue = arguments.event.getArgument("someArgument") /> 
     127}}} 
     128 
     129== !GetValue(name:string [, default:any]) == 
     130 
     131==== Description: ==== 
     132 
     133Returns a value from the viewstate, such as a form or url variable. 
     134 
     135==== Returns: ==== 
     136 
     137Any 
     138 
     139==== Arguments: ==== 
     140 
     141Name (required) - The name of the value to retrieve 
     142 
     143Default (optional) - If the value does not exist, a default value to set into the viewstate and then return 
     144 
     145== !GetView(name:string) == 
     146 
     147==== Description: ==== 
     148 
     149Returns the rendered content of a view. 
     150 
     151==== Returns: ==== 
     152 
     153String 
     154 
     155==== Arguments: ==== 
     156 
     157Name (required) - The name of the view to retrieve 
     158 
     159== !MakeEventBean(type:any, [fields:list]) == 
     160 
     161==== Description: ==== 
     162 
     163Loops over a CFC instance, looking for any methods whose names start with set.  For any setter methods where a like-named value exists in the viewstate, the setter will be called, passing this value. 
     164 
     165==== Returns: ==== 
     166 
     167CFC Instance 
     168 
     169==== Arguments: ==== 
     170 
     171Type (Required) - If a string is passed, it will instantiate a CFC of the type passed and attempt to call a function named "init" if one exists.  If a CFC instance is passed, it will use the instance. 
     172 
     173Fields (Optional) - If a list of fields is passed, it will only attempt to set the properties listed. 
     174 
     175== Trace(name:string, value:any) == 
     176 
     177==== Description: ==== 
     178 
     179Adds the value to the debugging trace and gives it the name passed. If a complex value is passed, the result of its <cfdump> is displayed. 
     180 
     181==== Returns: ==== 
     182 
     183Void 
     184 
     185==== Arguments: ==== 
     186 
     187Name (Required) - A label to identify the value in the debugging trace 
     188 
     189Value (Required) - The value to display in the debugging trace. If a complex value is passed, the result of its <cfdump> is displayed. 
     190 
     191== !ValueExists(string:name) == 
     192 
     193==== Description: ==== 
     194 
     195Does a value of the given name exist in the viewstate? 
     196 
     197==== Returns: ==== 
     198 
     199Boolean 
     200 
     201==== Arguments: ==== 
     202 
     203Name (required) - The name of the value to check