Search in sources :

Example 1 with TechAdvancement

use of megamek.common.TechAdvancement in project megameklab by MegaMek.

the class SpecializationView method filterSpecializations.

private void filterSpecializations() {
    RowFilter<SpecializationModel, Integer> filter = new RowFilter<SpecializationModel, Integer>() {

        @Override
        public boolean include(Entry<? extends SpecializationModel, ? extends Integer> entry) {
            SpecializationModel specModel = entry.getModel();
            TechAdvancement techAdvancement = specModel.getTechAdvancement(entry.getIdentifier());
            if ((1 << entry.getIdentifier() == Infantry.TAG_TROOPS) && TestInfantry.maxSecondaryWeapons(getInfantry()) < 2) {
                return false;
            }
            return (null != eSource.getTechManager()) && eSource.getTechManager().isLegal(techAdvancement);
        }
    };
    sorter.setRowFilter(filter);
}
Also used : RowFilter(javax.swing.RowFilter) TechAdvancement(megamek.common.TechAdvancement)

Example 2 with TechAdvancement

use of megamek.common.TechAdvancement in project megameklab by MegaMek.

the class CISpecializationView method filterSpecializations.

private void filterSpecializations() {
    RowFilter<SpecializationModel, Integer> filter = new RowFilter<SpecializationModel, Integer>() {

        @Override
        public boolean include(Entry<? extends SpecializationModel, ? extends Integer> entry) {
            SpecializationModel specModel = entry.getModel();
            TechAdvancement techAdvancement = specModel.getTechAdvancement(entry.getIdentifier());
            if ((1 << entry.getIdentifier() == Infantry.TAG_TROOPS) && TestInfantry.maxSecondaryWeapons(getInfantry()) < 2) {
                return false;
            }
            return (null != eSource.getTechManager()) && eSource.getTechManager().isLegal(techAdvancement);
        }
    };
    sorter.setRowFilter(filter);
}
Also used : RowFilter(javax.swing.RowFilter) TechAdvancement(megamek.common.TechAdvancement)

Aggregations

RowFilter (javax.swing.RowFilter)2 TechAdvancement (megamek.common.TechAdvancement)2