1 /* ************************************************************************
3 qooxdoo - the new era of web development
8 2004-2006 by 1&1 Internet AG, Germany, http://www.1and1.org
11 LGPL 2.1: http://www.gnu.org/licenses/lgpl.html
14 * Sebastian Werner (wpbasti)
15 * Andreas Ecker (ecker)
17 ************************************************************************ */
19 /* ************************************************************************
22 #require(qx.renderer.font.FontCache)
23 #after(qx.renderer.font.FontObject)
25 ************************************************************************ */
27 qx.OO.defineClass("qx.ui.embed.TextEmbed", qx.ui.basic.Terminator,
30 qx.ui.basic.Terminator.call(this);
32 if (qx.util.Validation.isValidString(vText)) {
41 ---------------------------------------------------------------------------
43 ---------------------------------------------------------------------------
47 Any text string which can contain TEXT, too
49 qx.OO.addProperty({ name : "text", type : "string" });
52 The font property describes how to paint the font on the widget.
54 qx.OO.addProperty({ name : "font", type : "object", instance : "qx.renderer.font.Font", convert : qx.renderer.font.FontCache, allowMultipleArguments : true });
59 qx.OO.addProperty({ name : "wrap", type : "boolean", defaultValue : true });
61 /** The horizontal alignment of the text. */
62 qx.OO.addProperty({ name : "textAlign", type : "string", defaultValue : "left", possibleValues : [ "left", "center", "right", "justify" ], allowNull : false });
68 ---------------------------------------------------------------------------
70 ---------------------------------------------------------------------------
73 qx.Proto._modifyText = function()
75 if (this._isCreated) {
82 qx.Proto._modifyFont = function(propValue, propOldValue, propData)
85 propValue._applyWidget(this);
86 } else if (propOldValue) {
87 propOldValue._resetWidget(this);
93 qx.Proto._modifyWrap = function(propValue, propOldValue, propData)
95 this.setStyleProperty("whiteSpace", propValue ? "normal" : "nowrap");
100 qx.Proto._modifyTextAlign = function(propValue, propOldValue, propData) {
101 this.setStyleProperty("textAlign", propValue);
110 ---------------------------------------------------------------------------
112 ---------------------------------------------------------------------------
115 qx.Proto._applyElementData = function() {
116 this.getElement().appendChild(document.createTextNode(this.getText()));
119 qx.Proto._syncText = function() {
120 this.getElement().firstChild.nodeValue = this.getText();