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 Node
protected 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 TypeMethodDescriptionvoid
void
addTransitionRule
(StyleRule<AnimationCurve> transitionRule) protected void
protected void
protected 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()
void
void
Restarts the animation from the beginning.protected void
setAdaptiveProperty
(AdaptivePropertyBase<T> adaptiveProperty) boolean
toString()
Returns a string representation of this object.void
updateAnimation
(float deltaTime) Progresses the animation in time.
-
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:Animatable
Restarts the animation from the beginning.- Specified by:
restartAnimation
in interfaceAnimatable
-
updateAnimation
public void updateAnimation(float deltaTime) Description copied from interface:Animatable
Progresses the animation in time.- Specified by:
updateAnimation
in interfaceAnimatable
- Parameters:
deltaTime
- Time between this frame and the last one, in seconds.
-
getValue
- Specified by:
getValue
in classVariableProperty<T>
- Returns:
- The value of this property.
-
toString
Description copied from interface:Printable
Returns a string representation of this object.
-