Re: ERD2W menus not working properly
Re: ERD2W menus not working properly
- Subject: Re: ERD2W menus not working properly
- From: Ramsey Gurley <email@hidden>
- Date: Mon, 30 Jul 2012 12:46:57 -0700
On Jul 30, 2012, at 11:43 AM, Sr. Ângelo Andrade Cirino wrote:
> Dear Ramsey,
>
> Thank you for your answer. I've watched your WOWODC presentation twice so far, as well as David's presentation.
>
>>
>> Don't put the localized names directly in the nav plist. Localized strings go in the Localized.strings file. I've never tried accented characters in the nav plist, but I would suspect it fails because of the NSPropertyListSerialization parser, not the encoding. Use simple ascii characters as your item names, then localize those names in the localizable strings file:
>>
>> plist contains
>> {
>> name = Reports;
>> action = "session.navController.homeAction"; /* dummy action */
>> },
>>
>> Localizable.strings contains
>>
>> "Nav.Reports" = "Relatórios";
>>
>
> Being able to use accents in the names of the menus would be a bonus. See, for me the primary language is Portuguese, and if I localize for other languages, I will surely use all the localization features available, It only happens that I would really like to use the Portuguese names for everything. All my Java classes, methods and properties names have accents with no problem, as well file names (in the Mac) and so on. This was my first problem with accents developing with Eclipse and WO on a Mac. Regarding your recommendations, for instance, my Localizable.strings file contains these strings among others:
>
> "Nav.Produtos" = "Products";
> "Nav.Clientes" = "Customers";
>
> As my primary aim is the Brazilian market, I do not want to do it the reverse way, like
>
>
> "Nav. Products" = "Produtos";
> "Nav. Customers" = "Clientes";
>
> So, lets abide to the NSPropertyListSerialization parser limitation and not use accents in the names.
That should be fine. Or possibly, just wrapping the value in "" may work.
name="Relatórios";
I don't know for sure. I never used special characters in the nav menu plist.
>
>>>
>>> Finally, here follows two of the rules I set up in RuleModeler trying to make the menu system work (as formatted by RuleModeler):
>>>
>>> {
>>> "author" = "50";
>>> "class" = "com.webobjects.directtoweb.Rule";
>>> "documentation" = "Default tab state for products pages";
>>> "lhs" = {
>>> "class" = "com.webobjects.eocontrol.EOKeyValueQualifier";
>>> "key" = "pageConfiguration";
>>> "selectorName" = "isEqualTo";
>>> "value" = "Produtos";
>>> };
>>> "rhs" = {
>>> "class" = "com.webobjects.directtoweb.Assignment";
>>> "keyPath" = "navigationState";
>>> "value" = "Produtos";
>>> };
>>> },
>>
>> This rule is wrong. PageConfigurations should be named something like EditProduct, CreateProduct, ListProduct. Not just Product.
>>
>>> {
>>> "author" = "50";
>>> "class" = "com.webobjects.directtoweb.Rule";
>>> "lhs" = {
>>> "class" = "com.webobjects.eocontrol.EOKeyValueQualifier";
>>> "key" = "pageConfiguration";
>>> "selectorName" = "isLike";
>>> "value" = "*Pessoal*";
>>> };
>>> "rhs" = {
>>> "class" = "com.webobjects.directtoweb.Assignment";
>>> "keyPath" = "navigationState";
>>> "value" = "Pessoal";
>>> };
>>> },
>>
>> This rule looks like it should work, but the priority may be too low or the rule system is not seeing it. Try to right click refresh your rule file in eclipse to see if that makes a difference.
>>
>
> Regarding the PageConfigurations, I meant to have the first layer of menu items not as actions on themselves, but just as menu markers for the user to select the specific submenu items, something like opening the Customer menu and then selecting the submenu Newsletter to enter the interface for sending the newsletter. In my application a Products menu item isn't meant to display a list of products, but instead to display its submenus with options like "List All", "Reports" and "Procurement".
>
>> Are you using the standalone rule modeler app? If not I would strongly suggest you do so. It can refresh the rules whenever you make changes to them. I'm guessing you are not using the standalone app, because your rule is a plist when the standalone app produces an slightly more intelligible string.
>>
>> If you are developing on a mac, get it and configure it correctly
>>
>> http://wocommunity.org/documents/tools/RuleModeler-latest.tar.gz
>>
>> http://wiki.wocommunity.org/display/documentation/Configuring+Rule+Modeler
>>
>> Ramsey
>>
>
> I am indeed using RuleModeler, but I didn't pay attention to the specific preference option to generate the rules in one line each.
Are you using an old version perhaps? When I copy a rule from modeler it looks like
50 : pageConfiguration like '*Movie*' => navigationState = "Movie" [com.webobjects.directtoweb.Assignment]
No plist. The all rules in a single line is important when you need to read your commit history in the source repository.
>
> Well, I simplified the menu to just one level with four items to experiment with the rules. When selected, each menu is performing adequately, listing the entities it is meant to, with the associated action and D2W.factory().listPageForEntityNamed. But the menu system stubbornly do not highlight the chosen menu option, Principal is locked to be the highlighted menu. The menu and the associated rules are now these:
>
> NavigationMenu.plist
>
> (
> {
> name = Root;
> children = (Principal,Pacotes,Clientes,Usuarios);
> },
> {
> name = Principal;
> action = "session.navController.homeAction";
> },
> {
> name = Pacotes;
> action = "session.navController.pacotesAction";
> },
> {
> name = Clientes;
> action = "session.navController.clientesAction";
> },
> {
> name = Usuarios;
> action = "session.navController.usuáriosAction";
> }
> )
>
> user.d2wmodel rules associated with the menu items
>
> {"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Usuario*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "navigationState"; "value" = "Usuarios"; }; },
> {"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Produto*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "navigationState"; "value" = "Produtos"; }; },
> {"author" = "100"; "class" = "com.webobjects.directtoweb.Rule"; "lhs" = {"class" = "com.webobjects.eocontrol.EOKeyValueQualifier"; "key" = "pageConfiguration"; "selectorName" = "isLike"; "value" = "*Clientes*"; }; "rhs" = {"class" = "com.webobjects.directtoweb.Assignment"; "keyPath" = "navigationState"; "value" = "Clientes"; }; },
>
> I can not see what I am doing wrong so that the navigation menu isn't highlighting the selected option. But I also need to yet figure out how to create and use submenus.
>
> Thanks,
>
> Angelo
That looks like it should work. You need to debug your rule firings to see why nothing is happening.
Ramsey
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden