01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08: package com.gwtext.client.widgets.grid;
09:
10: /**
11: * Handle to the Grid cell metadata passed to a Grid Column Renderer. This allows
12: * fine grained coltrol to the column Renderer to custom render a grid cell. You can
13: * customize a Grid cell appearance by either using {@link #setCssClass(String)} or
14: * {@link #setHtmlAttribute(String)} . There is a subtle difference between the two methods that is best illustrated
15: * by an example.
16: * <br/>
17: * So when cellMetadata.setHtmlAttribute("style=\"background:yellow;\""); is called, the DIV within the cell TD has its attributes set.
18: * <br/><br/>
19: * <code>
20: * <td tabindex="0" class="x-grid-col x-grid-td-2 x-grid-cell-6-2 x-grid-dirty-cell x-grid-cell-selected" id="ext-gen353">
21: * <div class="x-grid-col-2 x-grid-cell-inner"><div style="<b>background: yellow</b> none repeat scroll 0%; -moz-background-clip:-moz-initial; -moz-background-origin: -moz-initial;-moz-background-inline-policy: -moz-initial;" unselectable="on" class="x-grid-cell-text">$4.41</div>
22: * </div>
23: * </td>
24: * </code>
25: * <br/><br/>
26: * <p/>
27: * And when setCssClass is called, it sets the CSS on the TD element. As an example, when cellMetadata.setCssClass("mystyle") is called the rendered html for the cell is
28: * <br/><br/>
29: * <code>
30: * <p/>
31: * <td tabindex="0" class="x-grid-col x-grid-td-2 x-grid-cell-6-2 x-grid-dirty-cell x-grid-cell-selected <b>mystyle</b>" id="ext-gen353"><div class="x-grid-col-2 x-grid-cell-inner">
32: * <div style="-moz-background-clip: -moz-initial; -moz-background-origin:-moz-initial; -moz-background-inline-policy: -moz-initial;"unselectable="on" class="x-grid-cell-text">$4.41</div></div>
33: * </td>
34: * </code>
35: *
36: * @see ColumnConfig#setRenderer(Renderer)
37: * @see com.gwtext.client.widgets.grid.Renderer
38: */
39: public interface CellMetadata {
40:
41: /**
42: * Sets the CSS style to the table cell.
43: *
44: * @param cssClass CSS class
45: */
46: void setCssClass(String cssClass);
47:
48: /**
49: * Sets the HTML attribute definition to the data container element within the table cell.
50: *
51: * @param htmlAttribute the html attribute
52: */
53: void setHtmlAttribute(String htmlAttribute);
54: }
|