Search in sources :

Example 1 with IntegerEditionController

use of delta.common.ui.swing.text.IntegerEditionController 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 2 with IntegerEditionController

use of delta.common.ui.swing.text.IntegerEditionController in project lotro-companion by dmorcellet.

the class StatCurvesConfigurationPanel method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
    // Level
    panel.add(GuiFactory.buildLabel("Level:"), c);
    c.gridx++;
    _level = CharacterUiUtils.buildLevelCombo();
    _level.selectItem(Integer.valueOf(_config.getLevel()));
    panel.add(_level.getComboBox(), c);
    ItemSelectionListener<Integer> listener = new ItemSelectionListener<Integer>() {

        @Override
        public void itemSelected(Integer item) {
            updateLevel(item.intValue());
        }
    };
    _level.addListener(listener);
    // Max rating
    c.gridx = 0;
    c.gridy++;
    panel.add(GuiFactory.buildLabel("Max rating:"), c);
    c.gridx++;
    _maxRating = new IntegerEditionController(GuiFactory.buildTextField(""));
    _maxRating.setValueRange(Integer.valueOf(1), Integer.valueOf(5000000));
    _maxRating.setValue(Integer.valueOf((int) _config.getMaxRating()));
    _maxRating.getTextField().setColumns(5);
    panel.add(_maxRating.getTextField(), c);
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updateMaxRating();
        }
    };
    _maxRating.getTextField().addActionListener(al);
    c.gridx++;
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) IntegerEditionController(delta.common.ui.swing.text.IntegerEditionController) ActionEvent(java.awt.event.ActionEvent)

Aggregations

IntegerEditionController (delta.common.ui.swing.text.IntegerEditionController)2 GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 Insets (java.awt.Insets)2 JPanel (javax.swing.JPanel)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 FloatEditionController (delta.common.ui.swing.text.FloatEditionController)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 Armour (delta.games.lotro.lore.items.Armour)1 Weapon (delta.games.lotro.lore.items.Weapon)1 Legendary (delta.games.lotro.lore.items.legendary.Legendary)1 LegendaryAttrs (delta.games.lotro.lore.items.legendary.LegendaryAttrs)1 BorderLayout (java.awt.BorderLayout)1 FlowLayout (java.awt.FlowLayout)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 JTabbedPane (javax.swing.JTabbedPane)1