Jump to: navigation, search

Difference between revisions of "Scout/Tutorial/3.8/HelloWorld"

< Scout‎ | Tutorial‎ | 3.8
m
m (typo)
 
(26 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{ScoutPage|cat=Tutorial 3.7}}
+
{{ScoutPage|cat=Tutorial 3.8}}
 
'''Hello World'''
 
'''Hello World'''
{{note|Under construction|This page needs to be updated}}
+
This page shows how to create your Hello World app using the {{ScoutLink|SDK|name=Scout SDK}}. We assume that you already have {{ScoutLink|HowTo/3.8|Install Scout SDK|installed Scout}}.
This page shows how to create your Hello World app using the {{ScoutLink|SDK|name=Scout SDK}}. We assume that you already have {{ScoutLink|HowTo|Install Scout SDK|installed Scout}}.
+
  
 
==Create a new Scout Project ==
 
==Create a new Scout Project ==
  
<br/>[[Image:Newprojectmenu.png|left]]<br clear="all" />
+
[[Image:CreateANewScoutProject.PNG]]
  
 
Start your Eclipse and Use the ''New|Project ...'' menu  
 
Start your Eclipse and Use the ''New|Project ...'' menu  
  
<br/>[[Image:Newprojectdialog1.png|left]]<br clear="all" />
+
[[Image:CreateANewScoutProject2.PNG]]
  
 
In the wizard choose Scout project and click ''Next''
 
In the wizard choose Scout project and click ''Next''
  
<br/>[[Image:Newprojectdialog2.png|left]]<br clear="all" />
+
[[Image:CreateANewScoutProject3.PNG]]
  
 
Enter org.eclipse.scout.helloworld as an application name. The last part of the name (after the last period) will automatically be used as the project alias. Then, click ''Next''
 
Enter org.eclipse.scout.helloworld as an application name. The last part of the name (after the last period) will automatically be used as the project alias. Then, click ''Next''
  
<br/>[[Image:Newprojectdialog3.png|left]]<br clear="all" />
+
[[Image:CreateANewScoutProject4.PNG]]
  
 
Select ''Application with a single form'' as your app template, then click ''Finish''
 
Select ''Application with a single form'' as your app template, then click ''Finish''
  
<br/>[[Image:Switchperspective.png|left]]<br clear="all" />
+
[[Image:CreateANewScoutProject5.PNG]]
  
 
The empty application is created by {{ScoutLink|SDK|name=Scout SDK}} and if you are not already in the {{ScoutLink|SDK|Perspective|Scout perspective}} you are prompted to change there now, click on ''Yes''
 
The empty application is created by {{ScoutLink|SDK|name=Scout SDK}} and if you are not already in the {{ScoutLink|SDK|Perspective|Scout perspective}} you are prompted to change there now, click on ''Yes''
  
<br/>[[Image:Automaticformdataupdate.png|left]]<br clear="all" />
+
[[Image:CreateANewScoutProject6.PNG]]
  
 
Make sure you have switched on the automatic {{ScoutLink|Concepts|FormData|formdata}} update in menu ''Scout|Update Formdata Automatically''
 
Make sure you have switched on the automatic {{ScoutLink|Concepts|FormData|formdata}} update in menu ''Scout|Update Formdata Automatically''
Line 32: Line 31:
 
==Run the Empty Scout Application in the Scout SDK ==
 
==Run the Empty Scout Application in the Scout SDK ==
  
<br/>[[Image:Productlauncher.png|left]]<br clear="all" />
+
[[Image:CreateANewScoutProject7.PNG]]
  
In the {{ScoutLink|SDK|Explorer_View|Scout Explorer}} open the node ''Scout Projects'', then click on ''org.eclipse.scout.helloworld''. This will show the ''Scout Object Properties'' for the application where you click on the edit icon of the product launcher.
+
In the {{ScoutLink|SDK|Explorer_View|Scout Explorer}} open the node ''Scout Projects'', then click on ''org.eclipse.scout.helloworld''. This will show the ''Scout Object Properties'' for the application.
  
In the product launcher you then select the shortcuts to the launching boxes that you will need most during application development. Typically this contains:
 
* {{ScoutLink|Concepts|Server_Plug-In|Server}} product in dev mode (e.g. ''helloworld-server-dev.product'')
 
* One or more {{ScoutLink|Concepts|Client_Plug-In|client}} products in dev mode (e.g. ''helloworld-swt-client-dev.product'' for the SWT client)
 
  
<br/>[[Image:Runningempty.png|left]]<br clear="all" />
+
After starting first the server (1) and then the Swing client (2) from the launching boxes as shown below, the empty client will appear.
  
