The first rule of D2W: There is NO magic.

If you can't figure out why something works a certain way, that's just because 
you haven't found where the logic is yet.

The d2wContext is just a state machine / key-value store. It performs little 
logic on its own.

All the 'smarts' are in one of three places:

1. The page templates (from the 'Look')
2. The property level components
3. The assignment objects

Number 3 is the one most overlooked by novice D2W devs, and provides most of 
the 'hidden' functionality. It is well worth your effort to scan the available 
rule files looking for Assignment objects you've never used before. It's ALWAYS 
and eye opening experience. ;)

Rules are actually pretty simple. The left hand side is a qualifier, when it 
matches, it sets the key specified on the right hand side with the value 
derived through the Assignment object. Documenting 'the rules' does little 
good, because the moment you enhance or change one of the items above, the 
range of possible rules change.

Learn your templates, the available property level components, and the 
assignment objects. Once you understand those, parsing the rules becomes much 
easier, and creating your own rules to leverage the potential becomes clearer.

And as you learn, enhancements to the documentation is always welcome ;)

D

--
David LeBer
Codeferous Software

On 2013-09-28, at 11:52 AM, Theodore Petrosky <tedp...@yahoo.com> wrote:

> what did I learn in my d2w sojourn?
> 
> make sure you use the full package name when adding a queryDataSourceDelegate 
> (that one bit me until I read the email about 16 times).
> 
> you can create a Query page and specify in the rules what the entity is.
> 
> there are so many possible rules with settings that I feel there is no way to 
> learn them all. so there must be a logic to their organization that when you 
> learn it, it is all clear.
> 
> I am reminded of a story told by Gurdjieff.
> 
> He was studying at a Tibetan Monastery. One of the 'rules' was that to be 
> considered 'enlightened' one had to perform a very intricate dance. It took 
> on the average 3 years of study to master all the movements and pass the 
> test. But if you studied hard (ate your wheaties) and listened to your 
> master, you would eventually learn this complete dance.
> 
> One day he was eating his lunch watching two new supplicants begin the 
> process of learning the dance. Whilst eating and in the midst of a reverie, 
> he looked up and noticed that in the room, there was a bas-relief that 
> depicted all the steps of the dance. Unfortunately, when doing the dance, you 
> can not just look up as, depending on your angle you can or can not make out 
> the images. And that's when the images became clear to him.
> 
> In each step of the dance, the dancer is forming a character of the alphabet 
> (picture Village People YMCA), and the supplicant is spelling out the names 
> of the 20 men that founded the Monastery. Once you learned this fact, it was 
> easy.
> 
> Where is the D2W key? It's there somewhere!!!
> 
> 
> 
> On Sep 26, 2013, at 5:52 PM, David Holt <programming...@mac.com> wrote:
> 
>> Your method calling this query page should actually be:
>> 
>>   public WOComponent queryBillboarAction() {
>>     return D2W.factory().pageForConfigurationNamed("QueryBillboard", 
>> session());
>>   }
>> 
>> pageConfiguration = "QueryBillboard" => entity = "Grid" 
>> [com.webobjects.directtoweb.EntityAssignment], 
>> 
>> task is in the configurationName
>> 
>> On 2013-09-26, at 2:45 PM, David Holt <programming...@mac.com> wrote:
>> 
>>> Yes! You're coming to the crux of D2W power. Congratulations :-)
>>> 
>>> All you need to do is set some rules for task and entity of the custom 
>>> configuration you need. Typed into Mail:
>>> 
>>> pageConfiguration = "RowsAndRowsOfMyAwesomeBillboards" => task = 'list' 
>>> [com.webobjects.directtoweb.Assignment]
>>> pageConfiguration = "RowsAndRowsOfMyAwesomeBillboards" => entity  "Grid" 
>>> [com.webobjects.directtoweb.EntityAssignment], 
>>> 
>>> 
>>>   public WOComponent queryBillboardAction() {
>>>     QueryPageInterface qpi = (QueryPageInterface) 
>>> D2W.factory().queryPageForEntityNamed("Grid", session());
>>>     return (WOComponent) qpi; 
>>>   }
>>> 
>>> pageConfiguration = 'QueryBillboard' => navigationState = 'Tab2' 
>>> [com.webobjects.directtoweb.Assignment]
>>> pageConfiguration = "RowsAndRowsOfMyAwesomeBillboards" => navigationState = 
>>> 'Tab2' [com.webobjects.directtoweb.Assignment]
>>> 
>>> rule to return the custom page configuration:
>>> 
>>> pageConfiguration = "QueryBillboard" => listConfigurationName =   
>>> "RowsAndRowsOfMyAwesomeBillboards" [com.webobjects.directtoweb.Assignment], 
>>> 
>>> you can return the list in the same page like so:
>>> 
>>> pageConfiguration = "QueryBillboard" => showListInSamePage = "true" 
>>> [com.webobjects.directtoweb.BooleanAssignment]
>>> 
>>> and don't forget the rule to set your query delegate to the QueryBillboard 
>>> page.
>>> 
>>> Of course you could be more reasonable and call your custom page 
>>> configuration something like "ListBillboardGrid" and your task and entity 
>>> should be picked up by the default assignment rules (since both "list" and 
>>> "grid" are contained in the pageConfiguration name) but I exaggerated for 
>>> effect.
>>> 
>>> 
>>> On 2013-09-26, at 2:24 PM, Theodore Petrosky <tedp...@yahoo.com> wrote:
>>> 
>>>> 
>>>> On Sep 26, 2013, at 5:07 PM, David Holt <programming...@mac.com> wrote:
>>>> 
>>>>> Hi Ted,
>>>>> 
>>>>> well Grid is the entity, but you only want to display those grids that 
>>>>> are billboards?
>>>>> 
>>>>> "Pages.ListGrid" = "List Billboards"
>>>>> "Nav.ListGrid" = "List Billboards"
>>>>> 
>>>>>>>>>> ((D2WComponent) qpi).d2wContext().takeValueForKey("ListBillboard", 
>>>>>>>>>> "navigationState");
>>>>>>>>>> ((D2WComponent) qpi).d2wContext().takeValueForKey("QueryBillboard", 
>>>>>>>>>> "pageConfiguration");
>>>>> 
>>>>> I'm not sure these two rules make any sense (at least this is not how I 
>>>>> do it). You probably should be setting navigation state in the rules. And 
>>>>> if you want to use a custom pageConfiguration for your list page then you 
>>>>> need to set it in your query page rules (either inline or as your 
>>>>> listConfigurationName).
>>>>> 
>>>>> If you actually NEED a ListGrid page as well as Billboard, you'll have to 
>>>>> create a custom pageConfiguration for Billboards and assign the usual 
>>>>> task and entity to it.
>>>> 
>>>> and this is my issue. I NEED both the ListGrid and ListBillboard where the 
>>>> underlying entity is Grid. (Tab1 is the ListGrid tab, Tab2 is the 
>>>> ListBillboard tab) Are you suggesting here that I can do this with a 
>>>> custom pageConfiguration? Is there some example of this that I can 
>>>> examine? Keep in mind I have no problem when I enter the ListBillboard 
>>>> tab. My problem is when I click the query button on a Query Billboard. the 
>>>> resultant page is a ListGrid page that I want to call a List Billboard 
>>>> page.
>>>> 
>>>> Ted
>>>> 
>>>>> On 2013-09-26, at 12:21 PM, Theodore Petrosky <tedp...@yahoo.com> wrote:
>>>>> 
>>>>>> yes, I use the Localizable.strings. I don't see how this would help?  I 
>>>>>> thought I wanted to change the context pageConfiguration.
>>>>>> 
>>>>>> What did I miss?
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On Sep 26, 2013, at 12:12 PM, David Holt <programming...@mac.com> wrote:
>>>>>> 
>>>>>>> Are you using Localizable.strings?
>>>>>>> 
>>>>>>> 
>>>>>>> On 2013-09-26, at 7:24 AM, Theodore Petrosky <tedp...@yahoo.com> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> On Sep 26, 2013, at 4:41 AM, Fabian Peters <lists.fab...@e-lumo.com> 
>>>>>>>> wrote:
>>>>>>>> 
>>>>>>>>> Hi Ted,
>>>>>>>>> 
>>>>>>>>> Am 26.09.2013 um 01:51 schrieb Theodore Petrosky:
>>>>>>>>> 
>>>>>>>>>> yea sometimes the original answer to a post was over my head and I 
>>>>>>>>>> didn't understand something, so I gave up.
>>>>>>>>>> 
>>>>>>>>>> I have your solution working beautifully. I hope this helps me to 
>>>>>>>>>> understand the delegates more.
>>>>>>>>>> 
>>>>>>>>>> but here is an issue.
>>>>>>>>>> 
>>>>>>>>>> here is the method that returns the QueryPage:
>>>>>>>>>> 
>>>>>>>>>> public WOComponent queryBillboardAction() {
>>>>>>>>>> QueryPageInterface qpi = (QueryPageInterface) 
>>>>>>>>>> D2W.factory().queryPageForEntityNamed("Grid", session());
>>>>>>>>>> 
>>>>>>>>>> ((D2WComponent) qpi).d2wContext().takeValueForKey("ListBillboard", 
>>>>>>>>>> "navigationState");
>>>>>>>>>> ((D2WComponent) qpi).d2wContext().takeValueForKey("QueryBillboard", 
>>>>>>>>>> "pageConfiguration");
>>>>>>>>>> 
>>>>>>>>>> return (WOComponent) qpi;
>>>>>>>>>> 
>>>>>>>>>> }
>>>>>>>>>> 
>>>>>>>>>> of course this is a 'subselect' of the entity 'Grid'. so the page 
>>>>>>>>>> that returns is a ListGrid page.
>>>>>>>>>> 
>>>>>>>>>> How can I control this? It needs to be a ListBillboard page.
>>>>>>>>> 
>>>>>>>>> If your query page should return a list of billboards, then I guess 
>>>>>>>>> the query page should be one for billboards. If a billboard has some 
>>>>>>>>> relation to grid, you can still query for grid attributes by 
>>>>>>>>> specifying key-paths from billboard. Something like 
>>>>>>>>> "billboard.grids.id".
>>>>>>>> 
>>>>>>>> it's the other way around. I have an entity 'Grid'. this entity has a 
>>>>>>>> boolean attribute isBillboard. I have created a tab that gives a 
>>>>>>>> listing of a subset of Grid where isBillboard is true.
>>>>>>>> In the action method that returns the ListGrid page, I set the 
>>>>>>>> navigationState:
>>>>>>>> 
>>>>>>>>>>>>> ((D2WComponent) 
>>>>>>>>>>>>> lpi).d2wContext().takeValueForKey("ListBillboard", 
>>>>>>>>>>>>> "navigationState");
>>>>>>>> 
>>>>>>>> I have a search button that I set the delegate to return Grid entities 
>>>>>>>> where isBillboard is true.
>>>>>>>> 
>>>>>>>> Unfortunately, when you do a query, the returning page is a 'ListGrid' 
>>>>>>>> page (As the entity is Grid). I am looking for a way such that when 
>>>>>>>> this ListGrid page is returned, I can set the navigationState to 
>>>>>>>> 'ListBillboard'.
>>>>>>>> 
>>>>>>>> I could make this easy on myself and create a view on the backend 
>>>>>>>> called Billboard. (CREATE VIEW billboard AS SELECT * FROM t_grid WHERE 
>>>>>>>> isbillboard = true). I could even set up some rules and triggers on 
>>>>>>>> the backend that would make it updatable. Then I could just treat it 
>>>>>>>> as a separate entity and be done.
>>>>>>>> 
>>>>>>>> But I thought I would just stay on the WO side of things.
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Fabian
>>>>>>>>> 
>>>>>>>>>> Thank you for your patience.  When I first read your solution over a 
>>>>>>>>>> year ago I felt it was too complex as I didn't have the knowledge to 
>>>>>>>>>> understand it. Funny what another year looking at this stuff can do.
>>>>>>>>>> 
>>>>>>>>>> Ted
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On Sep 25, 2013, at 4:26 PM, David Holt <programming...@mac.com> 
>>>>>>>>>> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Nothing like a little deja vu, including the original poster.
>>>>>>>>>>> 
>>>>>>>>>>> :-)
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> On 2013-09-25, at 12:40 PM, Johnny Miller <jlmil...@kahalawai.com> 
>>>>>>>>>>> wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> Like this?
>>>>>>>>>>>> 
>>>>>>>>>>>> http://lists.apple.com/archives/webobjects-dev/2012/Apr/msg00260.html
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> On Sep 25, 2013, at 9:23 AM, Theodore Petrosky <tedp...@yahoo.com> 
>>>>>>>>>>>> wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>>> I have an entity 'Grid' that has an attribute 'isBillboard'. I 
>>>>>>>>>>>>> created the list billboard tab with:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> public WOComponent listBillboardAction() {
>>>>>>>>>>>>> 
>>>>>>>>>>>>> EOEditingContext ec = ERXEC.newEditingContext();
>>>>>>>>>>>>> ListPageInterface lpi = (ListPageInterface) 
>>>>>>>>>>>>> D2W.factory().pageForConfigurationNamed("ListGrid", session());
>>>>>>>>>>>>> 
>>>>>>>>>>>>> EODatabaseDataSource ds = new EODatabaseDataSource(ec, "Grid");
>>>>>>>>>>>>> 
>>>>>>>>>>>>> ERXFetchSpecification<Grid> fs =  new 
>>>>>>>>>>>>> ERXFetchSpecification<Grid>(Grid.ENTITY_NAME, 
>>>>>>>>>>>>> Grid.IS_COMPLETE.eq(false).and(Grid.IS_BILLBOARD.eq(true)), null);
>>>>>>>>>>>>> 
>>>>>>>>>>>>> ds.setFetchSpecification(fs);
>>>>>>>>>>>>> 
>>>>>>>>>>>>> lpi.setDataSource(ds);
>>>>>>>>>>>>> 
>>>>>>>>>>>>> ((D2WComponent) 
>>>>>>>>>>>>> lpi).d2wContext().takeValueForKey("ListBillboard", 
>>>>>>>>>>>>> "navigationState");
>>>>>>>>>>>>> 
>>>>>>>>>>>>> return (D2WPage) lpi;
>>>>>>>>>>>>> }
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> How can I apply the same limit to a Query page? I don't want to 
>>>>>>>>>>>>> put a control on the page to select 'isBillboard', i want 
>>>>>>>>>>>>> isBillboard to be true
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> public WOComponent queryBillboardAction() {
>>>>>>>>>>>>> QueryPageInterface qpi = (QueryPageInterface) 
>>>>>>>>>>>>> D2W.factory().queryPageForEntityNamed("Grid", session());
>>>>>>>>>>>>> 
>>>>>>>>>>>>> ((D2WComponent) 
>>>>>>>>>>>>> qpi).d2wContext().takeValueForKey("ListBillboard", 
>>>>>>>>>>>>> "navigationState");
>>>>>>>>>>>>> 
>>>>>>>>>>>>> return (WOComponent) qpi;
>>>>>>>>>>>>> 
>>>>>>>>>>>>> }
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/jlmiller%40kahalawai.com
>>>>>>>>>>>>> 
>>>>>>>>>>>>> This email sent to jlmil...@kahalawai.com
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
>>>>>>>>>>>> 
>>>>>>>>>>>> This email sent to programming...@mac.com
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com
>>>>>>>>>> 
>>>>>>>>>> This email sent to lists.fab...@e-lumo.com
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> _______________________________________________
>>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/tedpet5%40yahoo.com
>>>>>>>>> 
>>>>>>>>> This email sent to tedp...@yahoo.com
>>>>>>>> 
>>>>>>>> 
>>>>>>>> _______________________________________________
>>>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
>>>>>>>> 
>>>>>>>> This email sent to programming...@mac.com
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/programmingosx%40mac.com
>>> 
>>> This email sent to programming...@mac.com
>> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/dleber_wodev%40codeferous.com
> 
> This email sent to dleber_wo...@codeferous.com


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to