Repository: flex-sdk Updated Branches: refs/heads/develop c7e77bbed -> d5a809bbd
FLEX-31948 Removing the fatal by checking whether the column exists. Plus some minor code changes while reading code: simplifying if clauses, removing superfluous brackets, adding semicolons. Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/d5a809bb Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/d5a809bb Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/d5a809bb Branch: refs/heads/develop Commit: d5a809bbd07edd421277a759fba66d8cba97a05d Parents: c7e77bb Author: Mihai Chira <mih...@apache.org> Authored: Mon Apr 18 12:46:53 2016 +0200 Committer: Mihai Chira <mih...@apache.org> Committed: Mon Apr 18 12:46:53 2016 +0200 ---------------------------------------------------------------------- .../framework/src/mx/resources/ResourceManagerImpl.as | 11 +++++------ frameworks/projects/mx/src/mx/controls/ComboBox.as | 4 +--- frameworks/projects/mx/src/mx/controls/DataGrid.as | 3 ++- .../projects/spark/src/spark/components/DropDownList.as | 10 +++------- frameworks/projects/spark/src/spark/components/List.as | 4 ++-- frameworks/projects/spark/src/spark/utils/LabelUtil.as | 5 ++--- 6 files changed, 15 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/d5a809bb/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as b/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as index 29093b9..92915a0 100644 --- a/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as +++ b/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as @@ -530,7 +530,7 @@ public class ResourceManagerImpl extends EventDispatcher implements IResourceMan if (updateFlag) update(); - } + }; moduleInfo.addEventListener(ModuleEvent.READY, readyHandler, false, 0, true); @@ -554,7 +554,7 @@ public class ResourceManagerImpl extends EventDispatcher implements IResourceMan { throw new Error(message); } - } + }; moduleInfo.addEventListener(ModuleEvent.ERROR, errorHandler, false, 0, true); @@ -576,7 +576,7 @@ public class ResourceManagerImpl extends EventDispatcher implements IResourceMan // Start loading the module. moduleInfo.load(applicationDomain, securityDomain); - } + }; timer.addEventListener(TimerEvent.TIMER, timerHandler, false, 0, true); timer.start(); @@ -927,8 +927,7 @@ public class ResourceManagerImpl extends EventDispatcher implements IResourceMan parameters:Array = null, locale:String = null):String { - var resourceBundle:IResourceBundle = - findBundle(bundleName, resourceName, locale); + var resourceBundle:IResourceBundle = findBundle(bundleName, resourceName, locale); if (!resourceBundle) return null; @@ -1255,7 +1254,7 @@ class ResourceModuleInfo /** * @private */ - public var moduleInfo:IModuleInfo + public var moduleInfo:IModuleInfo; //---------------------------------- // readyHandler http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/d5a809bb/frameworks/projects/mx/src/mx/controls/ComboBox.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/mx/src/mx/controls/ComboBox.as b/frameworks/projects/mx/src/mx/controls/ComboBox.as index 8dec126..582e062 100644 --- a/frameworks/projects/mx/src/mx/controls/ComboBox.as +++ b/frameworks/projects/mx/src/mx/controls/ComboBox.as @@ -1388,9 +1388,7 @@ public class ComboBox extends ComboBase */ public function get selectedLabel():String { - var item:Object = selectedItem; - - return itemToLabel(item); + return itemToLabel(selectedItem); } //-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/d5a809bb/frameworks/projects/mx/src/mx/controls/DataGrid.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/mx/src/mx/controls/DataGrid.as b/frameworks/projects/mx/src/mx/controls/DataGrid.as index 92dca9b..a035e70 100644 --- a/frameworks/projects/mx/src/mx/controls/DataGrid.as +++ b/frameworks/projects/mx/src/mx/controls/DataGrid.as @@ -5103,7 +5103,8 @@ public class DataGrid extends DataGridBase implements IIMESupport */ override public function itemToLabel(data:Object):String { - return _columns[sortIndex == -1 ? 0 : sortIndex].itemToLabel(data); + var column:DataGridColumn = _columns[sortIndex == -1 ? 0 : sortIndex]; + return column ? column.itemToLabel(data) : ""; } //-------------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/d5a809bb/frameworks/projects/spark/src/spark/components/DropDownList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/DropDownList.as b/frameworks/projects/spark/src/spark/components/DropDownList.as index 2ada1c1..e4dbd96 100644 --- a/frameworks/projects/spark/src/spark/components/DropDownList.as +++ b/frameworks/projects/spark/src/spark/components/DropDownList.as @@ -369,13 +369,9 @@ public class DropDownList extends DropDownListBase { if (displayItem == undefined) displayItem = selectedItem; - if (displayItem != null && displayItem != undefined) - labelDisplay.text = LabelUtil.itemToLabel(displayItem, labelField, labelFunction); else - labelDisplay.text = prompt; - } + labelDisplay.text = displayItem != null ? LabelUtil.itemToLabel(displayItem, labelField, labelFunction) : prompt; + } } - -} - } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/d5a809bb/frameworks/projects/spark/src/spark/components/List.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/List.as b/frameworks/projects/spark/src/spark/components/List.as index de4db73..c457c5b 100644 --- a/frameworks/projects/spark/src/spark/components/List.as +++ b/frameworks/projects/spark/src/spark/components/List.as @@ -2781,7 +2781,7 @@ public class List extends ListBase implements IFocusManagerComponent */ mx_internal function findStringLoop(str:String, startIndex:int, stopIndex:int):Number { - // Try to find the item based on the start and stop indices. + // Try to find the item based on the start and stop indices for (startIndex; startIndex != stopIndex; startIndex++) { var itmStr:String = itemToLabel(dataProvider.getItemAt(startIndex)); @@ -2812,7 +2812,7 @@ public class List extends ListBase implements IFocusManagerComponent if (isEditableTarget(event.target)) return; - var touchMode:Boolean = (getStyle("interactionMode") == InteractionMode.TOUCH); + var touchMode:Boolean = getStyle("interactionMode") == InteractionMode.TOUCH; // 1. Was the space bar hit? or was the enter key hit and we're in 5-way mode // Hitting the space bar means the current caret item, http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/d5a809bb/frameworks/projects/spark/src/spark/utils/LabelUtil.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/utils/LabelUtil.as b/frameworks/projects/spark/src/spark/utils/LabelUtil.as index 43a9d96..5de7334 100644 --- a/frameworks/projects/spark/src/spark/utils/LabelUtil.as +++ b/frameworks/projects/spark/src/spark/utils/LabelUtil.as @@ -70,8 +70,7 @@ public class LabelUtil * @playerversion AIR 1.5 * @productversion Flex 4 */ - public static function itemToLabel(item:Object, labelField:String=null, - labelFunction:Function=null):String + public static function itemToLabel(item:Object, labelField:String = null, labelFunction:Function = null):String { if (labelFunction != null) return labelFunction(item); @@ -127,4 +126,4 @@ public class LabelUtil } } -} +} \ No newline at end of file