Version 8.1 by David Holt on 2009/04/23 13:05

Show last authors
1 ==== Quick Getting Started Placeholder ====
2
3 {{code title="Application.java" borderStyle="solid"}}
4
5
6 // initialize the navigation
7
8 public void finishInitialization() {
9 super.finishInitialization();
10 ERXNavigationManager.manager().configureNavigation();
11 NSLog.debug.appendln("finishInitialization called.");
12 }
13
14 {{/code}}
15
16
17
18 Example actions in Session:
19
20 {{code title="Session.java" borderStyle="solid"}}
21
22 // Don't forget to set the navigation state in your component.java (see below)
23
24 public WOActionResults toUserPage() {
25 return context().page().pageWithName(UserPage.class.getName());
26 }
27
28
29 {{/code}}
30
31 Setting the navigation state in the component
32
33 {{code title="UserPage.java" borderStyle="solid"}}
34
35 // Method used to set navigation state for use with the Navigation Menu components
36 // State is pushed from the page level component so that you don't have problems opening
37 // multiple tabs in modern browsers
38 // The code below tells the context that the selected tabs are "my profile" on level 1 and "summary" on level 2
39 // Add similar code to each of your page level components
40 public void awake() {
41 super.setNavigationState(new NSArray(new Object[]{ "my profile","summmary" }));
42 }
43
44 {{/code}}
45
46 Example Navigation.plist
47
48 {{code title="Navigation.plist" borderStyle="solid"}}
49
50 // there are more options than I am using below. See the docs for more examples
51
52 {
53 name = "Root";
54 children = ("my profile","my survey");
55 },
56 {
57 name = "my profile";
58 children = ("summary","details");
59 action = session.toUserPage;
60 },
61 {
62 name = "summary";
63 action = session.toUserPage;
64 },
65 {
66 name = "details";
67 action = session.toUserDetails;
68 },
69 {
70 name = "my survey";
71 children = ("instructions","section I");
72 action = session.toSurvey;
73 },
74 {
75 name = "instructions";
76 action = session.toSurvey;
77 },
78 {
79 name = "section I";
80 action = session.toSurvey1;
81 },
82
83 {{/code}}
84
85 HTML Source you'll see generated by ERXNavigationMenu when the app is run
86
87 {{code title="Main.html" borderStyle="solid"}}
88
89 <div class="ERXNavigationMenu">
90 <ul class="Level1Items">
91 <li nowrap="nowrap" class="Nav1" id="id1"><a href="/cgi-bin/WebObjects/MyApp.woa/wo/49YrOFk9VT0wc2WYDlZ8b0/5.0.11.0.0.1.1.2.1.0.0.1.1.0.0">my profile</a></li>
92
93 <li nowrap="nowrap" class="Nav1Selected" id="id2"><a href="/cgi-bin/WebObjects/MyApp.woa/wo/49YrOFk9VT0wc2WYDlZ8b0/5.0.11.0.0.1.1.2.1.1.0.1.1.0.0">my survey</a></li>
94 </ul>
95 <ul class="Level2Items">
96 <li nowrap="nowrap" class="Nav2" id="id3"><a href="/cgi-bin/WebObjects/MyApp.woa/wo/49YrOFk9VT0wc2WYDlZ8b0/5.0.11.0.0.1.1.2.3.1.0.0.1.1.0.0">instructions</a></li>
97
98 <li nowrap="nowrap" class="Nav2Selected" id="id4"><a href="/cgi-bin/WebObjects/MyApp.woa/wo/49YrOFk9VT0wc2WYDlZ8b0/5.0.11.0.0.1.1.2.3.1.1.0.1.1.0.0">section I</a></li>
99 </ul>
100
101
102 </div>
103
104 {{/code}}
105
106 CSS items that I defined in my application:
107
108 {{code value="html"}}
109
110 .ERXNavigationMenu {
111 }
112 .Level1Items {
113 }
114 .Level1Items li {
115 }
116 .Level1Items a {
117 }
118 .Level1Items .Nav1Selected a {
119 }
120 .Level1Items li.Nav1 a:hover {
121 }
122 .Level2Items {
123 }
124 .Level2Items li {
125 }
126 .Level2Items a {
127 }
128 .Level2Items .Nav2Selected a, .Level2Items li.Nav2 a:hover {
129 }
130
131 {{/code}}