@ElementParserToUse(className="org.vectomatic.dev.svg.impl.gen.SVGImageParser") public class SVGImage extends SVGWidget implements HasGraphicalHandlers, HasAllMouseHandlers, HasDocumentHandlers, ISVGStylable
OMSVGSVGElement
.
The class bridges event subscription methods and forwards
them to the underlying OMSVGSVGElement
.
The class integrates with GWT Widget hierarchy.
You can define an SVGImage using UiBinder templates.
Depending on your needs, you can either define the SVG inline.
This can be convenient if you want to
localize the button label, or use styles defined in the template.
Or you can use an SVGResource
with the resource attribute,
if your SVG is large or if you want to keep your template more readable.
The following section shows a sample UiBinder template. Notice
that you can bind tags inside the template to java variables. One
of the <g> tag is bound to a java variable
eyes of type OMSVGGElement
and one of the <path> tag is bound to a java variable
mouth of type OMSVGPathElement
.
<svgui:SVGImage> <svg width="100" height="100" viewBox="80 190 140 130" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <path d="m 208,146.86218 a 63,63.5 0 1 1 -126,0 63,63.5 0 1 1 126,0 z" style="fill:#ffff00;stroke:#000000;" transform="translate(3.9895924,108.83705)" /> <g ui:field="eyes" transform="translate(10.960155,103.59114)"> <path d="m 124,133.36218 c 0,4.97057 -4.02944,9 -9,9 -4.97056,0 -9,-4.02943 -9,-9 0,-4.97056 4.02944,-9 9,-9 4.97056,0 9,4.02944 9,9 z" class="{style.eye}" /> <path d="m 124,133.36218 c 0,4.97057 -4.02944,9 -9,9 -4.97056,0 -9,-4.02943 -9,-9 0,-4.97056 4.02944,-9 9,-9 4.97056,0 9,4.02944 9,9 z" class="{style.eye}" transform="translate(44,0)" /> </g> <path ui:field="mouth" d="m 118.88908,286.15612 5,10 10,5 30,0 10,-5 5,-10 -5,5 -10,5 -30,0 -10,-5 -5,-5 z" class="{style.mouth}" /> </svg> </svgui:SVGImage>Note that by default SVGImages are validated against the SVG 1.1 XSD schema. You can opt out of validation by setting the
validated="false"
attribute on the SVGImages.UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Modifier and Type | Field and Description |
---|---|
protected OMSVGSVGElement |
svgElement |
DEBUG_ID_PREFIX
Constructor and Description |
---|
SVGImage()
No-arg constructor.
|
SVGImage(OMSVGSVGElement svgElement) |
SVGImage(SVGResource resource) |
getUiBinderField
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
protected OMSVGSVGElement svgElement
public SVGImage()
setResource(SVGResource)
or setSvgElement(OMSVGSVGElement)
before using the widget.public SVGImage(SVGResource resource)
public SVGImage(OMSVGSVGElement svgElement)
public OMSVGSVGElement getSvgElement()
public void setResource(SVGResource resource)
public void setSvgElement(OMSVGSVGElement svgElement)
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
addMouseDownHandler
in interface HasMouseDownHandlers
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
addMouseUpHandler
in interface HasMouseUpHandlers
public HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
addMouseOutHandler
in interface HasMouseOutHandlers
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
addMouseOverHandler
in interface HasMouseOverHandlers
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
addMouseMoveHandler
in interface HasMouseMoveHandlers
public final HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler)
addTouchCancelHandler
in interface HasTouchCancelHandlers
public final HandlerRegistration addTouchEndHandler(TouchEndHandler handler)
addTouchEndHandler
in interface HasTouchEndHandlers
public final HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler)
addTouchMoveHandler
in interface HasTouchMoveHandlers
public final HandlerRegistration addTouchStartHandler(TouchStartHandler handler)
addTouchStartHandler
in interface HasTouchStartHandlers
public final HandlerRegistration addDragEndHandler(DragEndHandler handler)
addDragEndHandler
in interface HasDragEndHandlers
public final HandlerRegistration addDragEnterHandler(DragEnterHandler handler)
addDragEnterHandler
in interface HasDragEnterHandlers
public final HandlerRegistration addDragHandler(DragHandler handler)
addDragHandler
in interface HasDragHandlers
public final HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)
addDragLeaveHandler
in interface HasDragLeaveHandlers
public final HandlerRegistration addDragOverHandler(DragOverHandler handler)
addDragOverHandler
in interface HasDragOverHandlers
public final HandlerRegistration addDragStartHandler(DragStartHandler handler)
addDragStartHandler
in interface HasDragStartHandlers
public final HandlerRegistration addDropHandler(DropHandler handler)
addDropHandler
in interface HasDropHandlers
public HandlerRegistration addClickHandler(ClickHandler handler)
addClickHandler
in interface HasClickHandlers
public HandlerRegistration addLoadHandler(LoadHandler handler)
addLoadHandler
in interface HasLoadHandlers
public HandlerRegistration addResizeHandler(ResizeHandler handler)
addResizeHandler
in interface HasResizeHandlers
public HandlerRegistration addScrollHandler(ScrollHandler handler)
addScrollHandler
in interface HasScrollHandlers
public HandlerRegistration addSVGZoomHandler(SVGZoomHandler handler)
HasSVGZoomHandlers
SVGZoomHandler
handler.addSVGZoomHandler
in interface HasSVGZoomHandlers
handler
- the zoom handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addFocusInHandler(FocusInHandler handler)
HasFocusInHandlers
FocusInHandler
handler.addFocusInHandler
in interface HasFocusInHandlers
handler
- the focusin handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addFocusOutHandler(FocusOutHandler handler)
HasFocusOutHandlers
FocusOutHandler
handler.addFocusOutHandler
in interface HasFocusOutHandlers
handler
- the focusout handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addActivateHandler(ActivateHandler handler)
HasActivateHandlers
ActivateHandler
handler.addActivateHandler
in interface HasActivateHandlers
handler
- the activate handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
addMouseWheelHandler
in interface HasMouseWheelHandlers
public OMSVGStyle getStyle()
ISVGStylable
getStyle
in interface ISVGStylable
public final OMSVGAnimatedString getClassName()
ISVGStylable
getClassName
in interface ISVGStylable
public final void addClassNameBaseVal(String className)
ISVGStylable
addClassNameBaseVal
in interface ISVGStylable
className
- the class name to addpublic final void removeClassNameBaseVal(String className)
ISVGStylable
removeClassNameBaseVal
in interface ISVGStylable
className
- the class name to removepublic final void replaceClassNameBaseVal(String oldClassName, String newClassName)
ISVGStylable
replaceClassNameBaseVal
in interface ISVGStylable
oldClassName
- the class name to replacenewClassName
- the replacement class namepublic final void setClassNameBaseVal(String className)
ISVGStylable
setClassNameBaseVal
in interface ISVGStylable
className
- the class name