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

    classdef InfoView < xregbdrygui.AbstractBdryView
    %xregbdrygui.InfoView class
    %   xregbdrygui.InfoView extends xregbdrygui.AbstractBdryView.
    %
    %    xregbdrygui.InfoView 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'
    %       Options - Property is of type 'handle vector'
    %       Actions - Property is of type 'handle vector'
    %       UIContextMenu - Property is of type 'MATLAB array'
    %       InfoPane - Property is of type 'MATLAB array' (read only)
    
    % Copyright 2005-2015 The MathWorks, Inc. and Ford Global Technologies, Inc.

    properties (SetAccess=protected, AbortSet, SetObservable)
        %INFOPANE Property is of type 'MATLAB array' (read only)
        InfoPane = [];
    end
    
    methods  % constructor block
        function obj = InfoView( varargin )
        % XREGBDRYGUI.INFOVIEW class constructor
        
        % Call the inherited constructor
        obj@xregbdrygui.AbstractBdryView(varargin{ : }); % converted super class constructor call
        
        obj.pPostSetMessageService;
        pPostSetName(obj)
        pPostSetConstraint(obj)
        
        obj.ContentHandle = mbcgui.container.titlebarpanel(...
            'Parent', obj.Parent, ...
            'BarTitle', 'Properties' );
        obj.InfoPane = mbcgui.table.InfoPane( 'Parent', obj.ContentHandle, ...
            'SplitPosition', .6 );
        set(obj.ContentHandle,'ContentHandle', obj.InfoPane);
        
        end  % InfoView
        
    end  % constructor block
    
    methods  (Access=protected) % protected methods
        %----------------------------------------
        function pPostSetMessageService(obj)
        %PPOSTSETMESSAGESERVICE Respond to change of MessageService
        %  PPOSTSETMESSAGESERVICE(OBJ) is called when the MessageService property
        %  is changed.
        
        % Clear the listeners
        obj.clearMessageServiceListeners;
        
        % Add new listeners
        bms = obj.MessageService;
        obj.addMessageServiceListener( event.listener(bms,'ConstraintChange', @(src, evt) pPostSetConstraint( obj )) );
        obj.addMessageServiceListener( event.listener(bms,'NameChange',       @(src, evt) pPostSetName( obj )) );
        
        end  % pPostSetMessageService
        
        %----------------------------------------
        function pPostSetName(obj)
        %PPOSTSETNAME Changes the title in the properties box
        %  PPOSTSETNAME(OBJ) re-displays the constraint info in response to the
        %  name of the current node of the boundary tree changing.
        
        % Title on the model properties box
        cn = obj.MessageService.CurrentNode;
        if isempty( cn ),
            set( obj.ContentHandle, 'BarTitle', 'Properties' );
        else
            set( obj.ContentHandle, 'BarTitle', ['Properties - ', cn.name] );
        end
        
        end  % pPostSetName
        
        %----------------------------------------
        function pPostSetConstraint(obj)
        %PPOSTSETCONSTRAINT
        %  PPOSTSETCONSTRAINT(OBJ) Re-displays the constraint info in response to a
        %  change in the constraint at the current node.
        
        
        cn = obj.MessageService.CurrentNode;
        if isempty( cn ),
            obj.InfoPane.ListText = {};
        else
            obj.InfoPane.ListText = cn.properties;
        end
        
        end  % pPostSetConstraint
        
    end  % protected methods
    
end  % classdef