|
Re: [neon] Questions about AbstractPage [message #1751647 is a reply to message #1749966] |
Thu, 12 January 2017 08:44 |
|
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 )
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:
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03585 seconds