Search in sources :

Example 1 with ComboBoxController

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

the class ItemEditionPanelController method buildSlotCombo.

private ComboBoxController<EquipmentLocation> buildSlotCombo() {
    ComboBoxController<EquipmentLocation> ctrl = new ComboBoxController<EquipmentLocation>();
    ctrl.addEmptyItem("");
    for (EquipmentLocation slot : EquipmentLocation.getAll()) {
        ctrl.addItem(slot, slot.getLabel());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController)

Example 2 with ComboBoxController

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

the class ItemEditionPanelController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    // Main data line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Icon
        _icon = GuiFactory.buildIconLabel(null);
        panelLine.add(_icon);
        // Name
        _name = GuiFactory.buildTextField("");
        _name.setFont(_name.getFont().deriveFont(16f).deriveFont(Font.BOLD));
        _name.setColumns(25);
        panelLine.add(_name);
        // Slot
        _slot = buildSlotCombo();
        panelLine.add(_slot.getComboBox());
        // Unicity
        _unique = GuiFactory.buildCheckbox("Unique");
        panelLine.add(_unique);
    }
    // Armour specifics line
    if (_item instanceof Armour) {
        _armourPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(_armourPanel, c);
        c.gridy++;
        _armourPanel.setVisible(true);
        // Armour
        JTextField armourValue = GuiFactory.buildTextField("");
        _armourValue = new IntegerEditionController(armourValue);
        _armourValue.setValueRange(Integer.valueOf(0), Integer.valueOf(50000));
        _armourPanel.add(GuiFactory.buildLabel("Armour:"));
        _armourPanel.add(_armourValue.getTextField());
        // Armour Type
        _armourType = ItemUiTools.buildArmourTypeCombo();
        _armourPanel.add(GuiFactory.buildLabel("Armour Type:"));
        _armourPanel.add(_armourType.getComboBox());
    }
    // Weapon specifics line
    if (_item instanceof Weapon) {
        _weaponPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(_weaponPanel, c);
        c.gridy++;
        _weaponPanel.setVisible(false);
        // Weapon type
        _weaponType = ItemUiTools.buildWeaponTypeCombo();
        _weaponPanel.add(GuiFactory.buildLabel("Type:"));
        _weaponPanel.add(_weaponType.getComboBox());
        // Damage
        JTextField minDamage = GuiFactory.buildTextField("");
        _minDamage = new IntegerEditionController(minDamage, 3);
        _minDamage.setValueRange(Integer.valueOf(0), Integer.valueOf(10000));
        _weaponPanel.add(GuiFactory.buildLabel("Damage:"));
        _weaponPanel.add(_minDamage.getTextField());
        _weaponPanel.add(GuiFactory.buildLabel("-"));
        JTextField maxDamage = GuiFactory.buildTextField("");
        _maxDamage = new IntegerEditionController(maxDamage, 3);
        _maxDamage.setValueRange(Integer.valueOf(0), Integer.valueOf(10000));
        _weaponPanel.add(_maxDamage.getTextField());
        // Damage type
        _damageType = buildDamageTypeCombo();
        _weaponPanel.add(_damageType.getComboBox());
        // DPS
        JTextField dps = GuiFactory.buildTextField("");
        _dps = new FloatEditionController(dps);
        _dps.setValueRange(Float.valueOf(0), Float.valueOf(1000));
        _weaponPanel.add(GuiFactory.buildLabel("DPS:"));
        _weaponPanel.add(_dps.getTextField());
    }
    // Level and binding line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Item level
        _itemLevel = new ComboBoxController<Integer>(true, Integer.class);
        panelLine.add(GuiFactory.buildLabel("Item level:"));
        panelLine.add(_itemLevel.getComboBox());
        // Minimum level
        _minLevel = new ComboBoxController<Integer>(true, Integer.class);
        panelLine.add(GuiFactory.buildLabel("Required level:"));
        panelLine.add(_minLevel.getComboBox());
        // Binding
        _binding = buildBindingCombo();
        panelLine.add(GuiFactory.buildLabel("Binding:"));
        panelLine.add(_binding.getComboBox());
    }
    // Durability/sturdiness/quality line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Durability
        JTextField durability = GuiFactory.buildTextField("");
        _durability = new IntegerEditionController(durability, 3);
        _durability.setValueRange(Integer.valueOf(1), Integer.valueOf(150));
        panelLine.add(GuiFactory.buildLabel("Durability:"));
        panelLine.add(_durability.getTextField());
        // Sturdiness
        _sturdiness = buildSturdinessCombo();
        panelLine.add(GuiFactory.buildLabel("Sturdiness:"));
        panelLine.add(_sturdiness.getComboBox());
        // Quality
        _quality = ItemUiTools.buildQualityCombo();
        panelLine.add(GuiFactory.buildLabel("Quality:"));
        panelLine.add(_quality.getComboBox());
        // Stack max
        JTextField stackMax = GuiFactory.buildTextField("");
        _stackMax = new IntegerEditionController(stackMax);
        _stackMax.setValueRange(Integer.valueOf(1), Integer.valueOf(1000));
        panelLine.add(GuiFactory.buildLabel("Stack:"));
        panelLine.add(_stackMax.getTextField());
    }
    // Contextual data line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Birth name
        _birthName = GuiFactory.buildTextField("");
        _birthName.setColumns(20);
        panelLine.add(GuiFactory.buildLabel("Name:"));
        panelLine.add(_birthName);
        // Crafter name
        _crafterName = GuiFactory.buildTextField("");
        _crafterName.setColumns(20);
        panelLine.add(GuiFactory.buildLabel("Crafter:"));
        panelLine.add(_crafterName);
    }
    // User comments
    {
        _userComments = GuiFactory.buildTextField("");
        _userComments.setColumns(40);
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        panelLine.add(GuiFactory.buildLabel("Comments:"));
        panelLine.add(_userComments);
    }
    // Tabbed pane at the bottom
    // Description
    JPanel descriptionPanel = GuiFactory.buildBackgroundPanel(new BorderLayout());
    _description = GuiFactory.buildTextArea("", false);
    _description.setColumns(40);
    _description.setLineWrap(true);
    descriptionPanel.add(_description, BorderLayout.CENTER);
    // Stats
    _stats = new StatsEditionPanelController();
    // Essences
    _essencesEditor = new EssencesEditionPanelController(_parent);
    // Tabbed pane assembly
    JTabbedPane tabbedPane = GuiFactory.buildTabbedPane();
    tabbedPane.add("Stats", _stats.getPanel());
    tabbedPane.add("Description", descriptionPanel);
    tabbedPane.add("Essences", _essencesEditor.getPanel());
    // Legendary specifics
    // - relics
    JPanel relicsPanel = null;
    if (_item instanceof Legendary) {
        Legendary legItem = (Legendary) _item;
        LegendaryAttrs attrs = new LegendaryAttrs(legItem.getLegendaryAttrs());
        _relicsEditor = new RelicsEditionPanelController(_parent, attrs);
        relicsPanel = _relicsEditor.getPanel();
        tabbedPane.add("Relics", relicsPanel);
    }
    JPanel ret = GuiFactory.buildBackgroundPanel(new BorderLayout());
    ret.add(panel, BorderLayout.NORTH);
    ret.add(tabbedPane, BorderLayout.CENTER);
    _panel = ret;
    setItem();
    return ret;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) LegendaryAttrs(delta.games.lotro.lore.items.legendary.LegendaryAttrs) GridBagLayout(java.awt.GridBagLayout) Legendary(delta.games.lotro.lore.items.legendary.Legendary) IntegerEditionController(delta.common.ui.swing.text.IntegerEditionController) RelicsEditionPanelController(delta.games.lotro.gui.items.relics.RelicsEditionPanelController) JTabbedPane(javax.swing.JTabbedPane) JTextField(javax.swing.JTextField) Weapon(delta.games.lotro.lore.items.Weapon) Armour(delta.games.lotro.lore.items.Armour) BorderLayout(java.awt.BorderLayout) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) FloatEditionController(delta.common.ui.swing.text.FloatEditionController) EssencesEditionPanelController(delta.games.lotro.gui.items.essences.EssencesEditionPanelController) StatsEditionPanelController(delta.games.lotro.gui.character.stats.StatsEditionPanelController)

