Search in sources :

Example 1 with Size

use of delta.games.lotro.common.Size in project lotro-companion by dmorcellet.

the class WarbandsFilterController method setFilter.

private void setFilter() {
    String region = _filter.getRegion();
    _region.selectItem(region);
    Integer minLevel = _filter.getMinLevel();
    _minLevel.selectItem(minLevel);
    Size size = _filter.getSize();
    _size.selectItem(size);
}
Also used : Size(delta.games.lotro.common.Size)

Example 2 with Size

use of delta.games.lotro.common.Size in project lotro-companion by dmorcellet.

the class WarbandsFilterController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
    // Regions
    String[] regions = getRegions();
    _region = new ComboBoxController<String>();
    _region.addEmptyItem(" ");
    for (String region : regions) {
        _region.addItem(region, region);
    }
    ItemSelectionListener<String> regionListener = new ItemSelectionListener<String>() {

        @Override
        public void itemSelected(String region) {
            _filter.setRegion(region);
            updateFilter();
        }
    };
    _region.addListener(regionListener);
    panel.add(GuiFactory.buildLabel("Region:"));
    panel.add(_region.getComboBox());
    // Sizes
    Size[] sizes = { Size.SOLO, Size.SMALL_FELLOWSHIP, Size.FELLOWSHIP, Size.RAID };
    _size = new ComboBoxController<Size>();
    _size.addEmptyItem(" ");
    for (Size size : sizes) {
        _size.addItem(size, size.toString());
    }
    ItemSelectionListener<Size> sizeListener = new ItemSelectionListener<Size>() {

        @Override
        public void itemSelected(Size size) {
            _filter.setSize(size);
            updateFilter();
        }
    };
    _size.addListener(sizeListener);
    panel.add(GuiFactory.buildLabel("Size:"));
    panel.add(_size.getComboBox());
    // Levels
    Integer[] minLevels = getMinLevels();
    _minLevel = new ComboBoxController<Integer>();
    _minLevel.addEmptyItem(" ");
    for (Integer minLevel : minLevels) {
        _minLevel.addItem(minLevel, minLevel.toString());
    }
    ItemSelectionListener<Integer> minLevelListener = new ItemSelectionListener<Integer>() {

        @Override
        public void itemSelected(Integer minLevel) {
            _filter.setMinLevel(minLevel);
            updateFilter();
        }
    };
    _minLevel.addListener(minLevelListener);
    panel.add(GuiFactory.buildLabel("Minimum level:"));
    panel.add(_minLevel.getComboBox());
    // Reset
    _reset = GuiFactory.buildButton("Reset");
    _reset.addActionListener(this);
    panel.add(_reset);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) Size(delta.games.lotro.common.Size)

Aggregations

Size (delta.games.lotro.common.Size)2 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 FlowLayout (java.awt.FlowLayout)1 JPanel (javax.swing.JPanel)1