Package heronarts.lx.parameter
Class AggregateParameter
java.lang.Object
heronarts.lx.parameter.LXListenableParameter
heronarts.lx.parameter.AggregateParameter
- All Implemented Interfaces:
LXPath
,LXParameter
- Direct Known Subclasses:
ColorParameter
,MidiFilterParameter
,TimeParameter
An aggregate parameter is a parameter that may be directly monitored for changes, but whose
value is constructed from a number of underlying parameters. Changes to the underlying parameters
are automatically monitored and will trigger an update of the parameter's direct value if necessary.
There is also a mechanism to update the sub-parameter values if the aggregate value is set
directly (it is not required that this be supported/implemented based upon the nature of the parameter).
The sub-parameters are automatically registered with the parent component at OSC paths under the
path of the aggregate parameter itself.
The canonical example of an AggregateParameter is the
ColorParameter
which is comprised of an underlying hue, saturation, and brightness value that generate a single
resulting color value.-
Nested Class Summary
Nested classes/interfaces inherited from interface heronarts.lx.parameter.LXParameter
LXParameter.Collection, LXParameter.Formatter, LXParameter.Monitor, LXParameter.MultiMonitor, LXParameter.Polarity, LXParameter.Units
-
Field Summary
Fields inherited from class heronarts.lx.parameter.LXListenableParameter
description
Fields inherited from interface heronarts.lx.LXPath
ROOT, ROOT_PREFIX, ROOT_SLASH
-
Constructor Summary
ModifierConstructorDescriptionprotected
AggregateParameter
(String label) protected
AggregateParameter
(String label, double value) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addSubparameter
(String path, LXListenableParameter parameter) void
dispose()
Invoked when the parameter is done being used and none of its resources are needed anymore.Subclasses may override.protected abstract void
Subclasses should update the main parameter value when a sub-parameter has changedprotected double
onUpdateValue
(double value) Subclasses may optionally override to take action based upon directly updated valueprotected abstract void
updateSubparameters
(double value) Subclasses should update the subparameter values based upon the raw parameter value if it has been set directly.protected final double
updateValue
(double value) Invoked when the value has changed.Methods inherited from class heronarts.lx.parameter.LXListenableParameter
addListener, addListener, bang, getDescription, getFormatter, getLabel, getParent, getParentParameter, getPath, getPolarity, getUnits, getValue, incrementValue, isDefault, isMappable, removeListener, reset, reset, setComponent, setDescription, setFormatter, setMappable, setPolarity, setUnits, setValue, setValue
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface heronarts.lx.parameter.LXParameter
getBaseValue, getBaseValuef, getValuef
Methods inherited from interface heronarts.lx.LXPath
getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, isDescendant
-
Field Details
-
subparameters
-
-
Constructor Details
-
AggregateParameter
-
AggregateParameter
-
-
Method Details
-
addSubparameter
-
updateValue
protected final double updateValue(double value) Description copied from class:LXListenableParameter
Invoked when the value has changed. Subclasses should update any special internal state according to this new value.- Specified by:
updateValue
in classLXListenableParameter
- Parameters:
value
- New value- Returns:
- this
-
onUpdateValue
protected double onUpdateValue(double value) Subclasses may optionally override to take action based upon directly updated value- Parameters:
value
- Updated value- Returns:
- Value to store
-
updateSubparameters
protected abstract void updateSubparameters(double value) Subclasses should update the subparameter values based upon the raw parameter value if it has been set directly. -
onSubparameterUpdate
Subclasses should update the main parameter value when a sub-parameter has changed- Parameters:
p
- Subparameter that has changed
-
getRemoteControl
Subclasses may override. By default an AggregateParameter returns its first subparameter that is an LXListenableNormalizedParameter for remote control surface.- Returns:
- Subparameter to be used by a remote control surface
-
dispose
public void dispose()Description copied from interface:LXParameter
Invoked when the parameter is done being used and none of its resources are needed anymore.- Specified by:
dispose
in interfaceLXParameter
- Overrides:
dispose
in classLXListenableParameter
-