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 Summary
FieldsModifier and TypeFieldDescriptionprotected final StyledPropertyKey<T> protected final Nodeprotected final List<StyleRule<AnimationCurve>> Fields inherited from class dev.prozilla.pine.common.property.VariableProperty
random -
Constructor Summary
ConstructorsConstructorDescriptionStyledProperty(StyledPropertyKey<T> name, Node node, List<StyleRule<T>> rules, AdaptivePropertyBase<T> defaultValue) Creates a styled property without any transitions.StyledProperty(StyledPropertyKey<T> name, Node node, List<StyleRule<T>> rules, AdaptivePropertyBase<T> defaultValue, List<StyleRule<AnimationCurve>> transitionRules) Creates a styled property with transitions. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddTransitionRule(StyleRule<AnimationCurve> transitionRule) protected voidprotected voidprotected abstract AdaptivePropertyBase<T> createAdaptiveProperty(VariableProperty<T> property) protected abstract AdaptivePropertyBase<T> createAdaptiveProperty(T value) protected abstract TransitionedProperty<T> createTransitionedProperty(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(AdaptivePropertyBase<T> adaptiveProperty) boolean@NotNull StringtoString()Returns a string representation of this object.voidupdateAnimation(float deltaTime) Progresses the animation in time.Methods inherited from class dev.prozilla.pine.common.property.VariableProperty
exists, getValue, getValue, hasValue
-
Field Details
-
name
-
node
-
rules
-
transitionRules
-
-
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 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, AdaptivePropertyBase<T> 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
protected abstract TransitionedProperty<T> createTransitionedProperty(T initialValue, AnimationCurve curve) -
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 class:VariablePropertyReturns the value of this property.- Specified by:
getValuein classVariableProperty<T>- Returns:
- The value of this property.
-
toString
Description copied from interface:PrintableReturns a string representation of this object.
-