Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Loading master detail data on tabboxes(Loading master detail data on tabboxes)
Loading master detail data on tabboxes [message #1534068] Mon, 29 December 2014 00:04 Go to next message
Tore Van Grembergen is currently offline Tore Van GrembergenFriend
Messages: 12
Registered: July 2014
Location: Bassevelde
Junior Member
Hi,

what is the best way to load the master detail data of the "TABS" ?
see below screenshot
index.php/fa/20319/0/

Only the data of the first tab should be retrieved when opening the form.
All other tabs should only have the data imported when they are consulted.
The data on the other tabs are almost always detail tables to the master.
(e.g. in this example translations, aromas, production methods used etc)

Below an example of the second tab sheet.
It is only necessary to import that data when on is looking at the tab sheet

index.php/fa/20320/0/

Is this possible ?

Kind regards

Tore
Re: Loading master detail data on tabboxes [message #1535514 is a reply to message #1534068] Mon, 29 December 2014 19:19 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hello there,

I have not tried it yet. But I'll also need some kind of lazy loading in my app. My approach would be the org.eclipse.scout.rt.client.ui.form.fields.tabbox.AbstractTabBox.execTabSelected(IGroupBox) callback. There I would call a service to fill the TableFieldData according to the selected IGroupBox. The only open question for me is, how i can specifically invoke the importFormData method just for this particular table field, in order to get it displayed on the screen as well?

Regards, Peter
Re: Loading master detail data on tabboxes [message #1544444 is a reply to message #1535514] Sat, 03 January 2015 20:18 Go to previous messageGo to next message
Tore Van Grembergen is currently offline Tore Van GrembergenFriend
Messages: 12
Registered: July 2014
Location: Bassevelde
Junior Member
Dear Peter,

based on your hint, I found that below filtering could work :


      @Override
      protected void execTabSelected(IGroupBox selectedBox) throws ProcessingException {
          if (selectedBox.equals(getVertalingenBox()))
        {
          System.out.print("getVertalingenBox");

        }
        else if (selectedBox.equals(getAccijnsvooraadfichesBox()))
        {
          System.out.print("getAccijnsvooraadfichesBox");
        }
        else if (selectedBox.equals(getAromasBox()))
        {
          System.out.print("getAromasBox");
        }
        else if (selectedBox.equals(getKeurmerkenBox()))
        {
          System.out.print("getKeurmerkenBox");
        }
        else if (selectedBox.equals(getSmakenBox()))
        {
          System.out.print("getSmakenBox");
        }
        else if (selectedBox.equals(getGistingswijzenBox()))
        {
          System.out.print("getGistingswijzenBox");
        }
      }



If you click on a particular tab, one ends in the correct part of the code.
As you mention, from there it is trying to identify how to get the data into the tablefield.

Thanks already for the hint.

Kind regards

Tore
Re: Loading master detail data on tabboxes [message #1545444 is a reply to message #1544444] Sun, 04 January 2015 09:51 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hi,
no problem at all Smile
When you found a solution how to lazy load the tables please let me know Smile

Did you manage to to load your one-to-many relationships with one SQL.selectInto(...) already?

If yes, how did you do that?

Thanks

Peter
Re: Loading master detail data on tabboxes [message #1545452 is a reply to message #1545444] Sun, 04 January 2015 09:59 Go to previous messageGo to next message
Tore Van Grembergen is currently offline Tore Van GrembergenFriend
Messages: 12
Registered: July 2014
Location: Bassevelde
Junior Member
Dear Peter,

No realy sure what you mean.
What I have done is in the "load service" add different calls for all the tabs
(Don't know if it is a good way, but it seems to be working)

I have know something like :

....

    cSQLVertalingen = "call sp_tdtdrankv_selectdetail(:drankNr) ";
    oVertalingen = SQL.select(cSQLVertalingen, formData);

    formData.getVertalingenTable().clearRows();
    for (Object[] oVertaling : oVertalingen) {
      formData.getVertalingenTable().addRow(oVertaling);
    }

    cSQLAccvoorraadfiches = "call sp_tdtaccfch_selectdetailmetdranknr(:drankNr, :taalnr)";
    oAccvoorraadfiches = SQL.select(cSQLAccvoorraadfiches, formData, new NVPair("taalnr", nTaalnr));

    formData.getAccijnsvoorraadfichesTable().clearRows();
    for (Object[] oAccvoorraadfiche : oAccvoorraadfiches) {
      formData.getAccijnsvoorraadfichesTable().addRow(oAccvoorraadfiche);
    }

    cSQLAromas = "call sp_tdtdrankar_selectdetail(:taalnr, :drankNr, :aromanr)";
    oAromas = SQL.select(cSQLAromas, formData, new NVPair("taalnr", nTaalnr), new NVPair("aromanr", 0));

    formData.getAromasTable().clearRows();
    for (Object[] oAroma : oAromas) {
      formData.getAromasTable().addRow(oAroma);
    }

    cSQLKeurmerken = "call sp_tdtdrankkm_selectdetail(:taalnr, :drankNr, :keurmerknr)";
    oKeurmerken = SQL.select(cSQLKeurmerken, formData, new NVPair("taalnr", nTaalnr), new NVPair("keurmerknr", 0));

    formData.getKeurmerkenTable().clearRows();
    for (Object[] oKeurmerk : oKeurmerken) {
      formData.getKeurmerkenTable().addRow(oKeurmerk);
    }

    cSQLSmaken = "call sp_tdtdranksm_selectdetail(:taalnr, :drankNr, :smaaknr)";
    oSmaken = SQL.select(cSQLSmaken, formData, new NVPair("taalnr", nTaalnr), new NVPair("smaaknr", 0));

    formData.getSmakenTable().clearRows();
    for (Object[] oSmaak : oSmaken) {
      formData.getSmakenTable().addRow(oSmaak);
    }

    cSQLGistingswijzen = "call sp_tdtdrnkgst_selectdetail(:taalnr, :drankNr, :gistwnr)";
    oGistingswijzen = SQL.select(cSQLGistingswijzen, formData, new NVPair("taalnr", nTaalnr), new NVPair("gistwnr", 0));

    formData.getGistingswijzenTable().clearRows();
    for (Object[] oGistingswijze : oGistingswijzen) {
      formData.getGistingswijzenTable().addRow(oGistingswijze);
    }

....



As far as I think it is working; I have one call to the server to fill in the formData object, but I have different calls to the database server.

Kind regards

Tore
Re: Loading master detail data on tabboxes [message #1546042 is a reply to message #1545452] Sun, 04 January 2015 17:59 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

I found what I was looking for:
https://code.google.com/p/sakilapp/source/browse/scout/net.sakilapp.server/src/net/sakilapp/server/services/process/FilmProcessService.java?name=luna#107

Perhaps this helps too.
Re: Loading master detail data on tabboxes [message #1571356 is a reply to message #1546042] Sun, 18 January 2015 15:32 Go to previous message
Tore Van Grembergen is currently offline Tore Van GrembergenFriend
Messages: 12
Registered: July 2014
Location: Bassevelde
Junior Member
With regards to lazy loading.

This seems to work, but maybe somebody with more experience in the scout framework can validate if it is good practice :


   public class DrankInfoTabBox extends AbstractTabBox {

      @Override
      protected void execTabSelected(IGroupBox selectedBox) throws ProcessingException {

.....
        else if (selectedBox.equals(getAromasBox()))
        {
          DrankenFormData drankenFormData = new DrankenFormData();
          exportFormData(drankenFormData);

          IDrankenService service = SERVICES.getService(IDrankenService.class);
          drankenFormData = service.loadDrankenAromas(drankenFormData);

          importFormData(drankenFormData);
          getAromasTableField().reloadTableData();

        }
....

      }



The data of this tab is only loaded when the tabpage is selected.
The code might need some tweeking to prevent

  • reloading each time the tab is clicked.
  • copying back and forth of all the formdata. Maybe it is faster if only the table data would be copied.
  • ..




Tore


Previous Topic:Change SubTitle fontsize on Forms
Next Topic:Tab layout and selection issues
Goto Forum:
  


Current Time: Fri Oct 20 07:20:24 GMT 2017

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

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