www.gusucode.com > appdesigner工具箱matlab源码程序 > appdesigner/+appdesigner/+internal/+model/AppDesignerChildModelFactory.m

    classdef AppDesignerChildModelFactory < appdesservices.internal.interfaces.model.DesignTimeModelFactory
    % AppDesignerChildModelFactory  Factory to create children of the AppDesignerModel

    % Copyright 2013-2016 The MathWorks, Inc.
    
    properties (Access = private)
        AppLoader;
    end
    
    methods
        function obj = AppDesignerChildModelFactory(appLoader)
            obj.AppLoader = appLoader;
        end
 
        function model = createModel(obj, parentModel, peerNode)
            % create a model with the proxyView as a child of the parentModel
                   
            % Create the proxyView for this child peerNode
            proxyView = ...
                appdesigner.internal.view.DesignTimeProxyView(peerNode);

            switch (proxyView.getType())
                case 'AppModel'
                    appData = obj.AppLoader.getAppData(peerNode.getProperty('FullFileName'));
                    
                    % construct an AppModel
                    model = appdesigner.internal.model.AppModel(parentModel, proxyView, appData);
                
                otherwise
                    assert(false,sprintf('Unhandled proxyView type: %s', proxyView.getType()));               
            end
            
        end
    end
end