public class LXSwatch extends LXComponent implements LXLoopTask, LXOscComponent, LXComponent.Renamable
Modifier and Type | Class and Description |
---|---|
static interface |
LXSwatch.Listener |
LXComponent.Placeholder, LXComponent.Renamable
LXSerializable.Utils
Modifier and Type | Field and Description |
---|---|
BooleanParameter |
autoCycleEligible |
List<LXDynamicColor> |
colors |
static int |
MAX_COLORS |
BooleanParameter |
recall |
controlSurfaceSemaphore, KEY_CLASS, KEY_COMPONENT_ID, KEY_ID, KEY_PARAMETER_PATH, KEY_PATH, label, lx, modulationColor
Modifier and Type | Method and Description |
---|---|
LXDynamicColor |
addColor()
Adds a new dynamic color to the swatch
|
LXDynamicColor |
addColor(int index,
JsonObject colorObj) |
LXSwatch |
addListener(LXSwatch.Listener listener)
Registers a listener to the swatch
|
void |
dispose()
Invoked when a component is being removed from the system and will no longer be used at all.
|
LXDynamicColor |
getColor(int index)
Retrieves the color at a given index in the swatch.
|
int |
getIndex() |
String |
getPath()
Accessor for the path of this object.
|
void |
load(LX lx,
JsonObject obj)
Loads the LX component.
|
void |
loop(double deltaMs) |
void |
onParameterChanged(LXParameter p)
Subclasses are free to override this if desired.
|
LXDynamicColor |
removeColor()
Removes the last color from the swatch
|
LXDynamicColor |
removeColor(int index)
Removes the color at a specific index from the swatch
|
LXDynamicColor |
removeColor(LXDynamicColor color)
Removes a specific color from the swatch
|
LXSwatch |
removeListener(LXSwatch.Listener listener)
Unregisters a listener to the swatch
|
void |
save(LX lx,
JsonObject obj)
Serializes the LX component.
|
addArray, addChild, addInternalParameter, addParameter, addParameter, contains, copyParameters, getChild, getComponentName, getComponentName, getComponentName, getId, getLabel, getLX, getOscAddress, getOscLabel, getOscPath, getParameter, getParameters, getParent, handleOscMessage, loadParameters, removeParameter, removeParameter, saveParameters, setParent, toString, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getOscAddress, handleOscMessage
get, get, getCanonicalLabel, getCanonicalLabel, getCanonicalPath, getCanonicalPath, getComponent, getComponent, getParameter, getParameter
public static final int MAX_COLORS
public final List<LXDynamicColor> colors
public final BooleanParameter recall
public final BooleanParameter autoCycleEligible
public LXSwatch(LX lx)
public void onParameterChanged(LXParameter p)
LXComponent
onParameterChanged
in interface LXParameterListener
onParameterChanged
in class LXComponent
p
- Parameter that has a value changepublic int getIndex()
public String getPath()
LXComponent
getPath
in interface LXPath
getPath
in class LXComponent
public void loop(double deltaMs)
loop
in interface LXLoopTask
public LXDynamicColor getColor(int index)
index
- Indexpublic LXDynamicColor addColor()
public LXDynamicColor addColor(int index, JsonObject colorObj)
public LXDynamicColor removeColor()
public LXDynamicColor removeColor(LXDynamicColor color)
color
- The color to removepublic LXDynamicColor removeColor(int index)
index
- Index to removepublic LXSwatch addListener(LXSwatch.Listener listener)
listener
- Swatch listenerpublic LXSwatch removeListener(LXSwatch.Listener listener)
listener
- Swatch listenerpublic void save(LX lx, JsonObject obj)
LXComponent
super.save(lx, obj)
at the appropriate time.save
in interface LXSerializable
save
in class LXComponent
lx
- LX instanceobj
- Object to serialize intopublic void load(LX lx, JsonObject obj)
LXComponent
load
in interface LXSerializable
load
in class LXComponent
lx
- LX instanceobj
- Object to deserializepublic void dispose()
LXComponent
super.dispose()
at the appropriate
time to perform the basic cleanup, which may need to happen either before or after cleaning
up other objects.dispose
in class LXComponent
LX library by Mark C. Slee. © 2012-2020