Re: SubComponents activate Validation at the first time
Kieran Kelleher <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
I've never experienced these symptoms which may be because I use
non-synchronizing subcomponents only. Auto synchronization is very
heavy and leads to 6 (yes, SIX) push/pull bindings for each R-R cycle.
Apple engineers at WWDC recommend lazy pulling of binding values with
synchronization turned off .... it may work better for you.
synchronization off provides predictable behavior along with efficiency
For example, let's say we have a component with a binding
"hyperlinkValue":
protected String _hyperlinkValue;
public String hyperlinkValue()
{
if ( _hyperlinkValue == null ) {
// Pull the binding value
_hyperlinkValue = (String)valueForBinding( "hyperlinkValue"
);
// If binding value not supplied, set a default
if ( _hyperlinkValue == null ) {
_hyperlinkValue = "Download";
}
}
return _hyperlinkValue;
}
For memory and a little more speed efficiency you can also go stateless
which reuses the same WOComponent instance (more or less) repeatedly
eliminating class instantiation time and memory footprint growth ......
Stateless are a little more tricky, so start with non-synchronizing
first.
Here are a few relevant articles that might be of use:
http://homepage.mac.com/kelleherk/iblog/C1133025376/E1896801830/
index.html
http://homepage.mac.com/kelleherk/iblog/C1133025376/E1146937278/
index.html
WWDC 2003, session 614 was a great session on Reusable Componenents a
couple of years ago ... try get the DVDs on eBay if you can.
HTH,
-Kieran
________________________________________________________________
Blog: http://webobjects.webhop.org/
On Feb 27, 2006, at 10:21 AM, WebObjects wrote:
> Hello,
>
> I am using Components, something like:
> ----------------------------------------------------
> Main
> SubCompoent
> Texts, strings, etc...
> End SubCompoent
> End Main
> ----------------------------------------------------
>
> The problem I have: The user opens the page to the first time.
> By passing the data from the Main to SubComponent The validation is
> executed because of setXXXX methods "i guess".
> The method validationFailedWithException passes a message like "Name"
> is not allowed to be null. This happens by displaying the Page at the
> first time.
>
> It is correct because the "Name" is still NULL of couarse, but this is
> because the user didnt have the ability to put any data.
>
> However, anybody has an idea, what do i miss or make wrong? thank you.
>
> Sako.
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev