Changes for page Your First D2W Project
Last modified by Bastian Triller on 2013/01/12 00:43
From version 10.1
edited by Pascal Robert
on 2012/08/05 07:20
on 2012/08/05 07:20
Change comment:
There is no comment for this version
To version 12.1
edited by Steve Peery
on 2013/01/12 00:31
on 2013/01/12 00:31
Change comment:
Added navigationRootChoice method.
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki.p robert1 +XWiki.speery - Content
-
... ... @@ -138,8 +138,18 @@ 138 138 139 139 {{/code}} 140 140 141 - The first arraydefineswhatthetoplevelnavigationis goingto be, andthis is where we define the twotabs (the //childrenChoice//dictionary).After that, we define the other partsof the navigation. Yousee references to //action= session.navController//. This is the action (method) that will be calledfor thespecifiednavigationelement, so let's create those methods inthe **MainNavigationController** class.141 +Add the following method in **Session** for the navigation root. 142 142 143 +{{code}} 144 + 145 +public String navigationRootChoice() { 146 + return "home"; 147 +} 148 + 149 +{{/code}} 150 + 151 +The first array in the plist 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. 152 + 143 143 The first method we will implement in **MainNavigationController** is a generic method to list objects for a specific entity. 144 144 145 145 {{code language="java"}} ... ... @@ -208,3 +208,19 @@ 208 208 * modifying the order of attributes when viewing or editing a blog entry so that the title field is the first field, followed by content, the two dates and the author 209 209 210 210 Those two customizations can be done by adding D2W rules. The D2W rules are in two files, located in the **Resources** folder, **d2w.d2wmodel** and **user.d2wmodel**. To edit the files, make sure you installed RulesModeler, a Mac application that manages D2W rule files. If RuleModeler is present, you can simply double-click on **d2w.d2wmodel** and the file will open in RulesModeler. 221 + 222 +The first rule we need to add is a rule to specify that the //richTextMode// will be _ simpleRichTextMode//, which is a built-in definition that will put TinyMCE in a simple configuration. Create the **New** button in RulesModeler, and the rule must looks like this~:// 223 + 224 +[[image:Capture d’écran 2012-08-05 à 07.22.43.png||border="1"]] 225 + 226 +The next rule will specify that we want to use the [[EREditHTML>>http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/javadoc/er/directtoweb/components/strings/ERDEditHTML.html]] component for the //content// attribute. Again, click **New** in RulesModeler, and add this rule: 227 + 228 +[[image:Capture d’écran 2012-08-05 à 07.29.12.png||border="1"]] 229 + 230 +Last rule: when we want to inspect or edit the blog entry, we want to change how the attributes are displayed, so add this new rule: 231 + 232 +[[image:Capture d’écran 2012-08-05 à 07.30.15.png||border="1"]] 233 + 234 +We are done. Save the file in RulesModeler, and run the application again. Try editing a blog entry and you will notice that we know have a rich editor for the content and that the ordering of the fields is different, without having to change the HTML or the Java code 235 + 236 +Congratulations, you are done with the D2W tutorial [[The next tutorial is about creating a stateful application>>documentation:Your First Stateful Project]].