Apple WebObjects 3.5 Manual de usuario Pagina 99

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 218
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 98
Intercomponent Communication
99
For reusable components to be truly versatile, there must also be a
mechanism for the child component to interact with the parent, either by
setting the parent’s variables or invoking its methods, or both. This
mechanism must be flexible enough that a given child component can be
reused by various parent components without having to be modified in any
way. WebObjects provides just such a mechanism, as illustrated by the
following example.
Consider an AlertPanel component like the one described above, but with
the added ability to accept user input and relay that input to a parent
component. The panel might look like the one in Figure 29.
Figure 29. An Alert Panel That Allows User Input
As in the earlier example, you use this component by simply declaring its
position within the HTML page:
Parent's Template File
<HTML>
<HEAD>
<TITLE>Alert</TITLE>
</HEAD>
<BODY>
<WEBOBJECT NAME = "ALERT"></WEBOBJECT>
</BODY>
</HTML>
The corresponding declarations file reveals two new attributes (indicated in
bold):
Parent's Declarations File (excerpt)
ALERT: AlertPanel {
infoString = message;
infoFontSize = 4;
infoFontColor = "#500000";
alertString = "New Release";
alertFontColor = "#A00000";
alertFontSize = 6;
tableWidth = "50%";
parentAction = "respondToAlert";
exitStatus = usersChoice ;
};
Vista de pagina 98
1 2 ... 94 95 96 97 98 99 100 101 102 103 104 ... 217 218

Comentarios a estos manuales

Sin comentarios