April 2018
Intermediate to advanced
910 pages
33h 21m
English
There are two more methods we need to look at in this class, the ones that load and store the options represented in the panel. We'll start with load(), which is as follows:
protected void load() {
String dirs = NbPreferences
.forModule(PhotoManager.class).get("sourceDirs", "");
if (dirs != null && !dirs.isEmpty()) {
ensureModel();
model.clear();
Set<String> set = new HashSet<>(
Arrays.asList(dirs.split(";")));
set.forEach(i -> model.addElement(i));
}
}
NbPreferences does not support storing a list of strings, so, as we'll see below, we store the list of source directories as a semicolon-delimited list of strings. Here, we load the value of sourceDirs, and, if not null, we split on the semicolon, and add each ...