use of delta.games.lotro.character.CharactersManager in project lotro-companion by dmorcellet.
the class ReputationSynopsisPanelController method doChooseToons.
private void doChooseToons() {
CharactersManager manager = CharactersManager.getInstance();
List<CharacterFile> toons = manager.getAllToons();
List<CharacterFile> selectedToons = _tableController.getToons();
List<CharacterFile> newSelectedToons = CharactersChooserController.selectToons(_parent, toons, selectedToons);
if (newSelectedToons != null) {
_tableController.setToons(newSelectedToons);
}
}
use of delta.games.lotro.character.CharactersManager in project lotro-companion by dmorcellet.
the class ToonsManagementController method deleteToon.
private void deleteToon() {
GenericTableController<CharacterFile> controller = _toonsTable.getTableController();
CharacterFile file = controller.getSelectedItem();
if (file != null) {
String serverName = file.getServerName();
String toonName = file.getName();
// Check deletion
int result = GuiFactory.showQuestionDialog(_parentController.getWindow(), "Do you really want to delete " + toonName + "@" + serverName + "?", "Delete?", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.OK_OPTION) {
String id = CharacterFileWindowController.getIdentifier(serverName, toonName);
WindowController windowController = _mainWindowsManager.getWindow(id);
if (windowController != null) {
windowController.dispose();
}
CharactersManager manager = CharactersManager.getInstance();
manager.removeToon(file);
}
}
}
use of delta.games.lotro.character.CharactersManager in project lotro-companion by dmorcellet.
the class ToonsManagementController method importToon.
private void importToon() {
FileChooserController ctrl = new FileChooserController("import", "Import character...");
Window window = _parentController.getWindow();
File fromFile = ctrl.chooseFile(window, "Import");
if (fromFile != null) {
CharacterXMLParser parser = new CharacterXMLParser();
CharacterData data = new CharacterData();
boolean ok = parser.parseXML(fromFile, data);
if (ok) {
CharactersManager manager = CharactersManager.getInstance();
CharacterFile toon = manager.getToonById(data.getServer(), data.getName());
if (toon != null) {
CharacterInfosManager infos = toon.getInfosManager();
ok = infos.writeNewCharacterData(data);
if (ok) {
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_ADDED, toon, data);
EventsManager.invokeEvent(event);
}
} else {
CharacterFile newFile = manager.addToon(data);
ok = (newFile != null);
}
if (ok) {
GuiFactory.showInformationDialog(window, "Import OK!", "OK!");
} else {
GuiFactory.showErrorDialog(window, "Import failed!", "Error!");
}
} else {
GuiFactory.showErrorDialog(window, "Import failed (bad XML file)!", "Error!");
}
}
}
use of delta.games.lotro.character.CharactersManager in project lotro-companion by dmorcellet.
the class ToonsTableController method init.
private void init() {
reset();
CharactersManager manager = CharactersManager.getInstance();
List<CharacterFile> toons = manager.getAllToons();
for (CharacterFile toon : toons) {
loadToon(toon);
}
}
Aggregations