Search in sources :

Example 1 with DeedCategoryFilter

use of delta.games.lotro.lore.deeds.filters.DeedCategoryFilter in project lotro-companion by dmorcellet.

the class DeedFilterController method buildDeedPanel.

private JPanel buildDeedPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    int y = 0;
    JPanel line1Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
    // Label filter
    {
        JPanel containsPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
        containsPanel.add(GuiFactory.buildLabel("Name 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;
                DeedNameFilter nameFilter = _filter.getNameFilter();
                nameFilter.setPattern(newText);
                filterUpdated();
            }
        };
        _textController = new DynamicTextEditionController(_contains, listener);
        line1Panel.add(containsPanel);
    }
    GridBagConstraints c = new GridBagConstraints(0, y, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0);
    panel.add(line1Panel, c);
    y++;
    JPanel line2Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
    // Type
    {
        JLabel label = GuiFactory.buildLabel("Type:");
        line2Panel.add(label);
        _type = DeedUiUtils.buildDeedTypeCombo();
        ItemSelectionListener<DeedType> typeListener = new ItemSelectionListener<DeedType>() {

            @Override
            public void itemSelected(DeedType type) {
                DeedTypeFilter typeFilter = _filter.getTypeFilter();
                typeFilter.setDeedType(type);
                filterUpdated();
            }
        };
        _type.addListener(typeListener);
        line2Panel.add(_type.getComboBox());
    }
    // Category
    {
        JLabel label = GuiFactory.buildLabel("Category:");
        line2Panel.add(label);
        _category = DeedUiUtils.buildCategoryCombo();
        ItemSelectionListener<String> categoryListener = new ItemSelectionListener<String>() {

            @Override
            public void itemSelected(String category) {
                DeedCategoryFilter categoryFilter = _filter.getCategoryFilter();
                categoryFilter.setDeedCategory(category);
                filterUpdated();
            }
        };
        _category.addListener(categoryListener);
        line2Panel.add(_category.getComboBox());
    }
    c = new GridBagConstraints(0, y, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0);
    panel.add(line2Panel, c);
    y++;
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) JLabel(javax.swing.JLabel) TextListener(delta.common.ui.swing.text.TextListener) DeedTypeFilter(delta.games.lotro.lore.deeds.filters.DeedTypeFilter) DynamicTextEditionController(delta.common.ui.swing.text.DynamicTextEditionController) DeedCategoryFilter(delta.games.lotro.lore.deeds.filters.DeedCategoryFilter) DeedNameFilter(delta.games.lotro.lore.deeds.filters.DeedNameFilter) DeedType(delta.games.lotro.lore.deeds.DeedType)

Example 2 with DeedCategoryFilter

use of delta.games.lotro.lore.deeds.filters.DeedCategoryFilter in project lotro-companion by dmorcellet.

the class DeedFilterController method setFilter.

