1 /*
2  * WindowClosedEvent.java
3  *
4  * Copyright (C) 2021 by RStudio, PBC
5  *
6  * Unless you have received this program directly from RStudio pursuant
7  * to the terms of a commercial license agreement with RStudio, then
8  * this program is licensed to you under the terms of version 3 of the
9  * GNU Affero General Public License. This program is distributed WITHOUT
10  * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
11  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
12  * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
13  *
14  */
15 package org.rstudio.studio.client.common.satellite.events;
16 
17 import com.google.gwt.event.shared.EventHandler;
18 import com.google.gwt.event.shared.GwtEvent;
19 
20 public class WindowClosedEvent extends GwtEvent<WindowClosedEvent.Handler>
21 {
22    public interface Handler extends EventHandler
23    {
onWindowClosed(WindowClosedEvent event)24       void onWindowClosed(WindowClosedEvent event);
25    }
26 
WindowClosedEvent(String name)27    public WindowClosedEvent(String name)
28    {
29       name_ = name;
30    }
31 
getName()32    public String getName()
33    {
34       return name_;
35    }
36 
37    @Override
getAssociatedType()38    public Type<Handler> getAssociatedType()
39    {
40       return TYPE;
41    }
42 
43    @Override
dispatch(Handler handler)44    protected void dispatch(Handler handler)
45    {
46       handler.onWindowClosed(this);
47    }
48 
49    public static final Type<Handler> TYPE = new Type<>();
50 
51    private final String name_;
52 }
53