Blog Entry - Scout Adopters we didn't know about [message #1632609] |
Tue, 24 February 2015 11:22 |
|
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
I added a few boxes and numbers to the screenshots.
- 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?
- 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?
- How is it possible t hide the outline tree as shown in point 3. ?
Thanks,
Peter
|
|
|
|
Re: Blog Entry - Scout Adopters we didn't know about [message #1634177 is a reply to message #1632811] |
Wed, 25 February 2015 06:19 |
|
Hello Jeremie,
Jeremie Bresson wrote on Tue, 24 February 2015 13:541.
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.
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 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
Peter Pfeifer wrote on Wed, 25 February 2015 07:19Are 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.
.
|
|
|
Powered by
FUDForum. Page generated in 0.02885 seconds