text: /* ************************************************************************
  
     qooxdoo - the new era of web development
  
     http://qooxdoo.org
  
     Copyright:
       2006 STZ-IDA, Germany, http://www.stz-ida.de
  
     License:
       MIT: https://opensource.org/licenses/MIT
       See the LICENSE file in the project's top-level directory for details.
  
     Authors:
       * Til Schneider (til132)
       * Sebastian Werner (wpbasti)
  
  ************************************************************************ */
  
  /**
   * The default header cell renderer.
   */
  qx.Class.define("qx.ui.table.headerrenderer.Default",
  {
    extend : qx.core.Object,
    implement : qx.ui.table.IHeaderRenderer,
  
  
  
  
  
    /*
    *****************************************************************************
       STATICS
    *****************************************************************************
    */
  
    statics :
    {
      /**
       * @type {String} The state which will be set for header cells of sorted columns.
       */
      STATE_SORTED           : "sorted",
  
  
      /**
       * @type {String} The state which will be set when sorting is ascending.
       */
      STATE_SORTED_ASCENDING : "sortedAscending"
    },
  
  
  
  
    /*
    *****************************************************************************
       PROPERTIES
    *****************************************************************************
    */
  
    properties :
    {
      /**
       * ToolTip to show if the pointer hovers of the icon
       */
      toolTip :
      {
        check : "String",
        init : null,
        nullable : true
      }
    },
  
  
  
  
    /*
    *****************************************************************************
       MEMBERS
    *****************************************************************************
    */
  
    members :
    {
      // overridden
      createHeaderCell : function(cellInfo)
      {
        var widget = new qx.ui.table.headerrenderer.HeaderCell();
        this.updateHeaderCell(cellInfo, widget);
  
        return widget;
      },
  
  
      // overridden
      updateHeaderCell : function(cellInfo, cellWidget)
      {
        var DefaultHeaderCellRenderer = qx.ui.table.headerrenderer.Default;
  
        // check for localization [BUG #2699]
        if (cellInfo.name && cellInfo.name.translate) {
          cellWidget.setLabel(cellInfo.name.translate());
        } else {
          cellWidget.setLabel(cellInfo.name);
        }
  
        // Set image tooltip if given
        var widgetToolTip = cellWidget.getToolTip();
        if (this.getToolTip() != null)
        {
          if (widgetToolTip == null)
          {
            // We have no tooltip yet -> Create one
            widgetToolTip = new qx.ui.tooltip.ToolTip(this.getToolTip());
            cellWidget.setToolTip(widgetToolTip);
            // Link disposer to cellwidget to prevent memory leak
            qx.util.DisposeUtil.disposeTriggeredBy(widgetToolTip, cellWidget);
          }
          else
          {
            // Update tooltip text
            widgetToolTip.setLabel(this.getToolTip());
          }
        }
  
        cellInfo.sorted ?
          cellWidget.addState(DefaultHeaderCellRenderer.STATE_SORTED) :
          cellWidget.removeState(DefaultHeaderCellRenderer.STATE_SORTED);
  
        cellInfo.sortedAscending ?
          cellWidget.addState(DefaultHeaderCellRenderer.STATE_SORTED_ASCENDING) :
          cellWidget.removeState(DefaultHeaderCellRenderer.STATE_SORTED_ASCENDING);
      }
    }
  });
  