Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Scout/Tutorial/3.8/webservices/Create Company Form"

< Scout‎ | Tutorial‎ | 3.8
Line 1: Line 1:
 
== Create Company Form ==
 
== Create Company Form ==
On the client node, go to 'Forms'. Right click on the node to create the Company {{ScoutLink|Concepts|Form}} [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_1.png]. As name of the form, enter <code>Company</code> and choose to create the Form ID which is the primary key of the company [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_2.png]. Click next to choose from the artefacts which also should be created [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_3.png]. Uncheck all permissions as {{ScoutLink|Concepts|Security|Authorization}} is not part of this tutorial. Also, we uncheck the <code>NewHandler</code> to only access existing companies.
+
On the client node, go to 'Forms'. Right click on the node to create the Company {{ScoutLink|Concepts|Form}} [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_1.png]. As name of the form, enter <code>Company</code> and choose to create the Form ID which is the primary key of the company [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_2.png]. Click next to choose from the artefacts which also should be created by Scout SDK [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_3.png]. Uncheck all permissions as {{ScoutLink|Concepts|Security|Authorization}} is not part of this tutorial.
  
 +
== Create Form Fields ==
 +
On the <code>CompanyForm</code> node, go to 'MainBox'. Right click on the node to create a new Form {{ScoutLink|Concepts|Field}} [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_4.png]. Please add the following 9 fields to the {{ScoutLink|Concepts|MainBox}}:
  
  As page layout, choose <code>AbstractPageWithTable</code> [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_2.png] to create a page representing tabular data. On the next step, enter <code>Company</code> as name for that page and choose to add this page to the <code>MainOutline</code> [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_3.png]. By clicking Finish, the page is created and attached to the MainOutline.
+
  '''NameField'''
 
+
  Type: String Field [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_5.png]
== Create columns ==
+
On the <code>CompanyTablePage</code> node, go to 'Table' | 'Columns'. Right click on the node to create a new {{ScoutLink|Concepts|Column}} [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_4.png]. Please add the following three columns to that table:
+
 
+
'''CompanyNrColumn'''
+
  Type: Long Column [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_5.png]
+
Name: ''Do not fill because column represents primary key and therefore is hidden''
+
Class name: CompanyNrColumn [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_6.png]
+
 
+
'''NameColumn'''
+
Type: String Column
+
 
  Name: Name
 
  Name: Name
  Class name: NameColumn
+
  Class name: NameField [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_6.png]
  
  '''SymbolColumn'''
+
  '''SymbolField'''
  Type: String Column
+
  Type: String Field
 
  Name: Symbol
 
  Name: Symbol
  Class name: SymbolColumn
+
  Class name: SymbolField
  
To not display the <code>CompanyNr</code> column because of holding the primary key, go to that column in Scout SDK and uncheck <code>Displayable</code> in Scout Property View [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_8.png].
+
'''TradeTimeField'''
 +
Type: Date Field
 +
Name: Trade time
 +
Class name: TradeTimeField
  
To have the columns equally distributed over the available space of the table page, go to the {{ScoutLink|Concepts|Table}} node and check <code>Auto Resize Columns</code> in Scout Property View [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_9.png].
+
'''ValueLastField'''
 +
Type: Double Field
 +
Name: Value last
 +
Class name: ValueLastField
  
