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.LoadEvent;
53  import com.google.gwt.event.dom.client.LoadHandler;
54  import com.google.gwt.event.dom.client.MouseDownEvent;
55  import com.google.gwt.event.dom.client.MouseDownHandler;
56  import com.google.gwt.event.dom.client.MouseMoveEvent;
57  import com.google.gwt.event.dom.client.MouseMoveHandler;
58  import com.google.gwt.event.dom.client.MouseOutEvent;
59  import com.google.gwt.event.dom.client.MouseOutHandler;
60  import com.google.gwt.event.dom.client.MouseOverEvent;
61  import com.google.gwt.event.dom.client.MouseOverHandler;
62  import com.google.gwt.event.dom.client.MouseUpEvent;
63  import com.google.gwt.event.dom.client.MouseUpHandler;
64  import com.google.gwt.event.dom.client.TouchCancelEvent;
65  import com.google.gwt.event.dom.client.TouchCancelHandler;
66  import com.google.gwt.event.dom.client.TouchEndEvent;
67  import com.google.gwt.event.dom.client.TouchEndHandler;
68  import com.google.gwt.event.dom.client.TouchMoveEvent;
69  import com.google.gwt.event.dom.client.TouchMoveHandler;
70  import com.google.gwt.event.dom.client.TouchStartEvent;
71  import com.google.gwt.event.dom.client.TouchStartHandler;
72  import com.google.gwt.event.shared.HandlerRegistration;
73  
74  /**
75   * The {@link org.vectomatic.dom.svg.OMSVGSymbolElement} interface corresponds
76   * to the <a href='http://www.w3.org/TR/SVG11/struct.html#SymbolElement' title='symbol
77   * element specification'>symbol</a> element.
78   */
79  @TagName("symbol")
80  public class OMSVGSymbolElement extends OMSVGElement implements HasGraphicalHandlers, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGFitToViewBox, ISVGContainerElement {
81    public OMSVGSymbolElement() {
82      this((SVGSymbolElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SYMBOL_TAG).cast());
83    }
84  
85    protected OMSVGSymbolElement(SVGSymbolElement ot) {
86      super(ot);
87    }
88  
89    // Implementation of the svg::SVGSymbolElement W3C IDL interface
90  
91    // Implementation of the svg::SVGExternalResourcesRequired W3C IDL interface
92    /**
93     * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
94     * on the given element. Note that the SVG DOM defines the attribute {@link
95     * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
96     * as being of type {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean}, whereas
97     * the SVG language definition says that {@link org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
98     * is not animated. Because the SVG language definition states that {@link
99     * org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired#getExternalResourcesRequired()}
100    * cannot be animated, the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getAnimVal()}
101    * will always be the same as the {@link org.vectomatic.dom.svg.OMSVGAnimatedBoolean#getBaseVal()}.
102    */
103   public final OMSVGAnimatedBoolean getExternalResourcesRequired() {
104     return ((SVGSymbolElement)ot).getExternalResourcesRequired();
105   }
106 
107   // Implementation of the svg::SVGFitToViewBox W3C IDL interface
108   /**
109    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getViewBox()}
110    * on the given element.
111    */
112   public final OMSVGAnimatedRect getViewBox() {
113     return ((SVGSymbolElement)ot).getViewBox();
114   }
115   /**
116    * Corresponds to attribute {@link org.vectomatic.dom.svg.itf.ISVGFitToViewBox#getPreserveAspectRatio()}
117    * on the given element.
118    */
119   public final OMSVGAnimatedPreserveAspectRatio getPreserveAspectRatio() {
120     return ((SVGSymbolElement)ot).getPreserveAspectRatio();
121   }
122 
123   // Implementation of the svg::SVGLangSpace W3C IDL interface
124   /**
125    * Corresponds to attribute <code>xml:lang</code> on the given element.
126    */
127   public final String getXmllang() {
128     return ((SVGSymbolElement)ot).getXmllang();
129   }
130   /**
131    * Corresponds to attribute <code>xml:lang</code> on the given element.
132    * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an   attempt
133    * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
134    * attribute</a>.
135    */
136   public final void setXmllang(java.lang.String value) throws JavaScriptException {
137     ((SVGSymbolElement)ot).setXmllang(value);
138   }
139   /**
140    * Corresponds to attribute <code>xml:space</code> on the given element.
141    */
142   public final String getXmlspace() {
143     return ((SVGSymbolElement)ot).getXmlspace();
144   }
145   /**
146    * Corresponds to attribute <code>xml:space</code> on the given element.
147    * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) Raised on an   attempt
148    * to change the value of a <a href="svgdom.html#ReadOnlyNodes">read only
149    * attribute</a>.
150    */
151   public final void setXmlspace(java.lang.String value) throws JavaScriptException {
152     ((SVGSymbolElement)ot).setXmlspace(value);
153   }
154 
155   @Override
156   public final HandlerRegistration addClickHandler(ClickHandler handler) {
157     return addDomHandler(handler, ClickEvent.getType());
158   }
159   @Override
160   public final HandlerRegistration addLoadHandler(LoadHandler handler) {
161     return addDomHandler(handler, LoadEvent.getType());
162   }
163   @Override
164   public final HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
165     return addDomHandler(handler, MouseDownEvent.getType());
166   }
167   @Override
168   public final HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
169     return addDomHandler(handler, MouseMoveEvent.getType());
170   }
171   @Override
172   public final HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
173     return addDomHandler(handler, MouseOutEvent.getType());
174   }
175   @Override
176   public final HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
177     return addDomHandler(handler, MouseOverEvent.getType());
178   }
179   @Override
180   public final HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
181     return addDomHandler(handler, MouseUpEvent.getType());
182   }
183   @Override
184   public final HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) {
185     return addDomHandler(handler, TouchCancelEvent.getType());
186   }
187   @Override
188   public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
189     return addDomHandler(handler, TouchEndEvent.getType());
190   }
191   @Override
192   public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
193     return addDomHandler(handler, TouchMoveEvent.getType());
194   }
195   @Override
196   public final HandlerRegistration addTouchStartHandler(TouchStartHandler handler) {
197     return addDomHandler(handler, TouchStartEvent.getType());
198   }
199   @Override
200   public final HandlerRegistration addActivateHandler(ActivateHandler handler) {
201     return addDomHandler(handler, ActivateEvent.getType());
202   }
203   @Override
204   public final HandlerRegistration addFocusInHandler(FocusInHandler handler) {
205     return addDomHandler(handler, FocusInEvent.getType());
206   }
207   @Override
208   public final HandlerRegistration addFocusOutHandler(FocusOutHandler handler) {
209     return addDomHandler(handler, FocusOutEvent.getType());
210   }
211 }