Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Blog Entry - Scout Adopters we didn't know about
Blog Entry - Scout Adopters we didn't know about [message #1632609] Tue, 24 February 2015 11:22 Go to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hello there,

I have read the blog entry and must admit the screenshots shown there are awesome.; but they also raised a lot of questions how certain things were done there Smile

I added a few boxes and numbers to the screenshots.


  1. How is it possible to add own controls to a table page as shown in the screenshot (point 1)? Can someone provide a code sample please?
  2. Is it possible to add more tool items on the right hand side (point 2.) and open/start certain activities depending on what page is opened?
  3. How is it possible t hide the outline tree as shown in point 3. ?


index.php/fa/20982/0/
index.php/fa/20983/0/

Thanks,

Peter
Re: Blog Entry - Scout Adopters we didn't know about [message #1632811 is a reply to message #1632609] Tue, 24 February 2015 13:54 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1243
Registered: October 2011
Senior Member
1.
I remember we have discussed this in one of your first post: Complete Scout Newbie. Personally I do not know how this is done. I will ask Joszef if he is ready to share some code.

2.
I think you are looking for ToolButton. In one of our application we have a lot of those tools buttons.

index.php/fa/20984/0/

Just add them with the Scout SDK: Client > Desktop > Tools > "New Tool Item...". Depending on what you need you can add a:
* ToolButton: A Button extending AbstractToolButton
* FormToolButton: A Button extending AbstractFormToolButton.


3.
I think in the Left Columns you have highlighted you have two forms.
On the top you have the page tree.
On the bottom you have an additional Form opened as view.

With the DisplayViewId property you can manage where the Form will be opened as View (DisplayHint should be DISPLAY_HINT_VIEW).

If you look at the DefaultOutlineTreeForm the DisplayViewId is VIEW_ID_OUTLINE (which is mapped to North-West).

So if you open a second form as View and open it as VIEW_ID_W (West) or VIEW_ID_SW (South West) it will appears bellow the outline tree Form.
Re: Blog Entry - Scout Adopters we didn't know about [message #1634177 is a reply to message #1632811] Wed, 25 February 2015 06:19 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 191
Registered: November 2014
Senior Member

Hello Jeremie,

Jeremie Bresson wrote on Tue, 24 February 2015 13:54
1.
I remember we have discussed this in one of your first post: Complete Scout Newbie. Personally I do not know how this is done. I will ask Joszef if he is ready to share some code.


That would be great. I think such things are worth a wiki entry. Because the out-of-the-box behaviour of Scout is self more or less explaining. But more sophisticated topics like the one we had with form based login, user roles/permission, custom controls in a table page and so on...

Jeremie Bresson wrote on Tue, 24 February 2015 13:54

2.
I think you are looking for ToolButton. In one of our application we have a lot of those tools buttons.

index.php/fa/20984/0/

Just add them with the Scout SDK: Client > Desktop > Tools > "New Tool Item...". Depending on what you need you can add a:
* ToolButton: A Button extending AbstractToolButton
* FormToolButton: A Button extending AbstractFormToolButton.


Are these toobuttons used globally then, no matter which tablepage is active. E.g. if I have a Search-Toolbutton and I click there, I want to open the search form corresponding to the active tablepage. How can this be achieved?

Jeremie Bresson wrote on Tue, 24 February 2015 13:54

3.
I think in the Left Columns you have highlighted you have two forms.
On the top you have the page tree.
On the bottom you have an additional Form opened as view.

With the DisplayViewId property you can manage where the Form will be opened as View (DisplayHint should be DISPLAY_HINT_VIEW).

If you look at the DefaultOutlineTreeForm the DisplayViewId is VIEW_ID_OUTLINE (which is mapped to North-West).

So if you open a second form as View and open it as VIEW_ID_W (West) or VIEW_ID_SW (South West) it will appears bellow the outline tree Form.


Yes that's my fault. I didn't notice that the outline tree just got smaller in that case.

