1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.vectomatic.dom.svg.ui;
19
20 import org.vectomatic.dom.svg.OMSVGAnimatedString;
21 import org.vectomatic.dom.svg.OMSVGSVGElement;
22 import org.vectomatic.dom.svg.OMSVGStyle;
23 import org.vectomatic.dom.svg.events.ActivateHandler;
24 import org.vectomatic.dom.svg.events.FocusInHandler;
25 import org.vectomatic.dom.svg.events.FocusOutHandler;
26 import org.vectomatic.dom.svg.events.HasDocumentHandlers;
27 import org.vectomatic.dom.svg.events.HasGraphicalHandlers;
28 import org.vectomatic.dom.svg.events.SVGZoomHandler;
29 import org.vectomatic.dom.svg.itf.ISVGStylable;
30
31 import com.google.gwt.event.dom.client.ClickEvent;
32 import com.google.gwt.event.dom.client.ClickHandler;
33 import com.google.gwt.event.dom.client.DragEndEvent;
34 import com.google.gwt.event.dom.client.DragEndHandler;
35 import com.google.gwt.event.dom.client.DragEnterEvent;
36 import com.google.gwt.event.dom.client.DragEnterHandler;
37 import com.google.gwt.event.dom.client.DragEvent;
38 import com.google.gwt.event.dom.client.DragHandler;
39 import com.google.gwt.event.dom.client.DragLeaveEvent;
40 import com.google.gwt.event.dom.client.DragLeaveHandler;
41 import com.google.gwt.event.dom.client.DragOverEvent;
42 import com.google.gwt.event.dom.client.DragOverHandler;
43 import com.google.gwt.event.dom.client.DragStartEvent;
44 import com.google.gwt.event.dom.client.DragStartHandler;
45 import com.google.gwt.event.dom.client.DropEvent;
46 import com.google.gwt.event.dom.client.DropHandler;
47 import com.google.gwt.event.dom.client.HasAllMouseHandlers;
48 import com.google.gwt.event.dom.client.LoadHandler;
49 import com.google.gwt.event.dom.client.MouseDownEvent;
50 import com.google.gwt.event.dom.client.MouseDownHandler;
51 import com.google.gwt.event.dom.client.MouseMoveEvent;
52 import com.google.gwt.event.dom.client.MouseMoveHandler;
53 import com.google.gwt.event.dom.client.MouseOutEvent;
54 import com.google.gwt.event.dom.client.MouseOutHandler;
55 import com.google.gwt.event.dom.client.MouseOverEvent;
56 import com.google.gwt.event.dom.client.MouseOverHandler;
57 import com.google.gwt.event.dom.client.MouseUpEvent;
58 import com.google.gwt.event.dom.client.MouseUpHandler;
59 import com.google.gwt.event.dom.client.MouseWheelEvent;
60 import com.google.gwt.event.dom.client.MouseWheelHandler;
61 import com.google.gwt.event.dom.client.ScrollHandler;
62 import com.google.gwt.event.dom.client.TouchCancelEvent;
63 import com.google.gwt.event.dom.client.TouchCancelHandler;
64 import com.google.gwt.event.dom.client.TouchEndEvent;
65 import com.google.gwt.event.dom.client.TouchEndHandler;
66 import com.google.gwt.event.dom.client.TouchMoveEvent;
67 import com.google.gwt.event.dom.client.TouchMoveHandler;
68 import com.google.gwt.event.dom.client.TouchStartEvent;
69 import com.google.gwt.event.dom.client.TouchStartHandler;
70 import com.google.gwt.event.logical.shared.ResizeHandler;
71 import com.google.gwt.event.shared.HandlerRegistration;
72 import com.google.gwt.uibinder.client.ElementParserToUse;
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 @ElementParserToUse(className = "org.vectomatic.dev.svg.impl.gen.SVGImageParser")
109 public class SVGImage extends SVGWidget implements HasGraphicalHandlers, HasAllMouseHandlers, HasDocumentHandlers, ISVGStylable {
110 protected OMSVGSVGElement svgElement;
111
112
113
114
115
116 public SVGImage() {
117 }
118 public SVGImage(SVGResource resource) {
119 setResource(resource);
120 }
121 public SVGImage(OMSVGSVGElement svgElement) {
122 setSvgElement(svgElement);
123 }
124
125 public OMSVGSVGElement getSvgElement() {
126 return svgElement;
127 }
128
129 public void setResource(SVGResource resource) {
130 setSvgElement(resource.getSvg());
131 }
132
133 public void setSvgElement(OMSVGSVGElement svgElement) {
134 this.svgElement = svgElement;
135 setElement(this.svgElement.getElement());
136 }
137
138 @Override
139 public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
140
141
142 return addDomHandler(handler, MouseDownEvent.getType());
143 }
144 @Override
145 public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
146 return addDomHandler(handler, MouseUpEvent.getType());
147 }
148 @Override
149 public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
150 return addDomHandler(handler, MouseOutEvent.getType());
151 }
152 @Override
153 public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
154 return addDomHandler(handler, MouseOverEvent.getType());
155 }
156 @Override
157 public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
158 return addDomHandler(handler, MouseMoveEvent.getType());
159 }
160 @Override
161 public final HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) {
162 return addDomHandler(handler, TouchCancelEvent.getType());
163 }
164 @Override
165 public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
166 return addDomHandler(handler, TouchEndEvent.getType());
167 }
168 @Override
169 public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
170 return addDomHandler(handler, TouchMoveEvent.getType());
171 }
172 @Override
173 public final HandlerRegistration addTouchStartHandler(TouchStartHandler handler) {
174 return addDomHandler(handler, TouchStartEvent.getType());
175 }
176 @Override
177 public final HandlerRegistration addDragEndHandler(DragEndHandler handler) {
178 return addDomHandler(handler, DragEndEvent.getType());
179 }
180 @Override
181 public final HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
182 return addDomHandler(handler, DragEnterEvent.getType());
183 }
184 @Override
185 public final HandlerRegistration addDragHandler(DragHandler handler) {
186 return addDomHandler(handler, DragEvent.getType());
187 }
188 @Override
189 public final HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler) {
190 return addDomHandler(handler, DragLeaveEvent.getType());
191 }
192 @Override
193 public final HandlerRegistration addDragOverHandler(DragOverHandler handler) {
194 return addDomHandler(handler, DragOverEvent.getType());
195 }
196 @Override
197 public final HandlerRegistration addDragStartHandler(DragStartHandler handler) {
198 return addDomHandler(handler, DragStartEvent.getType());
199 }
200 @Override
201 public final HandlerRegistration addDropHandler(DropHandler handler) {
202 return addDomHandler(handler, DropEvent.getType());
203 }
204 @Override
205 public HandlerRegistration addClickHandler(ClickHandler handler) {
206 return addDomHandler(handler, ClickEvent.getType());
207 }
208 @Override
209 public HandlerRegistration addLoadHandler(LoadHandler handler) {
210 return svgElement.addLoadHandler(handler);
211 }
212 @Override
213 public HandlerRegistration addResizeHandler(ResizeHandler handler) {
214 return svgElement.addResizeHandler(handler);
215 }
216 @Override
217 public HandlerRegistration addScrollHandler(ScrollHandler handler) {
218 return svgElement.addScrollHandler(handler);
219 }
220 @Override
221 public HandlerRegistration addSVGZoomHandler(SVGZoomHandler handler) {
222 return svgElement.addSVGZoomHandler(handler);
223 }
224 @Override
225 public HandlerRegistration addFocusInHandler(FocusInHandler handler) {
226 return svgElement.addFocusInHandler(handler);
227 }
228 @Override
229 public HandlerRegistration addFocusOutHandler(FocusOutHandler handler) {
230 return svgElement.addFocusOutHandler(handler);
231 }
232 @Override
233 public HandlerRegistration addActivateHandler(ActivateHandler handler) {
234 return svgElement.addActivateHandler(handler);
235 }
236 @Override
237 public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
238 return addDomHandler(handler, MouseWheelEvent.getType());
239 }
240
241
242 public OMSVGStyle getStyle() {
243 return svgElement.getStyle();
244 }
245
246 public final OMSVGAnimatedString getClassName() {
247 return svgElement.getClassName();
248 }
249
250 public final void addClassNameBaseVal(String className) {
251 svgElement.addClassNameBaseVal(className);
252 }
253
254 public final void removeClassNameBaseVal(String className) {
255 svgElement.removeClassNameBaseVal(className);
256 }
257
258 public final void replaceClassNameBaseVal(String oldClassName, String newClassName) {
259 svgElement.replaceClassNameBaseVal(oldClassName, newClassName);
260 }
261
262 public final void setClassNameBaseVal(String className) {
263 svgElement.setClassNameBaseVal(className);
264 }
265 }