Example 3 with ComboBoxController

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

the class ItemUiTools method buildArmourTypeCombo.

/**
 * Build a controller for a combo box to choose a armour type.
 * @param armourTypes Armour types to use.
 * @return A new controller.
 */
public static ComboBoxController<ArmourType> buildArmourTypeCombo(Iterable<ArmourType> armourTypes) {
    ComboBoxController<ArmourType> ctrl = new ComboBoxController<ArmourType>();
    ctrl.addEmptyItem("");
    for (ArmourType quality : armourTypes) {
        ctrl.addItem(quality, quality.getName());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController)

Example 4 with ComboBoxController

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

the class RelicsFilterController method buildTypesCombo.

private ComboBoxController<RelicType> buildTypesCombo() {
    final ComboBoxController<RelicType> ctrl = new ComboBoxController<RelicType>();
    ctrl.addEmptyItem("");
    for (RelicType type : RelicType.values()) {
        ctrl.addItem(type, type.getName());
    }
    ItemSelectionListener<RelicType> l = new ItemSelectionListener<RelicType>() {

        @Override
        public void itemSelected(RelicType type) {
            _filter.setRelicType(type);
            updateFilter();
        }
    };
    ctrl.addListener(l);
    return ctrl;
}
Also used : ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) RelicType(delta.games.lotro.lore.items.legendary.relics.RelicType)

Example 5 with ComboBoxController

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

the class CraftingWindowController method buildVocationCombo.

private ComboBoxController<Vocation> buildVocationCombo() {
    ComboBoxController<Vocation> ret = new ComboBoxController<Vocation>();
    ret.addEmptyItem("");
    List<Vocation> vocations = Vocations.getInstance().getAll();
    for (Vocation vocation : vocations) {
        ret.addItem(vocation, vocation.getName());
    }
    return ret;
}
Also used : ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) Vocation(delta.games.lotro.lore.crafting.Vocation)

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