Class ImageReference

All Implemented Interfaces:
EventListener, IFontConsumer, IGProp<ReferenceString>, IPropReference, IReferencingGProp, Cloneable
Direct Known Subclasses:
BackgroundImageReference

public class ImageReference extends FixedVirtualizedAbstractReference<IImageTarget> implements IFontConsumer
The Image Reference property class hold the reference to an image definition implementing IImageTarget that in turn has images for various states and resolutions.
Author:
Christopher Mindus
  • Constructor Details Link icon

    • ImageReference Link icon

      protected ImageReference()
      Creates a Action Reference property with no name and with a null value.
    • ImageReference Link icon

      public ImageReference(Atom propertyAtom)
      Creates a Image Reference property with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
    • ImageReference Link icon

      public ImageReference(Atom propertyAtom, String newValue)
      Creates a Image Reference property with the specified name and value.
      Parameters:
      propertyAtom - the property atom.
      newValue - the new string value for the property.
  • Method Details Link icon

    • setImageTypes Link icon

      public void setImageTypes(int... types)
      Assigns the image types that are requested.
      Parameters:
      types - The list of image types requested, each value is combined of the AbstractImageDefinition.ID_MASK_* values. If types is empty or null or contains a single value -1 (or less than zero), all types are used.
    • initializeProp Link icon

      protected void initializeProp(Element element) throws PropException
      Called to initialize the property from an Element. The property should initialize itself from attributes and nodes with appropriate information.

      Subclasses should override this method if custom initialization is required.

      The default implementation gets the attribute "value" and calls the methods object=convertPropertyValue(string) followed by setPropertyValue(object).

      Overrides:
      initializeProp in class GProp<ReferenceString>
      Parameters:
      element - The Element.
      Throws:
      PropException - when the initialization fails.
    • initializeElement Link icon

      protected void initializeElement(Element element)
      Called when the XML file for the property tree is serialized from properties. The property should fill attributes and nodes with appropriate information.

      Subclasses should override this method if custom initialization is required.

      Overrides:
      initializeElement in class GProp<ReferenceString>
      Parameters:
      element - The Element to initialize.
    • getReferenceType Link icon

      public IPropReference.IRefType getReferenceType()
      Gets the reference Type.
      Specified by:
      getReferenceType in interface IPropReference
      Specified by:
      getReferenceType in interface IReferencingGProp
      Specified by:
      getReferenceType in class AbstractReference<IImageTarget>
      Returns:
      IPropReference.RefType.Image.
    • getPropertyClass Link icon

      public Class<?> getPropertyClass()
      Gets the class wanted.
      Specified by:
      getPropertyClass in class AbstractReference<IImageTarget>
      Returns:
      The property class that should be referenced.
    • isReferenceValid Link icon

      public boolean isReferenceValid(GProp<?> property)
      Validates the property reference that has been looked up.
      Specified by:
      isReferenceValid in interface IPropReference
      Specified by:
      isReferenceValid in class AbstractReference<IImageTarget>
      Parameters:
      property - The property to validate.
      Returns:
      true if valid, false otherwise.
    • setImage Link icon

      public boolean setImage(IImageTarget image)
      Sets the image reference to the specified image.
      Parameters:
      image - The image.
      Returns:
      true for changed, false for no change.
      Throws:
      NullPointerException - If image is null.
    • getClientImageData Link icon

      public ClientImageData getClientImageData()
      Gets the ClientImageData instance.
      Returns:
      The instance of the Client image data, or null if not a valid reference.
    • onEventSelf Link icon

      public void onEventSelf(GEvent event)
      Overridden to check for cache clearing...
      Specified by:
      onEventSelf in interface IGProp<ReferenceString>
      Overrides:
      onEventSelf in class AbstractReference<IImageTarget>
      Parameters:
      event - The property event.
    • informResolved Link icon

      protected void informResolved()
      Called when the property has been resolved. Subclasses override this method to implement some behavior. The default implementation performs nothing, i.e. there is no need to call super.informResolved().
      Overrides:
      informResolved in class FixedVirtualizedAbstractReference<IImageTarget>
    • informError Link icon

      protected void informError()
      Called when the property has an error. Subclasses override this method to implement some behavior. The default implementation performs nothing, i.e. there is no need to call super.informError().
      Overrides:
      informError in class FixedVirtualizedAbstractReference<IImageTarget>
    • clone Link icon

      public ImageReference clone()
      Cloning first makes sure there is a cached ClientImageData instance available in source.
      Overrides:
      clone in class AbstractReference<IImageTarget>
    • appendPropValue Link icon

      protected void appendPropValue(PropMgr propertyManager, SendTransaction trans, Object value)
      Sends the data to the client in a transaction.
      Overrides:
      appendPropValue in class AbstractReference<IImageTarget>
      Parameters:
      propertyManager - the property manager instance.
      trans - transaction to append the properties to.
      value - the value to append to the transaction, a reference to the current property value.
    • collectConsumedFonts Link icon

      public void collectConsumedFonts(Set<FontConsumed> fonts)
      Collects the consumed fonts.
      Specified by:
      collectConsumedFonts in interface IFontConsumer
      Parameters:
      fonts - The set of consumed fonts is filled in by this method.