When you don’t have an applet’s source code – Apple WebObjects 3.5 User Manual

Page 146

Advertising
background image

Chapter 8

Creating Client-Side Components

146

The value for a key must be a property-list type of object (either singly or
in combination, such as an array of string objects). The corresponding
property-list type of objects for Objective-C and Java are:

The remaining steps apply only if the applet has an action.

6. Declare an instance variable for the applet’s Association object and then, in

setAssociation

, assign the passed-in object to that variable.

protected Association _assoc;
...
synchronized public void setAssociation(Association assoc) {

_assoc = assoc;

}

The Association object must be stored so that it can be used later as the
receiver of the

invokeAction

message. The Association forwards the action to

the AppletGroupController, which handles the invocation of the server-
side action method.

7. When an action is invoked in the applet, send

invokeAction

to the applet’s

Association.

synchronized public boolean action(Event evt, Object what) {

if (_assoc != null) {

_assoc.invokeAction("action");

}
return true;

}

When You Don’t Have an Applet’s Source Code

If you have an applet but do not have the source code for it, you must follow
these steps to create an Association class for it:

Objective-C

Java

NSString

String

NSArray

Vector

NSDictionary

Hashtable

NSData

byte[]

Advertising