Tuesday, August 31, 2010

There is a property for that

Just came back from WOWODC and all the great talks and discussions. The saying of the week was: "There is a property for that" -- mostly tied to Wonder's many properties that can and sometimes need to be utilized to manage that frameworks functionality. Its the new rallying cry.

Wednesday, May 19, 2010

Creating standard WOComponent in D2W (Modern) pages

If one creates a standard WOComponent, extending D2WPage, this note from David LeBer will do the trick:

The current implementation of ERModernMoviesDemo (and the ERModern D2W Template) assumes that you are going to have a valid D2WContext for every page in the app. Yeah, I know, shoot me.

Given that a D2WContext really needs three things to display a page:

1. An Entity.
2. A task
3. The template for the task.

We can set up some rules to fudge this. Assuming we have a page named 'MyFooPage.wo' that inherits from D2WPage (we won't use any of D2WPage's features, just it's D2WContext), and we want a Tab named "Foo" to trigger it.

1. Add Foo to the NavigationMenu.plist:
{ name = "Foo"; action = "session.navController.goToFooPage"; },

2. Add a goToFooPage method in the navigation controller:

public WOComponent goToFooPage() {
return D2W.factory().pageForConfigurationNamed("DoThatFooThatYouDo", session());
}

3. Add Foo to Localizable.strings

"Nav.Foo" = "Foo";

4. Add the rules to fudge this page:

100: pageConfiguration = 'DoThatFooThatYouDo' => entity = "AValidEntityFromYourModel" [EntityAssignment]*
100: pageConfiguration = 'DoThatFooThatYouDo' => task = "inspect" [Assignment]
100: pageConfiguration = 'DoThatFooThatYouDo' => templateNameForInspectPage = "MyFooPage" [Assignment]

5. Set the navigation state:

100: pageConfiguration = 'DoThatFooThatYouDo' => navigationState = "Foo" [Assignment]


* AValidEntityFromYourModel does not have to be an Entity you are going to use on your page, we just need it to make the D2WContext happy.

The css class of the body tag on your page will be "DoThatFooThatYouDoBody"