ERXSwitchComponent

Robin Smith <[email protected]>
Newsgroups gmane.comp.web.webobjects.wonder-disc
Message-ID <CAHmZkDtmbZcHQqS7=BcNFpj9wMG5yDM8RRL6-10N3abv+R2ecA@mail.gmail.com>
Hi All

I have a question regarding ERXSwitchComponent and its componentCache.
What i have noticed by stepping through the code is that it caches the
components by name so if i call the same component more than once then
it returns the cached version.

This sounds great unless i then try edit a different object using the
same component, as the cache is preserving state from that last time
it was used. For example if i edit Person1 using EditPerson.wod then i
decide i want to edit Person2 which will also use EditPerson.wod any
state from the first use is preserved (this really isnt the easiest
thing to explain in an email)

So i have two questions

1. Was this designed only to be used with stateless components? If so
this is fine i will update the JavaDoc and move onto another solution.

2. If not even better, but am i missing something maybe
ERXSwitchComponent is supposed take an "id" that can make each use of
a component unique. I dont mind the cache, if in my example i went
back again to edit Person1 then it would be great for the cached
values to be used. The class calls
"paramWOContext.appendElementIDComponent(id);" repeatedly but i dont
really know what this is supposed to be doing as it doesn't seem to
change the "id" value.

If nobody has any input i will see about doing this work myself and
submitting it to you guys


Many Thanks

Robin

P.S. Why does ERXSwitchComponent not extend ERXDynamicElement

-- 

------------------------------
Click Travel Ltd
Taking business travel and expenses one step further
http://www.clicktravel.com

Winner of "Best Business Travel Management Company" at the Business Travel 
Awards (2012 & 2009) and the Travel Trade Gazette Awards (2011). We're also ranked 
22nd in the 2012 Sunday Times Hiscox Tech Track 100.

For all the latest Click news please visit our blog: 
http://clicktravel.com/blog

Think: Do you really need to print this email?

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.