After starting first the server and then the client from the launching boxes configured in the last step the empty client will appear.
+
[[Image:CreateANewScoutProject8.PNG]]
  
 
==Client Side: Add a Message Field to the Desktop Form ==
 
==Client Side: Add a Message Field to the Desktop Form ==
  
<br/>[[Image:Addformfield.png|left]]<br clear="all" />
+
[[Image:Scout-NewFormField.PNG]]
  
 
In the {{ScoutLink|SDK|Explorer_View|Scout Explorer}} drill down to client, Forms, DesktopForm, MainBox
 
In the {{ScoutLink|SDK|Explorer_View|Scout Explorer}} drill down to client, Forms, DesktopForm, MainBox
Line 56: Line 52:
 
To the main box we will add a message {{ScoutLink|Concepts|Field|field}}. Click right on ''MainBox'' and choose the menu ''New Form Field''.
 
To the main box we will add a message {{ScoutLink|Concepts|Field|field}}. Click right on ''MainBox'' and choose the menu ''New Form Field''.
  
<br/>[[Image:Newstringfield1.png|left]]<br clear="all" />
+
[[Image:Scout-NewFormField2.PNG]]
  
 
Step 1: Select field type. Here we'll use a {{ScoutLink|Concepts|StringField|String Field}}. Then click ''Next'' (you may directly click on it or use the search box as shown above)
 
Step 1: Select field type. Here we'll use a {{ScoutLink|Concepts|StringField|String Field}}. Then click ''Next'' (you may directly click on it or use the search box as shown above)
  
<br/>[[Image:Newstringfield2.png|left]]<br clear="all" />
+
[[Image:Scout-NewFormField3.PNG]]
  
 
Step 2: Add the field label, type "Message" that triggers the dropdown list. Choose ''New translated text...'' (or use an existing text)
 
Step 2: Add the field label, type "Message" that triggers the dropdown list. Choose ''New translated text...'' (or use an existing text)
  
<br/>[[Image:Newstringfield3.png|left]]<br clear="all" />
+
[[Image:Scout-NewFormField4.PNG]]
  
 
Step 3: Fill in the default translation. Some other fields are automatically filled:
 
Step 3: Fill in the default translation. Some other fields are automatically filled:
Line 72: Line 68:
 
Then click ''OK''
 
Then click ''OK''
  
<br/>[[Image:MessageTextDetails.jpg|left]]<br clear="all" />
+
[[Image:Scout-NewFormField5.PNG]]
  
 
Step 4: Verify details of the new string field by clicking again into the Text: The bold title is the ''key name'' and all translations should be shown
 
Step 4: Verify details of the new string field by clicking again into the Text: The bold title is the ''key name'' and all translations should be shown
Line 78: Line 74:
 
Confirm by clicking ''Finish''
 
Confirm by clicking ''Finish''
  
<br/>[[Image:Newstringfield5.png|left]]<br clear="all" />
+
[[Image:Scout-NewFormField6.PNG]]
  
 
Navigate down from the ''MainBox'' to the newly created ''MessageField''. Double click on the MessageField node to display the generated code (selected code in screenshot above) in the Java editor window.
 
Navigate down from the ''MainBox'' to the newly created ''MessageField''. Double click on the MessageField node to display the generated code (selected code in screenshot above) in the Java editor window.
Line 86: Line 82:
 
In the {{ScoutLink|SDK|Explorer_View|Scout Explorer}} navigate to the ''server'' node, then ''Process Services'', and ''DesktopProcessService''. The ''DesktopProcessService'' is the server side service corresponding to the DesktopForm defined on the client side. This {{ScoutLink|Concepts|Process_Service|process service}} was created as part of the selected application template. The ''load(DesktopFormData)'' method is defined out of the box.
 
In the {{ScoutLink|SDK|Explorer_View|Scout Explorer}} navigate to the ''server'' node, then ''Process Services'', and ''DesktopProcessService''. The ''DesktopProcessService'' is the server side service corresponding to the DesktopForm defined on the client side. This {{ScoutLink|Concepts|Process_Service|process service}} was created as part of the selected application template. The ''load(DesktopFormData)'' method is defined out of the box.
  
[[Image:Serverloadmethod.png|left]]<br clear="all" />
+
[[Image:Scout-Helloworld.PNG]]
  
