Package org.deepsymmetry.beatlink.data
Class ColorItem
- java.lang.Object
-
- org.deepsymmetry.beatlink.data.SearchableItem
-
- org.deepsymmetry.beatlink.data.ColorItem
-
public class ColorItem extends SearchableItem
Represents a track color label. This is a specializedSearchableItem
, since in addition to a specific color, it has an ID and label that can be used as a way to select tracks in a dynamic playlist request, and on which playlists can be sorted. A simple immutable value class.- Author:
- James Elliott
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Color
colorForId(int colorId)
Returns the color represented by a color label assigned to a track in rekordbox.static String
colorNameForId(int colorId)
Returns the name of the color represented by a color label assigned to a track in rekordbox.boolean
equals(Object obj)
int
hashCode()
static boolean
isNoColor(Color color)
Checks whether a color value corresponds to the "No Color" choice in rekordbox.String
toString()
-
-
-
Constructor Detail
-
ColorItem
public ColorItem(int id, String label)
Constructor simply sets the immutable value fields, looking up the color and name associated with the id.- Parameters:
id
- the database ID associated with this item, for searcheslabel
- the text label used to show this item to the user
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toString
in classSearchableItem
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classSearchableItem
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classSearchableItem
-
isNoColor
public static boolean isNoColor(Color color)
Checks whether a color value corresponds to the "No Color" choice in rekordbox. This is implemented via transparency; the no-color choice is fully transparent.- Parameters:
color
- a color to be examined- Returns:
true
if the color represents the lack of a color assignment
-
colorForId
public static Color colorForId(int colorId)
Returns the color represented by a color label assigned to a track in rekordbox. This is also used in the user interface color tint settings that can be set up for an exported media library (and returned in theMediaDetails
response). If no color has been assigned, a fully-transparent black is returned, which can be tested for- Parameters:
colorId
- the id of the color label assigned to a track or the col value in theMediaDetails
- Returns:
- the color that should be displayed (or which the UI should be tinted with)
-
colorNameForId
public static String colorNameForId(int colorId)
Returns the name of the color represented by a color label assigned to a track in rekordbox. This is also used in the user interface color tint settings that can be set up for an exported media library (and returned in theMediaDetails
response).- Parameters:
colorId
- the id of the color label assigned to a track or the col value in theMediaDetails
- Returns:
- the color that should be displayed (or which the UI should be tinted with)
-
-