Request for a new feature for the Window compoment.

[color=#000000]
Hi!

I need help to fork or improve the current Window component. What I need is to restrict the window floating area so the component does not float over the menu bar.

I have forked the Window code and created a SubWindow component but it not work well. What I see is that the method setParent() is the responsible for check that the component is added to the UI. I have modified the method to request a parent of SubWindowDesktop instance, so that desktop is the area in which the window float.
The SubWindowDesktop extends a Panel and has a CssLayout as it content.
The component work, but slower than the Window component when you drag it and some event don’t work.
If I use the same css v-window class it draw in an incorrect way, so I have extended the css v-window as a v-subwindow and add a “position: absolute !important;”. That fix the problem but I don’t understand way.
But the main problem is that the windowOrder is not working. What I see is that is implemented as a static field in the VWindow componenent. In the fork I have renamed it as a SubWindowWidget.
In the code, the static windowOrder list is auto-populated when the component is created but it’s not working. It is always in 0 size.
I have upload the code to github. Here is the link:
SubWindow Component

The code upload is a maven project that has the component itself and the demo.
It will be realy nice if the Vaadin Framework implement this behaviour in the Window componet. Currently, windows are only “top window” but in all of our project we really need a subwindow o restricted window.
I think that if implemented in the core a “WindowDesktop” in a similar way I have do it can be a minimal change in the sources a very nice feature.
But returned to the component, any idea way the static field is not updated?
Thanks in advance!
Marcelo
[/color]

Thanks for your idea and feedback. We gather both bugs and feature requests in GitHub, so you could add this to
github.com/vaadin/framework/issues

But it is not very easy feature to implement, since there are probably lot of corner cases, which should be considered. The features in framework should be generic and neutral.

At the moment implementing this requires e.g. implementing clientside extension to Window, which snaps the Window to certain coordinates with some technique. Based on your description you are already studying that kind of approach.

Hi Tatu.
In facts, Windows are DIV so it have all what it need to exist but currently they are added to a special DIV (v-ovelaycontainer) in the UI and float over everything. I have made a modification in the client widget in the setParent to remove UI and add SubWindowDesktop as required parent. In that way and as I said, the CssLayout create the DIV that restrict the floating movement. I think this is a generinc and neutral behaviour because you know in what sourface you want to restrict the movement.
Adding this new component (WindowDesktop) as a posible parent to windows could solve the problem in a clear way and, I think, whidout any other changes.
Still trying to solve this…
Thanks.

Well… I modified the Framework and it’s working!!!
Some minimal changes and the Window component have a new behavior.

Sounds good. I think this pull request is from you.

https://github.com/vaadin/framework/pull/10403

Vaadin is open source framework and contributions in form pull requests like this are welcome. Our developers will be in correspendence with you upon this.

Marcelo, do note that you have some unit tests failing in vaadin-server. Did you run the unit tests locally after your change?

-Olli

Hi Olli.
I have disabled the test and forget to enable it again.
Now searching what is failing.
I’m not sure what is happend…
debugging…

Could somebody help me with this:

Failed tests:
HierarchyMapperWithDataTest.fetchWithFilter:208->verifyFetchIsCorrect:223 Unexpected fetch results. expected:<100002 [parent: 100001]

but was:<100014>

I don’t see how this test is related to my code and is undocumented in the sources.

If the test is unrelated to your changes, somebody else needs to fix it first then. Hang on, it’s not always the fastest process.

-Olli

The test is failing only in my box. I upload all and in the github fork all test have passed successfully.