beautypg.com

Chapter 20: components, About component basics, Extending the components panel – Adobe Extending Dreamweaver CS4 User Manual

Page 315

background image

309

Chapter 20: Components

Adobe Dreamweaver supports the creation of many of the most popular types of components. In addition,
Dreamweaver lets you extend the types of components that appear in the Components panel.

About component basics

Programmers use various strategies to encapsulate their work. You can think of encapsulation as creating an entity that
exists in a virtual black box. To use it, you need not know how it works. But, knowing what information it requires to
do its job and what information it will result in after its job is complete is a must. For example, a programmer creates
a program that gets information from an employee database. Anyone, including other programs, can then use that
program to query that database. Thus, the program is reusable.

Experience shows that well-organized programs that use encapsulation are easier to maintain, enhance, and reuse.
Different technologies offer programmers different ways to accomplish this encapsulation, and different names
describe these strategies: functions, modules, and others. Dreamweaver uses the term component for some of the more
popular and modern encapsulation strategies such as Adobe ColdFusion components (CFCs). So, when users build
web applications in Dreamweaver, the Components panel assists them in using CFCs.

Components from recent technologies (such as web services, JavaBeans, or CFCs) can describe themselves. Usually,
information about the component is embedded in the files that constitute the component. The ability of a component
to publish or share this information is called introspection. So, a program like Dreamweaver can ask a component for
a list of the functions it exposes. (Exposed functions are those functions that can be loaded from another program).
Depending on the technology in use, a component can reveal other information about itself.

Extending the Components panel

To use a component strategy that is not represented in the current Components panel, extend the logic of the
Components panel. This way, the panel can handle new kinds of components.

To add a new component to the Dreamweaver Components panel, locate the available components (in the
environment of the user). Then, request descriptions from each component (or parse them if they are written using
ASCII files).

The precise way that the location of components and how component details are retrieved varies among technologies.
Additionally, it can vary based on the server model (ASP.NET, JSP/J2EE, ColdFusion, or others). So, the JavaScript
you write to extend the Components panel depends on the component technology you want to add. The functions
described here are meant to assist you in getting information to appear in the Components panel. But, you yourself
must write much of the logic for locating components and introspecting them. It includes querying the internal
structure of the component and making its fields, methods, and properties available through Dreamweaver.

Finally, server models such as ASP.NET, JSP/J2EE, or ColdFusion tend to support some, but not all, component types.
For example, ASP.NET supports web services but not JavaBeans. Adobe ColdFusion also supports web services and
CFCs. When you add a new component type to the Components panel, it must be server-model specific. For example,
if a Dreamweaver user is working on a ColdFusion site, CF Components appear in the pop-up menu in the
Components panel.

This manual is related to the following products: