Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » How to create a page that contains a form instead of a table?(Am I on the right track with my code?)
How to create a page that contains a form instead of a table? [message #1001776] Thu, 17 January 2013 06:00 Go to next message
Urs Beeli is currently offline Urs Beeli
Messages: 163
Registered: October 2012
Location: Bern, Switzerland
Senior Member
I wanted a page to show a form instead of a table. After failed attempts at trying this with an AbstractPage I reverted to using a AbstractPageWithTable and then added the following code to execPageActivated:

  @Override
  protected void execPageActivated() throws ProcessingException {
    if (getCompanyNr() != null) {
      form = new TabbedForm();
      form.setCompanyNr(getCompanyNr());
      form.setDisplayViewId(IForm.VIEW_ID_PAGE_TABLE);
      form.setEnabledGranted(false);
      setDetailForm(form);
      form.startDisplay();
    }
  }

This works nicely in my Swing client, but causes problems in the SWT client (see Bug 398305).

Is this the recommended way of doing it? Or is there a better way to show a form instead of the table?

Another question is how I would show the table again on this page instead of the form?

[Updated on: Thu, 17 January 2013 06:01]

Report message to a moderator

Re: How to create a page that contains a form instead of a table? [message #1001797 is a reply to message #1001776] Thu, 17 January 2013 06:47 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 262
Registered: October 2011
Senior Member
From: http://wiki.eclipse.org/Scout/Concepts/Page_Detail_Form

@Override
protected void execPageDeactivated() throws ProcessingException {
  if (getDetailForm() != null) {
    getDetailForm().doClose();
    setDetailForm(null);
  }
}


Assuming you have getter / setter to store a "detailForm".
Re: How to create a page that contains a form instead of a table? [message #1002271 is a reply to message #1001797] Fri, 18 January 2013 04:42 Go to previous messageGo to next message
Stathis Alexopoulos is currently offline Stathis Alexopoulos
Messages: 40
Registered: September 2010
Member
Hello Urs and Jeremie

Let me describe a clean test-bed project for our case With some steps.

Step 1.
Create a new Scout project with "Otline Tree and Table Form" template let's say xx.xx.

Step 2.
Goto ScoutExplorer xx.xx --> client --> Desktop --> StandardOutline --> Child Pages and create three new pages using AbstractPage template with the following names.

  • FirstPage
  • SecondPage
  • ThirdPage

Step 3.
Goto ScoutExplorer xx,xx --> client --> Desktop --> Forms and create five new forms with the following names

  • FirstPageMainForm
  • FirstPageSecondaryForm
  • FirstPageThirdForm
  • SecondPageMainForm
  • SecondPageSecondaryForm


Step 4.
Now goto FirstPage.java and add the following code.
  FirstPageMainForm mainForm;
  FirstPageSecondaryForm secondaryForm;
  FirstPageThirdForm thirdForm;

  @Override
  protected void execPageActivated() throws ProcessingException {
    mainForm = new FirstPageMainForm();
    mainForm.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
    mainForm.setDisplayViewId(IForm.VIEW_ID_PAGE_TABLE);
    mainForm.startModify();

    secondaryForm = new FirstPageSecondaryForm();
    secondaryForm.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
    secondaryForm.setDisplayViewId(IForm.VIEW_ID_E);
    secondaryForm.startModify();

    thirdForm = new FirstPageThirdForm();
    thirdForm.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
    thirdForm.setDisplayViewId(IForm.VIEW_ID_CENTER);
    thirdForm.startModify();
  }

  @Override
  protected void execPageDeactivated() throws ProcessingException {
    if (mainForm != null) {
      mainForm.doClose();
      mainForm = null;
    }
    if (secondaryForm != null) {
      secondaryForm.doClose();
      secondaryForm = null;
    }
    if (thirdForm != null) {
      thirdForm.doClose();
      thirdForm = null;
    }
  }


Step 5.
Also goto SecondPage.java and add the following code.
  SecondPageMainForm mainForm;
  SecondPageSecondaryForm secondaryForm;

  @Override
  protected void execPageActivated() throws ProcessingException {
    mainForm = new SecondPageMainForm();
    mainForm.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
    mainForm.setDisplayViewId(IForm.VIEW_ID_PAGE_TABLE);
    mainForm.startModify();

    secondaryForm = new SecondPageSecondaryForm();
    secondaryForm.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
    secondaryForm.setDisplayViewId(IForm.VIEW_ID_E);
    secondaryForm.startModify();

  }

  @Override
  protected void execPageDeactivated() throws ProcessingException {
    if (mainForm != null) {
      mainForm.doClose();
      mainForm = null;
    }
    if (secondaryForm != null) {
      secondaryForm.doClose();
      secondaryForm = null;
    }
  }


Step 6.
Run the Server and the SWT.
Step 7.
Navigate as follows

  1. FirstPage
  2. ThirdPage
  3. SecondPage
  4. ThirdPage
  5. FirstPage


Everything works fine. Isnt it?

Re: How to create a page that contains a form instead of a table? [message #1002275 is a reply to message #1002271] Fri, 18 January 2013 04:49 Go to previous messageGo to next message
Stathis Alexopoulos is currently offline Stathis Alexopoulos
Messages: 40
Registered: September 2010
Member
If you think that it worths to check the behavior of that test project, let me say my opinion.

I believe that either something is missing in the sequence (execPageActivated, execPageDeactivated) or something is going wrong with asyncexec. In my computer can sometimes observe the creation of the new page before the final blank.

Do you have some idea about it?
Re: How to create a page that contains a form instead of a table? [message #1003518 is a reply to message #1002275] Mon, 21 January 2013 07:29 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 163
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks for all your input. With the code provided by Stathis, I have been able to use an AbstractForm instead of an AbstractFormWithTable to display a form. Still, there are two problems I'm seeing with SWT (it works with Swing):

  • when using VIEW_ID_PAGE_TABLE to place the form, I sometimes still have trouble on other pages that contain tables that the table view is not shown, using VIEW_ID_PAGE_DETAIL instead solves this problem
  • switching from a form-page to a table-page back to another form-page works, however when switching from one form-page to another form-page the form on the second page is not shown (this might relate to what Stathis is mentioning in his second post)

Re: How to create a page that contains a form instead of a table? [message #1003913 is a reply to message #1003518] Tue, 22 January 2013 03:17 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 262
Registered: October 2011
Senior Member
When you say SWT, I assume you use a 4.x Branch (like normal Juno Scout Package)... It would be interesting to see if there is also a bug with a 3.x Branch (It requires another target platform)

This might be related to the bugs we have with E4.
Re: How to create a page that contains a form instead of a table? [message #1003962 is a reply to message #1003913] Tue, 22 January 2013 05:28 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 163
Registered: October 2012
Location: Bern, Switzerland
Senior Member
I've been using Juno (4.2) with Scout 3.8.1 for my playground project. Our "real" project will be based on Indigo with Scout Kepler (3.9?) Milestone 4.

I'll try to see if I can reproduce this there.
Re: How to create a page that contains a form instead of a table? [message #1004303 is a reply to message #1003962] Tue, 22 January 2013 19:11 Go to previous messageGo to next message
Stathis Alexopoulos is currently offline Stathis Alexopoulos
Messages: 40
Registered: September 2010
Member
Quote:
Everything works fine. Isnt it?


In my first post, the previous comment was ironic. That's why in my second post i proposed two possible explanations.

The code i provided it works only if the user follows the proposed navigation or in any way avoid to navigate directly from one page with forms to another page with forms.

In my experiments i noticed that navigating from the first page to second, the second page was drawed before disappearing. Also if you navigate to fast the sequence first->third->second the screen was still cluttered. These two observations made me to suspected that there is an issue about asyncExec(). So, i did a little hack with the following code at the end of execPageDeactivated()

   try {
      Thread.sleep(600);
    }
    catch (InterruptedException e) {}

The result is that you can navigate from one page to another without any problem. Please have in mind that 600 milliseconds is not an absolute number. In the second page for example a delay of 100 milliseconds is good enough.

So, there is a solution if we follow the first approach. Not so elegant, but simple enough and almost harmless.

Re: How to create a page that contains a form instead of a table? [message #1004408 is a reply to message #1004303] Wed, 23 January 2013 02:15 Go to previous messageGo to next message
Urs Beeli is currently offline Urs Beeli
Messages: 163
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks Stathis for your followup and the workaround. It works for my forms, too (even though my sense of aesthetics is deeply offended at the kludge Wink

[Updated on: Wed, 23 January 2013 02:52]

Report message to a moderator

Re: How to create a page that contains a form instead of a table? [message #1006419 is a reply to message #1004408] Thu, 31 January 2013 05:24 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 262
Registered: October 2011
Senior Member
@Stathis Alexopoulos:
Thanks a lot for your time and your example. Your case might be related to the behavior we have identified in Bug 387625
Re: How to create a page that contains a form instead of a table? [message #1018621 is a reply to message #1006419] Thu, 14 March 2013 03:56 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie Bresson
Messages: 262
Registered: October 2011
Senior Member
Urs Beeli provided interesting feedback in this thread (answering a similar question from Andreas Engler).
Re: How to create a page that contains a form instead of a table? [message #1041236 is a reply to message #1018621] Sun, 14 April 2013 17:08 Go to previous message
Andreas Engler is currently offline Andreas Engler
Messages: 10
Registered: January 2013
Junior Member
Hello,

my problem discribed in the thread linked by jeremie, still remains.

I tried to use the nightly build, in hope that way to overcome the issue, but with no success.

Followed the download eclipse-java and add the nightly build way. Created a new project with new rap target. Imported my exisiting Projekt. Am i missing something?

The target definition provided by urs does not work for me, i get errors regarding filechooser as discribed in the linked thread.

Kind regards

Andreas
Previous Topic:<<queueing rwt runnable into rwt thread:>>
Next Topic:Coding Guidline: Assert static import or not
Goto Forum:
  


Current Time: Wed May 22 22:10:54 EDT 2013

Powered by FUDForum. Page generated in 0.02018 seconds