Search in sources :

Example 1 with Faction

use of delta.games.lotro.lore.reputation.Faction in project lotro-companion by dmorcellet.

the class CharacterReputationDialogController method actionPerformed.

@Override
public void actionPerformed(ActionEvent event) {
    // +/- buttons
    Object source = event.getSource();
    for (FactionEditionPanelController editor : _editors.values()) {
        if (source == editor.getMinusButton()) {
            Faction faction = editor.getFaction();
            _data.updateFaction(faction, false);
            updateFactionDisplay(editor);
            _deedsDisplay.update();
            _rewardsDisplay.update();
        } else if (source == editor.getPlusButton()) {
            Faction faction = editor.getFaction();
            _data.updateFaction(faction, true);
            updateFactionDisplay(editor);
            _deedsDisplay.update();
            _rewardsDisplay.update();
        } else if (source == editor.getEditButton()) {
            Faction faction = editor.getFaction();
            FactionStatus status = _data.getOrCreateFactionStat(faction);
            FactionEditionDialogController edit = new FactionEditionDialogController(this, status);
            edit.show(true);
            updateFactionDisplay(editor);
            _deedsDisplay.update();
            _rewardsDisplay.update();
        }
    }
}
Also used : FactionEditionDialogController(delta.games.lotro.gui.stats.reputation.form.FactionEditionDialogController) FactionStatus(delta.games.lotro.character.reputation.FactionStatus) Faction(delta.games.lotro.lore.reputation.Faction)

Example 2 with Faction

use of delta.games.lotro.lore.reputation.Faction in project lotro-companion by dmorcellet.

the class CharacterReputationDialogController method updateFactionDisplay.

private void updateFactionDisplay(FactionEditionPanelController editor) {
    Faction faction = editor.getFaction();
    FactionLevel current;
    FactionStatus factionStatus = _data.getFactionStatus(faction);
    if (factionStatus != null) {
        current = factionStatus.getFactionLevel();
    } else {
        current = faction.getInitialLevel();
    }
    editor.setFactionLevel(current);
}
Also used : FactionLevel(delta.games.lotro.lore.reputation.FactionLevel) FactionStatus(delta.games.lotro.character.reputation.FactionStatus) Faction(delta.games.lotro.lore.reputation.Faction)

Example 3 with Faction

use of delta.games.lotro.lore.reputation.Faction in project lotro-companion by dmorcellet.

the class FactionStatusEditionPanelController method handleCompletionChange.

private void handleCompletionChange(Object source) {
    int index = 0;
    Faction faction = _status.getFaction();
    for (FactionLevel level : faction.getLevels()) {
        FactionLevelEditionGadgets gadgets = _gadgets.get(index);
        if (source == gadgets.getCompleted().getCheckbox()) {
            boolean completed = gadgets.getCompleted().isSelected();
            _status.setCompletionStatus(level, completed);
            _status.updateCurrentLevel();
            triggerChartUpdateTimer();
            break;
        }
        index++;
    }
    updateUi();
}
Also used : FactionLevel(delta.games.lotro.lore.reputation.FactionLevel) Faction(delta.games.lotro.lore.reputation.Faction)

Example 4 with Faction

use of delta.games.lotro.lore.reputation.Faction in project lotro-companion by dmorcellet.

the class FactionStatusEditionPanelController method buildStatusEditionPanel.

