Changes for page Your First D2W Project
Last modified by Bastian Triller on 2013/01/12 00:43
From version 17.1
edited by Steve Peery
on 2013/01/12 00:43
on 2013/01/12 00:43
Change comment:
There is no comment for this version
To version 18.1
edited by Steve Peery
on 2013/01/12 00:43
on 2013/01/12 00:43
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,22 +1,22 @@ 1 1 {{info}} 2 - 2 +Work in progress 3 3 {{/info}} 4 4 5 -Now that our data model is in a framework and that we have a basic REST application working, we are going to build a DirectToWeb application to manage the blog system. But first, what is DirectToWeb (D2W)? D2W is a rules-based application model where you can change the behavior of the application by rules. D2W is perfect for "admin" apps, for applications that share a common model or for "**CRUD**" (**C {**}reate **R{**}ead **U{**}pdate **D{**}estroy) applications.5 +Now that our data model is in a framework and that we have a basic REST application working, we are going to build a DirectToWeb application to manage the blog system. But first, what is DirectToWeb (D2W)? D2W is a rules-based application model where you can change the behavior of the application by rules. D2W is perfect for "admin" apps, for applications that share a common model or for "**CRUD**" (**C**reate **R**ead **U**pdate **D**estroy) applications. 6 6 7 7 So like I said, we are going to build a D2W app that will allow us to update and create blog entries and authors. Let's start by creating a //Wonder D2W Application// in Eclipse: 8 8 9 -[[image:Capture d’écran 2012-07-29 à 14.22.22.png ||border="1"]]9 +[[image:attach:Capture d’écran 2012-07-29 à 14.22.22.png]] 10 10 11 -Name it **D2WBlog**. The next step is to link the **BlogCommon** framework to the D2W app. To do so, right-click on **D2WBlog** and select **Build Path** > **Configure Build Path**. 11 +Name it **D2WBlog**. The next step is to link the **BlogCommon** framework to the D2W app. To do so, right-click on **D2WBlog** and select **Build Path** -> **Configure Build Path**. 12 12 13 -[[image:Capture d’écran 2012-07-29 à 14.25.46.png ||border="1"]]13 +[[image:attach:Capture d’écran 2012-07-29 à 14.25.46.png]] 14 14 15 -In the **Libraries** tab, click on **Add Library**. Select **WebObjects Frameworks** and click **Next**. Check **BlogCommon** and **H2PlugIn** from the list and click **Finish**. The **Libraries** tab should look like this:15 +In the **Libraries** tab, click on **Add Library**. Select **WebObjects Frameworks** and click **Next**. Check **BlogCommon** and **H2PlugIn** from the list and click **Finish**. The **Libraries** tab should look like this: 16 16 17 -[[image:Capture d’écran 2012-07-29 à 14.32.51.png ||border="1"]]17 +[[image:attach:Capture d’écran 2012-07-29 à 14.32.51.png]] 18 18 19 -It's time to run the app. Right-click on **Application.java** and select **Run As** > **WO Application**. By default, a D2W app will always display a login form and the login method is connected to a DirectAction that should handle the authentification. The default implementation of that DirectAction (the loginAction method in the DirectAction class) don't do anything special: 19 +It's time to run the app. Right-click on **Application.java** and select **Run As** -> **WO Application**. By default, a D2W app will always display a login form and the login method is connected to a DirectAction that should handle the authentification. The default implementation of that DirectAction (the loginAction method in the DirectAction class) don't do anything special: 20 20 21 21 {{code language="java"}} 22 22 ... ... @@ -87,9 +87,9 @@ 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 -[[image:Capture d’écran 2012-07-30 à 06.18.43.png ||border="1"]]92 +[[image:attach:Capture d’écran 2012-07-30 à 06.18.43.png]] 93 93 94 94 Edit the file with the content is like this: 95 95 ... ... @@ -138,7 +138,7 @@ 138 138 139 139 {{/code}} 140 140 141 -Add the following method in the **Session** class for the navigation root.141 +Add the following method in the **Session** class for the navigation root. 142 142 143 143 {{code}} 144 144 ... ... @@ -219,18 +219,18 @@ 219 219 220 220 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 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~://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 223 224 -[[image:Capture d’écran 2012-08-05 à 07.22.43.png ||border="1"]]224 +[[image:attach:Capture d’écran 2012-08-05 à 07.22.43.png]] 225 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: 226 +The next rule will specify that we want to use the [[EREditHTML>>url:http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/javadoc/er/directtoweb/components/strings/ERDEditHTML.html||shape="rect"]] component for the //content// attribute. Again, click **New** in RulesModeler, and add this rule: 227 227 228 -[[image:Capture d’écran 2012-08-05 à 07.29.12.png ||border="1"]]228 +[[image:attach:Capture d’écran 2012-08-05 à 07.29.12.png]] 229 229 230 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 231 232 -[[image:Capture d’écran 2012-08-05 à 07.30.15.png ||border="1"]]232 +[[image:attach:Capture d’écran 2012-08-05 à 07.30.15.png]] 233 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 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 235 236 -Congratulations, you are done with the D2W tutorial [[The next tutorial is about creating a stateful application>>doc umentation:Your First Stateful Project]].236 +Congratulations, you are done with the D2W tutorial! [[The next tutorial is about creating a stateful application>>doc:Your First Stateful Project]].