Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be 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 WsLogTablePage"

< Scout‎ | Tutorial‎ | 3.8
m (add ScoutPage)
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
{{ScoutPage|cat=Tutorial 3.8}}
 +
 
== Create WS Log Table Page ==
 
== Create WS Log Table Page ==
On the client node, go to 'Desktop' | 'Outlines' | 'MainOutline'. Right click on the node to create a new {{ScoutLink|Concepts|TablePage}} [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_1.png]. As page layout, choose <code>AbstractPageWithTable</code> [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_2.png] to create a page representing tabular data. On the next step, enter <code>WS Log</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.CreateWsLogTablePage_3.png]. By clicking Finish, the page is created and attached to the MainOutline.
+
On the client node, go to 'Desktop' | 'Outlines' | 'StandardOutline'. Right click on the node ''Child Pages'' to create a new {{ScoutLink|Concepts|TablePage}} [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_1.png]. As page layout, choose <code>AbstractPageWithTable</code> [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_2.png] to create a page representing tabular data. On the next step, enter <code>WS Log</code> as name for that page and choose to add this page to the <code>MainOutline</code> (might be StandardOutline) [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_3.png]. By clicking Finish, the page is created and attached to the MainOutline.
  
 
== Create columns ==
 
== Create columns ==
On the <code>WsLogTablePage</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:
+
On the <code>WsLogTablePage</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.CreateWsLogTablePage_4.png]. Please add the following five columns to that table:
  
  '''CompanyNrColumn'''
+
  '''WsLogNrColumn'''
  Type: Long Column [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_5.png]
+
  Type: Long Column
 
  Name: ''Do not fill because column represents primary key and therefore is hidden''
 
  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]
+
  Class name: WsLogNrColumn
  
  '''NameColumn'''
+
  '''DateColumn'''
 
  Type: String Column
 
  Type: String Column
  Name: Name
+
  Name: Date
  Class name: NameColumn
+
  Class name: DateColumn
  
  '''SymbolColumn'''
+
  '''ServiceColumn'''
 
  Type: String Column
 
  Type: String Column
  Name: Symbol
+
  Name: Service
  Class name: SymbolColumn
+
  Class name: ServiceColumn
  
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].
+
'''PortColumn'''
 +
Type: String Column
 +
Name: Port
 +
Class name: PortColumn
  
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].
+
'''OperationColumn'''
 +
Type: String Column
 +
Name: Operation
 +
Class name: OperationColumn
  
== Create service to load company data from database ==
+
To not display the <code>WsLogNrColumn</code> column because of holding the primary key, go to that column in Scout SDK and uncheck <code>Displayable</code> in Scout Property View.
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}}.
+
  
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:
+
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.
  
'''Service definition [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_11.png]'''
+
== Create service to load WS Log data from database ==
Class name: MainOutlineService
+
Finally, we have to populate the table with WS Log data.  
Super Type: AbstractService
+
For that purpose, go to the server node and double click on 'Outline Services' | 'StandardOutlineService' to open the corresponding Java class. In there, create the operation <code>getWsLogTableData</code> to load WS log data from database. Also add the operation signature to the service interface <code>IStandardOutlineService</code> to be accessible from client side.
 
+
'''Service registration [http://wiki.eclipse.org/Image:Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_12.png]'''
+
On the second wizard page you choose where to create and to register the service.
+
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.
+
 
+
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.
+
  
 
<source lang="java">
 
<source lang="java">
public class MainOutlineService extends AbstractService implements IMainOutlineService {
+
@Override
 
+
public Object[][] getWsLogTableData() throws ProcessingException {
  @Override
+
  return SQL.select("" +
  public Object[][] getCompanyTableData() throws ProcessingException {
+
         "SELECT  WS_LOG_NR, " +
    return SQL.select("" +
+
         "        EVT_DATE, " +
         "SELECT  COMPANY_NR, " +
+
         "        SERVICE, " +
         "        NAME, " +
+
        "        PORT, " +
         "        SYMBOL " +
+
        "        OPERATION " +
         "FROM    COMPANY ");
+
         "FROM    WS_LOG ");
  }
+
 
}
 
}
 
