Well, yes, of course, everything we do is subject to how the ND object
framework acts.  

It is the ND framework that executes the event methods we supply and
evaluates the return, whether the standard int return, if our code does not
throw an exception, or whatever exception  our code throws.  We can't
actually force it to do anything in response to the result from executing
our code.  Essentially there is a commitment from ND that if our code
returns certain results (an int return evaluating to PROCEED, SKIP, STOP,
or a CSpSkipException or CSpStopException thrown), then they will continue
or halt processing.

Unless/until you say that you actually tried returning SKIP/STOP or
throwing CSpSkip/StopException in onBeforeRowDisplay, I will assume that an
error at this level would stop all the objects from displaying, since the
'display' command is not supposed to be sent to individual objects until
'row display' processing happens.

-- Curt Springer, Team ND


At 12:59 PM 6/21/99 +0530, Kiran H.N wrote:
>I have tried using CSpStopException in a similar case but without
>success. The
>rest of the visual objects are processed normally.  The documentation
>says that
>CSpStopException stops  the current thread of execution as soon as
>possible.
>   Does "as soon as possible"  imply that when we throw an exception in
>say
>onBeforeDisplay/Htmlevent of  a visual object its really upto ND Object
>Framework to decide the appropriate time to stop the thread and as a
>consequence we might sometimes find that the execution stops only after
>all the
>visual objects are processed?.
>
>Curt Springer wrote:
>
>> I suggest that you move all such processing up to
>> <whatever>_onBeforeRowDisplayEvent (for page or repeated).  That way, if
>> you return STOP it will kill processing for the whole row (or page, if you
>> are at that level).  This assumes that the field is not bound to a data
>> object column, since you're doing everything manually.
>>
>> If you do it this way, you should set up references to the objects as
>> member variables in this_onAfterInitEvent:
>>
>> (on after init)
>> _cbAttribute = CSpComboBox("*cbAttribute");
>>
>> //member variable
>> private CSpComboBox _cbAttribute;
>>
>> Then you could move all the below code (after 'event.getSource()') verbatim
>> to onBeforeRowDisplay, substituting '_cbAttribute' for 'visualObject'.
>>
>> Also, Grace Frederick recently discovered something in a project we are
>> working on, that might make some difference:
>>
>> The standard method return of PROCEED, SKIP, STOP goes back to the earliest
>> days of ND/Spider java (ND version 2).  As of ND4, with the new event
>> model, alternatives were introduced:
>> --instead of returning SKIP, you can throw CSpSkipException
>> --instead of returning STOP, you can throw CSpStopException
>>
>> The documentation says that these new things are equivalent, but from our
>> experience they were not.  We were looking at onBeforeHtmlOutputEvent.  We
>> found that throwing CSpStopException really stopped things, whereas
>> returning STOP did not.
>>
>> -- Curt Springer, Team ND
>>
>> At 03:14 PM 6/19/99 +0530, Swaroop.S wrote:
>> >Hi,
>> >      We are experiencing a problem with the onBeforeDisplay/Htmlevent
>> >of visual objects. Suppose we are calling methods which throw an
>> >exception, in these events, we handle them using a try-catch block. Just
>> >in case an exception is thrown the statements in the catch block get
>> >executed. We will display an error page and then STOP the processing by
>>
>> >using return STOP; as the last statement in the catch block. We also use
>> >CSpHtml.reset() before displaying the error page.
>> >    But there seems to be a flaw , in the way we are using , i guess.
>> >The processing for that visual object is stopped , but the objects that
>> >follow the one ,for which an exception occured, are displayed! This
>> >leads to the error page being displayed with the othere visual objects
>> >coming below it! Is there a work around to this problem. I'm including
>> >the sample code with this mail.
>> >

>> > public int cbAttribute_onBeforeDisplayEvent(CSpDisplayEvent event)
>> > {
>> >  try
>> >  {
>> >   CSpVisual visualObject = (CSpVisual)event.getSource();
>> >
>> >   visualObject.removeAllChildren(true);
>> >   if (rtbMajorAttribute.getNumOfRows () > 0)
>> >   {
>> >    String lblcbPA  = "";
>> >    for (int i=0; i< rtbMajorAttribute.getNumOfRows () ;i++)
>> >    {
>> >     if (rtbMajorAttribute.getRowData(i, 3).stringValue().length() < 40)
>> >
>> >      lblcbPA = rtbMajorAttribute.getRowData(i, 2).stringValue() + " | "
>> >+ rtbMajorAttribute.getRowData(i, 3).stringValue(); //.substring(0,40);
>> >     else
>> >      lblcbPA = rtbMajorAttribute.getRowData(i, 2).stringValue() + " | "
>> >+ rtbMajorAttribute.getRowData(i, 3).stringValue().substring(0,40) +
>> >"..";
>> >
>> >     ((CSpSelectableGroup) visualObject).addSelectable( lblcbPA  ,new
>> >CSpInteger(rtbMajorAttribute.getRowData(i, 1).intValue()));
>> >    }
>> >
>> >    ((CSpSelectableGroup) visualObject).addSelectable("*.0 | Report for
>> >All Attributes ",new CSpInteger(-1));
>> >    ((CSpSelectableGroup) visualObject).unselectAll();
>> >
>> >    String   ls_Selected  =  "";
>> >    if (MajorAttribute.equals(""))
>> >     ls_Selected   = "-1";
>> >    else
>> >     ls_Selected   = MajorAttribute;
>> >
>> >     ((CSpSelectableGroup) visualObject).select(new
>> >CSpString(ls_Selected));
>> >     //log("ls_Selected is " + ls_Selected);
>> >   }
>> >   else
>> >   {
>> >    _errorCode = ERROR;
>> >    _errorDesc = "There are no Attributes currently defined in the
>> >Application";
>> >    throw new Exception();
>> >   }
>> >  }
>> >     catch (Exception ex)
>> >     {
>> >   if (_errorDesc.equals(""))
>> >    _errorDesc = ex.getMessage();
>> >   displayErrorPage();
>> >
>> >   return (STOP);
>> >
>> >     }//catch
>> >
>> >  return (PROCEED);
>> > }
>> > //]]SPIDER_EVENT<cbAttribute_onBeforeDisplayEvent>
>> >
>> >Thanks for your time.
>> >regds
>> >swaroop
>> >
>> >_________________________________________________________________________
>> >
>> >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]
> 
_________________________________________________________________________

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]

Reply via email to