www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+xregdatagui/SweepVariableListView.m
classdef SweepVariableListView < xregdatagui.AbstractListView %xregdatagui.SweepVariableListView class % xregdatagui.SweepVariableListView extends xregdatagui.AbstractListView. % % xregdatagui.SweepVariableListView 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.SweepVariableListView methods: % pSetupListviewListeners - Attach event listeners to the list % pUpdateDisplay - Complete update of the view display % pssfSweepVariablesChangedUpdate - respond to a change in the filters % Copyright 2015 The MathWorks, Inc. and Ford Global Technologies, Inc. methods % constructor block function obj = SweepVariableListView(varargin) %SweepVariableListView constructor % OUT = SweepVariableListView(VARARGIN) % What are the column names and widths columnNames = {'Variable Expression' 'Units' 'Results'}; columnWidths = [250 100 350]; % Do the setup stuff from inside the abstractDataView constructor obj@xregdatagui.AbstractListView(varargin{ : },... 'Type','sweepVariables',... 'Strings',columnNames,... 'Widths',columnWidths); % converted super class constructor call end % sweepvariablelistview 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, 'ssfSweepVariablesChanged', @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 = removeSweepVariable(ssf, index); % Flush the event queue obj.MessageService.flushEventQueue(ssf); end function modifyExpression(obj,index,newExpression,varargin) %modifyExpression modify expression implementation % modifyExpression(obj,index,newExpression) % modifyExpression(obj,index,newExpression,newUnit) ssf = obj.MessageService.SweepsetFilter; ssf = modifySweepVariable(ssf, index, newExpression,varargin{1: min(1,length(varargin))}); 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.varString expr.varUnit expr.result}'; OK = [expr.OK]'; end end % possibly private or hidden end % classdef