Search in sources :

Example 1 with Profession

use of delta.games.lotro.lore.crafting.Profession in project lotro-companion by dmorcellet.

the class CraftingSynopsisTableController method updateRowItems.

private void updateRowItems() {
    _rowItems.clear();
    for (CharacterFile toon : _toons) {
        CraftingStatus craftingStatus = toon.getCraftingStatus();
        List<Profession> professions = craftingStatus.getProfessions();
        GuildStatus guildStatus = craftingStatus.getGuildStatus();
        Profession guild = guildStatus.getProfession();
        for (Profession profession : professions) {
            ProfessionStatus professionStatus = craftingStatus.getProfessionStatus(profession, true);
            GuildStatus displayedStatus = (profession == guild) ? guildStatus : null;
            CraftingSynopsisItem item = new CraftingSynopsisItem(toon, professionStatus, displayedStatus);
            _rowItems.add(item);
        }
    }
}
Also used : ProfessionStatus(delta.games.lotro.character.crafting.ProfessionStatus) Profession(delta.games.lotro.lore.crafting.Profession) GuildStatus(delta.games.lotro.character.crafting.GuildStatus) CraftingStatus(delta.games.lotro.character.crafting.CraftingStatus) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 2 with Profession

use of delta.games.lotro.lore.crafting.Profession in project lotro-companion by dmorcellet.

the class CraftingWindowController method updateGuild.

private boolean updateGuild(Profession selectedGuild) {
    boolean changed = false;
    Profession currentProfession = _stats.getGuildStatus().getProfession();
    if (currentProfession != selectedGuild) {
        long now = System.currentTimeMillis();
        _stats.getGuildStatus().changeProfession(selectedGuild, now);
        changed = true;
    }
    return changed;
}
Also used : Profession(delta.games.lotro.lore.crafting.Profession)

Example 3 with Profession

use of delta.games.lotro.lore.crafting.Profession in project lotro-companion by dmorcellet.

the class CraftingWindowController method buildFormPanel.

@Override
protected JPanel buildFormPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    // Vocation panel
    JPanel vocationPanel = GuiFactory.buildPanel(new FlowLayout());
    {
        _vocation = buildVocationCombo();
        JLabel vocationLabel = GuiFactory.buildLabel("Vocation:");
        vocationPanel.add(vocationLabel);
        vocationPanel.add(_vocation.getComboBox());
    }
    // Guild panel
    JPanel guildPanel = GuiFactory.buildPanel(new FlowLayout());
    {
        _guild = new ComboBoxController<Profession>();
        JLabel guildLabel = GuiFactory.buildLabel("Guild:");
        guildPanel.add(guildLabel);
        guildPanel.add(_guild.getComboBox());
    }
    // Vocation panel
    JPanel vocationEditionPanel = _vocationController.getPanel();
    // Assembly
    JPanel topPanel = GuiFactory.buildPanel(new FlowLayout());
    topPanel.add(vocationPanel);
    topPanel.add(guildPanel);
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 10, 0, 10), 0, 0);
    panel.add(topPanel, c);
    GridBagConstraints c2 = new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 10, 5, 10), 0, 0);
    panel.add(vocationEditionPanel, c2);
    // Update vocation edition panel
    _vocationController.updateUiFromData();
    Vocation vocation = _stats.getVocation();
    // Init combos
    Profession currentGuild = _stats.getGuildStatus().getProfession();
    _vocation.selectItem(vocation);
    _guild.addEmptyItem("");
    updateGuildCombo(vocation);
    _guild.selectItem(currentGuild);
    // Init vocation combo
    ItemSelectionListener<Vocation> vocationListener = new ItemSelectionListener<Vocation>() {

        @Override
        public void itemSelected(Vocation selectedVocation) {
            handleVocationUpdate(selectedVocation);
        }
    };
    _vocation.addListener(vocationListener);
    // Init guild combo
    ItemSelectionListener<Profession> guildListener = new ItemSelectionListener<Profession>() {

        @Override
        public void itemSelected(Profession selectedGuild) {
            handleGuildUpdate(selectedGuild);
        }
    };
    _guild.addListener(guildListener);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Profession(delta.games.lotro.lore.crafting.Profession) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) JLabel(javax.swing.JLabel) Vocation(delta.games.lotro.lore.crafting.Vocation)

