Пример #1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   CompanionSupportFacade support = character.getCompanionSupport();
   if (REMOVE_COMMAND.equals(e.getActionCommand())) {
     CompanionFacade companion = (CompanionFacade) selectedElement;
     int ret =
         JOptionPane.showConfirmDialog(
             button,
             LanguageBundle.getFormattedString(
                 "in_companionConfirmRemovalMsg",
                 companion //$NON-NLS-1$
                     .getNameRef()
                     .getReference()),
             LanguageBundle.getString("in_companionConfirmRemoval"), // $NON-NLS-1$
             JOptionPane.YES_NO_OPTION);
     if (ret == JOptionPane.YES_OPTION) {
       support.removeCompanion(companion);
     }
   }
   if (CREATE_COMMAND.equals(e.getActionCommand())) {
     initDialog();
     String type = (String) selectedElement;
     companionDialog.setCharacter(character);
     companionDialog.setCompanionType(type);
     Utility.setDialogRelativeLocation(CompanionInfoTab.this, companionDialog);
     companionDialog.setVisible(true);
     CharacterFacade comp = companionDialog.getNewCompanion();
     if (comp != null) {
       selectCompanion(comp);
     }
   }
   cancelCellEditing();
 }
Пример #2
0
 @Override
 public void actionPerformed(ActionEvent e) {
   if (!"null".equals(e.getActionCommand())) {
     if ("SELECT".equals(e.getActionCommand()) || (JTreeTable.ACTION_DOUBLECLICK == e.getID())) {
       newCompanion =
           CharacterManager.createNewCharacter(
               character.getUIDelegate(), character.getDataSet());
       CompanionStubFacade selected = (CompanionStubFacade) raceTable.getSelectedObject();
       newCompanion.setRace(selected.getRaceRef().getReference());
       character.getCompanionSupport().addCompanion(newCompanion, companionType);
       setVisible(false);
     } else {
       newCompanion = null;
       setVisible(false);
     }
   }
 }
Пример #3
0
 public CompanionsModel(CharacterFacade character) {
   this.support = character.getCompanionSupport();
   this.maxMap = support.getMaxCompanionsMap();
   this.setRoot(new RootNode());
 }
Пример #4
0
 public void setCharacter(CharacterFacade character) {
   this.character = character;
   model.setDelegate(character.getCompanionSupport().getAvailableCompanions());
 }