• 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: Components on a page question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Components on a page question...


  • Subject: Re: Components on a page question...
  • From: James Cicenia <email@hidden>
  • Date: Mon, 29 Mar 2004 16:19:25 -0600

I didn't quite understand at the the time how to bind from the parent to the child. None of the bindings
were appearing... didn't see where the "add new binding" showed up anywhere in the code, etc.


Luckily these components would not be used anywhere else... and I have now gone with the
better design approach. Hey two months ago I was a rank newbie.. now I am an intermediate newbie
and have learned a tremendous amount in a short time due to the absolute generosity and patience
of you and everyone else on this list. Of course the omniweb archives help too.


Also until this weekend I didn't realize you could bind to a getter and setter in a popup!!!

But one day I will re-factor and clean up my code... but for now it is burn baby burn....and I must
say I am very impressed with this environment.


-James

On Mar 29, 2004, at 3:54 PM, Jonathan Rochkind wrote:

At 3:39 PM -0600 3/29/04, James Cicenia wrote:
However, it has made me rethink my work... I have always subclassed my
pages from a the master Page and had put all my code in there. But now
you have me thinking that that would be inefficient just keeping the code within
the children only.. Well,, deadlines are looming so re-factoring will have to be
done for version 1.1.

I don't know if it's an issue of efficient vs inefficient. It's an issue of good design. Which I suppose has implications on efficiency, but the primary thing here is design.


But I'm confused as to why you were making your partial pages subclasses of their parent page in the first place. What purpose were you trying to achieve here? In general, a subcomponent should, of course, be useable in _multiple_ parent pages, and of course it can't be a sub-class of all of them. There's no multiple inheritance in Java (and this is largely a good thing). If you thought you _had_ to do this, or it was standard---that's not so. If you thought that iVar state was somehow shared by all of these components because of the inheritance hiearchy---that's certainly not so either.

I can't think of any good reason, in general, to have partial components subclass the parent component they will exist in. But that doesn't mean there aren't any good reasons that I haven't thought of. It depends on what you were trying to achieve here.

But yeah, if you're on deadline, and It Ain't Broke, then Don't Fix It.

--Jonathan


-James Cicenia


On Mar 29, 2004, at 10:51 AM, Jonathan Rochkind wrote:

At 10:05 AM -0600 3/27/04, James Cicenia wrote:
Hello -

I have a WebObjects page that I built with multiple components
so that WOBuilder would have an easier time.

Say I have a Page with 3 components nested in it..

Page
	Page1
	Page2
	Page3

I subclassed Page1, Page2, Page3 from Page.

Okay, to begin with this is an unusual design.

All my objects, initializations
are in Page. When it builds the page will Page1,2&3 void out my objects?

You're getting confused. Page1, Page2, Page3 and Page are all distinct seperate objects. The fact that all the subcompobnents subclass Page doesn't change anything; you still have four different objects here. They do not share any state. Each has it's own copies of all iVars. If you want these components to share state, you need to pass objects from Page into the sub-components via bindings. And it probably isn't neccesary and is probably not a good idea to have these subcomponents sub-class the Page class---at least if the only reason you were doing that was to try and get them to share state, which that won't accomplish anyway.


If you already do have bindings, let us know what they are. The bindings could be implicated in your values changing when you don't expect them to also. The default WO framework method of binding synchronization sends values _both_ from parent to child _and_ back out from child to parent. If the child changes the value of a variable that has the same name as a binding, this value may be sent back out to the parent, replacing the parent's original value. If that's what's going on and it's undesirable, the solution is usually handling binding value setting and getting yourself, instead of letting the framework do it for you. See the synchronizesVariablesWithBindings method.

Forgive me if I'm misunderstanding your question or your perspective. I hope this helps.

--Jonathan

It seems they are. Originally I had passed the item into Page from a previous
page and everything displays properly... but when I try to save any changes
nothing is changed.


How do the pros handle this pattern?

-James Cicenia
_______________________________________________
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.


References: 
 >Components on a page question... (From: James Cicenia <email@hidden>)
 >Re: Components on a page question... (From: Jonathan Rochkind <email@hidden>)
 >Re: Components on a page question... (From: James Cicenia <email@hidden>)
 >Re: Components on a page question... (From: Jonathan Rochkind <email@hidden>)

  • Prev by Date: Re: Components on a page question...
  • Next by Date: One last Question: Components on a page question...
  • Previous by thread: Re: Components on a page question...
  • Next by thread: One last Question: Components on a page question...
  • Index(es):
    • Date
    • Thread