www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+xregdatagui/FilterListView.m

    classdef FilterListView < xregdatagui.AbstractListView
    %xregdatagui.FilterListView class
    %   xregdatagui.FilterListView extends xregdatagui.AbstractListView.
    %
    %    xregdatagui.FilterListView properties:
    %       Parent - Property is of type 'MATLAB array'
    %       Position - Property is of type 'rect'
    %       Enable - Property is of type 'on/off'
    %       Visible - Property is of type 'on/off'
    %       Userdata - Property is of type 'MATLAB array'
    %       Tag - Property is of type 'string'
    %       MessageService - Property is of type 'handle' (read only)
    %       UIContextMenu - Property is of type 'MATLAB array'
    %       Listeners - Property is of type 'handle vector' (read only)
    %       ListHandle - Property is of type 'MATLAB array' (read only)
    %       COMListeners - Property is of type 'handle vector' (read only)
    %       ContainerListeners - Property is of type 'handle vector' (read only)
    %       Strings - Property is of type 'MATLAB array'
    %       Widths - Property is of type 'MATLAB array'
    %
    %    xregdatagui.FilterListView methods:
    %       gettitle - A short description of the function
    %       pSetupListviewListeners - setup the listview listeners
    %       pUpdateDisplay - complete update of the view display
    %       pssfFiltersChangedUpdate - respond to a change in the filters
    
    %  Copyright 2015 The MathWorks, Inc. and Ford Global Technologies, Inc.
    
    methods  % constructor block
        function obj = FilterListView(varargin)
        %FILTERLISTVIEW constructor
        %   OUT = FILTERLISTVIEW(VARARGIN)
        
        % What are the column names and widths
        columnNames = {'Filter Expression','Results'};
        columnWidths = [250 350];
        
        % Do the setup stuff from inside the abstractDataView constructor
        obj@xregdatagui.AbstractListView(varargin{ : },...
            'Type','filters',...
            'Strings',columnNames,...
            'Widths',columnWidths); % converted super class constructor call
        end  % filterlistview
        
    end  % constructor block
    
    methods (Hidden) % possibly private or hidden
        %----------------------------------------
        function pPostSetDataMessageService(obj, ~,~)
        %PPOSTSETDATAMESSAGESERVICE setup MessageService listeners
        %    PPOSTSETDATAMESSAGESERVICE(OBJ, SRC, EVT)
        
        % Call the super pPostSetDataMessageService
        pPostSetDataMessageService@xregdatagui.AbstractListView(obj);
        
        dms = obj.MessageService;
        dmsListeners = [...
            event.listener(dms, 'dmsDataTypeChanged', @obj.pdmsDataTypeChangedUpdate);...
            event.listener(dms, 'ssfFiltersChanged',  @obj.updateListview),...
            ];
        obj.Listeners = [obj.Listeners(:) ; dmsListeners(:)];
        end  % pPostSetDataMessageService
        
        function removeExpression(obj,index)
        %removeExpression remove expression implementation
        
        ssf = obj.MessageService.SweepsetFilter;
        % Remove them
        ssf = removeFilter(ssf, index);
        % Flush the event queue
        obj.MessageService.flushEventQueue(ssf);
        
        end
        
        function modifyExpression(obj,index,newExpression,~,~)
        %modifyExpression modify expression implementation
        
        ssf = obj.MessageService.SweepsetFilter;
        ssf = modifyFilter(ssf, index, newExpression);
        obj.MessageService.flushEventQueue(ssf);
        
        end
        
        function [Data,OK] = getDisplayData(obj)
        %getDisplayData display data and status for listview
        
        ssf = obj.MessageService.SweepsetFilter;
        expr = get(ssf, obj.Type);
        
        Data = {expr.filterExp
            expr.result}';
        OK = [expr.OK]';
        
        end
        
        
    end  % possibly private or hidden
    
end  % classdef