Updated Branches: refs/heads/develop 82fb7f8bd -> 7a01335e6
FLEX-32848 patch by Stephan Plath , updated code formatting, added asdoc to isCellItemHighlighted and isCellItemSelected Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/dbd47e45 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/dbd47e45 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/dbd47e45 Branch: refs/heads/develop Commit: dbd47e45139eee34b7c56dbbe6ad0f8bf23868b4 Parents: b32da1e Author: cyrill.zadra <cyrill.za...@gmail.com> Authored: Tue Sep 24 14:33:39 2013 +0200 Committer: cyrill.zadra <cyrill.za...@gmail.com> Committed: Tue Sep 24 14:33:39 2013 +0200 ---------------------------------------------------------------------- .../src/mx/controls/AdvancedDataGrid.as | 48 ++++++++++++++++++++ .../AdvancedDataGridBase.as | 1 + .../AdvancedDataGridGroupItemRenderer.as | 17 ++++++- .../AdvancedDataGridItemRenderer.as | 45 +++++++++++++----- 4 files changed, 97 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dbd47e45/frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGrid.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGrid.as b/frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGrid.as index 88218d7..5e1995f 100644 --- a/frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGrid.as +++ b/frameworks/projects/advancedgrids/src/mx/controls/AdvancedDataGrid.as @@ -7419,6 +7419,50 @@ public class AdvancedDataGrid extends AdvancedDataGridBaseEx } /** + * Determines if cell is highlighted. + * + * @param data The data provider item. + * @param columnIndex index of column. + * + * @return <code>true</code> if the cell item is highlighted. + * + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 4.11 + */ + public function isCellItemHighlighted(data:Object, columnIndex:int): Boolean + { + if (data == null) + return false; + if (isCellItemSelected(data, columnIndex)) + return false; + return highlightUID == data && highlightColumnIndex == columnIndex; + } + + /** + * Determines if cell is selected. + * + * @param data The data provider item. + * @param columnIndex index of column. + * + * @return <code>true</code> if the cell item is selected. + * + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 4.11 + */ + public function isCellItemSelected(data:Object, columnIndex:int): Boolean + { + if (data == null) + return false; + return cellSelectionData[data] && cellSelectionData[data][columnIndex]; + } + + /** * @private * Check if a cell is already present in selecedCells. */ @@ -7602,11 +7646,15 @@ public class AdvancedDataGrid extends AdvancedDataGridBaseEx if (visibleRenderer) item = visibleRenderer[q]; if (item) + { + // IMPORTANT! Clear the selection before drawCellItem() is called -> IInvalidating(item).validateNow() + cellSelectionData[p][q] = null; drawCellItem(item, false, p == highlightUID && highlightColumnIndex == int(q), false, transition); + } } } http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dbd47e45/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridBase.as b/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridBase.as index 8572c4f..08e0269 100644 --- a/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridBase.as +++ b/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridBase.as @@ -913,6 +913,7 @@ public class AdvancedDataGridBase extends AdvancedListBase implements IFontConte for (var i:int = 0; i < n; i++) { var r:IListItemRenderer = listItems[rowIndex][i]; + r.validateDisplayList(); updateDisplayOfItemRenderer(r); } } http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dbd47e45/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridGroupItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridGroupItemRenderer.as b/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridGroupItemRenderer.as index b141e44..6f477aa 100644 --- a/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridGroupItemRenderer.as +++ b/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridGroupItemRenderer.as @@ -555,12 +555,25 @@ public class AdvancedDataGridGroupItemRenderer extends UIComponent if (data && parent) { + var selMode: String = listOwner.selectionMode; if (!enabled) labelColor = getStyle("disabledColor"); - else if (listOwner.isItemHighlighted(listData.uid)) + else if ((selMode == AdvancedDataGridBase.SINGLE_ROW + || selMode == AdvancedDataGridBase.MULTIPLE_ROWS) + && listOwner.isItemHighlighted(listData.uid)) labelColor = getStyle("textRollOverColor"); - else if (listOwner.isItemSelected(listData.uid)) + else if ((selMode == AdvancedDataGridBase.SINGLE_ROW + || selMode == AdvancedDataGridBase.MULTIPLE_ROWS) + && listOwner.isItemSelected(listData.uid)) labelColor = getStyle("textSelectedColor"); + else if ((selMode == AdvancedDataGridBase.SINGLE_CELL + || selMode == AdvancedDataGridBase.MULTIPLE_CELLS) + && listOwner.isCellItemHighlighted(listData.uid, listData.columnIndex)) + labelColor = getStyle("textRollOverColor"); + else if ((selMode == AdvancedDataGridBase.SINGLE_CELL + || selMode == AdvancedDataGridBase.MULTIPLE_CELLS) + && listOwner.isCellItemSelected(listData.uid, listData.columnIndex)) + labelColor = getStyle("textSelectedColor"); else labelColor = getStyle("color"); http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/dbd47e45/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridItemRenderer.as b/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridItemRenderer.as index 7c32f8b..ce73dfc 100644 --- a/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridItemRenderer.as +++ b/frameworks/projects/advancedgrids/src/mx/controls/advancedDataGridClasses/AdvancedDataGridItemRenderer.as @@ -303,18 +303,39 @@ public class AdvancedDataGridItemRenderer extends UITextField if (data && parent) { var newColor:Number; - - if (AdvancedDataGrid(_listData.owner).isItemHighlighted(_listData.uid)) - { - newColor = getStyle("textRollOverColor"); - } - else if (AdvancedDataGrid(_listData.owner).isItemSelected(_listData.uid)) - { - newColor = getStyle("textSelectedColor"); - } - else - { - newColor = getStyle("color"); + var adg: AdvancedDataGrid = AdvancedDataGrid(listData.owner); + + if (adg.selectionMode == AdvancedDataGridBase.SINGLE_ROW + || adg.selectionMode == AdvancedDataGridBase.MULTIPLE_ROWS) + { + if (adg.isItemHighlighted(listData.uid)) + { + newColor = getStyle("textRollOverColor"); + } + else if (adg.isItemSelected(listData.uid)) + { + newColor = getStyle("textSelectedColor"); + } + else + { + newColor = getStyle("color"); + } + } + else if (adg.selectionMode == AdvancedDataGridBase.SINGLE_CELL + || adg.selectionMode == AdvancedDataGridBase.MULTIPLE_CELLS) + { + if (adg.isCellItemHighlighted(listData.uid, listData.columnIndex)) + { + newColor = getStyle("textRollOverColor"); + } + else if (adg.isCellItemSelected(listData.uid, listData.columnIndex)) + { + newColor = getStyle("textSelectedColor"); + } + else + { + newColor = getStyle("color"); + } } if (newColor != explicitColor)