@ElementParserToUse(className="org.vectomatic.dev.svg.impl.gen.SVGButtonBaseParser") public class SVGToggleButton extends SVGButtonBase
An SVG push toggle typically defines at least the following two faces:
You can define an SVG toggle 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:SVGToggleButton resource="{resources.led}"> <svgui:upFace><svgui:styleChange classNames="{style.led-up}"/></svgui:upFace> <svgui:downFace><svgui:styleChange classNames="{style.led-down}"/></svgui:downFace> </svgui:SVGToggleButton>Note that by default the inline SVG in SVGToggleButtons 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 |
---|
SVGToggleButton() |
SVGToggleButton(OMSVGSVGElement svgElement,
Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces) |
SVGToggleButton(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
|
boolean |
isDown()
Returns whether this button is down
|
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 |
setDown(boolean isDown)
Sets whether this button is down.
|
addClassNameBaseVal, addClickHandler, addFace, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, getClassName, getCurrentFaceName, getStyle, getSvgElement, isEnabled, onClick, removeClassNameBaseVal, replaceClassNameBaseVal, setClassNameBaseVal, setEnabled, 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 SVGToggleButton()
public SVGToggleButton(OMSVGSVGElement svgElement, Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)
public SVGToggleButton(SVGResource resource, Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)
public boolean isDown()
public void setDown(boolean isDown)
isDown
- true to force the button down, false to force the button uppublic 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 nameCopyright © 2018. All Rights Reserved.