Class FImage

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.html.Image
com.vaadin.featurepack.ui.FImage
All Implemented Interfaces:
ClientConnector, FAbstractClientConnector, FSizeable, FAbstractComponent, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Image>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable

public class FImage extends com.vaadin.flow.component.html.Image implements FAbstractComponent
A Flow component that wraps an Image and provides legacy API for the functionality.

Resource handling has changed a lot in Flow, so only ExternalResource is currently supported.

See Also:
  • Constructor Details

    • FImage

      public FImage()
      Constructs an empty FImage.
    • FImage

      public FImage(String caption)
      Constructs an empty FImage with the provided caption.

      Note: FImage doesn't attach the caption component out of the box.

      Parameters:
      caption - the caption to set
    • FImage

      public FImage(String caption, Resource source)
      Constructs a FImage whose content is loaded from the given resource. Only ExternalResource is currently supported.

      Note: FImage doesn't attach the caption component out of the box.

      Parameters:
      caption -
      source - the Source of the embedded image.
  • Method Details

    • setSource

      public void setSource(Resource source)
      Sets the image source resource.
      Parameters:
      source - the source to set.
    • getSource

      public Resource getSource()
      Get the latest image source resource that has been given via either setSource(Resource) or FImage(String, Resource). If neither method has been called, returns null. Other ways of setting the image source don't affect this method.
      Returns:
      the latest resource or null
    • setAlternateText

      public void setAlternateText(String altText)
      Sets this component's alternate text that can be presented instead of the component's normal content for accessibility purposes.
      Parameters:
      altText - A short, human-readable description of this component's content.
    • getAlternateText

      public String getAlternateText()
      Gets this component's alternate text that can be presented instead of the component's normal content for accessibility purposes.
      Returns:
      Alternate text
    • setLabelComponent

      public void setLabelComponent(com.vaadin.flow.component.Component labelComponent)
      Override this method to attach the labelComponent into your view.
      Specified by:
      setLabelComponent in interface FAbstractComponent
      Parameters:
      labelComponent - caption component that has been generated for this image
    • setWidthFull

      public void setWidthFull()
      Description copied from interface: FSizeable
      Sets the width to 100%.
      Specified by:
      setWidthFull in interface FSizeable
      Specified by:
      setWidthFull in interface com.vaadin.flow.component.HasSize
    • setHeight

      public void setHeight(String height)
      Description copied from interface: FSizeable
      Sets the height of the component using String presentation.

      String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size.

      The empty string ("") or null will unset the height and set the units to pixels.

      See CSS specification for more details.

      Specified by:
      setHeight in interface FSizeable
      Specified by:
      setHeight in interface com.vaadin.flow.component.HasSize
      Parameters:
      height - in CSS style string representation
    • setHeight

      public void setHeight(float height, com.vaadin.flow.component.Unit unit)
      Description copied from interface: FSizeable
      Sets the height of the object. Negative number implies unspecified size (terminal is free to set the size).
      Specified by:
      setHeight in interface FSizeable
      Specified by:
      setHeight in interface com.vaadin.flow.component.HasSize
      Parameters:
      height - the height of the object.
      unit - the unit used for the width.
    • setSizeFull

      public void setSizeFull()
      Description copied from interface: FSizeable
      Sets the size to 100% x 100%.
      Specified by:
      setSizeFull in interface FSizeable
      Specified by:
      setSizeFull in interface com.vaadin.flow.component.HasSize
    • setSizeUndefined

      public void setSizeUndefined()
      Description copied from interface: FSizeable
      Clears any size settings.
      Specified by:
      setSizeUndefined in interface FSizeable
      Specified by:
      setSizeUndefined in interface com.vaadin.flow.component.HasSize
    • setHeightFull

      public void setHeightFull()
      Description copied from interface: FSizeable
      Sets the height to 100%.
      Specified by:
      setHeightFull in interface FSizeable
      Specified by:
      setHeightFull in interface com.vaadin.flow.component.HasSize
    • setWidth

      public void setWidth(String width)
      Description copied from interface: FSizeable
      Sets the width of the component using String presentation.

      String presentation is similar to what is used in Cascading Style Sheets. Size can be length or percentage of available size.

      The empty string ("") or null will unset the width and set the units to pixels.

      See CSS specification for more details.

      Specified by:
      setWidth in interface FSizeable
      Specified by:
      setWidth in interface com.vaadin.flow.component.HasSize
      Parameters:
      width - in CSS style string representation, null or empty string to reset
    • setWidth

      public void setWidth(float width, com.vaadin.flow.component.Unit unit)
      Description copied from interface: FSizeable
      Sets the width of the object. Negative number implies unspecified size (terminal is free to set the size).
      Specified by:
      setWidth in interface FSizeable
      Specified by:
      setWidth in interface com.vaadin.flow.component.HasSize
      Parameters:
      width - the width of the object.
      unit - the unit used for the width.