Class InlineHTML

All Implemented Interfaces:
IsEditor<LeafValueEditor<String>>, HasAllDragAndDropHandlers, HasAllGestureHandlers, HasAllMouseHandlers, HasAllTouchHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragEndHandlers, HasDragEnterHandlers, HasDragHandlers, HasDragLeaveHandlers, HasDragOverHandlers, HasDragStartHandlers, HasDropHandlers, HasGestureChangeHandlers, HasGestureEndHandlers, HasGestureStartHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasTouchCancelHandlers, HasTouchEndHandlers, HasTouchMoveHandlers, HasTouchStartHandlers, HasAttachHandlers, HasHandlers, HasDirection, HasDirectionEstimator, HasSafeHtml, EventListener, HasAutoHorizontalAlignment, HasDirectionalHtml, HasDirectionalSafeHtml, HasDirectionalText, HasHorizontalAlignment, HasHTML, HasText, HasVisibility, HasWordWrap, IsWidget, SourcesClickEvents, SourcesMouseEvents

public class InlineHTML extends HTML
A widget that can contain arbitrary HTML. This widget uses a <span> element, causing it to be displayed with inline layout.

If you only need a simple label (text, but not HTML), then the Label widget is more appropriate, as it disallows the use of HTML, which can lead to potential security issues if not used properly.

Built-in Bidi Text Support

This widget is capable of automatically adjusting its direction according to its content. This feature is controlled by LabelBase.setDirectionEstimator(boolean) or passing a DirectionEstimator parameter to the constructor, and is off by default.

CSS Style Rules

  • .gwt-InlineHTML { }
  • Constructor Details

    • InlineHTML

      public InlineHTML()
      Creates an empty HTML widget.
    • InlineHTML

      public InlineHTML(SafeHtml html)
      Initializes the widget's HTML from a given SafeHtml object.
      Parameters:
      html - the new widget's HTML contents
    • InlineHTML

      public InlineHTML(SafeHtml html, HasDirection.Direction dir)
      Creates an HTML widget with the specified contents and with the specified direction.
      Parameters:
      html - the new widget's SafeHtml contents
      dir - the content's direction. Note: Direction.DEFAULT means direction should be inherited from the widget's parent element.
    • InlineHTML

      public InlineHTML(SafeHtml html, DirectionEstimator directionEstimator)
      Creates an HTML widget with the specified HTML contents and with a default direction estimator.
      Parameters:
      html - the new widget's SafeHtml contents
      directionEstimator - A DirectionEstimator object used for automatic direction adjustment. For convenience, Label.DEFAULT_DIRECTION_ESTIMATOR can be used.
    • InlineHTML

      public InlineHTML(String html)
      Creates an HTML widget with the specified HTML contents.
      Parameters:
      html - the new widget's HTML contents
    • InlineHTML

      public InlineHTML(String html, HasDirection.Direction dir)
      Creates an HTML widget with the specified HTML contents and with the specified direction.
      Parameters:
      html - the new widget's HTML contents
      dir - the content's direction. Note: Direction.DEFAULT means direction should be inherited from the widget's parent element.
    • InlineHTML

      protected InlineHTML(Element element)
      This constructor may be used by subclasses to explicitly use an existing element. This element must be either a <div> <span> element.
      Parameters:
      element - the element to be used
  • Method Details

    • wrap

      public static InlineHTML wrap(Element element)
      Creates an InlineHTML widget that wraps an existing <div> or <span> element. This element must already be attached to the document. If the element is removed from the document, you must call Widget.removeFromParent().
      Parameters:
      element - the element to be wrapped