Last modified by Bastian Triller on 2021/08/07 03:59

From version 16.1
edited by Pascal Robert
on 2012/12/12 07:59
Change comment: There is no comment for this version
To version 18.1
edited by Pascal Robert
on 2012/12/12 07:59
Change comment: Migrated to Confluence 5.3

Summary

Details

Page properties
Content
... ... @@ -11,17 +11,17 @@
11 11  
12 12  Let's start by creating a new project in Eclipse. You need to create a **Wonder Application** project type, and name it **StatefulBlog**.
13 13  
14 -[[image:Capture d’écran 2012-08-06 à 04.56.13.png||border="1"]]
14 +[[image:attach:Capture d’écran 2012-08-06 à 04.56.13.png]]
15 15  
16 -Just like the D2W tutorial, you need to link the application with the **BlogCommon**, **Ajax** and **H2PlugIn** frameworks. To do so, right-click on **StatefulBlog** and select **Build Path** > **Configure Build Path**. 
16 +Just like the D2W tutorial, you need to link the application with the **BlogCommon**, **Ajax** and **H2PlugIn** frameworks. To do so, right-click on **StatefulBlog** and select **Build Path** -> **Configure Build Path**.
17 17  
18 -[[image:Capture d’écran 2012-07-29 à 14.25.46.png||border="1"]]
18 +[[image:attach:Capture d’écran 2012-07-29 à 14.25.46.png]]
19 19  
20 -In the **Libraries** tab, click on **Add Library**. Select **WebObjects Frameworks** and click **Next**. Check **Ajax**, **BlogCommon** and **H2PlugIn** from the list and click **Finish**. The **Libraries** tab should look like this:
20 +In the **Libraries** tab, click on **Add Library**. Select **WebObjects Frameworks** and click **Next**. Check **Ajax**, **BlogCommon** and **H2PlugIn** from the list and click **Finish**. The **Libraries** tab should look like this:
21 21  
22 -[[image:Capture d’écran 2012-08-06 à 05.15.32.png||border="1"]]
22 +[[image:attach:Capture d’écran 2012-08-06 à 05.15.32.png]]
23 23  
24 -We are ready to code Open the **Components** folder of the project, and open **Main WO**. In the **Related** view (bottom-right), you see that all related files of the component are listed, and we need to open the Java code associated with the component. To do so, in the **Related** view, double-click on **Main.java** to open the Java class into an editor.
24 +We are ready to code! Open the **Components** folder of the project, and open **Main WO**. In the **Related** view (bottom-right), you see that all related files of the component are listed, and we need to open the Java code associated with the component. To do so, in the **Related** view, double-click on **Main.java** to open the Java class into an editor.
25 25  
26 26  In **Main.java**, we need some Java code to get the list of blog entries so that we can show that list into the component. The following code will do what we need:
27 27  
... ... @@ -70,7 +70,7 @@
70 70  
71 71  {{/code}}
72 72  
73 -[[ERXBatchingDisplayGroup>>http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/javadoc/er/extensions/appserver/ERXDisplayGroup.html]] is a subclass of WODisplayGroup, a utility that adds multiple actions and logic to a list of objects. One of the best features of ERXBatchingDisplayGroup is that it does real batching (if the RDBMS that you use supports it), so that means that if we specify a batch of 20 objects (//dg.setNumberOfObjectsPerBatch(20)//), it will fetch only the first 20 objects from the database, and if you switch to the next batch, the display group will go to the database to get the next 20 objects. ERXBatchingDisplayGroup is useful if you known that your list will contains hundred of objects.
73 +[[ERXBatchingDisplayGroup>>url:http://jenkins.wocommunity.org/job/Wonder/lastSuccessfulBuild/javadoc/er/extensions/appserver/ERXDisplayGroup.html||shape="rect"]] is a subclass of WODisplayGroup, a utility that adds multiple actions and logic to a list of objects. One of the best features of ERXBatchingDisplayGroup is that it does real batching (if the RDBMS that you use supports it), so that means that if we specify a batch of 20 objects (//dg.setNumberOfObjectsPerBatch(20)//), it will fetch only the first 20 objects from the database, and if you switch to the next batch, the display group will go to the database to get the next 20 objects. ERXBatchingDisplayGroup is useful if you known that your list will contains hundred of objects.
74 74  
75 75  Let's edit the component. Open **Main.wo** and edit the content in the top panel to be:
76 76  
... ... @@ -144,7 +144,7 @@
144 144  
145 145  {{/code}}
146 146  
147 -Next: we need to add a component to present the login form to the user. Right-click on the **Components** folder in the project, and select **New** > **WOComponent**. Change the name of the component to be **AdminMainPage** and change the superclass to **er.extensions.components.ERXComponent**.
147 +Next: we need to add a component to present the login form to the user. Right-click on the **Components** folder in the project, and select **New** -> **WOComponent**. Change the name of the component to be **AdminMainPage** and change the superclass to **er.extensions.components.ERXComponent**.
148 148  
149 149  After the component have been created, open **AdminMainPage.java** and override the content of the class with the following code:
150 150  
... ... @@ -239,7 +239,7 @@
239 239  
240 240  {{/code}}
241 241  
242 -You will notice that we are using a ERXBatchingDisplayGroup again. But this time, when we call dg.setObjectArray//, we set the array of objects so that only the blog entries created by the logged author are displayed.//
242 +You will notice that we are using a ERXBatchingDisplayGroup again. But this time, when we call _//dg.setObjectArray//, we set the array of objects so that only the blog entries created by the logged author are displayed.
243 243  
244 244  Open **AdminMainPage.wo** and override all the content between the <body> tag to be:
245 245  
... ... @@ -428,4 +428,4 @@
428 428  
429 429  {{/code}}
430 430  
431 -Save everything, run the app, click on the "admin" link, login and check if you can create or edit a blog entry. Everything should be working, and just created your first stateful Project Wonder application [[It's time to deploy an application>>Your First Deployment]].
431 +Save everything, run the app, click on the "admin" link, login and check if you can create or edit a blog entry. Everything should be working, and just created your first stateful Project Wonder application! [[It's time to deploy an application>>doc:Your First Deployment]].