Search in sources :

Example 1 with CharacterEvent

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;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) VirtuesSet(delta.games.lotro.character.stats.virtues.VirtuesSet) JButton(javax.swing.JButton)

Example 2 with CharacterEvent

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
    }
}
Also used : CharacterEvent(delta.games.lotro.character.events.CharacterEvent)

Example 3 with CharacterEvent

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);
            }
        }
    }
}
Also used : CharacterEvent(delta.games.lotro.character.events.CharacterEvent) CharacterData(delta.games.lotro.character.CharacterData) CraftingWindowController(delta.games.lotro.gui.stats.crafting.CraftingWindowController) WindowController(delta.common.ui.swing.windows.WindowController) DefaultWindowController(delta.common.ui.swing.windows.DefaultWindowController) StashWindowController(delta.games.lotro.gui.character.stash.StashWindowController) TraitPointsEditionWindowController(delta.games.lotro.gui.stats.traitPoints.TraitPointsEditionWindowController) CharacterLogWindowController(delta.games.lotro.gui.log.CharacterLogWindowController)

Example 4 with CharacterEvent

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);
    }
}
Also used : CharacterSummary(delta.games.lotro.character.CharacterSummary) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) CharacterData(delta.games.lotro.character.CharacterData) CharacterStatsComputer(delta.games.lotro.character.stats.CharacterStatsComputer) CharacterInfosManager(delta.games.lotro.character.CharacterInfosManager)

Example 5 with CharacterEvent

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);
}
Also used : CharacterEvent(delta.games.lotro.character.events.CharacterEvent)

Aggregations

CharacterEvent (delta.games.lotro.character.events.CharacterEvent)17 CharacterData (delta.games.lotro.character.CharacterData)4 CharacterInfosManager (delta.games.lotro.character.CharacterInfosManager)3 BuffsManager (delta.games.lotro.character.stats.buffs.BuffsManager)3 CharacterSummary (delta.games.lotro.character.CharacterSummary)2 BuffInstance (delta.games.lotro.character.stats.buffs.BuffInstance)2 FlowLayout (java.awt.FlowLayout)2 JPanel (javax.swing.JPanel)2 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 DateEditionController (delta.common.ui.swing.text.dates.DateEditionController)1 DefaultWindowController (delta.common.ui.swing.windows.DefaultWindowController)1 WindowController (delta.common.ui.swing.windows.WindowController)1 CharacterEquipment (delta.games.lotro.character.CharacterEquipment)1 SlotContents (delta.games.lotro.character.CharacterEquipment.SlotContents)1 CharacterFile (delta.games.lotro.character.CharacterFile)1 CharactersManager (delta.games.lotro.character.CharactersManager)1 CharacterXMLParser (delta.games.lotro.character.io.xml.CharacterXMLParser)1 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)1 STAT (delta.games.lotro.character.stats.STAT)1 Buff (delta.games.lotro.character.stats.buffs.Buff)1