/**
 * Generated by Apache Royale Compiler from org\apache\royale\html\util\getLabelFromData.as
 * org.apache.royale.html.util.getLabelFromData
 *
 * @fileoverview
 *
 * @suppress {checkTypes|accessControls}
 */

goog.provide('org.apache.royale.html.util.getLabelFromData');
goog.require('org.apache.royale.utils.Language');



/**
 *  @langversion 3.0
 *  @playerversion Flash 10.2
 *  @playerversion AIR 2.6
 *  @productversion Royale 0.9.3
 * Utility function to get a label string from a value object
 * @export
 * @param {Object} obj
 * @param {Object} data
 * @return {string}
 */
org.apache.royale.html.util.getLabelFromData = function(obj, data) {
  if (org.apache.royale.utils.Language.is(data, String))
    return "" + data;
  if (!data)
    return "";
  if (obj["labelField"])
    return "" + data[obj["labelField"]];
  if (obj["dataField"])
    return "" + data[obj["dataField"]];
  if (data.hasOwnProperty("label"))
    return "" + data["label"];
  return "" + data;
}