All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.extjs.gxt.ui.client.widget.Text Maven / Gradle / Ivy

There is a newer version: 2.3.1-gwt22
Show newest version
/*
 * Sencha GXT 2.3.1a - Sencha for GWT
 * Copyright(c) 2007-2013, Sencha, Inc.
 * [email protected]
 * 
 * http://www.sencha.com/products/gxt/license/
 */
 package com.extjs.gxt.ui.client.widget;

import com.extjs.gxt.ui.client.core.El;
import com.extjs.gxt.ui.client.util.Util;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;

/**
 * A component that contains text. The text value is not treated as HTML. The
 * HTML tag used can be configured using {@link #tagName}.
 * 
 * 
*
Inherited Events:
*
BoxComponent Move
*
BoxComponent Resize
*
Component Enable
*
Component Disable
*
Component BeforeHide
*
Component Hide
*
Component BeforeShow
*
Component Show
*
Component Attach
*
Component Detach
*
Component BeforeRender
*
Component Render
*
Component BrowserEvent
*
Component BeforeStateRestore
*
Component StateRestore
*
Component BeforeStateSave
*
Component SaveState
*
*/ public class Text extends BoxComponent { private String tagName = "div"; private String text; /** * Creates a new text instance. */ public Text() { } /** * Creates a new text instance with the given text. * * @param text the text */ public Text(String text) { setText(text); } /** * @return the tagName */ public String getTagName() { return tagName; } /** * Returns the current text * * @return the text */ public String getText() { return text; } /** * The HTML tag name that will wrap the text (defaults to 'div', pre-render). * For inline behavior set the tag name to 'span'. * * @param tagName the tag name */ public void setTagName(String tagName) { this.tagName = tagName; } /** * Sets the text. * * @param text the new text */ public void setText(String text) { this.text = text; if (rendered) { el().update(Util.isEmptyString(text) ? " " : El.toSafeHTML(text)); } } @Override protected void onRender(Element target, int index) { setElement(DOM.createElement(getTagName()), target, index); super.onRender(target, index); setText(text); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy