Re: Getting values from parent page
Re: Getting values from parent page
- Subject: Re: Getting values from parent page
- From: George Domurot <email@hidden>
- Date: Wed, 11 May 2005 06:49:19 -0700
Florijan: This should be quite simple for you. You will need a variable
and accessor methods in your PageWrapper, something like:
protected String pageName;
public String pageName(){
if (pageName==null)
return "Untitled Document";
return pageName;
}
public void setPageName(String value){
pageName = value;
}
From within your PageWrapper component, use the API editor to add the
key pageName as a binding. Also, from this component set the title as
dynamic and bind it to pageName.
Now, from any component that you are "wrapping" with your PageWrapper,
simply bind a string value to the PageWrapper's pageName binding.
-George
--
George Domurot
email@hidden
On May 11, 2005, at 6:10 AM, Florijan Stamenkovic wrote:
Hi list..
I am trying to find a way for my PageWrapper full document component
to get a title for the page from it's parent component, which is a
partial doc.
My current idea (after reading some about it) is to bind the doc title
of the PageWrapper to a method that looks like this:
protected String pageName()
{
try{
return (String)context().page().valueForKey("pageName");
}
catch(Exception e){
return "Untitled document";
}
}
and then provide all my partial docs with a
final String pageName = "Whatever"
I had some other ideas, but they were for this or another reason just
not functional.
Is this a good approach to the issue? It seems fail-proof to me.I
tried to do it already with bindings on my partial pages like
ComponentContent: PageWrapper{
wrapperPageName = pageName; //where title is bound to
wrapperPageName in the full document PageWrapper
}
but that resulted in weird behavior. The String was passed and set on
the first run, so my page title did get the proper string (I was
setting different strings for wrapperPageName and pageName in their
constructors), but I was unable to change it dynamically. I bound the
pageName (parent component) key to a text field, put it in a form and
tried changing it while running the app. I could not. When I removed
the wrapperPageName = pageName binding, I could edit the String as I
pleased... Can't understand why.
TIA
Florijan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
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