Integration of ColdFusion Studio


ColdFusion Studio is the ColdFusion development tool of choice for many ColdFusion developers. One of the reasons that it is so popular is that it has all the features that most ColdFusion developers need integrated into one development platform.

ColdFusion code can be written with any text editor, from Notepad to ColdFusion Studio. It can even be written in Macromedia's Dreamweaver MX, which includes both WYSIWYG and text-editing capabilities. The development tool does not the code make. The tightness and readability of your code is determined by your knowledge of the CFML and your personal style.

In this section, we discuss the integration of the ColdFusion Studio development tool. We talk about how to best make use of ColdFusion Studio within your current development environment. We'll also show you how to customize your work area to make the most of ColdFusion Studio.

Note

Keep in mind that our intention is not to tell you about every tab, button, or menu that you can use, but to help you understand the interface so that you can use it more efficiently.


Getting to Know ColdFusion Studio

ColdFusion Studio is a companion application to ColdFusion Server. As mentioned, it is the development environment of choice for many ColdFusion developers. One of the reasons for this popularity is that ColdFusion Studio gives developers complete access to all the resources that they need to build a feature-rich and robust application.

ColdFusion Studio is not a WYSIWYG web page editor. It simply means that the HTML that is produced by such an editor is visual in nature and based on visual design rather than hand-coded page elements. WYSIWYG editors enable you to drag and drop elements on the page for the purposes of placement and resizing. As you add elements to the page design, the editor refreshes the design to include the new elements.

WYSIWYG editors are not, as some developers would have you believe, evil. On the other hand, they are not the answer to all your prayers either. Though these editors make quick work out of screen design and the placement of elements within the page and have become increasingly capable of creating dynamic page elements, they have less appeal to those used to coding directly in HTML and CFML.

The Studio Interface

Let's take a look at the ColdFusion Studio interface. Although we don't intend to give full coverage to every item and every feature available within Studio, we do want to draw your attention to several that are important.

The ColdFusion Studio interface is not complicated (see Figure 2.10), but there are elements that you need to know very well. Table 2.5 lists these elements and the functions that they serve within the development environment.

Figure 2.10. ColdFusion Studio.

graphics/02fig10.gif

Table 2.5. ColdFusion Studio Interface Elements

Interface Element

What It Does

Main menu

This is your standard Windows-style, drop-down menu for access to all the options and functions in ColdFusion Studio.

QuickBar

This includes button-type access to many of the most commonly used tags and functions in HTML and CFML. It gives you the option of keeping one or more of the default toolbars handy or creating your own custom toolbar.

Resource window

This gives you quick access to a tab structure for file management, datasource access, projects, code snippets, online help, and the Tag Inspector.

Editor window

This is the area in which you write and edit your application code. Within this window, you can edit and view a browser rendition of your code.

Editor toolbar

This is where the developer can toggle options, such as line numbers, word wrap, the Tag Insight feature, and the Tag Completion feature.

Debugging toolbar

This enables you to debug your application pages to find errors in your code. It enables you to set breakpoints, to step through your lines of code, and to monitor variables and recordsets.

Results window

This includes tabs (to track, search, and replace operations), code validation, link verification, images, project deployment, and compilation.

Using ColdFusion Studio

Before you start using ColdFusion Studio, you should familiarize yourself with the key features listed in the previous section. After you are comfortable with the ColdFusion Studio interface, you can familiarize yourself with some of the features that you will be using quite often.

Tag Insight, Function Insight, and Tag Completion

ColdFusion Studio has some nifty functionality built in. Tag Insight and Function Insight are features of ColdFusion Studio that provide you with a drop-down menu of all the attributes that are associated with the tag with which you're working.

Tag Insight (see Figure 2.11) and Function Insight are tools that enable you to write ColdFusion code more easily and efficiently. Tag Insight helps to complete tag names, attributes, and values as you type that is, after you've started the tag name. For example, when you type "<cf " (without the quotation marks), you promptly see a drop-down menu that shows you a list of all the tags that begin with "cf ". After you complete the tag name, you see a drop-down menu that lists all the attributes available to the defined tag. Function Insight works the same way, but it is applied to ColdFusion functions.

Figure 2.11. Tag Insight.

graphics/02fig11.gif

Tag Completion is a feature of ColdFusion Studio that completes many tags that you type. For instance, if you type a CFOUTPUT beginning tag, such as <cfoutput>, Tag Completion finishes the tag for you by adding the </cfoutput> end tag.

Expression Builder

The Expression Builder (see Figure 2.12) is a useful tool for helping you to handle the syntax of ColdFusion functions. The Expression Builder enables you to take advantage of ColdFusion functions even if you're not at all familiar with the syntax or attributes of the functions themselves. The Function Insight feature does something similar, but the Expression Builder goes way beyond that.

Figure 2.12. Expression Builder.

graphics/02fig12.gif

