Problem after click on Button

Hi,

I want to implement a new vaadin component called ReloadableLayout which fires a reloadEvent if the user performs a drag down on the layout. While implementing this component I discovered, that after a click on an added Button, my ReloadableLayout doesn’t react on the first try. On a second try it works very well again. I attached my eclipse project and any help or hints are very appreciated.

Thanks in advance.

26035.zip (994 KB)

Hallo Matthias,

for debugging why not create a log method so that you can see things in the Chrome (or other browser) console:

public static native void log(String msg) /*-{
    console.log(msg);
}-*/;

If you then add

public void onHammerEvent(NativeHammerEvent event) { log("Event: "+event.getType().getText()); ... you will spot that the Hammer GWT library you are using has a problem
with creating the ‘dragend’ event when releasing the button. I was able
to get the drag effect with my mouse, without any button pressed.
I would think this is a bug (or at least an incompatibility with Vaadin) in
the Hammer GWT library. Certainly it would be a good idea to not keep
sending ‘dragdown’ or similar when there is no mouse button pressed.
Maybe this can be changed there, even when the ‘mouseup’ event
could not be caught?

Maybe you can find another workaround, but my first attempt would
be to patch Hammer GWT where it sends ‘dragdown’ and make sure
the button is pressed, otherwise immediately stop the drag and send
‘dragend’.

HTH,
Enver

Hi Enver,

thanks for your answer but for me it looks like the Button doesn’t fire the MouseUpEvent or doesn’t propagate the event to the parent component. I removed all HammerGWT calls and added this lines of code to the constructor:

[code]
addDomHandler(new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
log(“MouseDown”);
}
}, MouseDownEvent.getType());

addDomHandler(new MouseUpHandler() {
@Override
public void onMouseUp(MouseUpEvent event) {
log(“MouseUp”);
}
}, MouseUpEvent.getType());
[/code]Now, if a click on the Layout is performed I will see to outputs, one for the MouseDown and one for MouseUp. If I perform a click on the Button, I get only one output for MouseDown.

Thats why I’m thinking something is wrong with the Button.

Hi Matthias,

can you please write a minimal test case for that?

I am not sure there are any warranties on how Vaadin Framework components behave when you use them (the ‘widget’, that is) on the client side - we have Vaadin Elements for that.

Still, I can forward to somebody to decide if the behaviour is intended or not – sorry I cannot spend much more time on the issue myself. But please first make sure it is really really easy for us to reproduce, that is, please don’t let us install the old project then figure out what ‘removed all HammerGWT calls and added this lines of code to the constructor’ means and which constructor we were talking about 200 context switches ago.

Best Regards,
–Enver

Hi Enver,

sorry for my really late response. I don’t really know what you mean by “how Vaadin Framework components behave when you use them (the ‘widget’, that is) on the client side”. For my understanding, the used button is added server side by using the methods from the extended CssLayout.

Hi Matthias,

sorry I cannot remember what I meant with that sentence six months ago.
I seem to say you are adding Vaadin components to GWT-compiled classes, but if I remember correctly, you did not do that – so I wonder what I was really trying to say back then. I think the problem had to to with client-side manipulation of the DOM, i.e. not only using Vaadin Framework (server-side programming) but somehow interfering with its inner workings (through client-side programming).

Having said that, if you could zip up the minimal test case and put it here:
https://github.com/vaadin/framework/issues/new
I’d be very grateful.

Happy New Year!
–Enver

Hi Enver,

I just created a new entry on Github and added the minimal test case. Here is the link to the Github entry: https://github.com/vaadin/framework/issues/8313

I’m looking forward to your answer and hopefully to a solution.

Best regards,
Matthias

Hi Matthias.

Apologies for taking my time.

I can confirm the behaviour you describe below is there even on Vaadin-8.0.5 !

While the resulting downstream behaviour (HammerGWT stuff) is somewhat inconsistent
(like, in the Eclipse browser after every button click you cannot refresh by pulling the Layout
down, while in Chrome it ‘almost always’ works) I made the following two observations.

a) you are right in that the Mouse-Up DOM event is completely missing when pushing the
Vaadin button.
b) if you instantiate “NativeButton” instead of “Button” then the Mouse-Up DOM event is
present. Also, HammerGWT then always works.

I hope this work-around helps for the time being. I also passed this on to the correct guys
to have a look at it. I can already confirm that Vaadin button has custom event handling
logic so it is possible that is somewhat complex.

Not clear to me yet if adding the Mouse-Up would break 1-2 decades full of Vaadin applications
or if that’s an easy fix.

Best,
Enver

Hi Enver,

thank you for your reply.

Best regards,
Matthias

You are very welcome; and likewise, thank you for your bug report.

Again, please apologise this took me quite a while to get back to you.

BR,
Enver