== Create service to load company data from database ==
+
'''ValueOpenField'''
Finally, we have to populate the table with company data. For that purpose, we create an Outline Service. An Outline Service is just like all other services in Scout. Basically, they are plain [http://en.wikipedia.org/wiki/OSGi OSGi] services which are registered in <code>plugin.xml</code> and are accessible by <code>SERVICES#get(<service name>)</code>. Depending on the service factory chosen in their service registration, they act as proxy for client-server communication, meaning that all service requests are tunneled to the backend. For more details, please refer to {{ScoutLink|Concepts|Communication}}.
+
Type: Double Field
 +
Name: Value open
 +
Class name: ValueOpenField
  
To create the Outline Service, go to the server node. Right click on the node 'Outline Services' to create the new outline service [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_10.png]. Please create the service as follows:
+
'''ValueLowField'''
 +
Type: Double Field
 +
Name: Value low
 +
Class name: ValueLowField
  
  '''Service definition [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_11.png]'''
+
  '''ValueHighField'''
  Class name: MainOutlineService
+
  Type: Double Field
  Super Type: AbstractService
+
  Name: Value high
 +
Class name: ValueHighField
  
  '''Service registration [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_12.png]'''
+
  '''VolumeField'''
  On the second wizard page you choose where to create and to register the service.
+
  Type: Long Field
  Because the <code>MainOutlineService</code> is used for client-server communication, we are required to have a service interface in the Shared Plug-In with a proxy registration on client-side.
+
  Name: Volume
 +
Class name: VolumeField
  
Double click on the <code>MainOutlineService</code> created to open the corresponding Java class. In there, create the operation <code>getCompanyTableData</code> to load company data from database. Also add the operation signature to the service interface <code>IMainOutlineService</code> to be accessible from client side.
+
'''ChangeField'''
 +
Type: Double Field
 +
Name: Change
 +
Class name: ChangeField
  
<source lang="java">
 
public class MainOutlineService extends AbstractService implements IMainOutlineService {
 
  
  @Override
+
Because <code>ChangeField</code> represents a procentual value, click on that field and set the property <code>Percent</code> in Scout Property View.and   To not display the <code>CompanyNr</code> column because of holding the primary key, go to that column in Scout SDK and uncheck <code>Displayable</code> in Scout Property View [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_8.png].
  public Object[][] getCompanyTableData() throws ProcessingException {
+
    return SQL.select("" +
+
        "SELECT   COMPANY_NR, " +
+
        "        NAME, " +
+
        "        SYMBOL " +
+
        "FROM    COMPANY ");
+
  }
+
}
+
</source>
+
  
== Load company data into CompanyTablePage ==
+
To have the columns equally distributed over the available space of the table page, go to the {{ScoutLink|Concepts|Table}} node and check <code>Auto Resize Columns</code> in Scout Property View [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_9.png].
Once the <code>MainOutlineService</code> is created to load company data from database, go to <code>CompanyTablePage</code> to consume the service's data.
+
On the Scout Property View, click on the operation <code>Exec Load Table Data</code> to populate the company table [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_13.png]. Implement the method as follows:
+
 
+
<source lang="java">
+
public class MainOutlineService extends AbstractService implements IMainOutlineService {
+
 
+
  @Override
+
  protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
+
    return SERVICES.getService(IMainOutlineService.class).getCompanyTableData();
+
  }
+
}
+
</source>
+
  
Finally, if you launch the application, you should see something like this:
 
  
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_14.png|600px]]
 
  
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_1.png|thumb|Create Company Form]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyForm_1.png|thumb|Create Company Form]]

Revision as of 16:07, 8 November 2011

Create Company Form

On the client node, go to 'Forms'. Right click on the node to create the Company The Scout documentation has been moved to https://eclipsescout.github.io/. [1]. As name of the form, enter Company and choose to create the Form ID which is the primary key of the company [2]. Click next to choose from the artefacts which also should be created by Scout SDK [3]. Uncheck all permissions as The Scout documentation has been moved to https://eclipsescout.github.io/. is not part of this tutorial.

Create Form Fields

On the CompanyForm node, go to 'MainBox'. Right click on the node to create a new Form The Scout documentation has been moved to https://eclipsescout.github.io/. [4]. Please add the following 9 fields to the The Scout documentation has been moved to https://eclipsescout.github.io/.:

NameField
Type: String Field [5]
Name: Name
Class name: NameField [6]
SymbolField
Type: String Field
Name: Symbol
Class name: SymbolField
TradeTimeField
Type: Date Field
Name: Trade time
Class name: TradeTimeField
ValueLastField
Type: Double Field
Name: Value last
Class name: ValueLastField
ValueOpenField
Type: Double Field
Name: Value open
Class name: ValueOpenField
ValueLowField
Type: Double Field
Name: Value low
Class name: ValueLowField
ValueHighField
Type: Double Field
Name: Value high
Class name: ValueHighField
VolumeField
Type: Long Field
Name: Volume
Class name: VolumeField
ChangeField
Type: Double Field
Name: Change
Class name: ChangeField


Because ChangeField represents a procentual value, click on that field and set the property Percent in Scout Property View.and To not display the CompanyNr column because of holding the primary key, go to that column in Scout SDK and uncheck Displayable in Scout Property View [7].

To have the columns equally distributed over the available space of the table page, go to the The Scout documentation has been moved to https://eclipsescout.github.io/. node and check Auto Resize Columns in Scout Property View [8].


Create Company Form
Create Company Table Page
Create Company Table Page
Create Company Table Page
Create Company Table Page
Create Company Table Page
Create Company Table Page

Back to the top