www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgexprgui/@EquationView/EquationView.m
function obj = EquationView(varargin) %EQUATIONVIEW Component to display an equation for an expression object % % h = EquationView(Prop, Value, ...) constructs a new EquationView object. % This object displays the equation string of an expression, as provided % by the charlist/charlistchort method of the expression. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. if nargin && isa(varargin{1}, 'cgexprgui.EquationView') obj = varargin{1}; varargin(1) = []; else obj = cgexprgui.EquationView; end % Call parent class constructor if ~isempty(varargin) obj.abstractlayoutcomponent(varargin{:}); else obj.abstractlayoutcomponent; end obj.hTitle = uicontrol('Style' , 'text' , ... 'Enable','inactive',... 'Visible',obj.Visible,... 'Parent' , obj.Parent , ... 'String', obj.Title, ... 'HorizontalAlignment' , 'left'); obj.hInputs = uicontrol('Style' , 'text' , ... 'Enable','inactive',... 'Visible',obj.Visible,... 'Parent' , obj.Parent , ... 'HorizontalAlignment' , 'left'); equationPanel = com.mathworks.toolbox.mbc.gui.EquationPanel.createPeer; obj.hEquation = mbcwidgets.javacomponent(equationPanel, ... 'parent', obj.Parent, ... 'visible', obj.Visible); obj.Display = xreggridbaglayout(obj.Parent,... 'dimension',[2 2],... 'rowsizes',[15 -1],... 'colsizes',[80 -1],... 'gapy', 2, ... 'mergeblock',{[2 2],[1 2]},... % editor pane 'visible', obj.Visible, ... 'position', obj.Position, ... 'elements',{obj.hTitle, obj.hInputs;... obj.hEquation, []}); obj.pDrawInputs; obj.pDrawEquation; obj.addPropertyListeners( ... {'ShortMode', 'Title', 'Expression', 'ExpressionName'}, ... {@pDrawEquation, {@i_settitle, obj.hTitle}, @i_setexpr, @pDrawEquation} ); function i_settitle(obj, evt, hTitle) set(hTitle, 'String', evt.NewValue); function i_setexpr(obj, evt) obj.pDrawEquation; obj.pDrawInputs;