Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Scout Mars M4 and SearchForms
Scout Mars M4 and SearchForms [message #1536298] Tue, 30 December 2014 05:59 Go to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hello,

right now I'm trying to implement a search form for one of my entities.
Generating and and opening the search form works out of the box. It's opened with the according tablepage.

But when looking at the MiniCRM tutorial the search criterias are handled in

@Override
protected Object[][] execLoadTableData(SearchFilter filter) throws ProcessingException {
  CompanySearchFormData formData = (CompanySearchFormData) filter.getFormData();
  if(formData == null) {
    formData = new CompanySearchFormData();
  }
  return SERVICES.getService(IStandardOutlineService.class).getCompanyTableData(formData);
}


and then in the ServicOutline
Implementation:

public Object[][] getCompanyTableData(CompanySearchFormData formData) throws ProcessingException {
  StringBuilder statement = new StringBuilder();
  statement.append(
      "SELECT COMPANY_NR, SHORT_NAME, NAME " +
	  "FROM   COMPANY " +
	  "WHERE  1=1 ");
  if (!StringUtility.isNullOrEmpty(formData.getShortName().getValue())) {
    statement.append("AND UPPER(SHORT_NAME) LIKE UPPER(:shortName || '%') ");
  }
  if (!StringUtility.isNullOrEmpty(formData.getName().getValue())) {
    statement.append("AND UPPER(NAME) LIKE UPPER(:name || '%')");
  }
  return SQL.select(statement.toString(), formData);
}


In MarsM4 Object[][] execLoadTableData is deprecated and protected void execLoadData(SearchFilter filter) should be used.

So far so good, the initial call works as expected and my tabelpage gets populated. But when I enter a search criteria in my search form and press "Search" nothing happens. Looking at the code an empty Search Handler is invoked, but then nothing else happens then.

So right now, I don't know how the according Tablepage#execLoadData(SearchFilter filter) gets called once again with the entered search criterias.

Do you have any ideas how this could work?

Thanks, Peter
Re: Scout Mars M4 and SearchForms [message #1536418 is a reply to message #1536298] Tue, 30 December 2014 07:33 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1243
Registered: October 2011
Senior Member
Peter Pfeifer wrote on Tue, 30 December 2014 06:59
In MarsM4 Object[][] execLoadTableData is deprecated and protected void execLoadData(SearchFilter filter) should be used.


This is explained here: Deprecate execLoadTableData() in table pages. Notice that with Mars, we still support both methods.

The prefered way is to use a TablePageData and SearchForm (already possible with the Luna version).

I was thinking that the Tutorial was already up-to-date. I will try to update it (because it was already possible with Luna) with the inputs I have discussed with Nils Israel.

We haven't started the 5.0 branch of the tutorials. This is on the TODO List for january (we are rethinking the way we document the scout project).

Peter Pfeifer wrote on Tue, 30 December 2014 06:59
So far so good, the initial call works as expected and my tabelpage gets populated. But when I enter a search criteria in my search form and press "Search" nothing happens. Looking at the code an empty Search Handler is invoked, but then nothing else happens then.

So right now, I don't know how the according Tablepage#execLoadData(SearchFilter filter) gets called once again with the entered search criterias.


This means that if you put a break point at the beginning of
* execLoadData(SearchFilter filter)
* and/or execLoadTableData(SearchFilter filter)

You do not land there, when you click on the search button? I need to try it, because it should work.
Re: Scout Mars M4 and SearchForms [message #1536683 is a reply to message #1536418] Tue, 30 December 2014 11:03 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Jeremie Bresson wrote on Tue, 30 December 2014 07:33

You do not land there, when you click on the search button? I need to try it, because it should work.


After updating to the newest nightly build i get to the breakpoints. BUT Smile now I get the following error when clicking on an entry in the TablePage after submitting a search

!MESSAGE org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.resolveRows(AbstractTable.java:3718) could not resolve row InternalTableRow[1,017, _Fichte, 70+ (2/2), 25, 0.49, 0.49, 0.27, 0.00, 0.10, , , , , true, true, , PICEA abies, true, false, -1]


My TablePage execLoadData looks like this:
@Override
  protected void execLoadData(SearchFilter filter) throws ProcessingException {
    ArticlesSearchFormData searchFormData = (ArticlesSearchFormData) filter.getFormData();
    if (searchFormData == null) {
      searchFormData = new ArticlesSearchFormData();
    }
    ArticlesTablePageData pageData = (ArticlesTablePageData) SERVICES.getService(IStandardOutlineService.class).getArticleTableData(searchFormData);
    importPageData(pageData);
  }


And my service implementation like this:
 @Override
  public AbstractTablePageData getArticleTableData(ArticlesSearchFormData searchFormData) throws ProcessingException {
    StringBuilder whereClause = new StringBuilder("WHERE 1 = 1 ");
    ArticlesTablePageData pageData = new ArticlesTablePageData();

    if (!StringUtility.isNullOrEmpty(searchFormData.getArticleName().getValue())) {
      whereClause.append(" AND UPPER(ArticleName) LIKE UPPER ('%' || :articleName || '%')");
    }

    SQL.selectInto("SELECT ID, ArticleName, Sort, Bunch, PriceBBK, StandardPrice, WholesalePrice, AcquisitionPrice, VAT, PricelistBBK, PricelistGeneral, LatinName, PricelistProducer, deleted, UserID "
        + "FROM Articles "
        + whereClause.toString()
        + " INTO :iD, :articleName, :sortType, :bunch, :priceBBK, :standardPrice, :wholesalePrice, :acquisitionPrice, :vAT, :pricelistBBK, :pricelistGeneral, :latinName, :pricelistProducer, :deleted, :userID", pageData);
    return pageData;
  }
Re: Scout Mars M4 and SearchForms [message #1550753 is a reply to message #1536683] Wed, 07 January 2015 07:48 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1243
Registered: October 2011
Senior Member
Peter Pfeifer wrote on Tue, 30 December 2014 12:03
After updating to the newest nightly build i get to the breakpoints. BUT Smile now I get the following error when clicking on an entry in the TablePage after submitting a search

!MESSAGE org.eclipse.scout.rt.client.ui.basic.table.AbstractTable.resolveRows(AbstractTable.java:3718) could not resolve row InternalTableRow[1,017, _Fichte, 70+ (2/2), 25, 0.49, 0.49, 0.27, 0.00, 0.10, , , , , true, true, , PICEA abies, true, false, -1]


This might be a bug in the table, but I am not able to reproduce it. The search form is not involved here.

Can you give more detail? About the Columns and the Data? (I assume one column and one value are responsible).

Peter Pfeifer wrote on Tue, 30 December 2014 12:03
My TablePage execLoadData looks like this:
(...)
And my service implementation like this:


This is a detail, but: your method getArticleTableData() could directly return an ArticlesTablePageData instead of an AbstractTablePageData.
Previous Topic:Define Layout of Perspective and its Views
Next Topic:deploy server to tomcat problem "Address allredy in use"
Goto Forum:
  


Current Time: Sun Oct 22 17:51:55 GMT 2017

Powered by FUDForum. Page generated in 0.02196 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software