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

    classdef SweepFilterListView < xregdatagui.AbstractListView
    %xregdatagui.SweepFilterListView class
    %   xregdatagui.SweepFilterListView extends xregdatagui.AbstractListView.
    %
    %    xregdatagui.SweepFilterListView 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)
    %       Container - Property is of type 'handle'
    %       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.SweepFilterListView methods:
    %       gettitle - A short description of the function
    %       pSetupListviewListeners - PCREATEDISPLAY Create all uicontrols and visual components for this view
    %       pUpdateDisplay - complete update of the view display
    %       pssfSweepFiltersChangedUpdate - respond to a change in the filters
    
    %  Copyright 2015 The MathWorks, Inc. and Ford Global Technologies, Inc.
    
    methods  % constructor block
        function obj = SweepFilterListView(varargin)
        %SweepFilterListView constructor
        %   OUT = SweepFilterListView(VARARGIN)
        
        % What are the column names and widths
        columnNames = {'Test Filter Expression' 'Results'};
        columnWidths = [250 350];
        
        % Do the setup stuff from inside the abstractDataView constructor
        obj@xregdatagui.AbstractListView(varargin{ : },...
            'Type','sweepFilters',...
            'Strings',columnNames,...
            'Widths',columnWidths); % converted super class constructor call
        
        end  % sweepfilterlistview
        
    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, 'ssfSweepFiltersChanged',  @obj.updateListview),...
            ];
        
        obj.Listeners = [obj.Listeners; dmsListeners];
        end  % pPostSetDataMessageService
        
        function updateListview(obj,~,~)
        %updateListview update listview 
        %   updateListview(obj)
        
        updateListview@xregdatagui.AbstractListView(obj)
        % disable add and edit for one-stage data
        s = size(obj.MessageService.SweepsetFilter);
        set(obj.Options.Actions(1:2),'Enabled',~obj.MessageService.isOneStage || (s(1)==0 && s(2)>0));
        end        
        
        function removeExpression(obj,index)
        %removeExpression remove expression implementation
        
        ssf = obj.MessageService.SweepsetFilter;
        % Remove them
        ssf = removeSweepFilter(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 = modifySweepFilter(ssf, index, newExpression);
        obj.MessageService.flushEventQueue(ssf);
        end
        
        function [Data,OK] = getDisplayData(obj)
        %getDisplayData display data and status for listview
        
        ssf = obj.MessageService.SweepsetFilter;
        vars = get(ssf, obj.Type);
        
        Data = {vars.filterExp
            vars.result}';
        OK = [vars.OK]';
        end
        
    end  % possibly private or hidden
    
end  % classdef