Skip to main content
Jump to: navigation, search

Difference between revisions of "Scout/Tutorial/5.0/webservices/Create Company Table Page"

< Scout‎ | Tutorial‎ | 5.0
m (Load company data into CompanyTablePage)
m (Load company data into CompanyTablePage)
Line 84: Line 84:
protected void execLoadData(SearchFilter filter) throws ProcessingException {
protected void execLoadData(SearchFilter filter) throws ProcessingException {
   CompanyTablePageData pageData = SERVICES.getService(IStandardOutlineService.class).getCompanyTablePageData();

Latest revision as of 08:52, 9 April 2015

Wiki Home

Create Company Table Page

On the client node, go to Desktop > Outlines > StandardOutline > Child Pages. Right click on the node to create a new TablePage.

Create Company Table Page

As page layout, choose AbstractPageWithTable to create a page representing tabular data.

Choose Page Layout

On the next step, enter Company as name for that page and choose to add this page to the StandardOutline

Give Page a name and link it with StandardOutline

By clicking Finish, the page is created and attached to the StandardOutline.

Create columns

On the CompanyTablePage node, go to Table > Columns. Right click on the node to create a new Column.

Create column

Please add the following three columns to that table:

Type: Long Column
Name: Do not fill because column represents primary key and therefore is hidden
Class name: CompanyNrColumn

Choose type for column Enter name for column

Type: String Column
Name: Name
Class name: NameColumn
Type: String Column
Name: Symbol
Class name: SymbolColumn

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

Hide Primary Key column

To have the columns equally distributed over the available space of the table page, go to the Table node and check Auto Resize Columns in Scout Property View.

Autoresize columns

Create service to load company data from database

Now we have to populate the table with company data. For that purpose, double click on the StandardOutlineService under Server > Outline Services to open the corresponding Java class. In there, create the operation getCompanyTablePageData to load company data from database. Also add the operation signature to the service interface IStandardOutlineService to be accessible from client side. To find the interface IStandardOutlineService, press Ctrl+Shift+T, type IStandardOutlineService and click Open.

public class StandardOutlineService extends AbstractService implements IStandardOutlineService {
  public CompanyTablePageData getCompanyTablePageData() throws ProcessingException {
    CompanyTablePageData pageData = new CompanyTablePageData();
    SQL.selectInto("" + 
        "SELECT COMPANY_NR, " + 
        "       NAME, " + 
        "       SYMBOL " + 
        "FROM   COMPANY " + 
        "INTO   :{companyNr}, " + 
        "       :{name}, " + 
        "       :{symbol} ", 
    return pageData;

Load company data into CompanyTablePage

Now as the StandardOutlineService is ready to load company data from the database, go back to the CompanyTablePage to consume the service's data.

On the Scout Property View, click on the operation Exec Load Data to populate the company table

Populate company table with data

Implement the method as follows:

protected void execLoadData(SearchFilter filter) throws ProcessingException {

Finally, if you launch the application, you should see something like this:

Org.eclipse.scout.tutorial.jaxws.CreateCompanyTablePage 14.png

You can continue the webservices tutorial.

Back to the top