Re: api variables
Re: api variables
- Subject: Re: api variables
- From: "Jerry W. Walker" <email@hidden>
- Date: Tue, 5 Sep 2006 12:05:38 -0400
Hi, Benoit,
On Sep 5, 2006, at 11:37 AM, benoit cantin wrote:
Here is an example of what we are doing. An entity called "Artist"
references instances of an entity called "Album". We have 2 Web
components, one which let users customize Artist properties, let's
call it component1, and the other which let users customize Album
properties (component2). Both components are reusable ones. Main
component defines an instance of component1, and component1 defines
an instance of component2. A variable called "theEditedArtist" is
passed from Main to component1, and to component2 as an API
variable. The reason is that we must get modification on
"theEditedArtist" made in component2 back to Main. Identically,
Boolean API variables are passed to component1 from Main to enable/
disable blocks visibility in component1. Other Boolean API
variables are passed from Main to component2 (which is attainable
from Main and component1). You guess that those Boolean variables
are passed from component1 to component2. These API variables must
be in a coherent state, since they control component1 and
component2 display, themselves displaying on the same screen area.
So the problem is to maintain Boolean coherency, otherwise :
-if all Booleans are set to false : no display.
-if all Booleans are set to true : multiple overlaying displayed
components.
Although the approach you're taking is reasonable in certain
circumstances, I think you would be better served simply defining a
full page WOComponent for editing Artist and another full page
WOComponent for editing Album. You could list the Albums and/or the
Artists on the Main page within WOHyperlinks embedded within
WORepetitions for both Album and Artist. When you're user clicks on
an Artist link, simply use WOComponent's pageWithName
("ArtistEditPage") and initialize the page with the Artist selected
on the main page.
If you're using WOBuilder and if you create a WOHyperlink on the main
page and bind it's action binding to a new name, WOBuilder will ask
if you want it to create an action method in the Main.java file for
you. If you say yes, it creates a nice template action method in your
Main.java class which uses pageWithName and provides a comment where
your initialization code should go.
I think you'll find, overall, that this is an easier approach than
going too deeply into subcomponents.
One of the more important things to remember with the full page
component approach is that pageWithName creates a new instance of the
named page. If you use it in page A to create an instance of page B
and want to get back to the same instance of page A from B later,
then you must pass "this" from page A to B in the initialization you
do in page A. If you try to return by using another pageWithName, you
will be creating a new instance of A and will have lost any state
that the previous instance of A retained.
Regards,
Jerry
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
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