diff options
author | Tobi Oetiker <tobi@oetiker.ch> | 2008-06-02 22:03:33 +0200 |
---|---|---|
committer | Tobi Oetiker <tobi@oetiker.ch> | 2008-06-02 22:03:33 +0200 |
commit | 8793d83042d5cf388a30ee5f8637fa6554334aa6 (patch) | |
tree | ca1d1a68cd3513f1eab9fa9a14559f687d233aae /qooxdoo/source/class/Mtr/ui/Cellrenderer.js | |
parent | 6b239270a134ef8f26d59a7ab9b35eeeeceb9c47 (diff) | |
download | smokeping-8793d83042d5cf388a30ee5f8637fa6554334aa6.tar.gz smokeping-8793d83042d5cf388a30ee5f8637fa6554334aa6.tar.xz |
initial support for mrt integration
Diffstat (limited to 'qooxdoo/source/class/Mtr/ui/Cellrenderer.js')
-rw-r--r-- | qooxdoo/source/class/Mtr/ui/Cellrenderer.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/qooxdoo/source/class/Mtr/ui/Cellrenderer.js b/qooxdoo/source/class/Mtr/ui/Cellrenderer.js new file mode 100644 index 0000000..2b2e45e --- /dev/null +++ b/qooxdoo/source/class/Mtr/ui/Cellrenderer.js @@ -0,0 +1,46 @@ +/* ************************************************************************ + + Mtr Frontend + + Author: + * Tobias Oetiker + +************************************************************************ */ +/* ************************************************************************ +#module(Mtr) +************************************************************************ */ + +/** + * A configurable cell renderre + */ + +qx.Class.define('Mtr.ui.Cellrenderer', +{ + extend: qx.ui.table.cellrenderer.Number, + /** + * Format a number with a configurable number of fraction digits + * and add optional pre and postfix. + * @param digits {Integer} how many digits should there be. Default is 0. + * @param prefix {String} optional prefix. + * @param postfix {String} optional postfix. + */ + + construct: function (digits,postfix,prefix) { + if (digits == undefined){ + digits = 0; + } + this.base(arguments) + var format = new qx.util.format.NumberFormat(); + format.set({ + maximumFractionDigits: digits, + minimumFractionDigits: digits + }); + if (postfix != undefined){ + format.setPostfix(postfix); + } + if (prefix != undefined){ + format.setPrefix(prefix); + } + this.setNumberFormat(format); + } +}); |