robert burrell donkin wrote:

> On Thursday, July 12, 2001, at 03:48 PM, David Ethell wrote:
>
>>> Html html = new Html()
>>>          .addElement(new Head()
>>>          .addElement(new org.apache.ecs.html.Title("Entry Form")))
>>>          .addElement(new Body()
>>>             .setBgColor(HtmlColor.SILVER)
>>>             .addElement(today)
>>>             .addElement(scrolling)
>>>             .setOnLoad("scrollMsg()")
>>
>>
>>> "Can't invoke a method on a Void"
>>
>>
>> The setOnLoad method returns a void and the addElement method can only
>> accept an object, not a void which is what gets returned if the final
>> method for your Body object is setOnLoad. There are two ways around
>> this.
>>
>> One is to use the addAttribute method to set your onLoad function
>> instead of using the setOnLoad. I know it's not as intuitive, but as
>> addAttribute returns Element instead of void you can use it.
>
>
> <snip>
> i'd say that probably setOnLoad (and all the other javascript methods) 
> should return the appropriate element type (in this case, body).
>
> (maybe somebody would like to jump in here and tell me if there's a 
> good reason why they were written that way.) 

Since most elements have some javascript methods avaialable to them, Jon 
and I ( it might be more fair to say, I decided and Jon implemented ) 
 that it would be easiest to break down the on* methods into interfaces 
that had to do with page loading, mouse clicks, etc.  And have the 
elements that need them implement the interfaces, that way you would get 
compile time errors if you forgot to implement one of the methods.  I 
think that was my original arguement anyway.

-stephan

>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to