@ElementParserToUse(className="org.vectomatic.dev.svg.impl.gen.SVGButtonBaseParser") public class SVGPushButton extends SVGButtonBase
An SVG push button typically defines at least the following two faces:
You can define an SVG push button using UiBinder templates. Use the svgui:upFace, svgui:upDisabledFace, svgui:upHoveringFace svgui:downFace, svgui:downDisabledFace, svgui:downHoveringFace tags to defined faces.
Depending on your needs, you can either define the SVG inline with
the svgui:element tag. 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.
Each face contains one or more svgui:styleChange tags. The classNames attribute specifies the name of the CSS class selectors to be applied to the SVG element when the face is activated.
The following section shows a sample UiBinder template:
<svgui:SVGPushButton ui:field="clickMeButton"> <svgui:element> <svg viewBox="0 0 200 60" width="200" height="60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <rect class="btn-shape" x="3" y="3" width="194" height="54" rx="10" ry="10" /> <text class="btn-text" x="16" y="43">Click me !</text> </svg> </svgui:element> <svgui:upFace><svgui:styleChange classNames="{style.btn1} {style.btn1-up}"/></svgui:upFace> <svgui:downHoveringFace><svgui:styleChange classNames="{style.btn1} {style.btn1-down-hovering}"/></svgui:downHoveringFace> </svgui:SVGPushButton>Note that by default the inline SVG in SVGPushButtons is validated against the SVG 1.1 XSD schema. You can opt out of validation by setting the
validated="false"
attribute on the svgui:element tag.SVGButtonBase.SVGFace, SVGButtonBase.SVGFaceChange, SVGButtonBase.SVGFaceName, SVGButtonBase.SVGStyleChange
currentFaceName, faces, svgElement
Constructor and Description |
---|
SVGPushButton() |
SVGPushButton(OMSVGSVGElement svgElement,
Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces) |
SVGPushButton(SVGResource resource,
Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces) |
Modifier and Type | Method and Description |
---|---|
SVGButtonBase.SVGFace |
getFace(SVGButtonBase.SVGFaceName faceName)
Returns the face associated with a face name
|
int |
getRepeatDelay() |
void |
onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event) |
void |
onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent event) |
void |
onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent event) |
void |
onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event) |
void |
setEnabled(boolean enabled)
Sets whether this button is enabled
|
void |
setRepeatDelay(int repeatDelayMillis) |
addClassNameBaseVal, addClickHandler, addFace, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, getClassName, getCurrentFaceName, getStyle, getSvgElement, isEnabled, onClick, removeClassNameBaseVal, replaceClassNameBaseVal, setClassNameBaseVal, setResource, setSvgElement, showFace
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
public SVGPushButton()
public SVGPushButton(OMSVGSVGElement svgElement, Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)
public SVGPushButton(SVGResource resource, Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)
public void setEnabled(boolean enabled)
SVGButtonBase
setEnabled
in class SVGButtonBase
enabled
- true to enable the button, false to disable itpublic void onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event)
public void onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)
public void onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent event)
public void onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent event)
public SVGButtonBase.SVGFace getFace(SVGButtonBase.SVGFaceName faceName)
SVGButtonBase
getFace
in class SVGButtonBase
faceName
- The face namepublic void setRepeatDelay(int repeatDelayMillis)
public int getRepeatDelay()
Copyright © 2018. All Rights Reserved.