LayoutClickListener doesn't work in FormLayout

The LayoutClickListener doesn’t work in FormLayout.
Tested in IE and FF.

If I change FormLayout to VerticalLayout - it works fine.

Here is sample code:

package com.example.vaadin;

import com.vaadin.Application;
import com.vaadin.event.LayoutEvents.LayoutClickEvent;
import com.vaadin.event.LayoutEvents.LayoutClickListener;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;

public class VaadinApplication extends Application {
		
	@Override
	public void init() {
		final Window mainWindow = new Window("Vaadin Application");
		Label label = new Label("Hello Vaadin user");
		
		mainWindow.addComponent(label);
		
		FormLayout layout = new FormLayout();
//		VerticalLayout layout = new VerticalLayout();
		mainWindow.addComponent(layout);
		
		layout.addComponent(new TextField("caption"));
		
		layout.addListener(new LayoutClickListener() {
			
			@Override
			public void layoutClick(LayoutClickEvent event) {
				mainWindow.showNotification("xxxxxxxx");
			}
		});
		
		mainWindow.setSizeFull();
		setMainWindow(mainWindow);
	}	
}

Hi,

I looked at the source code of VFormLayout and it seems that the client side class doesn’t contain support for LayoutClickListener. This is a bug, could you
open a ticket
about it?

-Henri

Sure :).


ticket#6346

I have a panel with position:absolute in my application and I want it to hide if I click outside that panel.
I can’t do it now because I use the FormLayout as a parent of that panel and I can’t use the parent of FormLayout, because there is no way (or I don’t know the way) to determine if it was outside or inside the popup panel.

Any ideas how to do it? Maybe I should look deeper into PopupView class and see how it’s done, but maybe there is a simpler way of hiding the panel after clicking outside of it?