Scout/Concepts/Page Detail Form

From Eclipsepedia

< Scout‎ | Concepts
Revision as of 05:43, 30 January 2014 by Eclipse.bugzilla.dietmar-stoll.de (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitter
Bugzilla
Bugzilla

A page detail form is an ordinary Form which is attached to a Page. This form might be opened in a view.

Description

A page detail form is typically created and started when the page gets activated. With the function IPage#setDetailForm() it can be attached to the page. Until now the page resp. the desktop takes care of showing and hiding the form on page activation and deactivation.

The following code shows an example how to create and attach a detail form.

@Override
protected void execPageActivated() throws ProcessingException {
  if (getDetailForm() == null) {
    PersonDetailForm form = new PersonDetailForm();
    form.setPersonNr(getPersonNr());
    setDetailForm(form);
    form.startView();
  }
}

As already said, attaching a detail form to a page means the detail form will automatically be hidden when the page gets deactivated and shown when the page gets activated (see PageDetailFormChanged on Desktop). So the detail form actually gets cached and does not need to be started more than once per page. This requires that the form does not get closed.

Note.png
Start vs Show
Note the difference between starting and showing a form. Starting means executing the form handler which normally loads the data and fills the fields. Showing the form means displaying it. This is normally automatically done after the form has been started. In case of the detail form it's not because the property autoAddRemoveOnDesktop is set to false by the method setDetailForm(). Now the form explicitly needs to be added to the desktop which will tell the UI to display it.

This is how it is done mostly. If you have a special kind of detail form which requires explicit closing, you could do this on page deactivation. But remember: This will break the caching and the form always needs to be started again on page activation.

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

If you would like to hide the page table and only show the detail form instead, you can set the property tableVisible to false.

@Override
protected boolean getConfiguredTableVisible() {
  return false;
}

See also