www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/+mbccrosssectiongui/@GraphView/GraphView.m
classdef GraphView < mbcgui.widget.BasicContainer %mbcgui.widget.GraphView class % mbcgui.widget.GraphView extends mbcgui.widget.BasicContainer. % % mbcgui.widget.GraphView 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' % Display - Property is of type 'MATLAB array' (read only) % 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' % GraphSize - Property is of type 'int' % WideHeaderMode - Property is of type 'bool' % SelectedInput - Property is of type 'MATLAB array' (read only) % SelectedOutput - Property is of type 'MATLAB array' (read only) % % mbcgui.widget.GraphView methods: % deserializeView - Set saved state data % gettitle - Return string to use as title for view % pConfigureTable - Alter settings of table to match tradeoff requirements % pGetSelection - Return pointer to selected item % pPerformClick - React to a mouse click on the object % pResetZoom - Reset the zoom data so that no graphs are zoomed % pSetValue - Interface that allows editing of an input's value % startValueDrag - Instruct object to initiate a value-line drag % pUpdateHighlight - Update the highlight setting % pUpdateSelection - Update the current cell selection % pUpdateYLims - Update YLimits % resetZoom - Reset the zoom on all graphs % serializeView - Get serializable setup data for the view % Copyright 2014-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. properties (AbortSet, SetObservable) %GRAPHSIZE Property is of type 'int' GraphSize = 150; %WIDEHEADERMODE Property is of type 'bool' WideHeaderMode = false; end properties (Access=?tCrossSectionGraphView, AbortSet) %OUTPUTSCACHE Property is of type 'MATLAB array' OutputsCache = null( xregpointer, 0 ); %GRAPHTABLE Handle to the ClassicTable used for display GraphTable = []; end properties %DATAMODEL Handle to the instance of the DataModel used in the table DataModel = []; %ModelInterface Interface to model commands ModelInterface = []; end properties (SetAccess=protected, AbortSet) %SELECTEDINPUT Property is of type 'MATLAB array' (read only) SelectedInput = []; %SELECTEDOUTPUT Property is of type 'MATLAB array' (read only) SelectedOutput = []; end events SelectionChange end % events methods % constructor block function obj = GraphView(modelInterface, parent) %GraphView Constructor for GraphView object % % OBJ = GraphView() % Call the inherited constructor obj@mbcgui.widget.BasicContainer('Parent', parent); % super class constructor call % create layout panel hPanel = mbcgui.container.layoutpanel('Parent', obj.Parent, ... 'Visible', obj.Visible, ... 'HitTest', 'on', ... 'ButtonDownFcn',@obj.pPerformClick,... 'Tag', 'GraphViewPanel'); obj.ModelInterface = modelInterface; obj.DataModel = mbccrosssectiongui.DataModel(obj.ModelInterface); obj.DataModel.WideHeaders = obj.WideHeaderMode; tbl = mbcgui.widget.ClassicTable('Parent', hPanel, ... 'Visible', 'on', ... 'ShowRowHeaders',true, ... 'ShowColumnHeaders',true,... 'MinimumCellSize', [obj.GraphSize obj.GraphSize],... 'UseVectorDrawMethod',false,... 'MainConstructor',{@i_createMainObject, obj},... 'RowConstructor', {@i_createRowHeadObject, obj},... 'ColumnConstructor', {@i_createColHeadObject, obj}, ... 'MainData', obj.DataModel, ... 'RowHeaderData', obj.DataModel,... 'ColumnHeaderData', obj.DataModel,... 'RowGap', 0,'ColumnGap',0, ... 'ColumnHeaderPosition', 'bottom', ... 'MaximumObjectCacheSize', 15, ... 'Border',[0 0 0 10]); obj.pConfigureTable(); tbl.TopLeftCorner = tbl.newCornerComponent('panel'); tbl.BottomRightCorner = tbl.newCornerComponent; obj.GraphTable = tbl; hPanel.LayoutComponent = tbl; obj.ContentHandle = hPanel; % Hook up listeners for DataModel obj.storeListeners(event.listener(obj.DataModel,'GraphChanged',@obj.onGraphChanged)); end % GraphView % Constructor functions for the table's cells and header objects end % constructor block methods function set.GraphSize(obj,value) % DataType = 'int' value = round(value); % round to obtain an integer obj.GraphSize = value; obj.GraphTable.MinimumCellSize = [value, value]; end function set.WideHeaderMode(obj,value) % DataType = 'bool' obj.WideHeaderMode = value; obj.DataModel.WideHeaders = value; obj.GraphTable.update; obj.pConfigureTable; end function value = get.SelectedInput(obj) value = obj.pGetSelection('input'); end function value = get.SelectedOutput(obj) value = obj.pGetSelection('output'); end end % set and get functions methods % public methods deserializeView(obj,data) str = gettitle(obj) resetZoom(obj) out = serializeView(obj) startValueDrag(obj,hAxes) performClick(obj) function update(obj) update(obj.DataModel) end end % public methods methods (Access=private) onGraphChanged(obj,src,evt) pConfigureTable(obj) val = pGetSelection(obj,type) pResetZoom(obj) pSetValue(obj,Column,Value) pUpdateSelection(obj,R,C) pUpdateYLims(obj) resetSelection(obj) end end % classdef function hDisplay = i_createMainObject(Parent, obj) hDisplay = mbccrosssectiongui.GraphCell(... 'Parent', Parent, ... 'Visible', 'off'); hDisplay.setGraphViewObject(obj); end % i_createMainObject function hDisplay = i_createRowHeadObject(Parent, obj) hDisplay = mbccrosssectiongui.RowHeader( ... 'Parent', Parent, ... 'Visible', 'off', ... 'WideHeaderMode', obj.WideHeaderMode); end % i_createRowHeadObject function hDisplay = i_createColHeadObject(Parent, obj) hDisplay = mbccrosssectiongui.ColumnHeader( ... 'Parent', Parent, ... 'Visible', 'off', ... 'WideHeaderMode', obj.WideHeaderMode); hDisplay.setGraphViewObject(obj); end % i_createColHeadObject % function i_setcontextmenu(src, evt, hPanel) % set(hPanel, 'UIContextMenu', evt.NewValue); % end % i_setcontextmenu