• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: why does selecting a parent not make me it's child?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why does selecting a parent not make me it's child?


  • Subject: Re: why does selecting a parent not make me it's child?
  • From: Denis Stanton <email@hidden>
  • Date: Thu, 17 Jul 2003 09:44:21 +1200

On Wednesday, July 16, 2003, at 09:15  AM, Chuck Hill wrote:

public Parent currentParent() {
    return parent();
}

public void setCurrentParent(Parent value) {
    addObjectToBothSidesOfRelationshipWithKey(value, "parent");
}

Then use currentParent for the bindings in place of parent.

public void setParent(Parent value) {
	Parent oldParent = this.parent();
	oldParent.removeFromHires(this);
	value.addToHires(this);
	takeStoredValueForKey(value, "parent");
}
I would not do this, this is what addObjectToBothSidesOfRelationshipWithKey does, but not as flexibly. What I really meant was the currentParent/setCurrentParent pair above.


Thank you for the explanation, which lead to a couple of those "aha..." moments when Learning finally occurs.


First I eventually understood that writing new methods for currentParent is safer than tinkering with the existing setParent method ( I was already getting problems with my modified class when I assigned a 'new' parent to a previously parent-less child instance

The second realisation came after I worried that I didn't know how to bind the popUp selection to the new setCurrentParent method. I was thinking that the binding was to the parent "variable" and I couldn't change it. It finally came to me that the binding merely identifies a pair of methods (currentparent and setCurrentMethod in this case). Whether they front for a variable, or for another method is not important. This is so basic to object oriented programming that you may be wondering what I am talking about, but I have more than 20 years of programming in my head from before OOD and I still think in terms of data items that occupy distinct physical bit and bytes in "memory".

Thank you for your patient assistance.

Denis
_______________________________________________
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.

References: 
 >Re: why does selecting a parent not make me it's child? (From: Chuck Hill <email@hidden>)

  • Prev by Date: Re: WO 5.2 - NullPointerException in _eoForGID (2) (EOEditingContext)
  • Next by Date: WOFileUpload docs?
  • Previous by thread: Re: why does selecting a parent not make me it's child?
  • Next by thread: Re: WO Deployment
  • Index(es):
    • Date
    • Thread