Class StyledProperty<T>

java.lang.Object
dev.prozilla.pine.common.property.VariableProperty<T>
dev.prozilla.pine.common.property.style.StyledProperty<T>
All Implemented Interfaces:
Animatable, Printable
Direct Known Subclasses:
StyledColorProperty, StyledDimensionProperty, StyledDirectionProperty, StyledDistributionProperty, StyledDualDimensionProperty, StyledEdgeAlignmentProperty, StyledGridAlignmentProperty, StyledIntProperty, StyledObjectProperty

public abstract class StyledProperty<T> extends VariableProperty<T> implements Animatable, Printable
A property used to style nodes based on a set of rules.

If a transition rule applies to this property, it will start a transition whenever its value changes.

  • Field Details

  • Constructor Details

    • StyledProperty

      public StyledProperty(StyledPropertyKey<T> name, Node node, List<StyleRule<T>> rules, AdaptivePropertyBase<T> defaultValue)
      Creates a styled property without any transitions.
      Parameters:
      node - The node this property belongs to
      rules - The rules that determine the value of this property
      defaultValue - The initial value of this property. Also used when no rule is applied.
    • StyledProperty

      public StyledProperty(StyledPropertyKey<T> name, Node node, List<StyleRule<T>> rules, AdaptivePropertyBase<T> defaultValue, List<StyleRule<AnimationCurve>> transitionRules)
      Creates a styled property with transitions.
      Parameters:
      node - The node this property belongs to
      rules - The rules that determine the value of this property
      defaultValue - The initial value of this property. Also used when no rule is applied.
      transitionRules - The rules that determine how the value of this property transitions when changed
  • Method Details

    • addRule

      public void addRule(StyleRule<T> rule)
    • invalidate

      public void invalidate()
    • applyRules

      protected void applyRules()
    • addTransitionRule

      public void addTransitionRule(StyleRule<AnimationCurve> transitionRule)
    • applyTransitionRules

      protected void applyTransitionRules()
    • createAdaptiveProperty

      protected abstract AdaptivePropertyBase<T> createAdaptiveProperty(T value)
    • createAdaptiveProperty

      protected abstract AdaptivePropertyBase<T> createAdaptiveProperty(VariableProperty<T> property)
    • createTransitionedProperty

      protected abstract TransitionedProperty<T> createTransitionedProperty(T initialValue, AnimationCurve curve)
    • supportsTransitions

      public boolean supportsTransitions()
    • getBestMatch

      protected <U> StyleRule<U> getBestMatch(List<StyleRule<U>> rules)
    • setAdaptiveProperty

      protected void setAdaptiveProperty(AdaptivePropertyBase<T> adaptiveProperty)
    • restartAnimation

      public void restartAnimation()
      Description copied from interface: Animatable
      Restarts the animation from the beginning.
      Specified by:
      restartAnimation in interface Animatable
    • updateAnimation

      public void updateAnimation(float deltaTime)
      Description copied from interface: Animatable
      Progresses the animation in time.
      Specified by:
      updateAnimation in interface Animatable
      Parameters:
      deltaTime - Time between this frame and the last one, in seconds.
    • getValue

      public T getValue()
      Specified by:
      getValue in class VariableProperty<T>
      Returns:
      The value of this property.
    • toString

      public String toString()
      Description copied from interface: Printable
      Returns a string representation of this object.
      Specified by:
      toString in interface Printable
      Overrides:
      toString in class Object
      Returns:
      String representation of this object.