org.vectomatic.dom.svg.ui
Class SVGToggleButton

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by org.vectomatic.dom.svg.ui.SVGWidget
              extended by org.vectomatic.dom.svg.ui.SVGButtonBase
                  extended by org.vectomatic.dom.svg.ui.SVGToggleButton
All Implemented Interfaces:
com.google.gwt.event.dom.client.ClickHandler, com.google.gwt.event.dom.client.HasAllMouseHandlers, com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers, com.google.gwt.event.dom.client.HasMouseMoveHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers, com.google.gwt.event.dom.client.HasMouseUpHandlers, com.google.gwt.event.dom.client.HasMouseWheelHandlers, com.google.gwt.event.dom.client.MouseDownHandler, com.google.gwt.event.dom.client.MouseOutHandler, com.google.gwt.event.dom.client.MouseOverHandler, com.google.gwt.event.dom.client.MouseUpHandler, com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.EventHandler, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsWidget, ISVGStylable

@ElementParserToUse(className="org.vectomatic.dev.svg.impl.gen.SVGButtonBaseParser")
public class SVGToggleButton
extends SVGButtonBase

SVG toggle button class

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.

Author:
laaglu

Nested Class Summary
 
Nested classes/interfaces inherited from class org.vectomatic.dom.svg.ui.SVGButtonBase
SVGButtonBase.SVGFace, SVGButtonBase.SVGFaceChange, SVGButtonBase.SVGFaceName, SVGButtonBase.SVGStyleChange
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class org.vectomatic.dom.svg.ui.SVGButtonBase
currentFaceName, faces, svgElement
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
SVGToggleButton()
           
SVGToggleButton(OMSVGSVGElement svgElement, Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)
           
SVGToggleButton(SVGResource resource, Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)
           
 
Method Summary
 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.
 
Methods inherited from class org.vectomatic.dom.svg.ui.SVGButtonBase
addClassNameBaseVal, addClickHandler, addFace, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, getClassName, getCurrentFaceName, getStyle, getSvgElement, isEnabled, onClick, removeClassNameBaseVal, replaceClassNameBaseVal, setClassNameBaseVal, setEnabled, setResource, setSvgElement, showFace
 
Methods inherited from class org.vectomatic.dom.svg.ui.SVGWidget
getUiBinderField
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
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, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

SVGToggleButton

public SVGToggleButton()

SVGToggleButton

public SVGToggleButton(OMSVGSVGElement svgElement,
                       Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)

SVGToggleButton

public SVGToggleButton(SVGResource resource,
                       Map<SVGButtonBase.SVGFaceName,SVGButtonBase.SVGFace> faces)
Method Detail

isDown

public boolean isDown()
Returns whether this button is down

Returns:
true if it is down, false if it is up

setDown

public void setDown(boolean isDown)
Sets whether this button is down.

Parameters:
isDown - true to force the button down, false to force the button up

onMouseDown

public void onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event)

onMouseUp

public void onMouseUp(com.google.gwt.event.dom.client.MouseUpEvent event)

onMouseOver

public void onMouseOver(com.google.gwt.event.dom.client.MouseOverEvent event)

onMouseOut

public void onMouseOut(com.google.gwt.event.dom.client.MouseOutEvent event)

getFace

public SVGButtonBase.SVGFace getFace(SVGButtonBase.SVGFaceName faceName)
Description copied from class: SVGButtonBase
Returns the face associated with a face name

Overrides:
getFace in class SVGButtonBase
Parameters:
faceName - The face name
Returns:
The face associated with this face name if there is one, null otherwise


Copyright © 2012. All Rights Reserved.