Class PropProvenance

java.lang.Object
com.iizigo.editor.PropProvenance

public final class PropProvenance extends Object
The provenance mark of a property (GProp.setPropProvenance(boolean)) as the operations of the Designer keep it. Core only defines the mark and saves it in the file; when it is set and when it is cleared is decided here.

The rules:

  • A ComplexOperation whose provenance switch is on (ComplexOperation.setProvenance) marks what it produces: a property it inserts - the property itself and, for a container, every container below it (markInserted(GProp)) - and a plain property, i.e. one that is not a container, whose value it sets (onValueSet(GProp, boolean)).
  • Every other value set of a plain property made through an operation of the Designer clears the mark of that property, and of that property only: a ComplexOperation whose switch is off, and the value operation of the property sheet (PropHelper.setValue).
  • The mark follows the set, not the change: a value set to the one the property already has marks or clears as well.
  • The mark of a container is never cleared.
  • Undo and redo put the mark of a plain property back as it was before and after the value set (PropValueState).

The mark is changed without an event. A property whose mark changed is marked changed (GProp.setChanged()).

Author:
Christopher Mindus
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Marks a property that an operation with the provenance switch on is about to insert: the property itself and, for a container, every container below it.
    static boolean
    onValueSet(GProp<?> gp, boolean provenance)
    Called when an operation has set the value of a property, changed or not: a plain property is marked when the provenance switch of the operation is on, and has its mark cleared otherwise.
  • Method Details

    • markInserted

      public static void markInserted(GProp<?> gp)
      Marks a property that an operation with the provenance switch on is about to insert: the property itself and, for a container, every container below it. The plain properties inside an inserted container are not marked: the mark of the container says where they come from.
      Parameters:
      gp - The property to insert.
    • onValueSet

      public static boolean onValueSet(GProp<?> gp, boolean provenance)
      Called when an operation has set the value of a property, changed or not: a plain property is marked when the provenance switch of the operation is on, and has its mark cleared otherwise. A container is left as it is: its mark says that it was created with the switch on, and it is never cleared.
      Parameters:
      gp - The property whose value was set.
      provenance - The provenance switch of the operation; false for an operation that has none.
      Returns:
      true if the mark changed.