OK, still can't get my custom navigation to work. I have 4 main tabs in my application; 3 of the 4 are typical ERXNavigationMenu tabs, with 3 levels of sub tabs. But one tab has so many subtabs that I want to display the entities in a popup button and when
the entity is selected, navigate to that entity's query or pick page. I have that part working, but as soon as you click on any action on the query or pick page, you are immediately logged out with no exceptions thrown.
To do this, I've extended the ERXNavigationMenu to create MyNavigationMenu and added a showDropDownMenu condition if there are 4 levels in the NavigationState. In the rule file I've made the navigationState for those entities, have 4 levels. For example:
60 : pageConfiguration like 'QueryBilling*' => navigationState = "DataManagement.DMList.Billing.QueryBilling" [com.webobjects.directtoweb.Assignment],
Here's my MyNavigationMenu:
Created a MyNavigationMenu component that extends ERXNavigationMenu and have added MyNavigationMenu to my MenuHeader.html.
- In the html file, I've added:
<wo:if
condition="$showDropDownMenu">
<div
class="navDropDownMenu">
<wo:form>
<wo:AjaxObserveField
action="$entityChanged"
fullSubmit="$true"
updateContainerID="ContentWrapper">
<wo:popUpButton
item="$aNavigationItem"
list="$dropDownItems"
noSelectionString="Select One to Manage"
displayString="$aNavigationItem.displayName"
selection="$selectedNavigationItem"
/>
</wo:AjaxObserveField>
</wo:form>
</div>
</wo:if>
- This is the Java file:
public
class MyNavigationMenu
extends ERXNavigationMenu
{
public
ERXNavigationItem selectedNavigationItem;
public NSArray _dropDownItems;
public MyNavigationMenu(WOContext context)
{
super(context);
_dropDownItems =
null;
}
public ERXNavigationItem selectedNavigationItem() {
return selectedNavigationItem; }
public void setSelectedNavigationItem(ERXNavigationItem ni) {
selectedNavigationItem = ni; }
public NSArray dropDownItems() {
return _dropDownItems; }
public void setDropDownItems(NSArray newDropDownItems) {
_dropDownItems = newDropDownItems; }
public void reset()
{
_dropDownItems =
null;
super.reset();
}
@Override
public void setUpMenu()
{
super.setUpMenu();
if (menuLevelsToShow() >= 4 && dropDownItems() ==
null)
setDropDownItems(itemsForLevel(3));
}
public boolean showDropDownMenu()
{
return navigationState().stateAsString() !=
null &&
navigationState().state().count() >= 3 &&
_dropDownItems !=
null &&
_dropDownItems.count() > 0;
}
public WOActionResults entityChanged()
{
if (selectedNavigationItem !=
null)
{
String action = "" style="color: #2221c8">selectedNavigationItem .action();
action = "" style="color: #492cfa">".") + 1);
NSArray<Method> methods = new NSArray<Method>(((Session)session()).navController().getClass().getDeclaredMethods());
WOComponent nextPage = null;
Method m = null;
for (Method m1 : methods)
{
if (m1.getName().equals(action))
{
m = m1;
break;
}
}
if (m !=
null)
{
try
{
nextPage = (WOComponent)m.invoke(((Session)session()).navController(),
new Object[0]);
}
catch (Exception e)
{
log.debug(e.getMessage());
}
return (WOActionResults)nextPage;
}
}
return null;
}
}
NavigationMenu.plist section for this tab:
(
{
name = "Root";
children = "session.navController.mainTabs";
},
{
name = "DataManagement";
action = "">
displayName = "Data Management";
},
{
name = "DMList";
children = ("Billing", "CourseLength");
},
{
name = "Billing";
action = "">
children = ("QueryBilling", "CreateBilling");
},
{
name = "QueryBilling";
action = "">
},
{
name = "CreateBilling";
action = "">
},
{
name = CourseLength;
children = ("PickCourseLength","CreateCourseLength");
action = "">
displayName = "Course Length";
},
{
name = CreateCourseLength;
action = "">
displayName = "Add Course Length";
},
{
name = ListCourseLength;
action = "">
},
{
name = PickCourseLength;
action = "">
displayName = "Course Lengths";
}
)
Any ideas on why this doesn't work? Or has someone already done this a better way? I know I should probably have something in the navigationMenu.plist or rule file to set showDropDownMenu instead
of just adding a fourth level to the navigationState, but once I learn how to create those custom flags, I'll do that.
TIA,
Dawn
From: David Holt < email@hidden>
Date: Friday, June 29, 2012 9:52 AM
To: D LOCKHART < email@hidden>
Subject: Re: Custom D2W Navigation
http://wiki.wocommunity.org/display/WO/Project+WONDER-Frameworks-ERXNavigation
On 2012-06-28, at 5:32 PM, Dawn Lockhart wrote:
I have extended ERXNavigationMenu to create a submenu as a drop down list instead of tabs. When I select an item in the drop down, I set the new navigation state in ERXNavigationManager.manager().navigationStateForSession and then I return the correct
list page WOComponent. So it correctly navigates to the list page. However, once I click on any navigation actions on the list page, it immediately logs me out. What else do I need to set before I return the list page?
I had hoped to come this week to WOWODC, but K12 was too cheap to send us and they stalled so long in telling us that we weren't going, that the hotel was booked and the airfares had risen dramatically. :( So Kieran will have to drink a few beers for me!
|