Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » RadioButtonGroup with LookupCall
RadioButtonGroup with LookupCall [message #1105160] Mon, 09 September 2013 12:48 Go to next message
Jan Put is currently offline Jan Put
Messages: 5
Registered: August 2013
Junior Member
Hi,

I have created an AbstractPageWithTable with a variable DossierNr that is properly initialized. From that page I open a form where I created an invisible field to store that DossierNr. On the form there is a radiogroup linked to a master field (DossierNr) and a lookupcall.

    public class KinGroup extends AbstractRadioButtonGroup<Long> {

      @Override
      protected String getConfiguredLabel() {
        return TEXTS.get("Kin");
      }

      @Override
      protected Class<? extends LookupCall> getConfiguredLookupCall() {
        return ClientLookupCall.class;
      }

      @Override
      protected Class<? extends IValueField> getConfiguredMasterField() {
        return DossierNrField.class;
      }
    }


Now i have the following problem:
Whenever I launch the form with following code:
    HeirForm form = new HeirForm();
    form.getDossierNrField().setValue(getDossierNr());
    form.startNew();
    form.waitFor();
    if (form.isFormStored()) {
      reloadPage();
    }


the initialization of the masterfield DossierNr is too late, so the getDataByAll is already called before the setValue call of the DossierNrField is executed.

I also tried the execPrepareLookup of the form, but then the masterfield isn't yet initialized either.

Is there another exec function I should be using or can I trigger the RadioButtonGroup to call the lookup call again? Any ideas?

Thx,
Jan Put
Re: RadioButtonGroup with LookupCall [message #1105299 is a reply to message #1105160] Mon, 09 September 2013 16:48 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 702
Registered: October 2011
Senior Member
I assume this is a problem in Scout.

I assume that if you change your RadioButtonGroup for a SmartField this works, isn't it?
I assume that in this case the call (getDataByAll(..) on the LookupCall) occurs later... (when the DossierNr value has been initialized)


Your problem is that an AbstractRadioButtonGroup need to make the call during the form initialization to create the corresponding buttons (this is when you call "new HeirForm()")

Can you try to (I did not try it):

Store your property in a form variable: m_dossierNr.

Pass the value from your table page to your constructor:
HeirForm form = new HeirForm(getDossierNr());


Add new constructors on you form:
  public DesktopForm(Long dossierNr) throws ProcessingException {
    super(false);
    m_dossierNr = dossierNr
    callInitializer();
  }


In the execPrepareLookup of you lookupcall, set the dossierNr on the call (it is contained in m_dossierNr instead of on the hidden master field).

Let me know if it works, otherwise I will try to reproduce your case on my computer.
Re: RadioButtonGroup with LookupCall [message #1105748 is a reply to message #1105299] Tue, 10 September 2013 08:21 Go to previous message
Jan Put is currently offline Jan Put
Messages: 5
Registered: August 2013
Junior Member
Hi Jeremie.
That did the trick. I had already found a workaround by calling an execPrepareLookup in the form class that I could override at form instantiation
	HeirForm form = new HeirForm() {

	  @Override
	  protected void execPrepareLookup(LookupCall call) {
		ClientLookupCall clLookup = (ClientLookupCall) call;
		clLookup.setDossierNr(HeirTablePage.this.getDossierNr());
		super.execPrepareLookup(call);
	  }
	};

, but your sollution is much more elegant and easier to use when instantiated in multiple locations. Thx!!

[Updated on: Tue, 10 September 2013 08:25]

Report message to a moderator

Previous Topic:Create a productive version with a runnable SWT-App
Next Topic:Maximal Rows/Columns Java Heap Space Problem
Goto Forum:
  


Current Time: Sun Sep 21 14:19:45 GMT 2014

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

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