Class KStringHolderProp<PROP_VALUE>

java.lang.Object
com.iizix.prop.GProp<PROP_VALUE>
com.iizix.prop.KStringHolderProp<PROP_VALUE>
Type Parameters:
PROP_VALUE - The property value class (KString, KTooltip, GBadge).
All Implemented Interfaces:
EventListener, IGProp<PROP_VALUE>, IReferencingGProp, IKStringHolder<PROP_VALUE>, IKStringInfoProvider, IKStringValuePropHolder<PROP_VALUE>, ITextExternalizableProp<PROP_VALUE>, Cloneable
Direct Known Subclasses:
BadgeProp, KStringProp, TooltipProp

public abstract class KStringHolderProp<PROP_VALUE> extends GProp<PROP_VALUE> implements IKStringValuePropHolder<PROP_VALUE>
The property that holds a value built around a KString: what KStringProp, the tooltip property and BadgeProp share. It owns the KStringHolder that resolves the string's references, and it implements once the behaviour the three concrete classes used to carry each: the holder's life cycle (creation, clone, dispose), the resolve triggers (value change, container renamed, moved or added, the post-order reference event), the hyperlink remote event, the Designer's refactoring rebuild and the verification. A change to how a KString lives inside a property is made here, once.

A concrete class supplies where the KString sits inside its value (IKStringHolder.getKString()), how its value is cloned and disposed of, the location name of its verification errors, its value classes, its XML and its wire. The concrete class names are unchanged: base-properties.xml and the JavaScript client never notice this class.

Author:
Christopher Mindus
  • Constructor Details

    • KStringHolderProp

      protected KStringHolderProp()
      Creates a property with no name and with a null value.
    • KStringHolderProp

      protected KStringHolderProp(Atom propertyAtom)
      Creates a property with the specified name with a null value.
      Parameters:
      propertyAtom - the property atom.
  • Method Details

    • getKStringHolder

      protected final KStringHolder getKStringHolder()
      Gets the KString holder.
      Returns:
      The holder, or null once the property is disposed of.
    • clone

      public KStringHolderProp<PROP_VALUE> clone()
      Clones the property and its KString holder. The clone gets a holder of its own and its value is set anew from a clone of the value, so that the new holder sees the string and resolves it.
      Overrides:
      clone in class GProp<PROP_VALUE>
      Returns:
      A new cloned instance.
    • clonePropValue

      protected abstract PROP_VALUE clonePropValue(PROP_VALUE value)
      Clones a property value for clone().
      Parameters:
      value - The value to clone, never null.
      Returns:
      The cloned value.
    • disposePropValue

      protected abstract void disposePropValue(PROP_VALUE value)
      Disposes of a property value when the property is disposed of.
      Parameters:
      value - The value, never null.
    • getKStringVerificationLocation

      protected abstract String getKStringVerificationLocation()
      Gets the location name used for the KString verification errors of this property.
      Returns:
      "KString", "Tooltip" or "Badge".
    • onPropValueSet

      protected void onPropValueSet(Object oldValue)
      Called when the property value has been set: the holder is told about the new KString. A subclass that overrides this method must call super.onPropValueSet(oldValue).
      Overrides:
      onPropValueSet in class GProp<PROP_VALUE>
      Parameters:
      oldValue - The old value.
    • onEventSelf

      public void onEventSelf(GEvent event)
      Called when a property event is send to this property: a value change, or the container being renamed, moved or added, resolves the KString references.

      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<PROP_VALUE>
      Overrides:
      onEventSelf in class GProp<PROP_VALUE>
      Parameters:
      event - The property event.
    • onReferenceEvent

      protected void onReferenceEvent(ResolveReferencesEvent event)
      Called to perform reference resolving, in POST-order.
      Overrides:
      onReferenceEvent in class GProp<PROP_VALUE>
      Parameters:
      event - The resolve references event.
    • resolveKStrings

      public void resolveKStrings(boolean doReCheck, GEvent triggerEvent)
      Resolves the references to KString's in all held KString's.
      Specified by:
      resolveKStrings in interface IKStringHolder<PROP_VALUE>
      Parameters:
      doReCheck - Re-check flag.
      triggerEvent - The triggering property event.
    • onPropDispose

      protected void onPropDispose()
      Called when disposed of: the holder first (it disposes of the KString it holds), then the value.
      Overrides:
      onPropDispose in class GProp<PROP_VALUE>
    • onRemoteEvent

      public void onRemoteEvent(RemoteEvent event)
      Processes remote hyperlink events.
      Specified by:
      onRemoteEvent in interface IGProp<PROP_VALUE>
      Overrides:
      onRemoteEvent in class GProp<PROP_VALUE>
      Parameters:
      event - The remote event.
    • onKStringRefactored

      public void onKStringRefactored(KStringHolder holder, GEvent triggerEvent)
      Called when a KString tag changed due to refactoring. The property value is rebuilt around the refactored KString through ITextExternalizableProp.createNewPropValue(KString) and set with the triggering property. This event is fired only in the Designer.
      Specified by:
      onKStringRefactored in interface IKStringHolder<PROP_VALUE>
      Parameters:
      holder - The KStringHolder instance.
      triggerEvent - Event that triggered the refactoring.
    • verify

      public boolean verify(PropVerification verification)
      Verifies this property: the KString references first, then the property itself.
      Specified by:
      verify in interface IGProp<PROP_VALUE>
      Overrides:
      verify in class GProp<PROP_VALUE>
      Parameters:
      verification - The property verification class.
      Returns:
      true if verification should proceed, false if disposed of and verification should not take place.