Ejemplo n.º 1
0
  public Hashtable<Object, Object> createModels(final CharacterFacade character) {
    Hashtable<Object, Object> state = new Hashtable<Object, Object>();
    state.put(TreeViewModelHandler.class, new TreeViewModelHandler(character));
    state.put(AddSpellAction.class, new AddSpellAction(character));
    state.put(RemoveSpellAction.class, new RemoveSpellAction(character));
    state.put(
        SpellInfoHandler.class,
        new SpellInfoHandler(character, availableTable, selectedTable, spellsPane));
    state.put(
        ClassInfoHandler.class,
        new ClassInfoHandler(character, availableTable, selectedTable, classPane));
    final CharacterComboBoxModel<String> defaultSpellBookModel;
    defaultSpellBookModel =
        new CharacterComboBoxModel<String>() {

          @Override
          public void setSelectedItem(Object anItem) {
            character.getSpellSupport().setDefaultSpellBook((String) anItem);
          }
        };
    defaultSpellBookModel.setListFacade(character.getSpellSupport().getSpellbooks());
    defaultSpellBookModel.setReference(character.getSpellSupport().getDefaultSpellBookRef());
    state.put(Models.DefaultSpellBookModel, defaultSpellBookModel);
    state.put(QualifiedSpellTreeCellRenderer.class, new QualifiedSpellTreeCellRenderer(character));

    return state;
  }
Ejemplo n.º 2
0
 public TreeViewModelHandler(CharacterFacade character) {
   availableModel =
       new SpellTreeViewModel(
           character.getSpellSupport().getKnownSpellNodes(), false, "SpellBooksAva");
   selectedModel =
       new SpellTreeViewModel(
           character.getSpellSupport().getBookSpellNodes(), true, "SpellBooksSel");
 }
Ejemplo n.º 3
0
 @Override
 public void actionPerformed(ActionEvent e) {
   List<?> data = selectedTable.getSelectedData();
   for (Object object : data) {
     if (object instanceof SpellNode) {
       SpellNode node = (SpellNode) object;
       character.getSpellSupport().removeFromSpellBook(node, node.getRootNode().getName());
     }
   }
 }
Ejemplo n.º 4
0
 @Override
 public void actionPerformed(ActionEvent e) {
   List<?> data = availableTable.getSelectedData();
   String bookname = getCurrentSpellBookName(character);
   for (Object object : data) {
     if (object instanceof SpellNode) {
       character.getSpellSupport().addToSpellBook((SpellNode) object, bookname);
     }
   }
 }