Class Image

All Implemented Interfaces:
Adaptable, Resource

public class Image extends ImageResource
Provides convenience methods for displaying images.
  • Field Details

  • Constructor Details

    • Image

      public Image(Resource resource)
      Creates a new image based on the given resource. the image properties are considered to 'on' the given resource.
      Parameters:
      resource - resource of the image
      Throws:
      IllegalArgumentException - if the given resource is not adaptable to node.
    • Image

      public Image(Resource resource, String imageName)
      Creates a new image based on the given resource. the image properties are considered to 'on' the given resource unless imageName is specified. then the respective child resource holds the image properties.
      Parameters:
      resource - current resource
      imageName - name of the image resource
      Throws:
      IllegalArgumentException - if the given resource is not adaptable to node.
  • Method Details

    • setDropTargetId

      public void setDropTargetId(String id, String classifier)
      Sets the drop target id for this image. the id is added as css class to the image attribute. and has the format: ""cq-dd-"{id}-{classifier}"
      Parameters:
      id - the drop target id as configured in edit config.
      classifier - optional classifier
    • setDropTargetId

      public void setDropTargetId(String id)
      Sets the drop target id for this image, using the name of the resources as path.
      Parameters:
      id - the drop target id as configured in edit config.
    • hasNoPlaceholder

      public boolean hasNoPlaceholder()
      Returns the placeholder flag.
      Returns:
      true if no placeholder for empty content should be drawn.
    • setNoPlaceholder

      public void setNoPlaceholder(boolean noPlaceholder)
      Sets the placeholder flag.
      Parameters:
      noPlaceholder - if true no placeholder for empty content is used.
    • loadStyleData

      public void loadStyleData(Style style)
      Loads several definitions from style.

      Currently, the minimum/maximum width and height are transferred from the given style.

      Parameters:
      style - style to load definitions from
    • getIconPath

      public String getIconPath()
      Returns a path to an icon representing the file. Checks if the component of the resource provides an icon for the respective type.
      Overrides:
      getIconPath in class DownloadResource
      Returns:
      a path to an icon or null.