use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.
the class ReputationSynopsisFilterController method build.
private JPanel build() {
JPanel panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
// Regions
String[] categories = getCategories();
_category = new ComboBoxController<String>();
_category.addEmptyItem(" ");
for (String category : categories) {
_category.addItem(category, category);
}
ItemSelectionListener<String> categoryListener = new ItemSelectionListener<String>() {
@Override
public void itemSelected(String region) {
_filter.setCategory(region);
updateFilter();
}
};
_category.addListener(categoryListener);
panel.add(GuiFactory.buildLabel("Category:"));
panel.add(_category.getComboBox());
return panel;
}
use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.
the class DeedFilterController method buildTitlesCombobox.
private ComboBoxController<String> buildTitlesCombobox() {
ComboBoxController<String> combo = DeedUiUtils.buildTitlesCombo();
ItemSelectionListener<String> listener = new ItemSelectionListener<String>() {
@Override
public void itemSelected(String title) {
TitleRewardFilter filter = _filter.getTitleFilter();
filter.setTitle(title);
filterUpdated();
}
};
combo.addListener(listener);
return combo;
}
use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.
the class ItemFilterController method build.
private JPanel build() {
JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
JPanel line1Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
// Quality
{
JPanel qualityPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
qualityPanel.add(GuiFactory.buildLabel("Quality:"));
_quality = ItemUiTools.buildQualityCombo();
ItemSelectionListener<ItemQuality> qualityListener = new ItemSelectionListener<ItemQuality>() {
@Override
public void itemSelected(ItemQuality quality) {
_qualityFilter.setQuality(quality);
filterUpdated();
}
};
_quality.addListener(qualityListener);
qualityPanel.add(_quality.getComboBox());
line1Panel.add(qualityPanel);
}
// Label filter
{
JPanel containsPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
containsPanel.add(GuiFactory.buildLabel("Label filter:"));
_contains = GuiFactory.buildTextField("");
_contains.setColumns(20);
containsPanel.add(_contains);
TextListener listener = new TextListener() {
@Override
public void textChanged(String newText) {
if (newText.length() == 0)
newText = null;
_nameFilter.setPattern(newText);
filterUpdated();
}
};
_textController = new DynamicTextEditionController(_contains, listener);
line1Panel.add(containsPanel);
}
// Line 2: weapon type, armour type, shield type
JPanel line2Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
// Weapon type
if (_weaponType != null) {
JPanel weaponTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
weaponTypePanel.add(GuiFactory.buildLabel("Weapon type:"));
ItemSelectionListener<WeaponType> weaponTypeListener = new ItemSelectionListener<WeaponType>() {
@Override
public void itemSelected(WeaponType type) {
_weaponTypeFilter.setWeaponType(type);
// If a weapon type is selected,
if (type != null) {
// Reset the shield type combo
if (_armourType != null) {
_armourType.selectItem(null);
}
// Reset the shield type combo
if (_shieldType != null) {
_shieldType.selectItem(null);
}
}
filterUpdated();
}
};
_weaponType.addListener(weaponTypeListener);
weaponTypePanel.add(_weaponType.getComboBox());
line2Panel.add(weaponTypePanel);
}
// Armour type
if (_armourType != null) {
JPanel armourTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
armourTypePanel.add(GuiFactory.buildLabel("Armour type:"));
ItemSelectionListener<ArmourType> armourTypeListener = new ItemSelectionListener<ArmourType>() {
@Override
public void itemSelected(ArmourType type) {
_armourTypeFilter.setArmourType(type);
// If an armour type is selected,
if (type != null) {
// Reset the weapon type combo
if (_weaponType != null) {
_weaponType.selectItem(null);
}
// Reset the shield type combo
if (_shieldType != null) {
_shieldType.selectItem(null);
}
}
filterUpdated();
}
};
_armourType.addListener(armourTypeListener);
armourTypePanel.add(_armourType.getComboBox());
line2Panel.add(armourTypePanel);
}
// Shield type
if (_shieldType != null) {
JPanel shieldTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
shieldTypePanel.add(GuiFactory.buildLabel("Shield type:"));
ItemSelectionListener<ArmourType> shieldTypeListener = new ItemSelectionListener<ArmourType>() {
@Override
public void itemSelected(ArmourType type) {
_shieldTypeFilter.setArmourType(type);
// If a shield type is selected,
if (type != null) {
// Reset the weapon type combo
if (_weaponType != null) {
_weaponType.selectItem(null);
}
// Reset the armour type combo
if (_armourType != null) {
_armourType.selectItem(null);
}
}
filterUpdated();
}
};
_shieldType.addListener(shieldTypeListener);
shieldTypePanel.add(_shieldType.getComboBox());
line2Panel.add(shieldTypePanel);
}
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(line1Panel, c);
c = new GridBagConstraints(0, 1, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(line2Panel, c);
return panel;
}
use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.
the class DeedFilterController method buildLotroPointsCombobox.
private ComboBoxController<Boolean> buildLotroPointsCombobox() {
ComboBoxController<Boolean> combo = build3StatesBooleanCombobox();
ItemSelectionListener<Boolean> listener = new ItemSelectionListener<Boolean>() {
@Override
public void itemSelected(Boolean value) {
LotroPointsRewardFilter filter = _filter.getLotroPointsFilter();
filter.setHasLotroPointsFlag(value);
filterUpdated();
}
};
combo.addListener(listener);
return combo;
}
use of delta.common.ui.swing.combobox.ItemSelectionListener in project lotro-companion by dmorcellet.
the class DeedFilterController method buildReputationCombobox.
private ComboBoxController<Faction> buildReputationCombobox() {
ComboBoxController<Faction> combo = DeedUiUtils.buildFactionCombo();
ItemSelectionListener<Faction> listener = new ItemSelectionListener<Faction>() {
@Override
public void itemSelected(Faction faction) {
ReputationRewardFilter filter = _filter.getReputationFilter();
filter.setFaction(faction);
filterUpdated();
}
};
combo.addListener(listener);
return combo;
}
Aggregations