private void setFilter() {
    // Name
    DeedNameFilter nameFilter = _filter.getNameFilter();
    String contains = nameFilter.getPattern();
    if (contains != null) {
        _contains.setText(contains);
    }
    // Type
    DeedTypeFilter typeFilter = _filter.getTypeFilter();
    DeedType type = typeFilter.getDeedType();
    _type.selectItem(type);
    // Category
    DeedCategoryFilter categoryFilter = _filter.getCategoryFilter();
    String category = categoryFilter.getDeedCategory();
    _category.selectItem(category);
    // Requirements:
    // - class
    DeedClassRequirementFilter classFilter = _filter.getClassFilter();
    CharacterClass requiredClass = classFilter.getCharacterClass();
    _class.selectItem(requiredClass);
    // - race
    DeedRaceRequirementFilter raceFilter = _filter.getRaceFilter();
    Race requiredRace = raceFilter.getRace();
    _race.selectItem(requiredRace);
    // Rewards:
    // Reputation
    ReputationRewardFilter factionFilter = _filter.getReputationFilter();
    Faction faction = factionFilter.getFaction();
    _reputation.selectItem(faction);
    // LOTRO points
    LotroPointsRewardFilter lotroPointsFilter = _filter.getLotroPointsFilter();
    Boolean lotroPoints = lotroPointsFilter.getHasLotroPointsFlag();
    _lotroPoints.selectItem(lotroPoints);
    // Class point
    ClassPointRewardFilter classPointFilter = _filter.getClassPointsFilter();
    Boolean classPoint = classPointFilter.getHasClassPointFlag();
    _classPoints.selectItem(classPoint);
    // Trait
    TraitRewardFilter traitFilter = _filter.getTraitFilter();
    String trait = traitFilter.getTrait();
    _trait.selectItem(trait);
    // Skill
    SkillRewardFilter skillFilter = _filter.getSkillFilter();
    String skill = skillFilter.getSkill();
    _skill.selectItem(skill);
    // Title
    TitleRewardFilter titleFilter = _filter.getTitleFilter();
    String title = titleFilter.getTitle();
    _title.selectItem(title);
    // Virtue
    VirtueRewardFilter virtueFilter = _filter.getVirtueFilter();
    VirtueId virtueId = virtueFilter.getVirtueId();
    _virtue.selectItem(virtueId);
    // Emote
    EmoteRewardFilter emoteFilter = _filter.getEmoteFilter();
    String emote = emoteFilter.getEmote();
    _emote.selectItem(emote);
    // Item
    ItemRewardFilter itemFilter = _filter.getItemFilter();
    Integer itemId = itemFilter.getItemId();
    _item.selectItem(itemId);
}
Also used : DeedRaceRequirementFilter(delta.games.lotro.lore.deeds.filters.DeedRaceRequirementFilter) TitleRewardFilter(delta.games.lotro.common.rewards.filters.TitleRewardFilter) DeedTypeFilter(delta.games.lotro.lore.deeds.filters.DeedTypeFilter) CharacterClass(delta.games.lotro.common.CharacterClass) SkillRewardFilter(delta.games.lotro.common.rewards.filters.SkillRewardFilter) EmoteRewardFilter(delta.games.lotro.common.rewards.filters.EmoteRewardFilter) TraitRewardFilter(delta.games.lotro.common.rewards.filters.TraitRewardFilter) VirtueId(delta.games.lotro.common.VirtueId) ReputationRewardFilter(delta.games.lotro.common.rewards.filters.ReputationRewardFilter) Race(delta.games.lotro.common.Race) DeedCategoryFilter(delta.games.lotro.lore.deeds.filters.DeedCategoryFilter) LotroPointsRewardFilter(delta.games.lotro.common.rewards.filters.LotroPointsRewardFilter) DeedClassRequirementFilter(delta.games.lotro.lore.deeds.filters.DeedClassRequirementFilter) DeedNameFilter(delta.games.lotro.lore.deeds.filters.DeedNameFilter) DeedType(delta.games.lotro.lore.deeds.DeedType) ItemRewardFilter(delta.games.lotro.common.rewards.filters.ItemRewardFilter) Faction(delta.games.lotro.lore.reputation.Faction) ClassPointRewardFilter(delta.games.lotro.common.rewards.filters.ClassPointRewardFilter) VirtueRewardFilter(delta.games.lotro.common.rewards.filters.VirtueRewardFilter)

Aggregations

DeedType (delta.games.lotro.lore.deeds.DeedType)2 DeedCategoryFilter (delta.games.lotro.lore.deeds.filters.DeedCategoryFilter)2 DeedNameFilter (delta.games.lotro.lore.deeds.filters.DeedNameFilter)2 DeedTypeFilter (delta.games.lotro.lore.deeds.filters.DeedTypeFilter)2 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 DynamicTextEditionController (delta.common.ui.swing.text.DynamicTextEditionController)1 TextListener (delta.common.ui.swing.text.TextListener)1 CharacterClass (delta.games.lotro.common.CharacterClass)1 Race (delta.games.lotro.common.Race)1 VirtueId (delta.games.lotro.common.VirtueId)1 ClassPointRewardFilter (delta.games.lotro.common.rewards.filters.ClassPointRewardFilter)1 EmoteRewardFilter (delta.games.lotro.common.rewards.filters.EmoteRewardFilter)1 ItemRewardFilter (delta.games.lotro.common.rewards.filters.ItemRewardFilter)1 LotroPointsRewardFilter (delta.games.lotro.common.rewards.filters.LotroPointsRewardFilter)1 ReputationRewardFilter (delta.games.lotro.common.rewards.filters.ReputationRewardFilter)1 SkillRewardFilter (delta.games.lotro.common.rewards.filters.SkillRewardFilter)1 TitleRewardFilter (delta.games.lotro.common.rewards.filters.TitleRewardFilter)1 TraitRewardFilter (delta.games.lotro.common.rewards.filters.TraitRewardFilter)1 VirtueRewardFilter (delta.games.lotro.common.rewards.filters.VirtueRewardFilter)1 DeedClassRequirementFilter (delta.games.lotro.lore.deeds.filters.DeedClassRequirementFilter)1