Apple WebObjects 3.5 Manual do Utilizador Página 96

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 218
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 95
Chapter 6 Creating Reusable Components
96
the World Wide Web Wisdom company could change the look of the
navigational controls in all of its applications by changing this one component.
If your application’s pages are highly structured, reusable components could be
the prevailing feature of each page:
<HTML>
<HEAD>
<TITLE>World Wide Web Wisdom, Inc.</TITLE>
</HEAD>
<BODY>
<WEBOBJECT NAME="HEADER"></WEBOBJECT>
<WEBOBJECT NAME="PRODUCTDESCRIPTION"></WEBOBJECT>
<WEBOBJECT NAME="NAVCONTROL"></WEBOBJECT>
<WEBOBJECT NAME="FOOTER"></WEBOBJECT>
</BODY>
</HTML>
The corresponding declarations file might look like this:
HEADER: CorporateHeader {};
PRODUCTDESCRIPTION: ProductTable {productCode = "WWWW0314"};
NAVCONTROL: NavigationControl {};
FOOTER: Footer {type = "catalogFooter"};
Notice that some of these components above take arguments—that is, they are
parameterized. For example, the ProductTable component’s
productCode attribute
is set to a particular product identifier, presumably to display a description of
that particular product. The combination of reusability and customizability is
particularly powerful, as you’ll see in the next section.
Simplifying Interfaces
Another benefit of reusable components is that they let you work at a higher
level of abstraction than would be possible by working directly with HTML
code or with WebObjects’ dynamic elements. You (or someone else) can create
a component that encapsulates a solution to a possibly complicated
programming problem, and then reuse that solution again and again without
having to be concerned with the details of its implementation. Examples of this
kind of component include:
•A menu that posts different actions depending on the user’s choice
•A calendar that lets a user specify start and end dates
•A table view that displays records returned by a database query
To illustrate this feature, consider a simple reusable component, an alert panel
like the one shown in Figure 28.
Vista de página 95
1 2 ... 91 92 93 94 95 96 97 98 99 100 101 ... 217 218

Comentários a estes Manuais

Sem comentários