Function Insight requires that you are familiar with the ColdFusion function names and their use; Expression Builder enables you to browse ColdFusion functions organized by their function type. In other words, if you which to see what functions are available to be run on a ColdFusion array, open the Expression Builder, open the Functions folder, and then click Arrays to see a list of all array functions.

If you're stuck and need some extra hints on syntax or an actual code example, you can toggle the Help window for any component of code that you select.

Query Builder

ColdFusion Studio's Query Builder (see Figure 2.13), or SQL Builder as it is also known, is a tool that helps you to build and verify SQL statements and ColdFusion queries. It enables you to connect to your datasource and build the SQL statements that are used to drive your ColdFusion application.

Figure 2.13. Query Builder .

graphics/02fig13.gif

The Query Builder enables you to create complex SQL statements without writing any code. Features of the Query Builder let you do the following:

  • Drag and drop columns into your SQL statements

  • Generate SELECT, INSERT, UPDATE, and DELETE statements

  • Execute SQL statements to verify their validity

  • Generate code complete with CFQUERY tags

SQL

SQL is an industry standard for communicating with databases. It is supported by most relational databases. SQL is discussed in-depth later in the book.

There are different ways to open the Query Builder. First, you can access it from the main menu in ColdFusion Studio by selecting Tools, SQL Builder. From there, you select a server and datasource and then drill down into the tables in that datasource. You can select queries that you've already saved or choose to create a new query. When you choose to create a new query, the Query Builder opens.

The second way to access Query Builder is through the Database tab in your Resource window. With it, you select your server and datasource and then drill down to your tables. You can customize your queries within the Query Builder to build SELECT, INSERT, UPDATE, or DELETE queries. The Query Builder also supports relational queries and table joins.

Using Code Snippets

Code snippets are a way to save small blocks of code that you use frequently. Code snippets are stored in ColdFusion Studio with a start and end portion so that you can create a snippet of code that will surround other tags or template content when inserted.

Code snippets are perfect for creating reusable blocks of code that you can use on a regular basis. Some of our favorite snippets are shown in Table 2.6.

Table 2.6. Code Snippets

Start Tag

