Difference between revisions of "Add ADF Library Components into App"
From ADF Docs
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Overview == | == Overview == | ||
− | ADF Library Components are CFC's loaded into the core ADF. The components are typically located in the /ADF/lib/ directory and are sectioned into | + | ADF Library Components are CFC's loaded into the core ADF. The components are typically located in the /ADF/lib/ directory and are sectioned into "Classes" of sorts. By adding or "injecting" ADF Library Components into your applications, it will make it easier for you to: |
* Program against particular versions of ADF Library Components | * Program against particular versions of ADF Library Components | ||
* Upgrade your applications | * Upgrade your applications | ||
Line 24: | Line 16: | ||
## PropertyName:string:optional - The optional property name to pass the bean into. Defaults to the bean name if not provided. | ## PropertyName:string:optional - The optional property name to pass the bean into. Defaults to the bean name if not provided. | ||
# The following is an example of adding a dependency for the ''Scripts_1_0'' ADF library component to your application. | # The following is an example of adding a dependency for the ''Scripts_1_0'' ADF library component to your application. | ||
− | addConstructorDependency(appBeanName, | + | addConstructorDependency(appBeanName, "scripts_1_0", "scripts"); |
# Where ''scripts_1_0'' is the ADF Library component and the property name will be ''scripts'' when referenced within the apps application scope (i.e. Application.MYAPP.scripts). | # Where ''scripts_1_0'' is the ADF Library component and the property name will be ''scripts'' when referenced within the apps application scope (i.e. Application.MYAPP.scripts). | ||
Line 30: | Line 22: | ||
Now that you have loaded the ADF Library Component into your application you can now write code similar to this in your applications render handlers, custom scripts and custom field types: | Now that you have loaded the ADF Library Component into your application you can now write code similar to this in your applications render handlers, custom scripts and custom field types: | ||
− | + | <pre> | |
− | + | <cfscript> | |
application.myApp.scripts.loadJQuery(); | application.myApp.scripts.loadJQuery(); | ||
application.myApp.scripts.loadJQueryUI(); | application.myApp.scripts.loadJQueryUI(); | ||
− | + | </cfscript> | |
− | + | </pre> | |
[[Category: How-to Guide]] | [[Category: How-to Guide]] |
Latest revision as of 17:42, 24 November 2010
Overview
ADF Library Components are CFC's loaded into the core ADF. The components are typically located in the /ADF/lib/ directory and are sectioned into "Classes" of sorts. By adding or "injecting" ADF Library Components into your applications, it will make it easier for you to:
- Program against particular versions of ADF Library Components
- Upgrade your applications
Instructions
Here are some instructions for adding an ADF Library Component into an ADF Application:
- Open the AppBeanConfig.cfm file in your applications directory. See the App Bean Config wiki page for more details.
- Identify what ADF Library components and version you want added to your application.
- Add the 'addConstructorDependency' command into the App Bean Config.
addConstructorDependency(BeanName, InjectedBeanName, PropertyName);
- The parameters for the 'addConstructorDependency' command are as follows:
- BeanName:string:required - The name of the bean (Singleton or Transient) to add the Dependency to.
- InjectedBeanName:string:required - The name of the bean to inject.
- PropertyName:string:optional - The optional property name to pass the bean into. Defaults to the bean name if not provided.
- The following is an example of adding a dependency for the Scripts_1_0 ADF library component to your application.
addConstructorDependency(appBeanName, "scripts_1_0", "scripts");
- Where scripts_1_0 is the ADF Library component and the property name will be scripts when referenced within the apps application scope (i.e. Application.MYAPP.scripts).
Using ADF Library Components in your App
Now that you have loaded the ADF Library Component into your application you can now write code similar to this in your applications render handlers, custom scripts and custom field types:
<cfscript> application.myApp.scripts.loadJQuery(); application.myApp.scripts.loadJQueryUI(); </cfscript>