001/**********************************************
002 * Copyright (C) 2010-2011 Lukas Laag
003 * This file is part of lib-gwt-svg.
004 * 
005 * libgwtsvg is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Lesser General Public License as published by
007 * the Free Software Foundation, either version 3 of the License, or
008 * (at your option) any later version.
009 * 
010 * libgwtsvg is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public License
016 * along with libgwtsvg.  If not, see http://www.gnu.org/licenses/
017 **********************************************/
018/*
019 * Copyright (c) 2004 World Wide Web Consortium,
020 *
021 * (Massachusetts Institute of Technology, European Research Consortium for
022 * Informatics and Mathematics, Keio University). All Rights Reserved. This
023 * work is distributed under the W3C(r) Software License [1] in the hope that
024 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
025 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
026 *
027 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
028 */
029
030package org.vectomatic.dom.svg;
031
032import org.vectomatic.dom.svg.events.ActivateEvent;
033import org.vectomatic.dom.svg.events.ActivateHandler;
034import org.vectomatic.dom.svg.events.FocusInEvent;
035import org.vectomatic.dom.svg.events.FocusInHandler;
036import org.vectomatic.dom.svg.events.FocusOutEvent;
037import org.vectomatic.dom.svg.events.FocusOutHandler;
038import org.vectomatic.dom.svg.events.HasGraphicalHandlers;
039import org.vectomatic.dom.svg.impl.SVGSymbolElement;
040import org.vectomatic.dom.svg.itf.ISVGContainerElement;
041import org.vectomatic.dom.svg.itf.ISVGExternalResourcesRequired;
042import org.vectomatic.dom.svg.itf.ISVGFitToViewBox;
043import org.vectomatic.dom.svg.itf.ISVGLangSpace;
044import org.vectomatic.dom.svg.itf.ISVGStylable;
045import org.vectomatic.dom.svg.utils.DOMHelper;
046import org.vectomatic.dom.svg.utils.SVGConstants;
047
048import com.google.gwt.core.client.JavaScriptException;
049import com.google.gwt.dom.client.TagName;
050import com.google.gwt.event.dom.client.ClickEvent;
051import com.google.gwt.event.dom.client.ClickHandler;
052import com.google.gwt.event.dom.client.DragEndEvent;
053import com.google.gwt.event.dom.client.DragEndHandler;
054import com.google.gwt.event.dom.client.DragEnterEvent;
055import com.google.gwt.event.dom.client.DragEnterHandler;
056import com.google.gwt.event.dom.client.DragEvent;
057import com.google.gwt.event.dom.client.DragHandler;
058import com.google.gwt.event.dom.client.DragLeaveEvent;
059import com.google.gwt.event.dom.client.DragLeaveHandler;
060import com.google.gwt.event.dom.client.DragOverEvent;
061import com.google.gwt.event.dom.client.DragOverHandler;
062import com.google.gwt.event.dom.client.DragStartEvent;
063import com.google.gwt.event.dom.client.DragStartHandler;
064import com.google.gwt.event.dom.client.DropEvent;
065import com.google.gwt.event.dom.client.DropHandler;
066import com.google.gwt.event.dom.client.LoadEvent;
067import com.google.gwt.event.dom.client.LoadHandler;
068import com.google.gwt.event.dom.client.MouseDownEvent;
069import com.google.gwt.event.dom.client.MouseDownHandler;
070import com.google.gwt.event.dom.client.MouseMoveEvent;
071import com.google.gwt.event.dom.client.MouseMoveHandler;
072import com.google.gwt.event.dom.client.MouseOutEvent;
073import com.google.gwt.event.dom.client.MouseOutHandler;
074import com.google.gwt.event.dom.client.MouseOverEvent;
075import com.google.gwt.event.dom.client.MouseOverHandler;
076import com.google.gwt.event.dom.client.MouseUpEvent;
077import com.google.gwt.event.dom.client.MouseUpHandler;
078import com.google.gwt.event.dom.client.TouchCancelEvent;
079import com.google.gwt.event.dom.client.TouchCancelHandler;
080import com.google.gwt.event.dom.client.TouchEndEvent;
081import com.google.gwt.event.dom.client.TouchEndHandler;
082import com.google.gwt.event.dom.client.TouchMoveEvent;
083import com.google.gwt.event.dom.client.TouchMoveHandler;
084import com.google.gwt.event.dom.client.TouchStartEvent;
085import com.google.gwt.event.dom.client.TouchStartHandler;
086import com.google.gwt.event.shared.HandlerRegistration;
087
088/**
089 * The {@link org.vectomatic.dom.svg.OMSVGSymbolElement} interface corresponds
090 * to the <a href='http://www.w3.org/TR/SVG11/struct.html#SymbolElement' title='symbol
091 * element specification'>symbol</a> element.
092 */
093@TagName("symbol")
094public class OMSVGSymbolElement extends OMSVGElement implements HasGraphicalHandlers, ISVGLangSpace, ISVGExternalResourcesRequired, ISVGStylable, ISVGFitToViewBox, ISVGContainerElement {
095  public OMSVGSymbolElement() {
096    this((SVGSymbolElement)DOMHelper.createElementNS(DOMHelper.getCurrentDocument(), SVGConstants.SVG_NAMESPACE_URI, SVGConstants.SVG_SYMBOL_TAG).cast());
097  }
098
099  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}