Writing our own nodes
The preceding section covered those two classes, but what is YearChildFactory
? The class RootNode
defines for the system the root node of what will become our tree. Each node, though, if it has children, is responsible for loading and building those child Nodes, which is done through this ChildFactory
class. Our instance looks like this:
public class YearChildFactory extends ChildFactory<String> { private final PhotoManager photoManager; private static final Logger LOGGER = Logger.getLogger(YearChildFactory.class.getName()); public YearChildFactory() { this.photoManager = Lookup.getDefault().lookup(PhotoManager.class); if (photoManager == null) { LOGGER.log(Level.SEVERE, "Cannot get PhotoManager object"); LifecycleManager.getDefault().exit(); } } @Override protected boolean createKeys(List<String> list) { list.addAll...