www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+xregdatagui/AbstractDataView.m

    classdef AbstractDataView < mbcgui.multiview.View
    %xregdatagui.AbstractDataView class
    %   xregdatagui.AbstractDataView extends mbcgui.multiview.View.
    %
    %    xregdatagui.AbstractDataView 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' (read only)
    %       UIContextMenu - Property is of type 'MATLAB array'
    %       Listeners - Property is of type 'handle vector' (read only)
    %
    %    xregdatagui.AbstractDataView methods:
    %       gettitle - A short description of the function
    %       pSetMessageService - SetFunction for DMS property
    %       defaultSplitDirection - split direction
    %       serializeView - A short description of the function
    
    %  Copyright 2015-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.
    
    properties (SetAccess=protected)
        %LISTENERS Property is of type 'handle vector' (read only)
        Listeners = [];
    end
    
    methods  % constructor block
        function obj = AbstractDataView(varargin)
        %ABSTRACTDATAVIEW constructor for the abstractDataView object
        %   OBJ = ABSTRACTDATAVIEW('Property', Value)
        
        % Call the inherited constructor
        obj@mbcgui.multiview.View( varargin{:}); % converted super class constructor call
        
        % It's possible that we've had our MessageService, framework and containers set
        if ~isempty(obj.MessageService)
            obj.pPostSetDataMessageService([]);
        end
        
        end  % abstractdataview
        
    end  % constructor block
    
    
    methods  % public methods
        %----------------------------------------
        function [out] = gettitle(in) %#ok<MANU>
        %GETTITLE view title
        %
        %  OUT = GETTITLE(IN)
        %
        
        out = 'Data View';
        end  % gettitle
        
        %----------------------------------------
        function [orient] = defaultSplitDirection(obj)
        %defaultSplitDirection split direction
        %   OUT = defaultSplitDirection(IN)
        
        % Default orientation is LR
        orient = 'lr';
        % If view width is less than height then use UD
        if obj.Position(3) < obj.Position(4)
            orient = 'ud';
        end
        
        end  % preferredSplitDirection
        
        %----------------------------------------
        function [out] = serializeView(obj) %#ok<MANU>
        %SERIALIZEVIEW serialize view
        %   OUT = SERIALIZEVIEW(IN)
        
        out = [];
        end  % serializeView
        
        function deserializeView(obj,ViewData)
        %deserializeView deserialize View
        if ~isempty(ViewData) && iscell(ViewData)
            set(obj,ViewData{:});
        end
        end
        
        
    end  % public methods
    
    methods (Hidden) % possibly private or hidden
        %----------------------------------------
        function pPostSetDataMessageService(obj, ~,~)
        %PPOSTSETDATAMESSAGESERVICE setup MessageService listeners
        %    PPOSTSETDATAMESSAGESERVICE(OBJ, SRC, EVT)
        
        dms = obj.MessageService;
        
        dmsListeners = event.proplistener(dms, dms.findprop('IsReadOnly'), 'PostSet', @obj.pPostSetDmsIsReadOnly);
        obj.Listeners = [obj.Listeners(:) ; dmsListeners(:)];
        end  % pPostSetDataMessageService
        
        %----------------------------------------
        function pPostSetDmsIsReadOnly(obj, ~,~) %#ok<INUSD>
        %PPOSTSETDMSISREADONLY data set to read-only
        %    PPOSTSETDMSISREADONLY(OBJ,SRC, EVENT)
        
        % do nothing by default
        
        end  % pPostSetDmsIsReadOnly
        
    end  % possibly private or hidden
    
end  % classdef