Search in sources :

Example 6 with ComboBoxController

use of delta.common.ui.swing.combobox.ComboBoxController 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 7 with ComboBoxController

use of delta.common.ui.swing.combobox.ComboBoxController in project lotro-companion by dmorcellet.

the class DeedUiUtils method buildVirtueCombo.

/**
 * Build a combo-box controller to choose a virtue.
 * @return A new combo-box controller.
 */
public static ComboBoxController<VirtueId> buildVirtueCombo() {
    ComboBoxController<VirtueId> ctrl = new ComboBoxController<VirtueId>();
    ctrl.addEmptyItem("");
    for (VirtueId virtue : VirtueId.values()) {
        ctrl.addItem(virtue, virtue.getLabel());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : VirtueId(delta.games.lotro.common.VirtueId) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController)

Example 8 with ComboBoxController

use of delta.common.ui.swing.combobox.ComboBoxController in project lotro-companion by dmorcellet.

the class DeedUiUtils method buildItemsCombo.

/**
 * Build a combo-box controller to choose an item name.
 * @return A new combo-box controller.
 */
public static ComboBoxController<Integer> buildItemsCombo() {
    ComboBoxController<Integer> ctrl = new ComboBoxController<Integer>();
    ctrl.addEmptyItem("");
    List<Item> items = DeedUtils.getItems();
    for (Item item : items) {
        ctrl.addItem(Integer.valueOf(item.getIdentifier()), item.getName());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : Item(delta.games.lotro.lore.items.Item) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController)

Example 9 with ComboBoxController

use of delta.common.ui.swing.combobox.ComboBoxController in project lotro-companion by dmorcellet.

the class DeedUiUtils method buildFactionCombo.

/**
 * Build a combo-box controller to choose a faction.
 * @return A new combo-box controller.
 */
public static ComboBoxController<Faction> buildFactionCombo() {
    ComboBoxController<Faction> ctrl = new ComboBoxController<Faction>();
    ctrl.addEmptyItem("");
    List<Faction> factions = FactionsRegistry.getInstance().getAll();
    for (Faction faction : factions) {
        ctrl.addItem(faction, faction.getName());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) Faction(delta.games.lotro.lore.reputation.Faction)

Example 10 with ComboBoxController

use of delta.common.ui.swing.combobox.ComboBoxController in project lotro-companion by dmorcellet.

the class CharacterUiUtils method buildServerCombo.

/**
 * Build a server combobox.
 * @return a server combobox.
 */
public static ComboBoxController<String> buildServerCombo() {
    ComboBoxController<String> ctrl = new ComboBoxController<String>();
    List<String> servers = Config.getInstance().getServerNames();
    for (String server : servers) {
        ctrl.addItem(server, server);
    }
    TypedProperties props = Config.getInstance().getParameters();
    String defaultServer = props.getStringProperty("default.server", null);
    ctrl.selectItem(defaultServer);
    return ctrl;
}
Also used : ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) TypedProperties(delta.common.utils.misc.TypedProperties)

Aggregations

ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)18 FlowLayout (java.awt.FlowLayout)3 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3 Insets (java.awt.Insets)3 JPanel (javax.swing.JPanel)3 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)2 Vocation (delta.games.lotro.lore.crafting.Vocation)2 FloatEditionController (delta.common.ui.swing.text.FloatEditionController)1 IntegerEditionController (delta.common.ui.swing.text.IntegerEditionController)1 TypedProperties (delta.common.utils.misc.TypedProperties)1 VirtueId (delta.games.lotro.common.VirtueId)1 StatsEditionPanelController (delta.games.lotro.gui.character.stats.StatsEditionPanelController)1 EssencesEditionPanelController (delta.games.lotro.gui.items.essences.EssencesEditionPanelController)1 RelicsEditionPanelController (delta.games.lotro.gui.items.relics.RelicsEditionPanelController)1 Profession (delta.games.lotro.lore.crafting.Profession)1 DeedType (delta.games.lotro.lore.deeds.DeedType)1 Armour (delta.games.lotro.lore.items.Armour)1 ArmourType (delta.games.lotro.lore.items.ArmourType)1 DamageType (delta.games.lotro.lore.items.DamageType)1