1 /* ************************************************************************
3 qooxdoo - the new era of web development
8 2006 STZ-IDA, Germany, http://www.stz-ida.de
11 LGPL: http://www.gnu.org/licenses/lgpl.html
12 EPL: http://www.eclipse.org/org/documents/epl-v10.php
13 See the LICENSE file in the project's top-level directory for details.
16 * Til Schneider (til132)
18 ************************************************************************ */
20 /* ************************************************************************
24 ************************************************************************ */
27 * An abstract data cell renderer that does the basic coloring
28 * (borders, selected look, ...).
30 qx.OO.defineClass("qx.ui.table.AbstractDataCellRenderer", qx.ui.table.DataCellRenderer,
32 qx.ui.table.DataCellRenderer.call(this);
37 qx.Proto.createDataCellHtml = function(cellInfo) {
38 var AbstractDataCellRenderer = qx.ui.table.AbstractDataCellRenderer;
39 return AbstractDataCellRenderer.MAIN_DIV_START + this._getCellStyle(cellInfo)
40 + AbstractDataCellRenderer.MAIN_DIV_START_END
41 + this._getContentHtml(cellInfo) + AbstractDataCellRenderer.MAIN_DIV_END;
46 qx.Proto.updateDataCellElement = function(cellInfo, cellElement) {
47 cellElement.innerHTML = this._getContentHtml(cellInfo);
52 * Returns the CSS styles that should be applied to the main div of this cell.
54 * @param cellInfo {Map} The information about the cell.
55 * See {@link #createDataCellHtml}.
56 * @return the CSS styles of the main div.
58 qx.Proto._getCellStyle = function(cellInfo) {
59 return cellInfo.style + qx.ui.table.AbstractDataCellRenderer.MAIN_DIV_STYLE;
64 * Returns the HTML that should be used inside the main div of this cell.
66 * @param cellInfo {Map} The information about the cell.
67 * See {@link #createDataCellHtml}.
68 * @return {String} the inner HTML of the main div.
70 qx.Proto._getContentHtml = function(cellInfo) {
71 return cellInfo.value;
75 qx.Proto.createDataCellHtml_array_join = function(cellInfo, htmlArr) {
76 var AbstractDataCellRenderer = qx.ui.table.AbstractDataCellRenderer;
78 if (qx.ui.table.TablePane.USE_TABLE) {
79 htmlArr.push(AbstractDataCellRenderer.TABLE_TD);
80 htmlArr.push(cellInfo.styleHeight);
83 htmlArr.push(AbstractDataCellRenderer.ARRAY_JOIN_MAIN_DIV_LEFT);
84 htmlArr.push(cellInfo.styleLeft);
85 htmlArr.push(AbstractDataCellRenderer.ARRAY_JOIN_MAIN_DIV_WIDTH);
86 htmlArr.push(cellInfo.styleWidth);
87 htmlArr.push(AbstractDataCellRenderer.ARRAY_JOIN_MAIN_DIV_HEIGHT);
88 htmlArr.push(cellInfo.styleHeight);
92 this._createCellStyle_array_join(cellInfo, htmlArr);
94 htmlArr.push(AbstractDataCellRenderer.ARRAY_JOIN_MAIN_DIV_START_END);
96 this._createContentHtml_array_join(cellInfo, htmlArr);
98 if (qx.ui.table.TablePane.USE_TABLE) {
99 htmlArr.push(AbstractDataCellRenderer.TABLE_TD_END);
101 htmlArr.push(AbstractDataCellRenderer.ARRAY_JOIN_MAIN_DIV_END);
106 qx.Proto._createCellStyle_array_join = function(cellInfo, htmlArr) {
107 htmlArr.push(qx.ui.table.AbstractDataCellRenderer.MAIN_DIV_STYLE);
111 qx.Proto._createContentHtml_array_join = function(cellInfo, htmlArr) {
112 htmlArr.push(cellInfo.value);
116 qx.Class.MAIN_DIV_START = '<div style="';
117 qx.Class.MAIN_DIV_START_END = '">';
118 qx.Class.MAIN_DIV_END = '</div>';
120 qx.Class.MAIN_DIV_STYLE = ';overflow:hidden;white-space:nowrap;border-right:1px solid #eeeeee;border-bottom:1px solid #eeeeee;padding-left:2px;padding-right:2px;cursor:default'
121 + (qx.core.Client.getInstance().isMshtml() ? '' : ';-moz-user-select:none;');
123 qx.Class.ARRAY_JOIN_MAIN_DIV_LEFT = '<div style="position:absolute;left:';
124 qx.Class.ARRAY_JOIN_MAIN_DIV_WIDTH = 'px;top:0px;width:';
125 qx.Class.ARRAY_JOIN_MAIN_DIV_HEIGHT = 'px;height:';
126 qx.Class.ARRAY_JOIN_MAIN_DIV_START_END = '">';
127 qx.Class.ARRAY_JOIN_MAIN_DIV_END = '</div>';
129 qx.Class.TABLE_TD = '<td style="height:';
130 qx.Class.TABLE_TD_END = '</td>';