01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08:
09: package com.gwtext.client.widgets;
10:
11: import com.google.gwt.core.client.JavaScriptObject;
12:
13: /**
14: * A simple class that renders text directly into a toolbar.
15: */
16: public class ToolbarTextItem extends ToolbarItem {
17:
18: /**
19: * Create a new ToolbarTextItem
20: *
21: * @param text the text
22: */
23: public ToolbarTextItem(String text) {
24: setJsObj(create(text));
25: }
26:
27: private native JavaScriptObject create(String text) /*-{
28: return new $wnd.Ext.Toolbar.TextItem(text);
29: }-*/;
30:
31: /**
32: * Return the text.
33: *
34: * @return the text
35: */
36: public native String getText()/*-{
37: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
38: return tbi.el.innerHTML;
39: }-*/;
40:
41: /**
42: * Sets the toolbar item text
43: *
44: * @param text the text to set
45: */
46: public native void setText(String text)/*-{
47: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
48: tbi.el.innerHTML = text;
49: }-*/;
50: }
|