Hi Skar,
Here is a renderer out of which you can get some inspiration. Basically, 
__labels is a hash of [value,translation] and __icons is a hash of 
[value,icons]. The cell model contains an enum value (e.g. "M" for 
"Male" and "F" for "Female").

HTH,
Vincent

qx.Class.define("org.jspresso.framework.view.qx.EnumerationTableCellRenderer",
{
  extend : qx.ui.table.cellrenderer.Default,

  construct : function(labels, icons) {
    this.base(arguments);
    this.__labels = labels;
    this.__icons = icons;
  },


  members :
  {
    __labels : null,
    __icons : null,
   
    _getContentHtml : function(cellInfo) {
      return this.__getImgHtml(cellInfo) + 
(this.__labels[cellInfo.value]||"");
    },
   
    __getImgHtml : function(cellInfo) {
      var rIcon = this.__icons[cellInfo.value];
      if(rIcon) {
        var w = 12;
        var h = 12;
        if(rIcon.getDimension()) {
          w = rIcon.getDimension().getWidth();
          h = rIcon.getDimension().getHeight();
        }
        var css = qx.bom.element.Style.compile({
          position : "relative",
          width : w + "px",
          height : h + "px",
          "margin-right" : "3px",
          "vertical-align" : "middle"
        });
        return '<img src="' + rIcon.getImageUrlSpec() + '" style="' + 
css + '"/>';
      }
      return "";
    }
  }
});

-- 
Vincent Vandenschrick
 Jspresso Framework
 http://www.jspresso.org


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to