/** Construct the list of spells the character knows, has prepared or has in a spell book. */
  private void buildKnownPreparedNodes() {
    allKnownSpellNodes.clearContents();
    knownSpellNodes.clearContents();
    bookSpellNodes.clearContents();
    preparedSpellNodes.clearContents();

    // Ensure spell information is up to date
    pc.getSpellList();

    // Scan character classes for spell classes
    List<PCClass> classList = getCharactersSpellcastingClasses();
    List<PObject> pobjList = new ArrayList<>(classList);

    // Include spells from race etc
    pobjList.add(charDisplay.getRace());

    // Look at each spell on each spellcasting class
    for (PObject pcClass : pobjList) {
      buildKnownPreparedSpellsForCDOMObject(pcClass);
    }

    spellBooks.clear();
    spellBookNames.clearContents();
    for (SpellBook spellBook : charDisplay.getSpellBooks()) {
      if (spellBook.getType() == SpellBook.TYPE_PREPARED_LIST) {
        DummySpellNodeImpl spellListNode = new DummySpellNodeImpl(getRootNode(spellBook.getName()));
        preparedSpellLists.add(spellListNode);
        addDummyNodeIfSpellListEmpty(spellBook.getName());
      } else if (spellBook.getType() == SpellBook.TYPE_SPELL_BOOK) {
        DummySpellNodeImpl spellListNode = new DummySpellNodeImpl(getRootNode(spellBook.getName()));
        spellBooks.add(spellListNode);
        addDummyNodeIfSpellBookEmpty(spellBook.getName());
        spellBookNames.addElement(spellBook.getName());
      }
    }
  }
 public RootNodeImpl(SpellBook book) {
   this.book = book;
   this.name = book.getName();
 }