Search in sources :

Example 6 with Profession

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

the class CraftingSynopsisFilterController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
    // Professions
    List<Profession> professions = Profession.getAll();
    _professions = new ComboBoxController<Profession>();
    _professions.addEmptyItem(" ");
    for (Profession profession : professions) {
        _professions.addItem(profession, profession.getLabel());
    }
    ItemSelectionListener<Profession> listener = new ItemSelectionListener<Profession>() {

        @Override
        public void itemSelected(Profession profession) {
            _filter.setProfession(profession);
            updateFilter();
        }
    };
    _professions.addListener(listener);
    panel.add(GuiFactory.buildLabel("Profession:"));
    panel.add(_professions.getComboBox());
    return panel;
}
Also used : JPanel(javax.swing.JPanel) Profession(delta.games.lotro.lore.crafting.Profession) FlowLayout(java.awt.FlowLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener)

Example 7 with Profession

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

the class MainTestCraftingHistoryChart method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    Locale.setDefault(Locale.US);
    LotroTestUtils utils = new LotroTestUtils();
    // for(CharacterFile toon : utils.getAllFiles())
    {
        CharacterFile toon = utils.getMainToon();
        CraftingStatus stats = toon.getCraftingStatus();
        stats.dump(System.out);
        List<Profession> professions = stats.getProfessions();
        for (Profession profession : professions) {
            ProfessionStatus stat = stats.getProfessionStatus(profession);
            JFrame f = new JFrame();
            ProfessionStatusPanelController controller = new ProfessionStatusPanelController(stat);
            JPanel panel = controller.getPanel();
            f.getContentPane().add(panel);
            f.pack();
            f.setVisible(true);
            f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        }
    }
}
Also used : ProfessionStatus(delta.games.lotro.character.crafting.ProfessionStatus) JPanel(javax.swing.JPanel) Profession(delta.games.lotro.lore.crafting.Profession) LotroTestUtils(delta.games.lotro.character.log.LotroTestUtils) JFrame(javax.swing.JFrame) CraftingStatus(delta.games.lotro.character.crafting.CraftingStatus) List(java.util.List) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 8 with Profession

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

the class CraftingSynopsisTableController method buildProfessionColumn.

private TableColumnController<CraftingSynopsisItem, Profession> buildProfessionColumn() {
    CellDataProvider<CraftingSynopsisItem, Profession> professionCell = new CellDataProvider<CraftingSynopsisItem, Profession>() {

        @Override
        public Profession getData(CraftingSynopsisItem item) {
            return item.getProfession();
        }
    };
    TableColumnController<CraftingSynopsisItem, Profession> professionColumn = new TableColumnController<CraftingSynopsisItem, Profession>("Profession", Profession.class, professionCell);
    professionColumn.setWidthSpecs(50, 50, 50);
    // Header renderer
    JPanel emptyHeaderPanel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    TableCellRenderer headerRenderer = buildSimpleCellRenderer(emptyHeaderPanel);
    professionColumn.setHeaderCellRenderer(headerRenderer);
    // Cell renderer
    TableCellRenderer cellRenderer = buildProfessionCellRenderer();
    professionColumn.setCellRenderer(cellRenderer);
    // Comparator
    ProfessionComparator comparator = new ProfessionComparator();
    professionColumn.setComparator(comparator);
    return professionColumn;
}
Also used : JPanel(javax.swing.JPanel) TableCellRenderer(javax.swing.table.TableCellRenderer) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) ProfessionComparator(delta.games.lotro.lore.crafting.ProfessionComparator) Profession(delta.games.lotro.lore.crafting.Profession) GridBagLayout(java.awt.GridBagLayout) TableColumnController(delta.common.ui.swing.tables.TableColumnController) CellDataProvider(delta.common.ui.swing.tables.CellDataProvider)

Example 9 with Profession

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

the class CraftingSynopsisTableController method buildProfessionCellRenderer.

private TableCellRenderer buildProfessionCellRenderer() {
    TableCellRenderer renderer = new DefaultTableCellRenderer() {

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
            Profession profession = (Profession) value;
            Icon icon = LotroIconsManager.getProfessionIcon(profession);
            label.setHorizontalAlignment(SwingConstants.CENTER);
            label.setIcon(icon);
            label.setToolTipText(profession.getLabel());
            label.setText("");
            return label;
        }
    };
    return renderer;
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer) Profession(delta.games.lotro.lore.crafting.Profession) JTable(javax.swing.JTable) JLabel(javax.swing.JLabel) Icon(javax.swing.Icon) DefaultTableCellRenderer(javax.swing.table.DefaultTableCellRenderer)

Example 10 with Profession

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

the class VocationEditionPanelController method updateGuildUi.

/**
 * Update the UI for guild edition.
 */
public void updateGuildUi() {
    // Cleanup
    if ((_guildStatus != null) && (_tabbedPane != null)) {
        JPanel guildPanel = _guildStatus.getPanel();
        _tabbedPane.remove(guildPanel);
    }
    GuildStatus guildStatus = _status.getGuildStatus();
    Profession guild = guildStatus.getProfession();
    // Add tab if needed
    if (guild != null) {
        _guildStatus = new FactionStatusPanelController(guildStatus.getFactionStatus());
        JPanel guildPanel = _guildStatus.getPanel();
        _tabbedPane.add("Guild", guildPanel);
        _tabbedPane.setSelectedComponent(guildPanel);
    }
}
Also used : JPanel(javax.swing.JPanel) Profession(delta.games.lotro.lore.crafting.Profession) FactionStatusPanelController(delta.games.lotro.gui.stats.reputation.form.FactionStatusPanelController) GuildStatus(delta.games.lotro.character.crafting.GuildStatus)

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