public class ColorPaletteLoader extends DataLoader
{
"name" : "String",
"tags" : ["String1","String2",...,"StringN"],
"colors" : [
{
"hexString" : {
"r" : "float",
"g" : "float",
"b" : "float"}
"a" : "float",
"importance" : "int"
}
}, ...]
}
On default the keyPressed event with following keys are associated with
following methods: | Constructor and Description |
|---|
ColorPaletteLoader(processing.core.PApplet parent)
Builds the ColorPaletteLoader and registers the KeyEvent to the parent
(PApplet).
|
ColorPaletteLoader(processing.core.PApplet parent,
java.lang.String folderName)
Builds the ColorPaletteLoader and registers the KeyEvent to the parent
(PApplet).
|
ColorPaletteLoader(processing.core.PApplet parent,
java.lang.String folderPath,
java.lang.String folderName)
Builds the ColorPaletteLoader and registers the KeyEvent to the parent
(PApplet).
|
| Modifier and Type | Method and Description |
|---|---|
ColorPaletteLoader |
addObserver(ColorPaletteUpdateObserver observer)
Add an object that wants to be informed when there is a change of the
current color palette.
|
ColorPaletteLoader |
clearObservers()
Remove all observers from this loader.
|
ColorPaletteLoader |
disableKeys()
Disable the automatic key events of this object.
|
ColorPaletteLoader |
enableKeys()
Enables the automatic key events of this object.
|
ColorPalette |
first()
Loads (if necessary) and returns the first file of the given folder.
|
ColorPalette |
get(int index)
Loads (if necessary) and returns the file with the given index.
|
ColorPalette |
getCurrent()
Loads (if necessary) and returns the current file.
|
ColorPalette |
last()
Loads (if necessary) and returns the last file of the given folder.
|
ColorPalette[] |
loadAllFiles()
Loads all files (if not loaded yet) and returns them all.
|
ColorPalette |
loadFile(int index)
Loads a file with the given index and returns it.
|
ColorPalette |
next()
Loads (if necessary) and returns the next file of the given folder.
|
ColorPalette |
nextRandom()
Loads (if necessary) and returns the next random file of the given
folder.
|
ColorPalette |
previous()
Loads (if necessary) and returns the previous file of the given folder.
|
ColorPaletteLoader |
removeObserver(ColorPaletteUpdateObserver observer)
Remove an observer from this loader.
|
ColorPaletteLoader |
resetKeySettings()
Resets the key settings for the KeyEvents to its default.
|
ColorPaletteLoader |
setIndex(int index)
Sets the current element.
|
ColorPaletteLoader |
setIndex(java.lang.String filename)
Sets the current element.
|
ColorPaletteLoader |
setKey(java.lang.String which,
char key)
Links a certain method call (e.g. next()) with a certain key (e.g.
|
DataLoader |
setKey(java.lang.String which,
int keyCode)
Links a certain method call (e.g. next()) with a certain keyCode (e.g.
|
ColorPaletteLoader |
update()
Re-Loads all the absolute paths for all valid files defined by the given
type in the set folder.
|
getFileName, getFileName, getFileName, getFileName, getFolder, getLoadingDirectory, getPath, keyEvent, loadPaths, loadPaths, sizepublic ColorPaletteLoader(processing.core.PApplet parent)
parent - A PApplet object.public ColorPaletteLoader(processing.core.PApplet parent,
java.lang.String folderName)
parent - A PApplet object.folderName - Folder containing files (not null). This folder should at
least contain one .color.json file. The given folder should be
a sub-folder of the current sketch directory or a relative
path to the sketch path. e.g. "..\\data" is a folder which is
located in the parent directory of the sketch folder. Make
sure to escape the backslashes in the path in the shown way.public ColorPaletteLoader(processing.core.PApplet parent,
java.lang.String folderPath,
java.lang.String folderName)
parent - A PApplet object.folderPath - A absolute path to the folder. Example:
"C:\\" is the folderPath and "data
" is the foldername then the files of the folder located at "
C:\\data\\" will be loaded. Make sure to escape the
backslashes in the path in the shown way.If folderPath is
null, the sketch location will be used to set this path.folderName - Folder containing files (not null). This folder should at
least contain one .color.json file. The given folder should be
a sub-folder of folderpath or a relative path to folderPath.
e.g. "C:\\data" is the folderpath and "..\\temp" is the
foldername then "C:\\temp\\" will be the location where the
files will be loaded. Make sure to escape the backslashes in
the path in the shown way.public ColorPaletteLoader update()
DataLoaderupdate in class DataLoaderpublic ColorPaletteLoader resetKeySettings()
DataLoaderresetKeySettings in class DataLoaderpublic ColorPaletteLoader disableKeys()
DataLoaderdisableKeys in class DataLoaderpublic ColorPaletteLoader enableKeys()
DataLoaderenableKeys in class DataLoaderpublic DataLoader setKey(java.lang.String which, int keyCode)
DataLoadersetKey in class DataLoaderwhich - A String representing the method which should be linked to the
keyCode. Possible values: \ "previous\", \"next\", \"first\",
\"last\", \"random\".keyCode - The keyCode for the key which should be used for the given
function.public ColorPaletteLoader setKey(java.lang.String which, char key)
DataLoadersetKey in class DataLoaderwhich - A String representing the method which should be linked to the
keyCode. Possible values: \ "previous\", \"next\", \"first\",
\"last\", \"random\".key - The char containing the key which should be used for the given
function.public ColorPalette loadFile(int index)
DataLoaderloadFile in class DataLoaderindex - The index of the file which should be loaded.public ColorPalette[] loadAllFiles()
DataLoaderloadAllFiles in class DataLoaderpublic ColorPalette nextRandom()
DataLoadernextRandom in class DataLoaderpublic ColorPalette previous()
DataLoaderprevious in class DataLoaderpublic ColorPalette next()
DataLoadernext in class DataLoaderpublic ColorPalette first()
DataLoaderfirst in class DataLoaderpublic ColorPalette last()
DataLoaderlast in class DataLoaderpublic ColorPaletteLoader setIndex(int index)
setIndex in class DataLoaderindex - The index of the element which should be the current element.
Index is in range of [0, size()).public ColorPaletteLoader setIndex(java.lang.String filename)
DataLoadersetIndex in class DataLoaderfilename - The name of the file which should be the current element.public ColorPalette getCurrent()
DataLoadergetCurrent in class DataLoaderpublic ColorPalette get(int index)
DataLoaderget in class DataLoaderpublic ColorPaletteLoader addObserver(ColorPaletteUpdateObserver observer)
observer - An object that will be informed at a change of the current
color palette.public ColorPaletteLoader removeObserver(ColorPaletteUpdateObserver observer)
observer - An object that was formerly an observer and which should be
removed.public ColorPaletteLoader clearObservers()