Window clicklistener is not working

Hi

I am trying to implement some code that will allow me to detect when the user selects a one of a number of windows.

I have successfully managed to hook focus listeners onto the components in the window but am struggling to determine when the user simply clicks on a window.

As far as I can see a window does not fire a MouseEvent.ClickEvent when a window is selected.

Here is some simple code that demonstrates the problem


public class MyVaadinApplication extends Application
{
    private Window window;

    @Override
    public void init()
    {
        window = new Window("Vaadin Application");
        window.addListener( new com.vaadin.event.MouseEvents.ClickListener(){

			public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
				System.out.println( "Window clicked");
				
			}});
        
        setMainWindow(window);
        
        Window window2 = new Window("Modal Window");
        window2.addListener( new com.vaadin.event.MouseEvents.ClickListener(){

			public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
				System.out.println( "Modal Window clicked");
				
			}});
        
        window.addWindow( window2);
        
    }
    
}

No reply

Should I raise this as a bug / issue?

Hi,

For me this seems to be a bug. The addListener(ClickListener listener) method is inherited from Panel and apparently the client-side implementation of Window doesn’t support it currently.

-Henri

please write a ticket to
http://dev.vaadin.com/
.

Hi everyone,

I try to use addListener(ClickEvent.class, this, “rightClick”) to add a Click listener to Window. It does not work. The event cannot be fired. However, it works properly for annoymous addListener(ClickListener listener) function.

Here is some simple code that demonstrates the problem

public class CamsWindow extends Window{

public CamsWindow(String curForm, String width, String height, String msgKey, String engCap, boolean model){
        String dispTtl = Helper.getLoginDisplay();
        removeAllComponents();
        setModal(model);
        setWidth(width);
        setHeight(height);
        setCaption(CamsMessageSourceManager.getMessage(msgKey, engCap, new String{dispTtl}));
        
this.addListener(Window.CloseEvent.class, this, "closeWindow"); //Work
[b]
        this.addListener(ClickEvent.class, this, "rightClick");
[/b] //NOT Work
    }

    public void rightClick(LayoutClickEvent event){
        log.debug("RightClick being Called)");
    }

public void closeWindow(CloseEvent e){
        log.debug("CloseWindow being Called");
    }
}

Thanks~