</source>
 
</source>
  
== Load company data into CompanyTablePage ==
+
== Load WS Log data into WsLogTablePage ==
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 client node, go to the <code>WsLogTablePage</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:
+
On the Scout Property View, click on the operation <code>Exec Load Table Data</code> to populate the WS Log table. Implement the method as follows:
  
 
<source lang="java">
 
<source lang="java">
public class MainOutlineService extends AbstractService implements IMainOutlineService {
+
@Override
 
+
protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
  @Override
+
  return SERVICES.getService(IStandardOutlineService.class).getWsLogTableData();
  protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
+
    return SERVICES.getService(IMainOutlineService.class).getCompanyTableData();
+
  }
+
 
}
 
}
 
</source>
 
</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.CreateWsLogTablePage_1.png|thumb|Create Company Table Page]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_1.png|thumb|Create Company Table Page]]
Line 75: Line 68:
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_3.png|thumb|Give Page a name and link it with MainOutline]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_3.png|thumb|Give Page a name and link it with MainOutline]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_4.png|thumb|Create column]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateWsLogTablePage_4.png|thumb|Create column]]
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_5.png|thumb|Choose type for column]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_6.png|thumb|Enter name for column]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_8.png|thumb|Hide Primary Key column]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_9.png|thumb|Autoresize columns]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_10.png|thumb|Create Outline service]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_11.png|thumb|Define service properties]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_12.png|thumb|Configure service registration]]
 
[[Image:org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage_13.png|thumb|Populate company table with data]]
 

Latest revision as of 02:57, 17 October 2012

The Scout documentation has been moved to https://eclipsescout.github.io/.

Create WS Log Table Page

On the client node, go to 'Desktop' | 'Outlines' | 'StandardOutline'. Right click on the node Child Pages to create a new The Scout documentation has been moved to https://eclipsescout.github.io/. [1]. As page layout, choose AbstractPageWithTable [2] to create a page representing tabular data. On the next step, enter WS Log as name for that page and choose to add this page to the MainOutline (might be StandardOutline) [3]. By clicking Finish, the page is created and attached to the MainOutline.

Create columns

On the WsLogTablePage node, go to 'Table' | 'Columns'. Right click on the node to create a new The Scout documentation has been moved to https://eclipsescout.github.io/. [4]. Please add the following five columns to that table:

WsLogNrColumn
Type: Long Column
Name: Do not fill because column represents primary key and therefore is hidden
Class name: WsLogNrColumn
DateColumn
Type: String Column
Name: Date
Class name: DateColumn
ServiceColumn
Type: String Column
Name: Service
Class name: ServiceColumn
PortColumn
Type: String Column
Name: Port
Class name: PortColumn
OperationColumn
Type: String Column
Name: Operation
Class name: OperationColumn

To not display the WsLogNrColumn column because of holding the primary key, go to that column in Scout SDK and uncheck Displayable in Scout Property View.

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.

Create service to load WS Log data from database

Finally, we have to populate the table with WS Log data. For that purpose, go to the server node and double click on 'Outline Services' | 'StandardOutlineService' to open the corresponding Java class. In there, create the operation getWsLogTableData to load WS log data from database. Also add the operation signature to the service interface IStandardOutlineService to be accessible from client side.

@Override
public Object[][] getWsLogTableData() throws ProcessingException {
  return SQL.select("" +
        "SELECT   WS_LOG_NR, " +
        "         EVT_DATE, " +
        "         SERVICE, " +
        "         PORT, " +
        "         OPERATION " +
        "FROM     WS_LOG ");
}

Load WS Log data into WsLogTablePage

On client node, go to the WsLogTablePage to consume the service's data. On the Scout Property View, click on the operation Exec Load Table Data to populate the WS Log table. Implement the method as follows:

@Override
protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
  return SERVICES.getService(IStandardOutlineService.class).getWsLogTableData();
}
Create Company Table Page
Choose Page Layout
Give Page a name and link it with MainOutline
Create column

Back to the top