Shawn:
We've been able to use addChild(...) in the parent's onBeforeDisplayEvent
in order to accomplish this.
Three things:
(1) We made the parent's onBeforeDisplayEvent final to ensure it would
happen; we allow the developers to provide their own onBeforeDisplayEvent logic
by overriding a different method that we guarantee to call.
(2) You could alternatively let developers override onBeforeDisplay only
if they call super.this_onBeforeDisplayEvent(event).
(3) This way, you only have to add the hidden field to the superpage.
Since the subpage extends the superpage, the superpage's onBeforeDisplay logic
is called, adding the child (in your case a hidden) to the *subpage*. Note that
event processing for this page (if it has events) has to be in the superpage,
however, since that's where the child object "is."
-- David.
(Embedded
image moved [EMAIL PROTECTED]
to file: 05/03/99 07:57 PM
pic21290.pcx)
To: [EMAIL PROTECTED]
cc: (bcc: David P Caldwell/GL/KSC/KeyCorp)
Subject: Re: [ND] Registering existence of an object without creation
Curt,
Thanks for the response. I tried setChildren() only to receive
some internal errors. I may be using it incorrectly. I first
did a getChildren(), added an element to the vector and then
setChildren(). (in the onAfterInit())
Regarding using a StaticText in place of a Hidden, I don't think
that will buy me anything, as the StaticText would still need
to get registered through the properties. I want my developers
to be able to simply superclass my page and not worry about any
of the underlying logic. Currently, my developers would need
to superclass my page and then add a hidden to that page. I want
to get away from the latter.
Thanks for your help,
Shawn
Curt Springer <[EMAIL PROTECTED]> wrote:
>There's been tons o' discussion here on this topic, under headings like "is
>ND really OO" or something.
>
>2 issues:
>
>1. The page reads in the property file (.spg) and creates its list of
>children. This is done before onAfterInit processing. At that point, you
>should be able to add stuff to the list using getChildren and setChildren.
> Of course you would have to construct a CSpHidden.
>
>It might be easier to define a superclass that extends CSpStaticText, and
>modify its onBeforeHtmlOutputEvent to put out html for a hidden field
>instead of static text. This assumes that it might be easier (and less
>breakable with subsequent versions of ND) to construct a CSpStaticText than
>a CSpHidden. I don't know.
>
>2. The page reads in the .html file and sets stuff up internally. From a
>real quick glance at the javadoc for CSpPage and its parent classes, it
>appears that ND hasn't provided hooks into this process for app developers.
> See the method createAccessors. I wonder if you could mess with the html
>file dynamically in 'beforeInit' processing, and do it before the page
>tries to read it in. I really don't know.
>
>-- Curt Springer, Team ND
>
>At 10:55 AM 5/3/99 -0800, [EMAIL PROTECTED] wrote:
>>Here's the issue: I have superclassed my CSpPage to give added
>>intelligence to the entire project. This added logic entails
>>the need for a hidden on the superpage. Unfortunately, even
>>though my other pages inherit the superclass logic, they do not
>>inherit the hidden field. The point of this is to set up an
>>object- oriented framework for the other developers in my
>>group. I do not want to force them to create a hidden on each of the
>pages that they superclass.
>>So the question becomes, is there any way to register the hidden
>>object automatically without their needing to be an associated
>>section with the page property file? I can fill the hidden dynamically
>with the API, I can dynamically add the hidden's spidertag in the HTML, but
>how can I register?
>>
>>Thanks
>>_________________________________________________________________________
>>
>>For help in using, subscribing, and unsubscribing to the discussion
>>forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>>
>>For dire need help, email: [EMAIL PROTECTED]
>>
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]
pic21290.pcx