Source Code Cross Referenced for Toolbar.java in  » Ajax » gwtext-2.01 » com » gwtext » client » widgets » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Ajax » gwtext 2.01 » com.gwtext.client.widgets 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * GWT-Ext Widget Library
003:         * Copyright(c) 2007-2008, GWT-Ext.
004:         * licensing@gwt-ext.com
005:         *
006:         * http://www.gwt-ext.com/license
007:         */
008:
009:        package com.gwtext.client.widgets;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.google.gwt.user.client.Element;
013:        import com.gwtext.client.widgets.form.Field;
014:
015:        /**
016:         * Basic Toolbar class.
017:         */
018:        public class Toolbar extends BoxComponent {
019:
020:            private static JavaScriptObject configPrototype;
021:
022:            static {
023:                init();
024:            }
025:
026:            private static native void init()/*-{
027:                    var c = new $wnd.Ext.Toolbar();
028:                    @com.gwtext.client.widgets.Toolbar::configPrototype = c.initialConfig;
029:                }-*/;
030:
031:            protected JavaScriptObject getConfigPrototype() {
032:                return configPrototype;
033:            }
034:
035:            /**
036:             * Create a new Toolbar.
037:             */
038:            public Toolbar() {
039:            }
040:
041:            public Toolbar(JavaScriptObject jsObj) {
042:                super (jsObj);
043:            }
044:
045:            public String getXType() {
046:                return "toolbar";
047:            }
048:
049:            protected native JavaScriptObject create(JavaScriptObject config) /*-{
050:            	if(!config.items) config.items = @com.gwtext.client.util.JavaScriptObjectHelper::createJavaScriptArray()();
051:            	return new $wnd.Ext.Toolbar(config);
052:               }-*/;
053:
054:            /**
055:             * Adds a button to the toolbar.
056:             *
057:             * @param button the button
058:             */
059:            public void addButton(ToolbarButton button) {
060:                if (isRendered()) {
061:                    JavaScriptObject componentJS = button.isCreated() ? button
062:                            .getOrCreateJsObj() : button.getConfig();
063:                    addButtonPostRender(componentJS);
064:
065:                } else {
066:                    JavaScriptObject componentJS = button.isCreated() ? button
067:                            .getOrCreateJsObj() : button.getConfig();
068:                    addButtonPreRender(componentJS);
069:                }
070:            }
071:
072:            private native void addButtonPreRender(JavaScriptObject componentJS) /*-{
073:            	var config = this.@com.gwtext.client.widgets.Component::config;
074:
075:                   if(!config.items) {
076:                       config.items = @com.gwtext.client.util.JavaScriptObjectHelper::createJavaScriptArray()();
077:                   }
078:                   config.items.push(componentJS);
079:               }-*/;
080:
081:            private native void addButtonPostRender(JavaScriptObject componentJS) /*-{
082:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
083:                   panel.addButton(componentJS);
084:               }-*/;
085:
086:            /**
087:             * Adds a toolbar menu button.
088:             *
089:             * @param button the button to add
090:             */
091:            public void addButton(ToolbarMenuButton button) {
092:                if (isRendered()) {
093:                    JavaScriptObject componentJS = button.isCreated() ? button
094:                            .getOrCreateJsObj() : button.getConfig();
095:                    addButtonPostRender(componentJS);
096:
097:                } else {
098:                    JavaScriptObject componentJS = button.isCreated() ? button
099:                            .getOrCreateJsObj() : button.getConfig();
100:                    addButtonPreRender(componentJS);
101:                }
102:            }
103:
104:            /**
105:             * Adds any standard element to the toolbar.
106:             *
107:             * @param element the element to add
108:             */
109:            public void addElement(Element element) {
110:                addItem(new ToolbarItem(element));
111:            }
112:
113:            /**
114:             * Adds a dynamically rendered {@link Field} (TextField, ComboBox, etc). Note: the field should not have been rendered yet.
115:             *
116:             * @param field the field to add
117:             */
118:            public void addField(Field field) {
119:                if (isRendered()) {
120:                    JavaScriptObject componentJS = field.isCreated() ? field
121:                            .getOrCreateJsObj() : field.getConfig();
122:                    addFieldPostRender(componentJS);
123:
124:                } else {
125:                    JavaScriptObject componentJS = field.isCreated() ? field
126:                            .getOrCreateJsObj() : field.getConfig();
127:                    addFieldPreRender(componentJS);
128:                }
129:            }
130:
131:            private static native void addFieldPostRender(JavaScriptObject field)/*-{
132:            		var toolbar = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
133:            		toolbar.addField(field);
134:                }-*/;
135:
136:            private native void addFieldPreRender(JavaScriptObject componentJS) /*-{
137:            	var config = this.@com.gwtext.client.widgets.Component::config;
138:
139:                   if(!config.items) {
140:                       config.items = @com.gwtext.client.util.JavaScriptObjectHelper::createJavaScriptArray()();
141:                   }
142:                   config.items.push(componentJS);
143:               }-*/;
144:
145:            //http://extjs.com/forum/showthread.php?t=2470
146:            /**
147:             * Adds a fill element that forces subsequent additions to the right side of the toolbar.
148:             */
149:            public void addFill() {
150:                if (isRendered()) {
151:                    addFillRendered();
152:                } else {
153:                    addItem(new ToolbarFill());
154:                }
155:            }
156:
157:            private native void addFillRendered() /*-{
158:                   var toolbar = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
159:                   toolbar.addFill();
160:               }-*/;
161:
162:            /**
163:             * Adds any {@link ToolbarItem} or subclass.
164:             *
165:             * @param item the item to add
166:             */
167:            public void addItem(ToolbarItem item) {
168:                if (isRendered()) {
169:                    JavaScriptObject componentJS = item.getJsObj();
170:                    addItemPostRender(componentJS);
171:
172:                } else {
173:                    JavaScriptObject componentJS = item.getJsObj();
174:                    addItemPreRender(componentJS);
175:                }
176:            }
177:
178:            private native void addItemPreRender(JavaScriptObject componentJS) /*-{
179:            	var config = this.@com.gwtext.client.widgets.Component::config;
180:
181:                   if(!config.items) {
182:                       config.items = @com.gwtext.client.util.JavaScriptObjectHelper::createJavaScriptArray()();
183:                   }
184:                   config.items.push(componentJS);
185:               }-*/;
186:
187:            private native void addItemPostRender(JavaScriptObject componentJS) /*-{
188:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
189:                   panel.addItem(componentJS);
190:               }-*/;
191:
192:            /**
193:             * Adds a separator.
194:             */
195:            public void addSeparator() {
196:                if (isRendered()) {
197:                    addSeparatorRendered();
198:                } else {
199:                    addItem(new ToolbarSeparator());
200:                }
201:            }
202:
203:            private native void addSeparatorRendered() /*-{
204:                   var toolbar = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
205:                   var separator = toolbar.addSeparator();
206:               }-*/;
207:
208:            /**
209:             * Adds a spacer element.
210:             *
211:             */
212:            public void addSpacer() {
213:                if (isRendered()) {
214:                    addSpacerRendered();
215:                } else {
216:                    addItem(new ToolbarSpacer());
217:                }
218:            }
219:
220:            private native void addSpacerRendered() /*-{
221:                   var toolbar = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
222:                   var spacer = toolbar.addSpacer();
223:               }-*/;
224:
225:            /**
226:             * Adds text to the toolbar.
227:             *
228:             * @param text the text
229:             */
230:            public void addText(String text) {
231:                if (isRendered()) {
232:                    addTextRendered(text);
233:                } else {
234:                    addItem(new ToolbarTextItem(text));
235:                }
236:            }
237:
238:            private native void addTextRendered(String text) /*-{
239:                   var toolbar = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
240:                   toolbar.addText(text);
241:               }-*/;
242:
243:            //todo2
244:            /**
245:             * Inserts a ToolbarItem at the specified index.
246:             *
247:             * @param index the index to insert at
248:             * @param item the idnem to inser
249:             */
250:            /*public void insertItem(int index, ToolbarItem item) {
251:                insertButton(getJsObj(), index, item.getJsObj());
252:            }
253:
254:            private native void insertButton(JavaScriptObject toolbar, int index, JavaScriptObject item) *//*-{
255:                    toolbar.insertButton(index, item);
256:                }-*//*;
257:             */
258:            /**
259:             * Inserts a ToolbarButton at the specified index.
260:             *
261:             * @param index the index to insert at
262:             * @param button the button to isnert
263:             */
264:            /*  public void insertButton(int index, ToolbarButton button) {
265:                  insertButton(getJsObj(), index, button.getJsObj());
266:              }*/
267:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.