Changes for page Your First D2W Project

Last modified by Bastian Triller on 2013/01/12 00:43

From version 4.1
edited by Pascal Robert
on 2012/07/30 06:25
Change comment: There is no comment for this version
To version 6.1
edited by Pascal Robert
on 2012/07/30 09:12
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -20,7 +20,7 @@
20 20  
21 21  {{code language="java"}}
22 22  
23 - public WOActionResults loginAction() {
23 +public WOActionResults loginAction() {
24 24   String username = request().stringFormValueForKey("username");
25 25   String password = request().stringFormValueForKey("password");
26 26   return D2W.factory().defaultPage(session());
... ... @@ -61,7 +61,7 @@
61 61   WOComponent nextPage = null;
62 62   String email = request().stringFormValueForKey("username");
63 63   String errorMessage = null;
64 -
64 +
65 65   try {
66 66   Author user = Author.fetchAuthor(ERXEC.newEditingContext(), Author.EMAIL.eq(email));
67 67   ((Session) session()).setAuthor(user);
... ... @@ -87,11 +87,11 @@
87 87  
88 88  We are done with the login logic, so we can move to the next step: working on the navigation. The navigation is quite simple: we want two tabs, //Posts and Authors//, when one of the two tabs is selected, we display the list of objects for the selected tabs, and we have two links: one to create a new blog entry or a new author, and the other to query (search) for matching objects.
89 89  
90 -The navigation structure is done in a "plist" file. If you are a Mac OS X guy, you probably know what is a plist, but if not, a plist is like a JSON structure to hold key/values. The plist file is located in the **Resources** folder, the file's name is **NavigationMenu.plist**. By default, Eclipse will open the file in Xcode, which might not be what we want. To open it in a text editor in Eclipse, right-click on **NavigationMenu.plist** and select **Open With** -> **Text Editor**.
90 +The navigation structure is done in a "plist" file. If you are a Mac OS X guy, you probably know what is a plist, but if not, a plist is like a JSON structure to hold key/values. The plist file is located in the **Resources** folder, the file's name is **NavigationMenu.plist**. By default, Eclipse will open the file in Xcode, which might not be what we want. To open it in a text editor in Eclipse, right-click on **NavigationMenu.plist** and select **Open With** > **Text Editor**.
91 91  
92 92  [[image:Capture d’écran 2012-07-30 à 06.18.43.png||border="1"]]
93 93  
94 -Edit the file so the content is like this:
94 +Edit the file with the content is like this:
95 95  
96 96  {{code}}
97 97  
... ... @@ -120,7 +120,7 @@
120 120   {
121 121   name = SearchPosts;
122 122   action = "session.navController.searchPostsAction";
123 - },
123 + },
124 124   {
125 125   name = Authors;
126 126   action = "session.navController.listAuthorsAction";
... ... @@ -137,3 +137,5 @@
137 137  )
138 138  
139 139  {{/code}}
140 +
141 +The first array defines what the top level navigation is going to be, and this is where we define the two tabs (the childrenChoice dictionary). After that, we define the other parts of the navigation. You see references to //action = session.navController//. This is the action (method) that will be called for the specified navigation element, so let's create those methods in the **MainNavigationController** class.