July 2017
Intermediate to advanced
466 pages
11h 24m
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 ...
Read now
Unlock full access