Search in sources :

Example 1 with VirtuesSet

use of delta.games.lotro.character.stats.virtues.VirtuesSet 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 VirtuesSet

use of delta.games.lotro.character.stats.virtues.VirtuesSet in project lotro-companion by dmorcellet.

the class VirtuesEditionPanelController method getVirtues.

/**
 * Get the current virtues values.
 * @return the currently displayed virtues definition.
 */
public VirtuesSet getVirtues() {
    VirtuesSet ret = new VirtuesSet();
    for (VirtueId virtueId : VirtueId.values()) {
        VirtueEditionUiController ui = _virtues.get(virtueId);
        int tier = ui.getTier();
        ret.setVirtueValue(virtueId, tier);
    }
    _selectedVirtues.getSelectedVirtues(ret);
    return ret;
}
Also used : VirtueId(delta.games.lotro.common.VirtueId) VirtuesSet(delta.games.lotro.character.stats.virtues.VirtuesSet)

Example 3 with VirtuesSet

use of delta.games.lotro.character.stats.virtues.VirtuesSet in project lotro-companion by dmorcellet.

the class VirtuesEditionDialogController method editVirtues.

/**
 * Edit virtues.
 * @param parent Parent controller.
 * @param virtues Virtues to show.
 * @return The edited virtues or <code>null</code> if the window was closed or canceled.
 */
public static VirtuesSet editVirtues(WindowController parent, VirtuesSet virtues) {
    VirtuesEditionDialogController controller = new VirtuesEditionDialogController(parent, virtues);
    VirtuesSet editedVirtues = controller.editModal();
    return editedVirtues;
}
Also used : VirtuesSet(delta.games.lotro.character.stats.virtues.VirtuesSet)

Example 4 with VirtuesSet

use of delta.games.lotro.character.stats.virtues.VirtuesSet in project lotro-companion by dmorcellet.

the class MainTestVirtuesDisplayPanel method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    CharacterGenerationTools tools = new CharacterGenerationTools();
    CharacterGeneratorMeva mevaGenerator = new CharacterGeneratorMeva(tools);
    CharacterData meva = mevaGenerator.buildCharacter();
    meva.setDate(Long.valueOf(System.currentTimeMillis()));
    VirtuesDisplayPanelController panelCtrl = new VirtuesDisplayPanelController();
    VirtuesSet virtues = meva.getVirtues();
    virtues.setSelectedVirtue(null, 1);
    panelCtrl.setVirtues(virtues);
    JFrame frame = new JFrame();
    frame.add(panelCtrl.getPanel());
    frame.pack();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setVisible(true);
}
Also used : CharacterData(delta.games.lotro.character.CharacterData) CharacterGeneratorMeva(delta.games.lotro.character.stats.CharacterGeneratorMeva) JFrame(javax.swing.JFrame) VirtuesSet(delta.games.lotro.character.stats.virtues.VirtuesSet) CharacterGenerationTools(delta.games.lotro.character.stats.CharacterGenerationTools)

Example 5 with VirtuesSet

use of delta.games.lotro.character.stats.virtues.VirtuesSet in project lotro-companion by dmorcellet.

the class MainTestVirtuesEditionPanel method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    CharacterGenerationTools tools = new CharacterGenerationTools();
    CharacterGeneratorMeva mevaGenerator = new CharacterGeneratorMeva(tools);
    CharacterData meva = mevaGenerator.buildCharacter();
    VirtuesSet virtues = meva.getVirtues();
    virtues.setSelectedVirtue(null, 1);
    VirtuesEditionPanelController panelCtrl = new VirtuesEditionPanelController();
    panelCtrl.setVirtues(virtues);
    JFrame frame = new JFrame("Virtues edition");
    frame.add(panelCtrl.getPanel());
    frame.pack();
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setVisible(true);
}
Also used : CharacterData(delta.games.lotro.character.CharacterData) CharacterGeneratorMeva(delta.games.lotro.character.stats.CharacterGeneratorMeva) JFrame(javax.swing.JFrame) VirtuesSet(delta.games.lotro.character.stats.virtues.VirtuesSet) CharacterGenerationTools(delta.games.lotro.character.stats.CharacterGenerationTools)

Aggregations

VirtuesSet (delta.games.lotro.character.stats.virtues.VirtuesSet)5 CharacterData (delta.games.lotro.character.CharacterData)2 CharacterGenerationTools (delta.games.lotro.character.stats.CharacterGenerationTools)2 CharacterGeneratorMeva (delta.games.lotro.character.stats.CharacterGeneratorMeva)2 JFrame (javax.swing.JFrame)2 CharacterEvent (delta.games.lotro.character.events.CharacterEvent)1 VirtueId (delta.games.lotro.common.VirtueId)1 FlowLayout (java.awt.FlowLayout)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 JButton (javax.swing.JButton)1 JPanel (javax.swing.JPanel)1