1 /**********************************************
2 * Copyright (C) 2011 Lukas Laag
3 * This file is part of svgreal.
4 *
5 * svgreal is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * svgreal is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with svgreal. If not, see http://www.gnu.org/licenses/
17 **********************************************/
18 package org.vectomatic.svg.edit.client.event;
19
20 import org.vectomatic.svg.edit.client.SVGWindow;
21
22 import com.google.gwt.event.shared.GwtEvent;
23
24 /**
25 * Event to broadcast the activation of a window
26 * @author laaglu
27 */
28 public class ActivateWindowEvent extends GwtEvent<ActivateWindowHandler> {
29 /**
30 * Handler type.
31 */
32 private static Type<ActivateWindowHandler> TYPE;
33
34 private final SVGWindow window;
35
36 public ActivateWindowEvent(SVGWindow window) {
37 this.window = window;
38 }
39
40 @Override
41 public com.google.gwt.event.shared.GwtEvent.Type<ActivateWindowHandler> getAssociatedType() {
42 if (TYPE == null) {
43 TYPE = new Type<ActivateWindowHandler>();
44 }
45 return TYPE;
46 }
47
48 /**
49 * Ensures the existence of the handler hook and then returns it.
50 *
51 * @return returns a handler hook
52 */
53 public static Type<ActivateWindowHandler> getType() {
54 if (TYPE == null) {
55 TYPE = new Type<ActivateWindowHandler>();
56 }
57 return TYPE;
58 }
59
60 @Override
61 protected void dispatch(ActivateWindowHandler handler) {
62 handler.onActivate(this);
63 }
64
65 public SVGWindow getWindow() {
66 return window;
67 }
68
69 }