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]
begin:vcard 
n:;Kiran H.N
x-mozilla-html:FALSE
org:IT Solutions (India) Pvt Ltd.,
adr:;;;Bangalore;Karnataka;;India
version:2.1
email;internet:[EMAIL PROTECTED]
title:Software Engineer
x-mozilla-cpt:;0
tel;home:3422187
tel;work:6655122  Ext 237,249
fn:Kiran H.N
end:vcard

Reply via email to