package Common.Visual;
import Common.Database.Objects.DBObject;
import Common.Database.Tables.DataSet;
import Common.Utils.Utils_;

import javax.swing.*;
public abstract class FilterMenuFlag<D extends DBObject> extends FilterFlag<D> {
    int count = 0;
    public FilterMenuFlag(DataSet<?, D> dataSet_in, AbstractButton control_in, boolean active_in) {
        super(dataSet_in, control_in, active_in);
    }
    @Override
    public boolean Validate(D object) {
        boolean valid = validate(object);
        if (valid)
            count++;
        return active & valid;
    }
    @Override
    public void ShowMatchesCount() {
        control.setText(description + " " + Utils_.RBrackets(count));
    }
    @Override
    public void DropMatchesCount() {
        count = 0;
    }
}
