Re: binding a complete component to an object
Re: binding a complete component to an object
- Subject: Re: binding a complete component to an object
- From: Andreas Kosmala <email@hidden>
- Date: Thu, 13 Nov 2003 22:33:38 +0100
you got it totally right - thanks a lot and sorry for my late answer!
the API editor was the missing link ;-)
Additionally I made one mistake: I wanted to make the underlying
WOComponent the object to be edited by the component. But that's
nonsense. I would say the WOComponent (PersonEdit) is a kind of view and
the object (Person) is the corresponding model (which normally is a
persistent object)
andreas
Chuck Hill schrieb:
I'm not sure that I understand your question. I'll answer what I think you
as asking. :-)
Q. On some page (which I will call SomePage) there is a User object that I
want to edit in a PersonEdit component on that page. How do I pass the
Person object from SomePage to PersonEdit?
A:
(1) Make sure that there are access/mutator method on SomePage for the User
instance variable:
protected User aUser;
(You can also make aUser public but I dislike that)
public User user() {
return aUser;
}
public void setUser(User newUser) {
aUser = newUser;
}
(2) Make sure that there are access/mutator method on PersonEdit for the
User instance variable that will be edited:
protected User userToEdit;
(You can also make userToEdit public but...)
public User userToEdit() {
return userToEdit;
}
public void setUserToEdit(User newUser) {
userToEdit= newUser;
}
(3) Use the inspector to add this binding to the PersonEdit component on
SomePage:
userToEdit = user;
Notes:
- I've used different names for user, aUser, userToEdit to show that all
are not the same. They could all be called user and the binding would look
like:
user = user;
- You can add the 'userToEdit' binding to the API for the PersonEdit
component in the API editor in WOBuilder (looks like a piece from a jigsaw
puzzle). This makes using the PersonEdit component easier as you don't
need to remember what the binding names are.
Chuck
At 10:14 AM 09/11/2003 +0100, Andreas Kosmala wrote:
Hi all,
sorry for the eventually stupid question but I dont find a solution in
the docs: what I want to do is nothing special in my opinion: When I use
a user component I wrote on my own (e.g. PersonEdit) within a page, I
want to bind this complete user component to one object-attribute (of
the corresponding class PersonEdit) within this page. How to do this?!
User components dont offer any bindings at all.
regards,
Andreas
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.