Example 4 with Profession

use of delta.games.lotro.lore.crafting.Profession in project lotro-companion by dmorcellet.

the class CraftingWindowController method updateGuildCombo.

private void updateGuildCombo(Vocation vocation) {
    List<Profession> oldProfessions = _guild.getItems();
    if (vocation != null) {
        // Add new professions
        for (Profession profession : vocation.getProfessions()) {
            if (profession.hasGuild()) {
                if (oldProfessions.contains(profession)) {
                    oldProfessions.remove(profession);
                } else {
                    _guild.addItem(profession, profession.getLabel());
                }
            }
        }
        // Remove obsolete professions
        for (Profession oldProfession : oldProfessions) {
            if (oldProfession != null) {
                _guild.removeItem(oldProfession);
            }
        }
    } else {
        _guild.removeAllItems();
        _guild.addEmptyItem("");
    }
}
Also used : Profession(delta.games.lotro.lore.crafting.Profession)

Example 5 with Profession

use of delta.games.lotro.lore.crafting.Profession in project lotro-companion by dmorcellet.

the class VocationEditionPanelController method updateProfessionsUi.

/**
 * Update the UI for professions.
 */
private void updateProfessionsUi() {
    Vocation vocation = _status.getVocation();
    _vocationPanel.removeAll();
    JComponent centerComponent = null;
    List<Profession> professions = (vocation != null) ? vocation.getProfessions() : null;
    if ((professions != null) && (professions.size() > 0)) {
        _tabbedPane = GuiFactory.buildTabbedPane();
        // Professions
        for (Profession profession : professions) {
            ProfessionStatus stats = _status.getProfessionStatus(profession, true);
            ProfessionStatusPanelController craftingPanelController = _panels.get(profession);
            if (craftingPanelController == null) {
                craftingPanelController = new ProfessionStatusPanelController(stats);
                _panels.put(profession, craftingPanelController);
            }
            JPanel craftingPanel = craftingPanelController.getPanel();
            _tabbedPane.add(profession.getLabel(), craftingPanel);
        }
        // Clean other professions
        for (Profession profession : Profession.getAll()) {
            if (!professions.contains(profession)) {
                _panels.remove(profession);
            }
        }
        centerComponent = _tabbedPane;
    } else {
        JLabel centerLabel = new JLabel("No vocation!");
        centerComponent = centerLabel;
        _tabbedPane = null;
    }
    _vocationPanel.add(centerComponent, BorderLayout.CENTER);
    _vocationPanel.revalidate();
    _vocationPanel.repaint();
}
Also used : ProfessionStatus(delta.games.lotro.character.crafting.ProfessionStatus) JPanel(javax.swing.JPanel) Profession(delta.games.lotro.lore.crafting.Profession) JComponent(javax.swing.JComponent) JLabel(javax.swing.JLabel) Vocation(delta.games.lotro.lore.crafting.Vocation)

Aggregations

Profession (delta.games.lotro.lore.crafting.Profession)11 JPanel (javax.swing.JPanel)6 ProfessionStatus (delta.games.lotro.character.crafting.ProfessionStatus)3 JLabel (javax.swing.JLabel)3 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)2 CharacterFile (delta.games.lotro.character.CharacterFile)2 CraftingStatus (delta.games.lotro.character.crafting.CraftingStatus)2 GuildStatus (delta.games.lotro.character.crafting.GuildStatus)2 Vocation (delta.games.lotro.lore.crafting.Vocation)2 FlowLayout (java.awt.FlowLayout)2 GridBagLayout (java.awt.GridBagLayout)2 DefaultTableCellRenderer (javax.swing.table.DefaultTableCellRenderer)2 TableCellRenderer (javax.swing.table.TableCellRenderer)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 CellDataProvider (delta.common.ui.swing.tables.CellDataProvider)1 TableColumnController (delta.common.ui.swing.tables.TableColumnController)1 LotroTestUtils (delta.games.lotro.character.log.LotroTestUtils)1 FactionStatusPanelController (delta.games.lotro.gui.stats.reputation.form.FactionStatusPanelController)1 ProfessionComparator (delta.games.lotro.lore.crafting.ProfessionComparator)1 GridBagConstraints (java.awt.GridBagConstraints)1