@ElementParserToUse(className="org.vectomatic.dev.svg.impl.gen.SVGImageParser") public class SVGImage extends SVGWidget implements HasGraphicalHandlers, com.google.gwt.event.dom.client.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.Modifier and Type | Field and Description |
---|---|
protected OMSVGSVGElement |
svgElement |
Constructor and Description |
---|
SVGImage()
No-arg constructor.
|
SVGImage(OMSVGSVGElement svgElement) |
SVGImage(SVGResource resource) |
Modifier and Type | Method and Description |
---|---|
com.google.gwt.event.shared.HandlerRegistration |
addActivateHandler(ActivateHandler handler)
Adds a
ActivateHandler handler. |
void |
addClassNameBaseVal(String className)
Adds the specified class name to the baseVal CSS class name of this element
|
com.google.gwt.event.shared.HandlerRegistration |
addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addDragEndHandler(com.google.gwt.event.dom.client.DragEndHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addDragEnterHandler(com.google.gwt.event.dom.client.DragEnterHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addDragHandler(com.google.gwt.event.dom.client.DragHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addDragLeaveHandler(com.google.gwt.event.dom.client.DragLeaveHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addDragOverHandler(com.google.gwt.event.dom.client.DragOverHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addDragStartHandler(com.google.gwt.event.dom.client.DragStartHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addDropHandler(com.google.gwt.event.dom.client.DropHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addFocusInHandler(FocusInHandler handler)
Adds a
FocusInHandler handler. |
com.google.gwt.event.shared.HandlerRegistration |
addFocusOutHandler(FocusOutHandler handler)
Adds a
FocusOutHandler handler. |
com.google.gwt.event.shared.HandlerRegistration |
addLoadHandler(com.google.gwt.event.dom.client.LoadHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addSVGZoomHandler(SVGZoomHandler handler)
Adds a
SVGZoomHandler handler. |
com.google.gwt.event.shared.HandlerRegistration |
addTouchCancelHandler(com.google.gwt.event.dom.client.TouchCancelHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addTouchEndHandler(com.google.gwt.event.dom.client.TouchEndHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addTouchMoveHandler(com.google.gwt.event.dom.client.TouchMoveHandler handler) |
com.google.gwt.event.shared.HandlerRegistration |
addTouchStartHandler(com.google.gwt.event.dom.client.TouchStartHandler handler) |
OMSVGAnimatedString |
getClassName()
Returns the CSS class name of this element.
|
OMSVGStyle |
getStyle()
Returns the CSS style of this element
|
OMSVGSVGElement |
getSvgElement() |
void |
removeClassNameBaseVal(String className)
Removes the specified class name from the baseVal CSS class name of this element
|
void |
replaceClassNameBaseVal(String oldClassName,
String newClassName)
Replaces the specified class name in the baseVal CSS class name of this element
with a new class name
|
void |
setClassNameBaseVal(String className)
Sets the baseVal CSS class name of this element to the specified value
|
void |
setResource(SVGResource resource) |
void |
setSvgElement(OMSVGSVGElement svgElement) |
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
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 com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler)
addMouseDownHandler
in interface com.google.gwt.event.dom.client.HasMouseDownHandlers
public com.google.gwt.event.shared.HandlerRegistration addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler handler)
addMouseUpHandler
in interface com.google.gwt.event.dom.client.HasMouseUpHandlers
public com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler handler)
addMouseOutHandler
in interface com.google.gwt.event.dom.client.HasMouseOutHandlers
public com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler handler)
addMouseOverHandler
in interface com.google.gwt.event.dom.client.HasMouseOverHandlers
public com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler handler)
addMouseMoveHandler
in interface com.google.gwt.event.dom.client.HasMouseMoveHandlers
public final com.google.gwt.event.shared.HandlerRegistration addTouchCancelHandler(com.google.gwt.event.dom.client.TouchCancelHandler handler)
addTouchCancelHandler
in interface com.google.gwt.event.dom.client.HasTouchCancelHandlers
public final com.google.gwt.event.shared.HandlerRegistration addTouchEndHandler(com.google.gwt.event.dom.client.TouchEndHandler handler)
addTouchEndHandler
in interface com.google.gwt.event.dom.client.HasTouchEndHandlers
public final com.google.gwt.event.shared.HandlerRegistration addTouchMoveHandler(com.google.gwt.event.dom.client.TouchMoveHandler handler)
addTouchMoveHandler
in interface com.google.gwt.event.dom.client.HasTouchMoveHandlers
public final com.google.gwt.event.shared.HandlerRegistration addTouchStartHandler(com.google.gwt.event.dom.client.TouchStartHandler handler)
addTouchStartHandler
in interface com.google.gwt.event.dom.client.HasTouchStartHandlers
public final com.google.gwt.event.shared.HandlerRegistration addDragEndHandler(com.google.gwt.event.dom.client.DragEndHandler handler)
addDragEndHandler
in interface com.google.gwt.event.dom.client.HasDragEndHandlers
public final com.google.gwt.event.shared.HandlerRegistration addDragEnterHandler(com.google.gwt.event.dom.client.DragEnterHandler handler)
addDragEnterHandler
in interface com.google.gwt.event.dom.client.HasDragEnterHandlers
public final com.google.gwt.event.shared.HandlerRegistration addDragHandler(com.google.gwt.event.dom.client.DragHandler handler)
addDragHandler
in interface com.google.gwt.event.dom.client.HasDragHandlers
public final com.google.gwt.event.shared.HandlerRegistration addDragLeaveHandler(com.google.gwt.event.dom.client.DragLeaveHandler handler)
addDragLeaveHandler
in interface com.google.gwt.event.dom.client.HasDragLeaveHandlers
public final com.google.gwt.event.shared.HandlerRegistration addDragOverHandler(com.google.gwt.event.dom.client.DragOverHandler handler)
addDragOverHandler
in interface com.google.gwt.event.dom.client.HasDragOverHandlers
public final com.google.gwt.event.shared.HandlerRegistration addDragStartHandler(com.google.gwt.event.dom.client.DragStartHandler handler)
addDragStartHandler
in interface com.google.gwt.event.dom.client.HasDragStartHandlers
public final com.google.gwt.event.shared.HandlerRegistration addDropHandler(com.google.gwt.event.dom.client.DropHandler handler)
addDropHandler
in interface com.google.gwt.event.dom.client.HasDropHandlers
public com.google.gwt.event.shared.HandlerRegistration addClickHandler(com.google.gwt.event.dom.client.ClickHandler handler)
addClickHandler
in interface com.google.gwt.event.dom.client.HasClickHandlers
public com.google.gwt.event.shared.HandlerRegistration addLoadHandler(com.google.gwt.event.dom.client.LoadHandler handler)
addLoadHandler
in interface com.google.gwt.event.dom.client.HasLoadHandlers
public com.google.gwt.event.shared.HandlerRegistration addResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler handler)
addResizeHandler
in interface com.google.gwt.event.logical.shared.HasResizeHandlers
public com.google.gwt.event.shared.HandlerRegistration addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler handler)
addScrollHandler
in interface com.google.gwt.event.dom.client.HasScrollHandlers
public com.google.gwt.event.shared.HandlerRegistration addSVGZoomHandler(SVGZoomHandler handler)
HasSVGZoomHandlers
SVGZoomHandler
handler.addSVGZoomHandler
in interface HasSVGZoomHandlers
handler
- the zoom handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addFocusInHandler(FocusInHandler handler)
HasFocusInHandlers
FocusInHandler
handler.addFocusInHandler
in interface HasFocusInHandlers
handler
- the focusin handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addFocusOutHandler(FocusOutHandler handler)
HasFocusOutHandlers
FocusOutHandler
handler.addFocusOutHandler
in interface HasFocusOutHandlers
handler
- the focusout handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addActivateHandler(ActivateHandler handler)
HasActivateHandlers
ActivateHandler
handler.addActivateHandler
in interface HasActivateHandlers
handler
- the activate handlerHandlerRegistration
used to remove this handlerpublic com.google.gwt.event.shared.HandlerRegistration addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler handler)
addMouseWheelHandler
in interface com.google.gwt.event.dom.client.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 nameCopyright © 2018. All Rights Reserved.