www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgexprgui/@TableCreator/pChangeDims.m

    function pChangeDims(obj)
%PCHANGEDIMS Recreate the display for the current dimension setting
%
%  PCHANGEDIMS(OBJ) makes sure that the object is using the correct
%  display for the current dimension setting.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


% Construct the appropriate UI
hCompOld = obj.hEditorPane.Peer;
Name = char(hCompOld.getTableName);
DefVal = hCompOld.getTableValue;
if obj.Dimensions==1
    if ~isempty(regexp(Name, 'New_\d+D_Table'))
        % If name looks like a default then change to default for this
        % dimensionality
        Name = 'New_1D_Table';
    end
    hComp = com.mathworks.toolbox.mbc.gui.peer.MBCLookupEditorPeer( ...
        1, Name, DefVal, obj.pGetExistingVars, 10, obj.pGetDefaultVars);
else
    if ~isempty(regexp(Name, 'New_\d+D_Table'))
        % If name looks like a default then change to default for this
        % dimensionality
        Name = 'New_2D_Table';
    end
    hComp = com.mathworks.toolbox.mbc.gui.peer.MBCLookupEditorPeer( ...
        2, Name, DefVal, obj.pGetExistingVars, [10 10], obj.pGetDefaultVars);
end

delete(obj.hEditorPane);
obj.hEditorPane = mbcwidgets.javacomponent(hComp, ...
    'position', obj.position, ...
    'parent', obj.parent, ...
    'visible', obj.visible, ...
    'enable', obj.enable);
obj.hEditorPane.connect(obj, 'up');