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: import com.google.gwt.user.client.Element;
13:
14: /**
15: * The base class that other classes should extend in order to get some basic common toolbar item functionality.
16: */
17: public class ToolbarItem extends BaseExtWidget {
18:
19: protected ToolbarItem() {
20: }
21:
22: /**
23: * Creates a new Item.
24: *
25: * @param element the html element
26: */
27: public ToolbarItem(Element element) {
28: setJsObj(create(element));
29: }
30:
31: private native JavaScriptObject create(Element element) /*-{
32: return new $wnd.Ext.Toolbar.Item(element);
33: }-*/;
34:
35: public ToolbarItem(JavaScriptObject jsObj) {
36: super (jsObj);
37: }
38:
39: /**
40: * Removes and destroys this item.
41: */
42: public native void destroy()/*-{
43: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
44: tbi.destroy();
45: }-*/;
46:
47: /**
48: * Disables this item.
49: */
50: public native void disable()/*-{
51: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
52: tbi.disable();
53: }-*/;
54:
55: /**
56: * Enables this item.
57: */
58: public native void enable()/*-{
59: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
60: tbi.enable();
61: }-*/;
62:
63: /**
64: * Try to focus this item.
65: */
66: public native void focus()/*-{
67: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
68: tbi.focus();
69: }-*/;
70:
71: /**
72: * Hides this item.
73: */
74: public native void hide()/*-{
75: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
76: tbi.hide();
77: }-*/;
78:
79: /**
80: * Shows this item.
81: */
82: public native void show()/*-{
83: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
84: tbi.show();
85: }-*/;
86:
87: /**
88: * Convenience function for boolean show/hide.
89: *
90: * @param visible true to show
91: */
92: public native void setVisible(boolean visible)/*-{
93: var tbi = this.@com.gwtext.client.widgets.BaseExtWidget::jsObj;
94: tbi.setVisible(visible);
95: }-*/;
96: }
|