End Tag

 <cfif isdefined("  <cfswitch expression="  <cfset variables.varname=" 

 ")>  <cfelse>  </cfif>  ">       <cfcase value="">       </cfcase>  </cfswitch>  "> 

Code Sweepers

Code sweepers are designed to provide developers with a means to ensure that their code is formatted consistently throughout their applications. When you run a code sweeper against a code template, you can expect the code within that template to be formatted to a defined coding standard. For example, you might have some code that is written like this:

 <HTML>  <head>  <title>Code Sweeper Test</title>  </head>  <Body>  <Table>  <tr>  <TD>Neil Ross, </TD>  <TD>neil@codesweeper.com</TD>  </TR>  </Table>  </Body>  </HTml> 

After you run the code sweeper, your code will be nicely formatted and readable, like this:

 <html>  <head>      <title>Code Sweeper Test</title>  </head>     <body>          <table>               <tr>                    <td>     Neil Ross,                    </td>                    <td>     neil@codesweeper.com                    </td>               </tr>          </table>     </body>  </html> 

You can easily customize any code sweeper to your coding specifications. To customize your code sweeper, press F8 to access the Studio settings. Choose CodeSweeper, and then select the code sweeper that you want to customize. Then press the Edit Profile button. You can see the CodeSweeper Settings window in Figure 2.14.

Figure 2.14. CodeSweeper Settings window .

graphics/02fig14.gif

Code sweeper settings include general settings and tag-specific settings. The general settings control the option to force all upper- or lowercase tag, attribute, and event names. It also enables you to apply attribute quoting, and it can be set for each individual tag.

Remote Development Services (RDS) and Development Mappings

ColdFusion Studio enables you to work with files on remote servers through the RDS service. RDS lets you communicate with a remote host and enables secure access to that host, while also providing the capability to browse datasources and use the SQL Builder to debug your code.

Working with files on remote servers is very much like working with them on your local or network drive. The difference is that you must first establish a connection to the remote server by adding an FTP or RDS connection through ColdFusion Studio.

To create an RDS connection, you must provide the name of the host where the files are stored. You might also need to provide a password so that ColdFusion Studio can access the resource.

Setting up development mappings ensures that you can browse the code that you are developing through the browser that is built in to ColdFusion Studio. Development mappings also enable you to use ColdFusion's debugging to debug your application code, even on remote servers.

Working with Projects

ColdFusion Studio enables you to group your templates into a collection. That collection is called a project. Project grouping is a great way to manage your files because it enables you to make changes across the project, divide smaller segments of your application into subprojects, and deploy project templates to a production server with a single upload.

Understanding Projects

A project is a collection of files that are used in your application or in your web site. A project can contain any file type. Most projects consist of application templates and HTML files as well as images, style sheets, and scripts.

You can create and access your project from the Project tab on the Resources window or through the main menu. You can manage one or more projects and access them individually with the handy Project drop-down list at the top of the Projects window. When you choose a project, you see a list of project folders and projects files in the pane just below the drop-down list.

A project lets you create a virtual file system that contains the files that you need for your project. You can add or remove files to your project from a real directory on your computer or on any computer on your network.

There are advantages to working with projects instead of with a real directory:

  • Projects are easy to create and work with.

  • Projects are easy to maintain and deploy.

  • Projects enable you to include only the files that you need to access.

  • Projects make it easy to run operations such as extended find. You can then replace or debug on only the relevant files.

Your projects will be organized into folders. There are different types of folders that you can use in a project:

  • Physical folders are directly tied, or mapped, to a directory on your computer. Physical folders are either manual-inclusive or auto-inclusive:

    • Manual-inclusive folders require you to specify which files in the mapped directory should be included in the folder. The location of a manual-inclusive folder cannot be changed.

    • Auto-inclusive folders include every file in the mapped directory by definition. You can specify which file types you would like to include (for example, all the HTML files), but you cannot specify individual files to include. Auto-inclusive folders are automatically updated when you add files to or delete files from the mapped directory. Changing a folder from auto-inclusive to manual-inclusive retains all files by default.

  • Virtual folders function as repositories for files that have no logical relationship to each other on a disk drive. You can think of a virtual folder as a container into which you can place whatever files you want. Virtual folders are a useful way to organize files that can be distributed across your file system.

Creating a Project

When you create a project, you must specify a folder to hold the project file. This folder must already exist somewhere on your computer. If the existing folder has files and subfolders, you can add them to the project.

After creating the initial project, you can add, edit, and delete folders in the project as necessary. You can also add and remove individual project files.

Working with Projects

Within a project, you can run all the standard file management and maintenance operations that you perform on individual files. You can also set and modify resource filters and perform a variety of other project-level tasks. Project-level tasks include operations such as verifying links throughout the project, using extended find and replace operations throughout the project, working with source control, and deploying a project.

Deploying a Project

Deployment is the process of copying all the files in your project to one or more servers. You can specify a deployment path for the entire project or for individual folders and files within that project.

Project deployment is easy and flexible. Just run the Project Deployment Wizard and it walks you through creating either a direct deployment or a scriptable deployment. By following the wizard, you can choose all the necessary options to get your project into production.

Debugging in ColdFusion Studio

You can run the debugger against your application pages to find errors in your code when RDS is enabled and a server mapping is defined. Debugging is not supported on Windows 98.

The debugger lets you perform these tasks:

  • Set breakpoints and watches

  • Evaluate variables and expressions

  • Step through lines of code

  • Investigate the code stack

  • Monitor recordsets

  • Observe variables in all scopes

Customizing ColdFusion Studio

There are a few small customizations that can make a world of difference for your development efforts. The key to customization is to make your development environment as comfortable as possible. When you are successful at making your development environment comfortable, shortcuts and everyday procedures can quickly become second nature. To access these customizable elements, press Shift+F8.

Custom QuickBar

ColdFusion Studio gives you the option to use button shortcuts in several default toolbars. These toolbars make up the area known as the QuickBar. These toolbars have buttons for almost every element of code that a typical application might use. I recommend that you create a customized QuickBar that includes the shortcut buttons to all the CFML and HTML tags that you use most often.

You can toggle which toolbars you want to appear in ColdFusion Studio by simply right-clicking and selecting the name of the toolbar that you want to see. The toolbar appears floating above the Studio interface. You can dock it within the QuickBar area or just about anywhere else on the screen.

To create a custom QuickBar, right-click the existing QuickBar, and then click Customize. You can also access this functionality by pressing Shift+F8 on your keyboard. Along with access to all the standard toolbar buttons, you can create custom buttons that insert customized blocks of code into your template.

Keyboard Shortcuts

Keyboard shortcuts are a great way to speed up the development process. Most developers use the same syntax and the same code conventions over and over in an application. You can customize your keyboard shortcuts to trigger the insertion of code snippets, to simulate clicking a button on your QuickBar, or to perform any of the many standard functions within ColdFusion Studio.

Keyboard shortcuts can save you a lot of time and in the long run, many headaches. Keyboard shortcuts can be created to insert your favorite code snippets and to perform standard functions.

Summary

ColdFusion Studio is the development tool of choice for many ColdFusion developers. ColdFusion Studio is rich with features that are directly tied to the development of robust ColdFusion applications. As you start to use the ColdFusion Studio development environment, get to know your surroundings. Some developers work for months or longer without knowing how to create a custom toolbar, and they waste plenty of time fumbling back and forth between one toolbar or another.



Inside ColdFusion MX
Inside Coldfusion MX
ISBN: 0735713049
EAN: 2147483647
Year: 2005
Pages: 579

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net