private JPanel buildStatusEditionPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    // Header row 1
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
    JLabel tier = GuiFactory.buildLabel("Rank");
    panel.add(tier, c);
    // Header row 2
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    panel.add(GuiFactory.buildLabel("Completed"), c);
    c.gridx++;
    panel.add(GuiFactory.buildLabel("XP"), c);
    c.gridx++;
    panel.add(GuiFactory.buildLabel("Completion date"), c);
    c.gridx++;
    c.gridy++;
    ActionListener l = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            handleCompletionChange(e.getSource());
        }
    };
    DateListener dateListener = new DateListener() {

        @Override
        public void dateChanged(DateEditionController controller, Long newDate) {
            long date = (newDate != null) ? newDate.longValue() : 0;
            handleDateChange(controller, date);
        }
    };
    // Data rows
    Faction faction = _status.getFaction();
    for (FactionLevel level : faction.getLevels()) {
        FactionLevelStatus levelStatus = _status.getStatusForLevel(level);
        c.gridx = 0;
        JLabel tierLabel = GuiFactory.buildLabel(level.toString());
        panel.add(tierLabel, c);
        c.gridx++;
        FactionLevelEditionGadgets gadgets = new FactionLevelEditionGadgets(levelStatus);
        CheckboxController checkboxCtrl = gadgets.getCompleted();
        JCheckBox checkbox = checkboxCtrl.getCheckbox();
        panel.add(checkbox, c);
        checkbox.addActionListener(l);
        c.gridx++;
        panel.add(gadgets.getXp().getTextField(), c);
        c.gridx++;
        DateEditionController dateCompletion = gadgets.getCompletionDate();
        dateCompletion.addListener(dateListener);
        panel.add(dateCompletion.getTextField(), c);
        c.gridx++;
        _gadgets.add(gadgets);
        c.gridy++;
        if (level == faction.getInitialLevel()) {
            checkboxCtrl.setState(false);
        }
    }
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) CheckboxController(delta.common.ui.swing.checkbox.CheckboxController) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) FactionLevel(delta.games.lotro.lore.reputation.FactionLevel) JCheckBox(javax.swing.JCheckBox) ActionListener(java.awt.event.ActionListener) DateListener(delta.common.ui.swing.text.dates.DateListener) DateEditionController(delta.common.ui.swing.text.dates.DateEditionController) FactionLevelStatus(delta.games.lotro.character.reputation.FactionLevelStatus) Faction(delta.games.lotro.lore.reputation.Faction)

Example 5 with Faction

use of delta.games.lotro.lore.reputation.Faction in project lotro-companion by dmorcellet.

the class ReputationSynopsisTableController method buildDataProvider.

private DataProvider<Faction> buildDataProvider() {
    FactionsRegistry registry = FactionsRegistry.getInstance();
    List<Faction> factions = registry.getAll();
    DataProvider<Faction> ret = new ListDataProvider<Faction>(factions);
    return ret;
}
Also used : ListDataProvider(delta.common.ui.swing.tables.ListDataProvider) FactionsRegistry(delta.games.lotro.lore.reputation.FactionsRegistry) Faction(delta.games.lotro.lore.reputation.Faction)

Aggregations

Faction (delta.games.lotro.lore.reputation.Faction)20 FactionLevel (delta.games.lotro.lore.reputation.FactionLevel)6 JPanel (javax.swing.JPanel)5 FactionLevelStatus (delta.games.lotro.character.reputation.FactionLevelStatus)3 FactionStatus (delta.games.lotro.character.reputation.FactionStatus)3 ReputationItem (delta.games.lotro.common.ReputationItem)3 FactionsRegistry (delta.games.lotro.lore.reputation.FactionsRegistry)3 GridBagLayout (java.awt.GridBagLayout)3 CellDataProvider (delta.common.ui.swing.tables.CellDataProvider)2 TableColumnController (delta.common.ui.swing.tables.TableColumnController)2 Reputation (delta.games.lotro.common.Reputation)2 VirtueId (delta.games.lotro.common.VirtueId)2 ReputationRewardFilter (delta.games.lotro.common.rewards.filters.ReputationRewardFilter)2 BorderLayout (java.awt.BorderLayout)2 GridBagConstraints (java.awt.GridBagConstraints)2 Insets (java.awt.Insets)2 TableCellRenderer (javax.swing.table.TableCellRenderer)2 CheckboxController (delta.common.ui.swing.checkbox.CheckboxController)1 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1