Add a simple implentation for the ''load'' method:
+
Add a simple implementation for the ''load'' method:
  
 
<source lang="java" line="GESHI_NORMAL_LINE_NUMBERS" start="1">
 
<source lang="java" line="GESHI_NORMAL_LINE_NUMBERS" start="1">
Line 97: Line 93:
 
</source>
 
</source>
  
On line 2 we access the message field of the {{ScoutLink|Concepts|FormData|FormData}} and set it's value to <code>"hello world"</CODE>. The updated form data is returned and eventually sent back to the client.
+
On line 2 we access the message field of the {{ScoutLink|Concepts|FormData|FormData}} and set its value to <code>"hello world"</code>. The updated form data is returned and eventually sent back to the client.
  
 
==Run the "hello world" application ==
 
==Run the "hello world" application ==
Line 107: Line 103:
 
And, "Ta Taa"
 
And, "Ta Taa"
  
<br/>[[Image:Finalapplication.png|left]]<br clear="all" />
+
[[Image:Scout-Helloworld1.PNG]]

Latest revision as of 12:52, 25 July 2012


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitter
Bugzilla
Bugzilla

Hello World This page shows how to create your Hello World app using the Scout SDK. We assume that you already have installed Scout.

Create a new Scout Project

CreateANewScoutProject.PNG

Start your Eclipse and Use the New|Project ... menu

CreateANewScoutProject2.PNG

In the wizard choose Scout project and click Next

CreateANewScoutProject3.PNG

Enter org.eclipse.scout.helloworld as an application name. The last part of the name (after the last period) will automatically be used as the project alias. Then, click Next

CreateANewScoutProject4.PNG

Select Application with a single form as your app template, then click Finish

CreateANewScoutProject5.PNG

The empty application is created by Scout SDK and if you are not already in the Scout perspective you are prompted to change there now, click on Yes

CreateANewScoutProject6.PNG

Make sure you have switched on the automatic formdata update in menu Scout|Update Formdata Automatically

Run the Empty Scout Application in the Scout SDK

CreateANewScoutProject7.PNG

In the Scout Explorer open the node Scout Projects, then click on org.eclipse.scout.helloworld. This will show the Scout Object Properties for the application.


After starting first the server (1) and then the Swing client (2) from the launching boxes as shown below, the empty client will appear.

CreateANewScoutProject8.PNG

Client Side: Add a Message Field to the Desktop Form

Scout-NewFormField.PNG

In the Scout Explorer drill down to client, Forms, DesktopForm, MainBox

  • client client part of Scout application
  • Forms holding all Forms available in the client part
  • DesktopForm the form created by the template chosen above: Application with a single form
  • MainBox the container (a GroupBox) holding all UI components of the form

To the main box we will add a message field. Click right on MainBox and choose the menu New Form Field.

Scout-NewFormField2.PNG

Step 1: Select field type. Here we'll use a String Field. Then click Next (you may directly click on it or use the search box as shown above)

Scout-NewFormField3.PNG

Step 2: Add the field label, type "Message" that triggers the dropdown list. Choose New translated text... (or use an existing text)

Scout-NewFormField4.PNG

Step 3: Fill in the default translation. Some other fields are automatically filled:

  • Key Name used to retrieve the translated text in the code
  • Deutsch German translation

Then click OK

Scout-NewFormField5.PNG

Step 4: Verify details of the new string field by clicking again into the Text: The bold title is the key name and all translations should be shown

Confirm by clicking Finish

Scout-NewFormField6.PNG

Navigate down from the MainBox to the newly created MessageField. Double click on the MessageField node to display the generated code (selected code in screenshot above) in the Java editor window.

Server Side: Implement the Data Loading

In the Scout Explorer navigate to the server node, then Process Services, and DesktopProcessService. The DesktopProcessService is the server side service corresponding to the DesktopForm defined on the client side. This process service was created as part of the selected application template. The load(DesktopFormData) method is defined out of the box.

Scout-Helloworld.PNG

Add a simple implementation for the load method:

  1. public DesktopFormData load(DesktopFormData formData) throws ProcessingException {
  2.   formData.getMessage().setValue("hello world");
  3.   return formData;
  4. }

On line 2 we access the message field of the FormData and set its value to "hello world". The updated form data is returned and eventually sent back to the client.

Run the "hello world" application

In the Scout Explorer go back to top-level node Scout Projects, then click on org.eclipse.scout.helloworld to access the launch boxes in the Scout Object Properties.

  • Start the server in the server box
  • Start the client in the SWT box

And, "Ta Taa"

Scout-Helloworld1.PNG