Hi Angelo :-)
On Jul 29, 2012, at 9:08 PM, Sr. Ângelo Andrade Cirino wrote:
> I have been trying with little success to design a rather complex (at least
> for me as it is my first D2W project) application using D2W and ERModernLook.
> I am able to create a list page and inspect or edit an entity with all the
> formatting and restrictions on the attributes and relationships as I need.
> With this part of D2W I am very satisfied, really glad with the easy of
> working with D2W.
>
> But then I tried to insert a menu with subitems for each menu item and then
> D2W stopped working properly.
Allow me to be pedantic for a moment. The nav menu is outside of D2W. The only
connection it has with D2W is the nav context, which is just a NSDictionary as
far as it is concerned. It just happens to be used with D2W a lot :-)
> The NavigationMenu.plist seems to be well formed and the application
> correctly shows the first layer of menu items. But the application will not
> show any children nor highlight the currently selected menu item. So here we
> have two problems: 1) the second level of menu items not being shown and 2)
> the currently selected menu not being highlighted.
The navigation state is not being set correctly.
>
> I followed the instructions given in the WOWODC HelloD2W project and have:
>
> 1. Added to my properties file:
> er.extensions.ERXNavigationManager.localizeDisplayKeys=true
>
> 2. When the app finishes initializing, call:
> ERXNavigationManager.manager().configureNavigation();
>
> 3. Created a NavigationMenu.plist file
>
> 4. Set the navigation context in MenuHeader
>
> 5. Set the navigationState on the navigation context in the rules file
>
> An excerpt of the NavigationMenu.plist follows:
>
> (
> {
> name = Root;
> children =
> (Principal,Produtos,Clientes,Fornecedores,Financeiro,Pessoal,Documentos,Sistema,Visionar);
> },
> {
> name = Principal;
> action = "session.navController.homeAction";
> },
> {
> name = Produtos;
> action = "session.navController.pacotesAction";
> children = (Pacotes,Passagens,Relatorios);
> },
> {
> name = Pacotes;
> action = "session.navController.pacotesAction";
> },
> {
> name = Passagens;
> action = "session.navController.homeAction"; /* dummy action */
> },
> {
> name = Relatorios;
> displayName = "Relatórios";
> action = "session.navController.homeAction"; /* dummy action */
> },
> {
> name = Clientes;
> action = "session.navController.homeAction"; /* dummy action */
> children =
> (Cadastro,Orcamentos,MalaDireta,Captacao,Campanhas,PosVenda,Incidentes,Relatorios);
> }
> }
>
> The menu is rather lengthy, and yes, I am willing to use UTF-8 as I am a
> Portuguese speaker and am producing this software for the Brazilian market,
> what leads us to the third problem: the system will not parse names with
> accents, like the ó in Relatórios and forces me to name all the menu items
> without accents and to use the alias displayName for them. By the way, I have
> localized the menu in the Localizable.strings resource and my application and
> database correctly handle UTF-8.
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";
>
> 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.
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
>
> So, in short, I have three problems to solve:
>
> 1. Show the submenus
> 2. Highlight the currently selected menu item
> 3. Parse the menu plist for menu names that include UTF-8 characters like
> accented letters
>
> Thank you guys for any help,
>
> Angelo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]