Class StyledProperty<T,P extends Property<T>,A extends AdaptiveProperty<T,P>,R extends TransitionedProperty<T>>
java.lang.Object
dev.prozilla.pine.common.property.style.StyledProperty<T,P,A,R>
- All Implemented Interfaces:
Animatable,Printable,Property<T>,Functor<T>
- Direct Known Subclasses:
StyledIntProperty,StyledObjectProperty
public abstract class StyledProperty<T,P extends Property<T>,A extends AdaptiveProperty<T,P>,R extends TransitionedProperty<T>>
extends Object
implements Property<T>, 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 Summary
FieldsModifier and TypeFieldDescriptionprotected Aprotected final StyledPropertyKey<T> protected final Nodeprotected final List<StyleRule<AnimationCurve>> -
Constructor Summary
ConstructorsConstructorDescriptionStyledProperty(StyledPropertyKey<T> name, Node node, List<StyleRule<T>> rules, A defaultValue) Creates a styled property without any transitions.StyledProperty(StyledPropertyKey<T> name, Node node, List<StyleRule<T>> rules, A defaultValue, List<StyleRule<AnimationCurve>> transitionRules) Creates a styled property with transitions. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddTransitionRule(StyleRule<AnimationCurve> transitionRule) protected voidprotected voidprotected abstract AcreateAdaptiveProperty(Property<T> property) protected abstract AcreateAdaptiveProperty(T value) protected abstract RcreateTransitionedProperty(T initialValue, AnimationCurve curve) protected <U> StyleRule<U> getBestMatch(List<StyleRule<U>> rules) getValue()Returns the value of this property.voidvoidRestarts the animation from the beginning.protected voidsetAdaptiveProperty(A adaptiveProperty) boolean@NotNull StringtoString()Returns a string representation of this object.voidupdateAnimation(float deltaTime) Progresses the animation in time.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.prozilla.pine.common.property.Property
getValueOr, hasValue, hasValueProperty, isNotNull, isNotNullProperty, isNull, map, replaceNull, requireValue, snapshot, toStringProperty
-
Field Details
-
name
-
node
-
rules
-
adaptiveProperty
-
transitionRules
-
-
Constructor Details
-
StyledProperty
public StyledProperty(StyledPropertyKey<T> name, Node node, List<StyleRule<T>> rules, A defaultValue) Creates a styled property without any transitions.- Parameters:
node- The node this property belongs torules- The rules that determine the value of this propertydefaultValue- 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, A defaultValue, List<StyleRule<AnimationCurve>> transitionRules) Creates a styled property with transitions.- Parameters:
node- The node this property belongs torules- The rules that determine the value of this propertydefaultValue- 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
-
invalidate
public void invalidate() -
applyRules
protected void applyRules() -
addTransitionRule
-
applyTransitionRules
protected void applyTransitionRules() -
createAdaptiveProperty
-
createAdaptiveProperty
-
createTransitionedProperty
-
supportsTransitions
public boolean supportsTransitions() -
getBestMatch
-
setAdaptiveProperty
-
restartAnimation
public void restartAnimation()Description copied from interface:AnimatableRestarts the animation from the beginning.- Specified by:
restartAnimationin interfaceAnimatable
-
updateAnimation
public void updateAnimation(float deltaTime) Description copied from interface:AnimatableProgresses the animation in time.- Specified by:
updateAnimationin interfaceAnimatable- Parameters:
deltaTime- Time between this frame and the last one, in seconds.
-
getValue
Description copied from interface:PropertyReturns the value of this property. -
toString
Description copied from interface:PrintableReturns a string representation of this object.
-