use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class CharacterDataWindowController method buildVirtuesPanel.
private JPanel buildVirtuesPanel() {
JPanel panel = GuiFactory.buildPanel(new FlowLayout());
JPanel virtuesPanel = _virtuesController.getPanel();
panel.add(virtuesPanel);
JButton button = GuiFactory.buildButton("Edit...");
panel.add(button);
ActionListener al = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
VirtuesSet virtues = VirtuesEditionDialogController.editVirtues(CharacterDataWindowController.this, _data.getVirtues());
if (virtues != null) {
_data.getVirtues().copyFrom(virtues);
_virtuesController.setVirtues(virtues);
// Broadcast virtues update event...
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _data);
EventsManager.invokeEvent(event);
}
}
};
button.addActionListener(al);
return panel;
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class CharacterDataWindowController method okImpl.
@Override
public void okImpl() {
_attrsController.get();
boolean ok = CharacterDataIO.saveInfo(_data.getFile(), _data);
if (ok) {
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _data);
EventsManager.invokeEvent(event);
} else {
// TODO warn
}
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class CharacterFileWindowController method removeCharacterData.
private void removeCharacterData() {
GenericTableController<CharacterData> controller = _toonsTable.getTableController();
CharacterData data = controller.getSelectedItem();
if (data != null) {
// Check deletion
String serverName = data.getServer();
String toonName = data.getName();
int result = GuiFactory.showQuestionDialog(getFrame(), "Do you really want to delete this configuration of " + toonName + "@" + serverName + "?", "Delete?", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.OK_OPTION) {
String id = CharacterDataWindowController.getIdentifier(data);
WindowController windowController = _windowsManager.getWindow(id);
if (windowController != null) {
windowController.dispose();
}
boolean ok = _toon.getInfosManager().remove(data);
if (ok) {
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_REMOVED, _toon, data);
EventsManager.invokeEvent(event);
}
}
}
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class CharacterFileWindowController method startNewCharacterData.
private void startNewCharacterData() {
CharacterInfosManager infos = _toon.getInfosManager();
CharacterData lastInfos = infos.getLastCharacterDescription();
CharacterData newInfos = new CharacterData();
CharacterSummary newSummary;
if (lastInfos != null) {
newSummary = new CharacterSummary(lastInfos.getSummary());
} else {
newSummary = new CharacterSummary(_toon.getSummary());
}
newInfos.setSummary(newSummary);
newInfos.setDate(Long.valueOf(System.currentTimeMillis()));
// Compute stats
CharacterStatsComputer computer = new CharacterStatsComputer();
newInfos.getStats().setStats(computer.getStats(newInfos));
boolean ok = _toon.getInfosManager().writeNewCharacterData(newInfos);
if (ok) {
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_ADDED, _toon, newInfos);
EventsManager.invokeEvent(event);
showCharacterData(newInfos);
}
}
use of delta.games.lotro.character.events.CharacterEvent in project lotro-companion by dmorcellet.
the class AllEssencesEditionPanelController method refreshToon.
private void refreshToon() {
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
EventsManager.invokeEvent(event);
}
Aggregations