www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@toGVColumnHeader/setTableData.m
function setTableData(obj, R, C, dm) %SETTABLEDATA Scrolling table interface function % % SETTABLEDATA(OBJ, R, C, DATA) sets up OBJ to display the information % from row R and column C of the data object DATA. % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. % Check whether to position object for a Y-axis per cell obj.DisplayYAxisTickMarks = ~dm.useCommonYAxis; % Check whether to use wider headers or not obj.WideHeaderMode = dm.WideHeaders; % Check whether to highlight the column header as the current fill item SC = xregGui.SystemColorsDbl; if dm.HighLightedColumn==C set(obj.hBorder, 'BackgroundColor', [0.784 1.0 0.737]); obj.hLabel.BackGroundColor = [0.784 1.0 0.737]; else set(obj.hBorder, 'BackgroundColor', SC.CTRL_BG); obj.hLabel.BackGroundColor = SC.CTRL_BG; end val = dm.ColumnItemValues(C); if dm.SelectedColumn==C fontw = 'bold'; else fontw = 'normal'; end % Get graphing x-limits from data model graphlims = dm.getGraphXLimits(R, C); % Check whether the input's value is outside its range if val<dm.XLimits(C,1) || val>dm.XLimits(C,2) % Turn edit box border red tt = sprintf('Value is outside the range of %s', dm.ColumnItemLabels{C}); hlcolor = 'r'; else % Use standard colours tt = ''; hlcolor = get(obj.hBorder, 'BackgroundColor'); end % Check whether the input value is outside the graphing range if val<graphlims(1) || val>graphlims(2) axisval = NaN; else axisval = val; end if obj.WideHeaderMode axisstr = dm.ColumnItemLabels{C}; labelstr = ''; else axisstr = ''; labelstr = [dm.ColumnItemLabels{C}, ':']; end set(obj.hAxis,'Value', axisval, ... 'Selected', dm.SelectedColumn==C, ... 'String', axisstr); obj.hAxis.setLimits(graphlims(1), graphlims(2)); set(obj.hLabel, 'String', labelstr, ... 'FontWeight', fontw); set(obj.hValueEditor, ... 'Min', min(dm.XLimits(C,1), val), ... 'Max', max(dm.XLimits(C,2), val), ... 'Value', dm.ColumnItemValues(C), ... 'TooltipString', tt, ... 'FontWeight', fontw); % set(obj.hValueHighlighter, 'HighlightColor', hlcolor); % Save the column that is being displayed obj.CurrentColumn = C;