Class KStringHolder

  • All Implemented Interfaces:
    EventListener

    public class KStringHolder
    extends java.lang.Object
    implements EventListener
    Helper class used to maintain a KString for its dynamic tags with references, i.e. the image, text table, VirtualSpace and Connector tags.
    Author:
    Christopher Mindus
    • Nested Class Summary

      Nested Classes 
      Modifier and TypeClassDescription
      class KStringHolder.TagReference<TARGET>
      Class that holds and maintains the reference for a tag.
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      static java.lang.StringBASE_ERROR_ID
      The error ID base.
    • Constructor Summary

      Constructors 
      ConstructorDescription
      KStringHolder​(IKStringHolder<?> holder)
      Constructor for a holder of a single KString.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voiddisposeHolder()
      Disposes of the instance and the KString and removes property listener.
      KStringgetRefactoredKString()
      Gets the refactored KString.
      protected booleanisReferenceTreeValid()
      Verifies if the tree is valid for reference creation, i.e.
      voidonEvent​(GEvent event)
      Called when a property event is send to the holder property.
      protected voidonReferenceEvent​(ResolveReferencesEvent event)
      Called to perform reference resolving.
      voidresolve​(boolean doReCheck, GEvent triggerEvent)
      Resolves the references.
      voidresolveBeforeSend()
      Resolves the references in the KString if required before sending it to the remote party.
      voidsetKString​(KString ks)
      Called when a KString is assigned in the holder.
      voidverify​(PropVerification verification, java.lang.String location)
      Called when a KString requires verification of the references due to broken or valid references.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • BASE_ERROR_ID

        public static final java.lang.String BASE_ERROR_ID
        The error ID base.
        See Also:
        Constant Field Values
    • Constructor Detail

      • KStringHolder

        public KStringHolder​(IKStringHolder<?> holder)
        Constructor for a holder of a single KString.
        Parameters:
        holder - The holder property.
        Throws:
        java.lang.NullPointerException - If the holder is null.
    • Method Detail

      • disposeHolder

        public void disposeHolder()
        Disposes of the instance and the KString and removes property listener. Disposal can be done followed by calling setKString() with a new KString.
      • setKString

        public void setKString​(KString ks)
        Called when a KString is assigned in the holder.
        Parameters:
        ks - The KString, or null for none (same as calling dispose() method).
      • getRefactoredKString

        public KString getRefactoredKString()
        Gets the refactored KString.

        The returned instance is of the same type, i.e. if a PlainKString is the original string, this will also be the return from this call.

        Returns:
        The refactored KString, or null if this instance is disposed of.
      • resolve

        public void resolve​(boolean doReCheck,
                            GEvent triggerEvent)
        Resolves the references.
        Parameters:
        doReCheck - Re-check flag.
        triggerEvent - The triggering property event.
      • resolveBeforeSend

        public void resolveBeforeSend()
        Resolves the references in the KString if required before sending it to the remote party. The reference tree is assumed valid.
      • isReferenceTreeValid

        protected boolean isReferenceTreeValid()
        Verifies if the tree is valid for reference creation, i.e. that there is a valid Property Manager owning the root. This method can be overridden in order for references not to be created for the particular configuration (e.g. Client-related references such as LabelForReference that does not create references when communicating).
        Returns:
        true if the root property manager is found, false otherwise.
      • onEvent

        public void onEvent​(GEvent event)
        Called when a property event is send to the holder property.
        Specified by:
        onEvent in interface EventListener
        Parameters:
        event - The property event.
      • onReferenceEvent

        protected void onReferenceEvent​(ResolveReferencesEvent event)
        Called to perform reference resolving. A property should override this method if it needs to perform reference resolving and validation.

        Subclasses override this method and only subclasses extending PropCnr needs to call super.onReferenceEvent(ResolveReferenceEvent event).

        Parameters:
        event - The resolve references event.
      • verify

        public void verify​(PropVerification verification,
                           java.lang.String location)
        Called when a KString requires verification of the references due to broken or valid references. This event is fired only in the Designer.
        Parameters:
        verification - The property verification class.
        location - The location.