Thanks,

Peter

[Updated on: Thu, 26 February 2015 08:40]

Report message to a moderator

Re: Blog Entry - Scout Adopters we didn't know about [message #1669078 is a reply to message #1634177] Thu, 12 March 2015 19:20 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1243
Registered: October 2011
Senior Member
Peter Pfeifer wrote on Wed, 25 February 2015 07:19
Are these toobuttons used globally then, no matter which tablepage is active. E.g. if I have a Search-Toolbutton and I click there, I want to open the search form corresponding to the active tablepage. How can this be achieved?


About ToolButtons let me provide some insides:
What I describe is for Luna and Mars. I know that with the N-Release, the API is lightly different.

1/ Opening always the same form:
Given a Form called MyForm, just add this code as inner class in the Desktop class:

@Order(100.0)
public class MyFormButton extends AbstractFormToolButton<MyForm> {

  @Override
  protected String getConfiguredText() {
    return TEXTS.get("MyForm");
  }

  @Override
  protected void execStartForm() throws ProcessingException {
    MyForm myForm = new MyForm();
    myForm.startModify();
    
    setForm(myForm);
  }
}

In execStartForm() you need to start the form and to set it.

Be aware that when you set a form, it is decorated (check the AbstractFormToolButton.decorateForm(FORM) implementation). If you want to open your form somewhere else, you can override the method and define your own decoration set-up.
@Override
protected void decorateForm(MyForm f) {
  f.setAutoAddRemoveOnDesktop(false);
  f.setDisplayHint(IForm.DISPLAY_HINT_VIEW);
  f.setDisplayViewId(IForm.VIEW_ID_S);
}


2/ Opening the search form:
Following the same idea, you can add a FormToolButton to hide and display the search field:
@Order(200.0)
public class SearchToolButton extends AbstractFormToolButton<ISearchForm> {

  @Override
  protected String getConfiguredText() {
    return TEXTS.get("Search");
  }
}


Now the FormToolButton SearchToolButton is no longer responsible of starting the search form. The Table Page does it. But when the user activates another TablePage, the form attached to the SearchToolButton needs to be changed. The method execPageSearchFormChanged(IForm, IForm) can be used for this purpose.

Here is a possible implementation:
@Override
protected void execPageSearchFormChanged(IForm oldForm, IForm newForm) throws ProcessingException {
  SearchToolButton b = findToolButton(SearchToolButton.class);
  if (b == null) {
    return;
  }

  if (newForm != null && !(newForm instanceof ISearchForm)) {
    throw new IllegalArgumentException("A search form must be of type ISearchForm! " + newForm);
  }
  b.setForm((ISearchForm) newForm, true);

  if (newForm != null) {
    if (getOutline() != null && getOutline().getActivePage() instanceof IPageWithTable<?>) {
      IPageWithTable<?> tablePage = (IPageWithTable<?>) getOutline().getActivePage();
      if (tablePage.isSearchRequired() && !tablePage.getSearchFilter().isCompleted()) {
        b.setSelected(true);
      }
    }
  }
}


More possibilities
The Pages also support the notion of Detail Form. In a similar way than for SearchForm you can have a FormToolButton to display and hide this display form. Use execPageDetailFormChanged(IForm, IForm) to handle Page change.

If you need more Form attached to the Page, you can of course extend this pattern. Just have your AbstractYourAppPageWithTable or AbstractYourAppPageWithNode providing a OtherDetailForm (for example). In the Page you know when the page is activated and deactivated [execPageActivated() and execPageDeactivated()]. You can find the corresponding FormToolButton (for example: OtherDetailFormToolButton) in your Desktop and add set attach the OtherDetailForm to the OtherDetailFormToolButton.

.
Previous Topic:In 2016, Eclipse Scout will become a Java framework.
Next Topic:Add and style custom UI elements
Goto Forum:
  


Current Time: Sun Oct 22 04:36:17 GMT 2017

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

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