1 /* ************************************************************************
3 qooxdoo - the new era of web development
8 2006 by STZ-IDA, Germany, http://www.stz-ida.de
11 LGPL 2.1: http://www.gnu.org/licenses/lgpl.html
14 * Til Schneider (til132)
15 * Carsten Lergenmueller (carstenl)
17 ************************************************************************ */
19 /* ************************************************************************
23 ************************************************************************ */
26 * A header cell renderer which renders an icon (only). The icon cannot be combined
29 * @param iconUrl {string} URL to the icon to show
30 * @param tooltip {string ? ""} Text of the tooltip to show if the mouse hovers over the
34 qx.OO.defineClass("qx.ui.table.IconHeaderCellRenderer", qx.ui.table.DefaultHeaderCellRenderer,
35 function(iconUrl, tooltip) {
36 qx.ui.table.DefaultHeaderCellRenderer.call(this);
40 this.setIconUrl(iconUrl);
41 this.setToolTip(tooltip);
45 * URL of the icon to show
47 qx.OO.addProperty({ name:"iconUrl", type:"string", defaultValue:"", allowNull:false });
50 * ToolTip to show if the mouse hovers of the icon
52 qx.OO.addProperty({ name:"toolTip", type:"string", defaultValue:null, allowNull:true });
55 qx.Proto.updateHeaderCell = function(cellInfo, cellWidget) {
56 qx.ui.table.DefaultHeaderCellRenderer.prototype.updateHeaderCell.call(this, cellInfo, cellWidget);
59 var img = cellWidget.getUserData("qx_ui_table_IconHeaderCellRenderer_icon");
61 img = new qx.ui.basic.Image();
62 cellWidget.setUserData("qx_ui_table_IconHeaderCellRenderer_icon", img);
63 cellWidget.addAtBegin(img);
65 img.setSource(this.getIconUrl());
67 // Set image tooltip if given
68 var widgetToolTip = cellWidget.getToolTip();
69 if (this.getToolTip() != null){
71 //Create tooltip if necessary
72 if (true || widgetToolTip == null ){
73 widgetToolTip = new qx.ui.popup.ToolTip(this.getToolTip());
74 cellWidget.setToolTip(widgetToolTip);
75 //this.debug("Creating tooltip");
79 widgetToolTip.getAtom().setLabel(this.getToolTip());
80 //this.debug("Setting tooltip text " + this.getToolTip());