Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > Programming Topics

  

Extending Dynamic Elements

Synopsis

Describes how to implement custom dynamic elements using components.

Discussion

Custom dynamic elements in WebObjects are built in one of two ways: based on a component or subclassed from WODynamicElement. A custom dynamic element based on a component consists of a HTML, a WOD and a WebScript file. The HTML file specifies how this dynamic element looks. The WOD file declares the WebObjects dynamic elements comprising the custom dynamic element. The WOS file implements the dynamic element. As an example, we will build a dynamic element MyText which is a HTML form text input with a description above it to act as a hint of what to enter.

MyText.HTML

 
<font size="2"><webobject name=AHint></webobject></font><br> 
<webobject name=AText></webobject>

MyText.WOD (Continued)

 
AHint: WOString 
{ 
	value = hintValue; 
}; 
AText: WOText 
{ 
	value = stringTextValue; 
	rows = rowValue; 
	cols = colValue; 
	escapeHTML = escapeHTMLValue; 
};

MyText.WOS

 
id hintValue, rowValue, colValue, stringTextValue, escapeHTMLValue;

We use the MyText dynamic element to input a headline. The following declarations are made in the WOD file.

WOD file

 
Headline: MyText
 
{
 
	stringTextValue = myDocument.headline;
 
	hintValue = "enter Headline here";
 
	rowValue = "2";
 
	colValue = "50";
 
	escapeHTMLValue = NO;
 
};

When the Headline element is displayed, "enter Headline here" appears on the top and the HTML form text field appears on the bottom.

Building a custom dynamic element by subclassing WODynamicElement is deprecated. In WebObjects 4, the performance and functionality of component-based dynamic elements eliminates the need to subclass WODynamicElement. The WebObjects Examples contain a framework called ComponentElement.fproj which contains component versions of every WebObjects dynamic element. This framework illustrates the power of component-based dynamic elements.

See Also

Questions

Keywords

Revision History

22 July, 1998. Winnie Pun. First Draft.
19 November, 1998. Clif Liu. Second Draft.


© 1999 Apple Computer, Inc.