% extended waitbar Eventlistener for classifier ensemble
classdef janis_gui_RespondToEnsemble < janis_gui_RespondToCycle

    methods

        % just calls the original Eventlistener
        function obj = janis_gui_RespondToEnsemble(validator_obj)
            obj = obj@janis_gui_RespondToCycle(validator_obj);
        end

        % events treated like before, but a new line will be added,
        % displayed informationen of all the classifiers.
        function handleEvnt(obj,src,evtdata)
            if isa(src.patternParser.patternMat{1},'janis_validator')
                handleEvnt@janis_gui_RespondToCycle(obj,src,evtdata);
                hAxes = findobj(obj.h,'type','axes');
                hTitle = get(hAxes,'title');
                currentStr = get(hTitle,'String');
                currentStr = currentStr(1:end-1,:);
                singlePredictions = 'This iteration: ';
                for k=1:size(src.patternParser.patternMat,2)
                    singlePredictions = sprintf('%s %3d%% |', ...
                        singlePredictions, ...
                        src.patternParser.patternMat{k}.classPerformance.LastCorrectRate*100);
                end
                currentStr = strvcat(currentStr,singlePredictions);
                obj.h = waitbar(src.actualRound/src.getRoundCount, obj.h, ...
                    currentStr);
            end

        end
    end
end