Class ButtonBase

All Implemented Interfaces:
HasAllDragAndDropHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasAllTouchHandlers, HasBlurHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragEndHandlers, HasDragEnterHandlers, HasDragHandlers, HasDragLeaveHandlers, HasDragOverHandlers, HasDragStartHandlers, HasDropHandlers, HasFocusHandlers, HasGestureChangeHandlers, HasGestureEndHandlers, HasGestureStartHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasTouchCancelHandlers, HasTouchEndHandlers, HasTouchMoveHandlers, HasTouchStartHandlers, HasAttachHandlers, HasHandlers, HasSafeHtml, EventListener, Focusable, HasEnabled, HasFocus, HasHTML, HasText, HasVisibility, IsWidget, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents, SourcesMouseEvents
Direct Known Subclasses:
Button, CheckBox, CustomButton

public abstract class ButtonBase extends FocusWidget implements HasHTML, HasSafeHtml
Abstract base class for Button, CheckBox, RadioButton.
  • Constructor Details

    • ButtonBase

      protected ButtonBase(Element elem)
      Creates a new ButtonBase that wraps the given browser element.
      Parameters:
      elem - the DOM element to be wrapped
  • Method Details

    • getHTML

      public String getHTML()
      Description copied from interface: HasHTML
      Gets this object's contents as HTML.
      Specified by:
      getHTML in interface HasHTML
      Returns:
      the object's HTML
    • getText

      public String getText()
      Description copied from interface: HasText
      Gets this object's text.
      Specified by:
      getText in interface HasText
      Returns:
      the object's text
    • setHTML

      public void setHTML(String html)
      Description copied from interface: HasHTML
      Sets this object's contents via HTML. Use care when setting an object's HTML; it is an easy way to expose script-based security problems. Consider using HasText.setText(String) whenever possible.
      Specified by:
      setHTML in interface HasHTML
      Parameters:
      html - the object's new HTML
    • setHTML

      public void setHTML(SafeHtml html)
      Description copied from interface: HasSafeHtml
      Sets this object's contents via known-safe HTML.

      The object will behave exactly the same as when a widget's HasHTML.setHTML(String) method is invoked; however the SafeHtml passed to this method observes the contract that it can be used in an HTML context without causing unsafe script execution. Thus, unlike HasHTML.setHTML(String), using this method cannot result in Cross-Site Scripting security vulnerabilities.

      Specified by:
      setHTML in interface HasSafeHtml
      Parameters:
      html - the object's new HTML, represented as a SafeHtml object
    • setText

      public void setText(String text)
      Description copied from interface: HasText
      Sets this object's text.
      Specified by:
      setText in interface HasText
      Parameters:
      text - the object's new text