View Javadoc

1   /**********************************************
2    * Copyright (C) 2010-2011 Lukas Laag
3    * This file is part of lib-gwt-svg.
4    * 
5    * libgwtsvg is free software: you can redistribute it and/or modify
6    * it under the terms of the GNU Lesser 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   * libgwtsvg 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 Lesser General Public License for more details.
14   * 
15   * You should have received a copy of the GNU Lesser General Public License
16   * along with libgwtsvg.  If not, see http://www.gnu.org/licenses/
17   **********************************************/
18  /*
19   * Copyright (c) 2004 World Wide Web Consortium,
20   *
21   * (Massachusetts Institute of Technology, European Research Consortium for
22   * Informatics and Mathematics, Keio University). All Rights Reserved. This
23   * work is distributed under the W3C(r) Software License [1] in the hope that
24   * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
25   * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
26   *
27   * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
28   */
29  
30  package org.vectomatic.dom.svg;
31  
32  import org.vectomatic.dom.svg.events.ActivateEvent;
33  import org.vectomatic.dom.svg.events.ActivateHandler;
34  import org.vectomatic.dom.svg.events.FocusInEvent;
35  import org.vectomatic.dom.svg.events.FocusInHandler;
36  import org.vectomatic.dom.svg.events.FocusOutEvent;
37  import org.vectomatic.dom.svg.events.FocusOutHandler;
38  import org.vectomatic.dom.svg.events.HasGraphicalHandlers;
39  import org.vectomatic.dom.svg.impl.SVGSymbolElement;
40  import org.vectomatic.dom.svg.itf.ISVGContainerElement;
41  import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
42  import org.vectomatic.dom.svg.itf.ISVGFitToViewBox;
43  import org.vectomatic.dom.svg.itf.ISVGLangSpace;
44  import org.vectomatic.dom.svg.itf.ISVGStylable;
45  import org.vectomatic.dom.svg.utils.DOMHelper;
46  import org.vectomatic.dom.svg.utils.SVGConstants;
47  
48  import com.google.gwt.core.client.JavaScriptException;
49  import com.google.gwt.dom.client.TagName;
50  import com.google.gwt.event.dom.client.ClickEvent;
51  import com.google.gwt.event.dom.client.ClickHandler;
52  import com.google.gwt.event.dom.client.DragEndEvent;
53  import com.google.gwt.event.dom.client.DragEndHandler;
54  import com.google.gwt.event.dom.client.DragEnterEvent;
55  import com.google.gwt.event.dom.client.DragEnterHandler;
56  import com.google.gwt.event.dom.client.DragEvent;
57  import com.google.gwt.event.dom.client.DragHandler;
58  import com.google.gwt.event.dom.client.DragLeaveEvent;
59  import com.google.gwt.event.dom.client.DragLeaveHandler;
60  import com.google.gwt.event.dom.client.DragOverEvent;
61  import com.google.gwt.event.dom.client.DragOverHandler;
62  import com.google.gwt.event.dom.client.DragStartEvent;
63  import com.google.gwt.event.dom.client.DragStartHandler;
64  import com.google.gwt.event.dom.client.DropEvent;
65  import com.google.gwt.event.dom.client.DropHandler;
66  import com.google.gwt.event.dom.client.LoadEvent;
67  import com.google.gwt.event.dom.client.LoadHandler;
68  import com.google.gwt.event.dom.client.MouseDownEvent;
69  import com.google.gwt.event.dom.client.MouseDownHandler;
70  import com.google.gwt.event.dom.client.MouseMoveEvent;
71  import com.google.gwt.event.dom.client.MouseMoveHandler;
72  import com.google.gwt.event.dom.client.MouseOutEvent;
73  import com.google.gwt.event.dom.client.MouseOutHandler;
74  import com.google.gwt.event.dom.client.MouseOverEvent;
75  import com.google.gwt.event.dom.client.MouseOverHandler;
76  import com.google.gwt.event.dom.client.MouseUpEvent;
77  import com.google.gwt.event.dom.client.MouseUpHandler;
78  import com.google.gwt.event.dom.client.TouchCancelEvent;
79  import com.google.gwt.event.dom.client.TouchCancelHandler;
80  import com.google.gwt.event.dom.client.TouchEndEvent;
81  import com.google.gwt.event.dom.client.TouchEndHandler;
82  import com.google.gwt.event.dom.client.TouchMoveEvent;
83  import com.google.gwt.event.dom.client.TouchMoveHandler;
84  import com.google.gwt.event.dom.client.TouchStartEvent;
85  import com.google.gwt.event.dom.client.TouchStartHandler;
86  import com.google.gwt.event.shared.HandlerRegistration;
87  
88  /**
89   * The {@link org.vectomatic.dom.svg.OMSVGSymbolElement} interface corresponds
90   * to the <a href='http://www.w3.org/TR/SVG11/struct.html#SymbolElement' title='symbol
91   * element specification'>symbol</a> element.
92   */
93  @TagName("symbol")
94  public class OMSVGSymbolElement extends OMSVGElement implements HasGraphicalHandlers, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGFitToViewBox, ISVGContainerElement {
95    public OMSVGSymbolElement() {
96      this((SVGSymbolElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SYMBOL_TAG).cast());
97    }
98  
99    protected OMSVGSymbolElement(SVGSymbolElement ot) {
100     super(ot);
101   }
102 
103   // Implementation of the svg::SVGSymbolElement W3C IDL interface
104 
105   // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
106   /**
107    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
108    * on the given element. Note that the SVG DOM defines the attribute {@link
109    * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
110    * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
111    * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
112    * is not animated. Because the SVG language definition states that {@link
113    * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
114    * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
115    * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
116    */
117   public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
118     return ((SVGSymbolElement)ot).getExternalResourcesRequired();
119   }
120 
121   // Implementation of the svg::SVGFitToViewBox W3C IDL interface
122   /**
123    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}
124    * on the given element.
125    */
126   public final OMSVGAnimatedRect getViewBox() {
127     return ((SVGSymbolElement)ot).getViewBox();
128   }
129   /**
130    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
131    * on the given element.
132    */
133   public final OMSVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
134     return ((SVGSymbolElement)ot).getPreserveAspectRatio();
135   }
136 
137   // Implementation of the svg::SVGLangSpace W3C IDL interface
138   /**
139    * Corresponds to attribute <code>xml:lang</code> on the given element.
140    */
141   public final String getXmllang() {
142     return ((SVGSymbolElement)ot).getXmllang();
143   }
144   /**
145    * Corresponds to attribute <code>xml:lang</code> on the given element.
146    * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an   attempt
147    * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
148    * attribute</a>.
149    */
150   public final void setXmllang(java.lang.String value) throws JavaScriptException {
151     ((SVGSymbolElement)ot).setXmllang(value);
152   }
153   /**
154    * Corresponds to attribute <code>xml:space</code> on the given element.
155    */
156   public final String getXmlspace() {
157     return ((SVGSymbolElement)ot).getXmlspace();
158   }
159   /**
160    * Corresponds to attribute <code>xml:space</code> on the given element.
161    * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an   attempt
162    * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
163    * attribute</a>.
164    */
165   public final void setXmlspace(java.lang.String value) throws JavaScriptException {
166     ((SVGSymbolElement)ot).setXmlspace(value);
167   }
168 
169   @Override
170   public final HandlerRegistration addClickHandler(ClickHandler handler) {
171     return addDomHandler(handler, ClickEvent.getType());
172   }
173   @Override
174   public final HandlerRegistration addDragEndHandler(DragEndHandler handler) {
175     return addDomHandler(handler, DragEndEvent.getType());
176   }
177   @Override
178   public final HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
179     return addDomHandler(handler, DragEnterEvent.getType());
180   }
181   @Override
182   public final HandlerRegistration addDragHandler(DragHandler handler) {
183     return addDomHandler(handler, DragEvent.getType());
184   }
185   @Override
186   public final HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler) {
187     return addDomHandler(handler, DragLeaveEvent.getType());
188   }
189   @Override
190   public final HandlerRegistration addDragOverHandler(DragOverHandler handler) {
191     return addDomHandler(handler, DragOverEvent.getType());
192   }
193   @Override
194   public final HandlerRegistration addDragStartHandler(DragStartHandler handler) {
195     return addDomHandler(handler, DragStartEvent.getType());
196   }
197   @Override
198   public final HandlerRegistration addDropHandler(DropHandler handler) {
199     return addDomHandler(handler, DropEvent.getType());
200   }
201   @Override
202   public final HandlerRegistration addLoadHandler(LoadHandler handler) {
203     return addDomHandler(handler, LoadEvent.getType());
204   }
205   @Override
206   public final HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
207     return addDomHandler(handler, MouseDownEvent.getType());
208   }
209   @Override
210   public final HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
211     return addDomHandler(handler, MouseMoveEvent.getType());
212   }
213   @Override
214   public final HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
215     return addDomHandler(handler, MouseOutEvent.getType());
216   }
217   @Override
218   public final HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
219     return addDomHandler(handler, MouseOverEvent.getType());
220   }
221   @Override
222   public final HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
223     return addDomHandler(handler, MouseUpEvent.getType());
224   }
225   @Override
226   public final HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) {
227     return addDomHandler(handler, TouchCancelEvent.getType());
228   }
229   @Override
230   public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
231     return addDomHandler(handler, TouchEndEvent.getType());
232   }
233   @Override
234   public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
235     return addDomHandler(handler, TouchMoveEvent.getType());
236   }
237   @Override
238   public final HandlerRegistration addTouchStartHandler(TouchStartHandler handler) {
239     return addDomHandler(handler, TouchStartEvent.getType());
240   }
241   @Override
242   public final HandlerRegistration addActivateHandler(ActivateHandler handler) {
243     return addDomHandler(handler, ActivateEvent.getType());
244   }
245   @Override
246   public final HandlerRegistration addFocusInHandler(FocusInHandler handler) {
247     return addDomHandler(handler, FocusInEvent.getType());
248   }
249   @Override
250   public final HandlerRegistration addFocusOutHandler(FocusOutHandler handler) {
251     return addDomHandler(handler, FocusOutEvent.getType());
252   }
253 }