www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/+cageview/+optim/SetupInfoView.m
classdef SetupInfoView < mbcgui.multiview.View %cageview.optim.SetupInfoView class % cageview.optim.SetupInfoView extends mbcgui.multiview.View. % % cageview.optim.SetupInfoView 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' % Options - Property is of type 'handle vector' % Actions - Property is of type 'handle vector' % UIContextMenu - Property is of type 'MATLAB array' % % cageview.optim.SetupInfoView methods: % gettitle - Return string to use as title for view % Copyright 2005-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. properties (Access=protected, AbortSet) %HLIST Property is of type 'MATLAB array' hList = []; end methods % constructor block function obj = SetupInfoView(varargin) %SetupInfoView Constructor for OptimSetupInfoView % OBJ = SetupInfoView(PROP, VALUE) constructs a view that displays % miscellaneous information about the setup of an optimization. This % includes the algorithm name, description and the selected free % variables. % Call the inherited constructor obj@mbcgui.multiview.View(varargin{ : }); % converted super class constructor call % Construct list object obj.hList = mbcgui.table.InfoPane('Parent', obj.Parent, ... 'SplitPosition', 0.35); obj.ContentHandle = obj.hList; % Hook up to the message service if it exists if ~isempty(obj.MessageService) obj.pPostSetMessageService; end end % OptimSetupInfoView end % constructor block methods % public methods %---------------------------------------- function str = gettitle(obj) %#ok<MANU> %GETTITLE Return string to use as title for view % STR = GETTITLE(OBJ) returns a string that should be used as a title for % the container the view sits in. str = 'Optimization Setup Information'; end % gettitle end % public methods methods (Access=protected) %---------------------------------------- function pDrawList(obj) %PDRAWLIST Update the information in the list % PDRAWLIST(OBJ) redraws the list with updated information from the % optimization. if obj.hasData optim = obj.MessageService.getOptim; setup = getSetup(optim); % Free variable labels freevalues = getfreevalues(optim); valnames = pveceval(freevalues, @getname); valnames = sprintf('%s, ', valnames{:}); valnames = valnames(1:end-2); % Scaling mode scaled = {'Item scaling', mbconoff(getScaled(optim))}; DS = getOptimDatasets(optim); if isempty(DS.OpPointVariables) OpVars = 'None'; else OpVars = mbcListString( pveceval(DS.OpPointVariables, @getname) ); end pObj1 = getPrimaryExpression(optim); if ~isnull(pObj1) [mdl,pInp]= getSwitchModel(pObj1.info); else mdl = []; end if ~isnull(DS.ModeVariable) ModeInfo= {'Mode variable',DS.ModeVariable.getname}; elseif ~isempty(mdl) && isMultiModal(mdl) ModeInfo= {'Mode variable',pInp(end).getname}; else ModeInfo = {}; end info = [{'Algorithm name', getfunctionfile(optim); ... 'Algorithm description', getDescription(setup); ... 'Free variables', valnames;... 'Operating point variables',OpVars}; ... ModeInfo scaled]; obj.hList.ListText = info; else obj.hList.ListText = {}; end end % pDrawList %---------------------------------------- function pPostSetMessageService(obj) %PPOSTSETMESSAGESERVICE Method that is called when the message service is set % PPOSTSETMESSAGESERVICE(OBJ) is called in response to a new message % service being set in the object. pPostSetMessageService@mbcgui.multiview.View(obj) obj.addMessageServiceListener( ... { ... 'SetupChanged', ... }, ... { ... {@i_redrawlist, obj}, ... } ... ); % Update display obj.pDrawList end % pPostSetMessageService end end % classdef function i_redrawlist(~, ~, obj) obj.pDrawList end % i_redrawlist