Re: Switch component for existing instances
Re: Switch component for existing instances
- Subject: Re: Switch component for existing instances
- From: email@hidden
- Date: Thu, 30 Jun 2005 22:42:51 +1200
Hello Jarvis;
I have come to learn that the "switch" tends to make everything
inside into a "stateless" environment and thus I have developed a
technique of modelling 'state-holding' objects that conform to KVC
and can provide state for the session and the switch'ed components.
These are effectively stored in the session object and referred to
from my components that are within the switch. Despite the
additional complexity, in many situations this actually facilitates
better workflows than I could have generated with a linear component
workflow technique.
I don't know your exact situation, but from your simple outline, this
sounds like you are trying to construct nice menu/breadcrumb/etc...
systems to work apps into. A very simple world-visible example of
this in my work is here;
http://www.macpeopledownunder.net/
...but things can, and do, get much more complex than that. I have
some fairly good offline documentation I would be happy to share with
you about some of this stuff if you would like as it is easier to see
diagrams than to try and explain this in text.
cheers.
...
This question seems to have come up a few times previously in the
list archives, and while there are pointers to Webobjects Objective
C components that do this (eg OWOReplacementComponent, and a couple
of others), but none in Java that I've been able to find.
As a couple of other people seem to have done, I've gone a long way
down the track of re-implementing a custom component (subclass of
WODynamicElement) to do this. And I've now reached a point where it
*almost* works.
So - a couple of questions!
Firstly, is trying to instantiate WOComponents outside of the
normal flow of page creation (ie Instantiating subcomponents
'manually' in the constructor of a page rather than allowing them
to be instantiated by WO as it generates the page) either a really
bad design, or likely to break something?
(What I'm trying to do is implement a menu/navigation component
that queries the subcomponents that it's switching between for
their state in order to display enabled/disabled links.
Instantiating the components 'outside' is an attempt to avoid
having to create and destroy each component 'inside' the menu
component just to be able to read its state.
I've considered creating static class methods on subcomponents to
allow their state to be queried without the overhead of
instantiating them twice. But java doesn't allow static methods in
interfaces, which is a frustration. I'm also toying with using
notifications, somehow....)
Secondly, assuming it is a reasonable design, has anyone else been
able to get it to work? Or know of a working implementation?
Thirdly, assuming the answers to the previous two questions are
'no' and 'no'... can someone please help me work out why I'm getting
___
Andrew Lindesay
www.lindesay.co.nz
+64-21-47-0929
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden