www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/+cgcalsetup/NormalizerPage.m
classdef NormalizerPage < cgcalsetup.WizardPage %NORMALIZERPAGE wizard page to set up normalizers % % cgcalsetup.NormalizerPage methods: % updatePage - update wizard page with data % updateData - update data from wizard page % createPage - create page for wizard (Static) % getNextPage - function handle for next page % Copyright 2009-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. properties (Access=private) %hNormX - X Normalizer Editor hNormX %hNormY - Y Normalizer Editor hNormY %hUseOpPoints - use model operating points for normalizer hUseOpPoints end methods function updatePage(N,iFace) %UPDATEPAGE update wizard page C = N.Data; if ~isSwitchModel(C) || length(getSwitchFactors(getSwitchModel(C.Model)))<2 set(N.hUseOpPoints,'Enable','off','Value',C.UseOpPoints) else set(N.hUseOpPoints,'Enable','on','Value',C.UseOpPoints) end initialize(N.hNormX) initialize(N.hNormY) N.hInfoPane.InfoString = 'Select the table inputs and set up the normalizers to use for all the new tables.'; feval(iFace.setFinishButton, 0); % enable listeners for normalizer editors enableListeners(N.hNormX,'on') enableListeners(N.hNormY,'on') end function updateData(N) %#ok<MANU> %UPDATEDATA no action required end function previousPage(N,iFace) %previousPage(N,iFace) % % disable listeners for normalizer editors previousPage@cgcalsetup.WizardPage(N,iFace) enableListeners(N.hNormX,'off') enableListeners(N.hNormY,'off') end end methods (Access=protected) function N = NormalizerPage(fh,iFace,C) %UPDATEDATA update normalizer data from NormalizerPage wizard N.Data = C; N.Layout = createLayout(N,fh,iFace); updatePage(N,iFace) end function MainLyt = createLayout(N,fh,~) %createLayout create main layout for normalizer page % % MainLyt = createLayout(N,fh,iFace) C = N.Data; N.hUseOpPoints=uicontrol('Parent',fh,... 'Style','checkbox',... 'String','Use model operating points',... 'Tag','cgNormOpPoint',... 'Callback',{@setUseOpPoints,C}); N.hNormX = cgcalsetup.NormalizerEditor(fh,C,1); N.hNormY = cgcalsetup.NormalizerEditor(fh,C,2); lyt=xreggridbaglayout(fh,'dimension',[2 2],... 'rowsizes',[20 -1 ],... 'colsizes',[-1 -1],... 'mergeblock',{[1 1],[1 2]},... 'gapx', 20, ... 'gapy',5,... 'border',[10 10 10 10],... 'packstatus','off',... 'elements',{N.hUseOpPoints,N.hNormX.Layout,... [],N.hNormY.Layout}); N.hInfoPane = mbcgui.container.InfoPane('Parent', fh, ... 'InfoHeight', 35, ... 'Title','Table Inputs',... 'Center', lyt); MainLyt = xreglayerlayout(fh,'Elements', {N.hInfoPane}); end function f = getNextPage(N) %#ok<MANU> %getNextPage function handle to next wizard page (Tables) f = @cgcalsetup.TablePage.createPage; end end methods (Static) function layout = createPage( fh, iFace, C ) %createPage create normalizer wizard page % % layout = createPage( fh, iFace, C ) if isa(fh, 'xregcontainer') N = get(fh,'UserData'); updatePage(N,iFace) else N = cgcalsetup.NormalizerPage(fh,iFace,C); end feval(iFace.setNextButton, 1); feval(iFace.setFinishButton, 0); layout = N.Layout; end end end function setUseOpPoints(h,~,C) %setUseOpPoints call back for use operating points checkbox C.UseOpPoints = get(h,'Value'); end