UNPKG

@qooxdoo/framework

Version:

The JS Framework for Coders

111 lines (95 loc) 3.11 kB
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2009 1&1 Internet AG, Germany, http://www.1und1.de License: MIT: https://opensource.org/licenses/MIT See the LICENSE file in the project's top-level directory for details. Authors: * Jonathan Weiß (jonathan_rass) ************************************************************************ */ /** * Abstract base class for HTML based cell renderer. * * HTML cell renderer are used to construct an HTML string, which is used to * render the cell. * * @require(qx.bom.Stylesheet) * */ qx.Class.define("qx.ui.virtual.cell.Abstract", { type: "abstract", extend: qx.core.Object, implement: qx.ui.virtual.cell.ICell, construct() { super(); // initialize stylesheet qx.ui.virtual.cell.CellStylesheet.getInstance(); }, members: { /** * Get the css classes for the cell * * @param value {var} The cell's data value * @param states {Object} A map containing the cell's state names as map keys. * @return {String} Space separated list of CSS classes */ getCssClasses(value, states) { return "qx-cell"; }, /** * Get the element attributes for the cell * * @param value {var} The cell's data value * @param states {Object} A map containing the cell's state names as map keys. * @return {String} Compiled string of cell attributes. e.g. * <code>'tabIndex="1" readonly="false"'</code> */ getAttributes(value, states) { return ""; }, /** * Get the CSS styles for the cell * * @param value {var} The cell's data value * @param states {Object} A map containing the cell's state names as map keys. * @return {String} Compiled string of CSS styles. e.g. * <code>'color="red; padding: 10px'</code> */ getStyles(value, states) { return ""; }, /** * Get the cell's insets. Insets are the sum of the cell's padding and * border width. * * @param value {var} The cell's data value * @param states {Object} A map containing the cell's state names as map keys. * @return {Integer[]} An array containing the sum of horizontal insets at index * <code>0</code> and the sum of vertical insets at index <code>1</code>. */ getInsets(value, states) { return [0, 0]; }, /** * Get cell'S HTML content * * @param value {var} The cell's data value * @param states {Object} A map containing the cell's state names as map keys. * @return {String} The cell's content as HTML fragment. */ getContent(value, states) { return value; }, getCellProperties(value, states) { return { classes: this.getCssClasses(value, states), style: this.getStyles(value, states), attributes: this.getAttributes(value, states), content: this.getContent(value, states), insets: this.getInsets(value, states) }; } } });