| Package: MachII.framework |
| Handles view display for an EventContext. |
| Method Summary | |
|---|---|
| public ViewContext |
init(AppManager appManager)
Used by the framework for initialization. Do not override. |
| public string |
buildUrl(string eventName, [any urlParameters=""], [string urlBase])
Builds a framework specific url and automatically escapes entities for html display. |
| public string |
buildUrlToModule(string moduleName, string eventName, [any urlParameters=""], [string urlBase])
Builds a framework specific url with module name and automatically escapes entities for html display. |
| public void |
displayView(Event event, string viewName, [string contentKey=""], [string contentArg=""], [boolean append="false"])
Displays a view by view name and peforms contentKey, contentArg and append functions. |
| public AppManager |
getAppManager()
Sets the AppManager instance this ViewContext belongs to. |
| private string |
getFullPath(string viewName)
Gets the full path of a view by view name from the view manager. |
| public any |
getProperty(string propertyName)
Gets the specified property - this is just a shortcut for getAppManager().getPropertyManager().getProperty() |
| public PropertyManager |
getPropertyManager()
Gets the components PropertyManager instance. |
| private void |
setAppManager(AppManager appManager)
Returns the AppManager instance this ViewContext belongs to. |
| public any |
setProperty(string propertyName, any propertyValue)
Sets the specified property - this is just a shortcut for getAppManager().getPropertyManager().setProperty() |
| private void |
setPropertyManager(PropertyManager propertyManager)
Sets the components PropertyManager instance. |
| Method Detail |
|---|
| buildUrl |
|---|
public string buildUrl( string eventName, [any urlParameters=""], [string urlBase] )
Builds a framework specific url and automatically escapes entities for html display.
Parameters:
| string eventName |
| [any urlParameters=""] |
| [string urlBase] |
Code:
<cffunction name="buildUrl" access="public" returntype="string" output="false" hint="Builds a framework specific url and automatically escapes entities for html display."> <cfargument name="eventName" type="string" required="true" hint="Name of the event to build the url with." /> <cfargument name="urlParameters" type="any" required="false" default="" hint="Name/value pairs (urlArg1=value1|urlArg2=value2) to build the url with or a struct of data." /> <cfargument name="urlBase" type="string" required="false" hint="Base of the url. Defaults to the value of the urlBase property." /> <cfset arguments.moduleName = getAppManager().getModuleName() /> <cfreturn HtmlEditFormat(getAppManager().getRequestManager().buildUrl(argumentcollection=arguments)) /> </cffunction>
| buildUrlToModule |
|---|
public string buildUrlToModule( string moduleName, string eventName, [any urlParameters=""], [string urlBase] )
Builds a framework specific url with module name and automatically escapes entities for html display.
Parameters:
| string moduleName |
| string eventName |
| [any urlParameters=""] |
| [string urlBase] |
Code:
<cffunction name="buildUrlToModule" access="public" returntype="string" output="false" hint="Builds a framework specific url with module name and automatically escapes entities for html display."> <cfargument name="moduleName" type="string" required="true" hint="Name of the module to build the url with. Defaults to current module if empty string." /> <cfargument name="eventName" type="string" required="true" hint="Name of the event to build the url with." /> <cfargument name="urlParameters" type="any" required="false" default="" hint="Name/value pairs (urlArg1=value1|urlArg2=value2) to build the url with or a struct of data." /> <cfargument name="urlBase" type="string" required="false" hint="Base of the url. Defaults to the value of the urlBase property." /> <cfreturn HtmlEditFormat(getAppManager().getRequestManager().buildUrl(argumentcollection=arguments)) /> </cffunction>
| displayView |
|---|
public void displayView( Event event, string viewName, [string contentKey=""], [string contentArg=""], [boolean append="false"] )
Displays a view by view name and peforms contentKey, contentArg and append functions.
Parameters:
| Event event |
| string viewName |
| [string contentKey=""] |
| [string contentArg=""] |
| [boolean append="false"] |
Code:
<cffunction name="displayView" access="public" returntype="void" output="true" hint="Displays a view by view name and peforms contentKey, contentArg and append functions."> <cfargument name="event" type="MachII.framework.Event" required="true" hint="The current Event object." /> <cfargument name="viewName" type="string" required="true" hint="The view name to display." /> <cfargument name="contentKey" type="string" required="false" default="" hint="The contentKey name if defined." /> <cfargument name="contentArg" type="string" required="false" default="" hint="The contentArg name if defined." /> <cfargument name="append" type="boolean" required="false" default="false" hint="Directive to append event." /> <cfset var viewPath = getFullPath(arguments.viewName) /> <cfset var viewContent = "" /> <cfset request.event = arguments.event /> <cfif arguments.contentKey NEQ ''> <cfsavecontent variable="viewContent"> <cfinclude template="#viewPath#" /> </cfsavecontent> <cfif arguments.append AND IsDefined(arguments.contentKey)> <cfset viewContent = Evaluate(arguments.contentKey) & viewContent /> </cfif> <cfset setVariable(arguments.contentKey, viewContent) /> </cfif> <cfif arguments.contentArg NEQ ''> <cfsavecontent variable="viewContent"> <cfinclude template="#viewPath#" /> </cfsavecontent> <cfif arguments.append> <cfset viewContent = arguments.event.getArg(arguments.contentArg, "") & viewContent /> </cfif> <cfset arguments.event.setArg(arguments.contentArg, viewContent) /> </cfif> <cfif arguments.contentKey EQ '' AND arguments.contentArg EQ ''> <cfinclude template="#viewPath#" /> </cfif> </cffunction>
| getAppManager |
|---|
public AppManager getAppManager( )
Sets the AppManager instance this ViewContext belongs to.
Parameters:
Code:
<cffunction name="getAppManager" access="public" returntype="MachII.framework.AppManager" output="false" hint="Sets the AppManager instance this ViewContext belongs to."> <cfreturn variables.appManager /> </cffunction>
| getFullPath |
|---|
private string getFullPath( string viewName )
Gets the full path of a view by view name from the view manager.
Parameters:
| string viewName |
Code:
<cffunction name="getFullPath" access="private" returntype="string" output="false" hint="Gets the full path of a view by view name from the view manager."> <cfargument name="viewName" type="string" required="true" /> <cfreturn getAppManager().getViewManager().getViewPath(arguments.viewName) /> </cffunction>
| getProperty |
|---|
public any getProperty( string propertyName )
Gets the specified property - this is just a shortcut for getAppManager().getPropertyManager().getProperty()
Parameters:
| string propertyName |
Code:
<cffunction name="getProperty" access="public" returntype="any" output="false" hint="Gets the specified property - this is just a shortcut for getAppManager().getPropertyManager().getProperty()"> <cfargument name="propertyName" type="string" required="yes" hint="The name of the property to return." /> <cfreturn getPropertyManager().getProperty(arguments.propertyName) /> </cffunction>
| getPropertyManager |
|---|
public PropertyManager getPropertyManager( )
Gets the components PropertyManager instance.
Parameters:
Code:
<cffunction name="getPropertyManager" access="public" returntype="MachII.framework.PropertyManager" output="false" hint="Gets the components PropertyManager instance."> <cfreturn variables.propertyManager /> </cffunction>
| init |
|---|
public ViewContext init( AppManager appManager )
Used by the framework for initialization. Do not override.
Parameters:
| AppManager appManager |
Code:
<cffunction name="init" access="public" returntype="ViewContext" output="false" hint="Used by the framework for initialization. Do not override."> <cfargument name="appManager" type="MachII.framework.AppManager" required="true" /> <cfset setAppManager(arguments.appManager) /> <cfset setPropertyManager(getAppManager().getPropertyManager()) /> <cfreturn this /> </cffunction>
| setAppManager |
|---|
private void setAppManager( AppManager appManager )
Returns the AppManager instance this ViewContext belongs to.
Parameters:
| AppManager appManager |
Code:
<cffunction name="setAppManager" access="private" returntype="void" output="false" hint="Returns the AppManager instance this ViewContext belongs to."> <cfargument name="appManager" type="MachII.framework.AppManager" required="true" /> <cfset variables.appManager = arguments.appManager /> </cffunction>
| setProperty |
|---|
public any setProperty( string propertyName, any propertyValue )
Sets the specified property - this is just a shortcut for getAppManager().getPropertyManager().setProperty()
Parameters:
| string propertyName |
| any propertyValue |
Code:
<cffunction name="setProperty" access="public" returntype="any" output="false" hint="Sets the specified property - this is just a shortcut for getAppManager().getPropertyManager().setProperty()"> <cfargument name="propertyName" type="string" required="yes" hint="The name of the property to set." /> <cfargument name="propertyValue" type="any" required="yes" hint="The value to store in the property." /> <cfreturn getPropertyManager().setProperty(arguments.propertyName, arguments.propertyValue) /> </cffunction>
| setPropertyManager |
|---|
private void setPropertyManager( PropertyManager propertyManager )
Sets the components PropertyManager instance.
Parameters:
| PropertyManager propertyManager |
Code:
<cffunction name="setPropertyManager" access="private" returntype="void" output="false" hint="Sets the components PropertyManager instance."> <cfargument name="propertyManager" type="MachII.framework.PropertyManager" required="true" hint="The PropertyManager instance to set." /> <cfset variables.propertyManager = arguments.propertyManager /> </cffunction>