Search in sources :

Example 1 with FactionsRegistry

use of delta.games.lotro.lore.reputation.FactionsRegistry 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)

Example 2 with FactionsRegistry

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

the class ReputationDeedsDisplayController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    FactionsRegistry registry = FactionsRegistry.getInstance();
    int y = 0;
    List<ReputationDeed> deeds = registry.getReputationDeeds();
    for (ReputationDeed deed : deeds) {
        String deedName = deed.getName();
        JLabel label = GuiFactory.buildLabel(deedName + ":");
        label.setToolTipText("Status for the '" + deedName + "' deed");
        GridBagConstraints c = new GridBagConstraints(0, y, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
        panel.add(label, c);
        c.gridx++;
        c.weightx = 1.0;
        c.fill = GridBagConstraints.HORIZONTAL;
        JLabel countLabel = GuiFactory.buildLabel("NN / NN");
        panel.add(countLabel, c);
        _countLabels.add(countLabel);
        y++;
    }
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) FactionsRegistry(delta.games.lotro.lore.reputation.FactionsRegistry) ReputationDeed(delta.games.lotro.lore.reputation.ReputationDeed) JLabel(javax.swing.JLabel)

Example 3 with FactionsRegistry

use of delta.games.lotro.lore.reputation.FactionsRegistry in project lotro-tools by dmorcellet.

the class LotroCompendiumDeedsLoader method handleReputation.

@SuppressWarnings("unchecked")
private void handleReputation(Rewards rewards, List<Object> reputationItems) {
    // reputation={{val="+700 with Iron Garrison Guards"}}
    if (reputationItems == null) {
        return;
    }
    FactionsRegistry registry = FactionsRegistry.getInstance();
    Reputation reputation = rewards.getReputation();
    for (Object reputationItem : reputationItems) {
        Map<String, Object> reputationMap = (Map<String, Object>) reputationItem;
        String reputationStr = (String) reputationMap.get("val");
        int spaceIndex = reputationStr.indexOf(" ");
        Integer value = NumericTools.parseInteger(reputationStr.substring(0, spaceIndex));
        String factionStr = reputationStr.substring(spaceIndex + 1).trim();
        if (factionStr.startsWith("with "))
            factionStr = factionStr.substring(5);
        Faction faction = registry.getByName(factionStr);
        if ((faction != null) && (value != null)) {
            ReputationItem repItem = new ReputationItem(faction);
            repItem.setAmount(value.intValue());
            reputation.add(repItem);
        } else {
            System.out.println("Not handled [" + reputationStr + "]");
        }
    }
}
Also used : FactionsRegistry(delta.games.lotro.lore.reputation.FactionsRegistry) Reputation(delta.games.lotro.common.Reputation) Map(java.util.Map) ReputationItem(delta.games.lotro.common.ReputationItem) Faction(delta.games.lotro.lore.reputation.Faction)

Example 4 with FactionsRegistry

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

the class CharacterReputationDialogController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildPanel(new BorderLayout());
    // Top: reputation deeds
    JPanel topPanel = buildTopPanel();
    panel.add(topPanel, BorderLayout.NORTH);
    // Center: faction levels
    FactionsRegistry registry = FactionsRegistry.getInstance();
    JTabbedPane tabs = GuiFactory.buildTabbedPane();
    List<String> categories = registry.getFactionCategories();
    for (String category : categories) {
        List<Faction> factions = registry.getFactionsForCategory(category);
        JPanel reputationPanel = buildReputationPanelForCategory(category, factions);
        JPanel tabPanel = GuiFactory.buildPanel(new BorderLayout());
        tabPanel.setOpaque(true);
        tabPanel.setBackground(Color.RED);
        tabPanel.add(reputationPanel, BorderLayout.CENTER);
        tabs.add(category, tabPanel);
    }
    TitledBorder factionsBorder = GuiFactory.buildTitledBorder("Factions");
    tabs.setBorder(factionsBorder);
    panel.add(tabs, BorderLayout.CENTER);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) BorderLayout(java.awt.BorderLayout) FactionsRegistry(delta.games.lotro.lore.reputation.FactionsRegistry) JTabbedPane(javax.swing.JTabbedPane) TitledBorder(javax.swing.border.TitledBorder) Faction(delta.games.lotro.lore.reputation.Faction)

Example 5 with FactionsRegistry

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

the class ReputationSynopsisFilterController method getCategories.

private String[] getCategories() {
    FactionsRegistry registry = FactionsRegistry.getInstance();
    List<String> categories = registry.getFactionCategories();
    String[] ret = categories.toArray(new String[categories.size()]);
    return ret;
}
Also used : FactionsRegistry(delta.games.lotro.lore.reputation.FactionsRegistry)

Aggregations

FactionsRegistry (delta.games.lotro.lore.reputation.FactionsRegistry)5 Faction (delta.games.lotro.lore.reputation.Faction)3 JPanel (javax.swing.JPanel)2 ListDataProvider (delta.common.ui.swing.tables.ListDataProvider)1 Reputation (delta.games.lotro.common.Reputation)1 ReputationItem (delta.games.lotro.common.ReputationItem)1 ReputationDeed (delta.games.lotro.lore.reputation.ReputationDeed)1 BorderLayout (java.awt.BorderLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Map (java.util.Map)1 JLabel (javax.swing.JLabel)1 JTabbedPane (javax.swing.JTabbedPane)1 TitledBorder (javax.swing.border.TitledBorder)1