Class AssetReference

All Implemented Interfaces:
EventListener, IGProp<ReferenceString>, IPropReference, IReferencingGProp, Cloneable

public class AssetReference extends FixedVirtualizedAbstractReference<FileURIPropCnr>
The Asset Reference property class hold the reference to a file in the Assets directory.
Author:
Christopher Mindus
  • Constructor Details

    • AssetReference

      protected AssetReference()
      Creates an Asset Reference property with no name and with a null value.
    • AssetReference

      public AssetReference(Atom propertyAtom)
      Creates an Asset Reference property with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
    • AssetReference

      public AssetReference(Atom propertyAtom, String newValue)
      Creates an Asset Reference property with the specified name and value.
      Parameters:
      propertyAtom - the property atom.
      newValue - the new string value for the property.
  • Method Details

    • onEventSelf

      public void onEventSelf(GEvent event)
      Called when a property event is send to this property.

      A subclass can override this method to perform appropriate processing and is not required to call super.onEventSelf(e).

      Specified by:
      onEventSelf in interface IGProp<ReferenceString>
      Overrides:
      onEventSelf in class AbstractReference<FileURIPropCnr>
      Parameters:
      event - The property event.
    • getFileURL

      public URL getFileURL()
      Gets the file URL for this reference.

      The method first attempts to use the resolved mechanism of getting the VirtualSpace. If this has failed or has not been resolved yet, the property tree will be used to search for it. The latter is, of course, slower.

      Returns:
      The URL instance, or null if not found.
    • getFileURIPropCnr

      public FileURIPropCnr getFileURIPropCnr()
      For the Designer, gets the File property for the reference.

      The method first attempts to use the resolved mechanism of getting the VirtualSpace. If this has failed or has not been resolved yet, the property tree will be used to search for it. The latter is, of course, slower.

      Returns:
      The FileURIPropCnr instance, or null if not found.
    • getFileURIPropCnr

      public FileURIPropCnr getFileURIPropCnr(GProp<?> anyPropInTree)
      For the Designer, gets the File property for the reference.

      The method first attempts to use the resolved mechanism of getting the VirtualSpace. If this has failed or has not been resolved yet, the property tree will be used to search for it. The latter is, of course, slower.

      Parameters:
      anyPropInTree - Any property in tree if this instance is not attached.
      Returns:
      The FileURIPropCnr instance, or null if not found.
    • informResolved

      protected void informResolved()
      Called when the property has been resolved.
      Overrides:
      informResolved in class FixedVirtualizedAbstractReference<FileURIPropCnr>
    • informError

      protected void informError()
      Called when the property has an error.
      Overrides:
      informError in class FixedVirtualizedAbstractReference<FileURIPropCnr>
    • informClearError

      protected void informClearError()
      Called when the property has been cleared from error.
      Overrides:
      informClearError in class FixedVirtualizedAbstractReference<FileURIPropCnr>
    • getReferenceType

      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<FileURIPropCnr>
      Returns:
      IPropReference.RefType.AssetFile.
    • getPropertyClass

      public Class<FileURIPropCnr> getPropertyClass()
      Gets the class wanted.
      Specified by:
      getPropertyClass in class AbstractReference<FileURIPropCnr>
      Returns:
      FileURIPropCnr.class.
    • isReferenceValid

      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<FileURIPropCnr>
      Parameters:
      property - The property to validate.
      Returns:
      true if valid, false otherwise.
    • validateReferenceScope

      protected String validateReferenceScope(FileURIPropCnr target)
      Called when the a property container has been renamed or moved in order to perform validation of the reference, e.g. if a base property has been moved out of scope. The implementor can assign or clear property errors by returning the error string.
      Overrides:
      validateReferenceScope in class AbstractReference<FileURIPropCnr>
      Parameters:
      target - Target reference to validate the scope of, i.e. the referenced property.
      Returns:
      The error message, or null for valid. Default implementation returns null.
    • getClientResourceString

      public String getClientResourceString()
      Gets the Client resource string in form "module$/path/filename.ext".
      Returns:
      null If not valid.