Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » [neon] Questions about AbstractPage
[neon] Questions about AbstractPage [message #1749966] Wed, 14 December 2016 14:12 Go to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
As part of our Mars -> Neon Migration we have a Page (not a PageWithTable) that contains a single form. The Mars class looks as follows:

public class MyPage extends AbstractPage {
  private MyForm form;

  @Override
  protected String getConfiguredTitle() {
    return TEXTS.get("MY_PAGE");
  }

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

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


When porting this to Neon I get a compilation error telling me I need to implement initTable().

Returning null from this method (after all, I do not need/want a table on my Page because I want it to show a form) causes a NPE when switching to the Outline containing that page.

So I added a dummy table implementation and now it all works (more or less, see below for one of the "less" parts). However, I was slightly irritated. Why does the AbstractPage in Neon require a table? It didn't in Mars. I would have expected the table only to be added in AbstractPageWithTable...

Is my workaround of just supplying a dummy table the recommended way to get around this?

As to the other question I have with this regard: All the various pages extending AbstractPageWithTable in my outline show in the same way. When selecting my AbstractPage containing the embedded form, it shows instead of the table page but it comes with a "Tab" above the page. Is there any way to get rid of this?

index.php/fa/27861/0/
Re: [neon] Questions about AbstractPage [message #1751647 is a reply to message #1749966] Thu, 12 January 2017 08:44 Go to previous messageGo to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 205
Registered: November 2010
Senior Member
Urs,

Quote:
Why does the AbstractPage in Neon require a table? It didn't in Mars. I would have expected the table only to be added in AbstractPageWithTable...


AbstractPage is not intended to be subclassed directly, it is more like a container for common code. Therefore when we refactored that class, we took no regard for projects. (But yes, we should probably mention that in the JavaDoc Wink )

You should always subclass either AbstractPageWithTable or AbstractPageWithNodes. If you want to visualize tabular data on the right side, use a AbstractPageWithTable. For all other cases (a detail form on the right side, a fixed number of subnodes, or nothing at all) use AbstractPageWithNodes. The "page with nodes" actually has a table as well that is used to display subnodes. See the following example:
index.php/fa/28111/0/

So, all pages can have a table. But also, all pages can have a detail form. In fact, they can have both! There are not displayed together, but on the same level. If a detail form is present, that is displayed first. You can then use the navigation buttons to toggle between the detail form and the detail table without changing the node selection in the outline tree.

You can configure if the form or the table are visible using getConfiguredTableVisible and getConfiguredDetailFormVisible.

Quote:
As to the other question I have with this regard: All the various pages extending AbstractPageWithTable in my outline show in the same way. When selecting my AbstractPage containing the embedded form, it shows instead of the table page but it comes with a "Tab" above the page. Is there any way to get rid of this?


What you did, is opening an "ordinary" form when the node is activated and close it again when the node is deselected. Because it is an simple form, it is not really attached to the tree and therefore a tab is displayed. To fix that, you should configure the form as the "detail form" of your page. The page then manages the form for you. So your code should more look like this:

public class MyPage extends AbstractPageWithNodes {

  @Override
  protected String getConfiguredTitle() {
    return TEXTS.get("MY_PAGE");
  }
  
  @Override
  protected Class<? extends IForm> getConfiguredDetailForm() {
    return MyForm.class;
  }
} 

public class MyForm extends AbstractForm {
  ...
  
  @Override
  public void start() {
    startModify();
  }
  
  ...
}


Overriding the start() method in the form makes the page's code easier. You could also override startDetailForm() and call startModify() directly, but then you would need a cast:

  @Override
  protected void startDetailForm() {
    ((MyForm) getDetailForm()).startModify();
  }


Regards,
Beat
Re: [neon] Questions about AbstractPage [message #1751691 is a reply to message #1751647] Thu, 12 January 2017 15:27 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Beat

thanks for your detailed reply. I'll try modifying my code accordingly and report back here.
Re: [neon] Questions about AbstractPage [message #1751872 is a reply to message #1751691] Mon, 16 January 2017 11:46 Go to previous message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
That works perfectly, thanks for outlining how to solve this.

I needed to add
getConfiguredTableVisible() { return false; }

to disable the navigation buttons, but now it behaves as I intended.
Previous Topic:[neon] Can the JobAPI replace the Eclipse.JobGroup functionality
Next Topic:[neon] How to specify different config.properties file when starting client
Goto Forum:
  


Current Time: Thu Apr 25 09:49:56 GMT 2024

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

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

Back to the top