Source Code Cross Referenced for Panel.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) 


0001:        /*
0002:         * GWT-Ext Widget Library
0003:         * Copyright(c) 2007-2008, GWT-Ext.
0004:         * licensing@gwt-ext.com
0005:         * 
0006:         * http://www.gwt-ext.com/license
0007:         */
0008:        package com.gwtext.client.widgets;
0009:
0010:        import com.google.gwt.core.client.JavaScriptObject;
0011:        import com.google.gwt.user.client.Element;
0012:        import com.gwtext.client.core.*;
0013:        import com.gwtext.client.util.JavaScriptObjectHelper;
0014:        import com.gwtext.client.widgets.event.PanelListener;
0015:
0016:        /**
0017:         * Panel is a container that has specific functionality and structural components that make it the perfect building
0018:         * block for application-oriented user interfaces. The Panel contains bottom and top toolbars, along with separate header,
0019:         * footer and body sections. It also provides built-in expandable and collapsible behavior, along with a variety of prebuilt
0020:         * tool buttons that can be wired up to provide other customized behavior. Panels can be easily dropped into any Container or
0021:         * layout, and the layout and rendering pipeline is completely managed by the framework.
0022:         */
0023:        public class Panel extends Container {
0024:
0025:            private static JavaScriptObject configPrototype;
0026:
0027:            static {
0028:                init();
0029:            }
0030:
0031:            private static native void init()/*-{
0032:                    var c = new $wnd.Ext.Panel();
0033:                    @com.gwtext.client.widgets.Panel::configPrototype = c.initialConfig;
0034:                }-*/;
0035:
0036:            protected JavaScriptObject getConfigPrototype() {
0037:                return configPrototype;
0038:            }
0039:
0040:            public String getXType() {
0041:                return "panel";
0042:            }
0043:
0044:            /**
0045:             * Create a new Panel.
0046:             */
0047:            public Panel() {
0048:            }
0049:
0050:            /**
0051:             * Construct a new Panel with the given title.
0052:             *
0053:             * @param title the title
0054:             */
0055:            public Panel(String title) {
0056:                setTitle(title);
0057:            }
0058:
0059:            public Panel(String title, String html) {
0060:                setTitle(title);
0061:                setHtml(html);
0062:            }
0063:
0064:            public Panel(String title, int width, int height) {
0065:                setTitle(title);
0066:                setWidth(width);
0067:                setHeight(height);
0068:            }
0069:
0070:            protected Panel(JavaScriptObject jsObj) {
0071:                super (jsObj);
0072:            }
0073:
0074:            /**
0075:             * Applys the Panel to an existing element.
0076:             *
0077:             * @param element the element
0078:             */
0079:            public Panel(Element element) {
0080:                super (element);
0081:            }
0082:
0083:            protected native JavaScriptObject create(JavaScriptObject config) /*-{
0084:            	return new $wnd.Ext.Panel(config);
0085:               }-*/;
0086:
0087:            public void setStyleName(String style) {
0088:                setBodyStyle(style);
0089:            }
0090:
0091:            /**
0092:             * Adds a button to this panel. Note that this method must be called prior to rendering. The preferred approach is to
0093:             * add buttons via the buttons config.
0094:             *
0095:             * @param button the button to add
0096:             */
0097:            public void addButton(Button button) {
0098:                if (isCreated()) {
0099:                    JavaScriptObject componentJS = button.isCreated() ? button
0100:                            .getOrCreateJsObj() : button.getConfig();
0101:                    addButtonPostCreate(componentJS);
0102:
0103:                } else {
0104:                    JavaScriptObject componentJS = button.isCreated() ? button
0105:                            .getOrCreateJsObj() : button.getConfig();
0106:                    addButtonPreCreate(componentJS);
0107:                }
0108:            }
0109:
0110:            private native void addButtonPreCreate(JavaScriptObject componentJS) /*-{
0111:            	var config = this.@com.gwtext.client.widgets.Component::config;
0112:
0113:                   if (!config.buttons) {
0114:                       config.buttons = @com.gwtext.client.util.JavaScriptObjectHelper::createJavaScriptArray()();
0115:                   }
0116:                   config.buttons.push(componentJS);
0117:               }-*/;
0118:
0119:            private native void addButtonPostCreate(JavaScriptObject componentJS) /*-{
0120:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0121:                   panel.addButton(componentJS);
0122:               }-*/;
0123:
0124:            /**
0125:             * Collapses the panel body so that it becomes hidden. Fires the beforecollapse event which will cancel the collapse
0126:             * action if it returns false.
0127:             */
0128:            public void collapse() {
0129:                if (!isRendered()) {
0130:                    setCollapsed(true);
0131:                } else {
0132:                    collapseRendered();
0133:                }
0134:            }
0135:
0136:            private native void collapseRendered() /*-{
0137:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0138:                   panel.collapse();
0139:               }-*/;
0140:
0141:            /**
0142:             * Collapses the panel body so that it becomes hidden. Fires the beforecollapse event which will cancel the collapse
0143:             * action if it returns false.
0144:             *
0145:             * @param animate True to animate the transition, else false (defaults to the value of the animCollapse panel config)
0146:             */
0147:            public void collapse(boolean animate) {
0148:                if (!isRendered()) {
0149:                    setCollapsed(true);
0150:                } else {
0151:                    collapseRendered(animate);
0152:                }
0153:            }
0154:
0155:            private native void collapseRendered(boolean animate) /*-{
0156:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0157:                   panel.collapse(animate);
0158:               }-*/;
0159:
0160:            /**
0161:             * Expands the panel body so that it becomes visible.  Fires the beforeexpand event which will
0162:             * cancel the expand action if it returns false.
0163:             */
0164:            public void expand() {
0165:                if (!isRendered()) {
0166:                    setCollapsed(false);
0167:                } else {
0168:                    expandRendered();
0169:                }
0170:            }
0171:
0172:            private native void expandRendered() /*-{
0173:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0174:                   panel.expand();
0175:               }-*/;
0176:
0177:            /**
0178:             * Expands the panel body so that it becomes visible.  Fires the beforeexpand event which will
0179:             * cancel the expand action if it returns false.
0180:             *
0181:             * @param animate True to animate the transition, else false (defaults to the value of the animCollapse panel config)
0182:             */
0183:            public void expand(boolean animate) {
0184:                if (!isRendered()) {
0185:                    setCollapsed(false);
0186:                } else {
0187:                    expandRendered(animate);
0188:                }
0189:            }
0190:
0191:            private native void expandRendered(boolean animate) /*-{
0192:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0193:                   panel.expand(animate);
0194:               }-*/;
0195:
0196:            /**
0197:             * The Panel's body Element which may be used to contain HTML content. The content may be specified in the html config,
0198:             * or it may be loaded using the autoLoad config, or through the Panel's Updater.
0199:             * <br>
0200:             * If this is used to load visible HTML elements in either way, then the Panel may not be used as a Layout for hosting nested Panels.
0201:             * <br>
0202:             * If this Panel is intended to be used as the host of a Layout (See layout then the body Element must not be loaded or changed -
0203:             * it is under the control of the Panel's Layout.
0204:             *
0205:             * @return the body element
0206:             */
0207:            public native ExtElement getBody() /*-{
0208:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0209:                   var el = panel.body;
0210:            	return el == null || el === undefined ? null : @com.gwtext.client.core.ExtElement::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(el);
0211:               }-*/;
0212:
0213:            /**
0214:             * The Panel's footer Element. This Element is used to house the Panel's
0215:             * buttons.
0216:             *
0217:             * @return the footer element
0218:             */
0219:            public native ExtElement getFooter() /*-{
0220:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0221:                   var el = panel.footer;
0222:            	return el == null || el === undefined ? null : @com.gwtext.client.core.ExtElement::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(el);
0223:               }-*/;
0224:
0225:            /**
0226:             * The Panel's header Element. This Element is used to house the title and tools
0227:             *
0228:             * @return the header element
0229:             */
0230:            public native ExtElement getHeader() /*-{
0231:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0232:                   var el = panel.header;
0233:            	return el == null || el === undefined ? null : @com.gwtext.client.core.ExtElement::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(el);
0234:               }-*/;
0235:
0236:            /**
0237:             * The wrapper element for the body of the Panel.
0238:             *
0239:             * @return the wrapper element for the body of the Panel
0240:             */
0241:            public native ExtElement getBodyWrap() /*-{
0242:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0243:                   var el = panel.bwrap;
0244:            	return el == null || el === undefined ? null : @com.gwtext.client.core.ExtElement::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(el);
0245:               }-*/;
0246:
0247:            /**
0248:             * Returns the toolbar from the bottom section of the panel.
0249:             *
0250:             * @return the bottom toolbar
0251:             */
0252:            public native Toolbar getBottomToolbar() /*-{
0253:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0254:                   var tb = panel.getBottomToolbar();
0255:            	return tb == null || tb === undefined ? null : @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(tb);
0256:               }-*/;
0257:
0258:            /**
0259:             * Returns the height in pixels of the framing elements of this panel (including any top and bottom bars and header
0260:             * and footer elements, but not including the body height). To retrieve the body height see {@link #getInnerHeight()}.
0261:             *
0262:             * @return the frame hieght
0263:             */
0264:            public native int getFrameHeight() /*-{
0265:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0266:                   return panel.getFrameHeight();
0267:               }-*/;
0268:
0269:            /**
0270:             * Returns the width in pixels of the framing elements of this panel (not including the body width). To retrieve
0271:             * the body width see {@link #getInnerWidth()}.
0272:             *
0273:             * @return the frame width
0274:             */
0275:            public native int getFrameWidth() /*-{
0276:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0277:                   return panel.getFrameWidth();
0278:               }-*/;
0279:
0280:            /**
0281:             * Returns the height in pixels of the body element (not including the height of any framing elements).
0282:             * For the frame height see {@link #getFrameHeight()} .
0283:             *
0284:             * @return the inner height
0285:             */
0286:            public native int getInnerHeight() /*-{
0287:                  var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0288:                  return panel.getInnerHeight();
0289:              }-*/;
0290:
0291:            /**
0292:             * Returns the width in pixels of the body element (not including the width of any framing elements).
0293:             * For the frame width see {@link #getFrameWidth()} .
0294:             *
0295:             * @return the inner width
0296:             */
0297:            public native int getInnerWidth() /*-{
0298:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0299:                   return panel.getInnerWidth();
0300:               }-*/;
0301:
0302:            /**
0303:             * Returns the toolbar from the top section of the panel.
0304:             *
0305:             * @return the top toolbar
0306:             */
0307:            public native Toolbar getTopToolbar() /*-{
0308:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0309:                   var tb = panel.getTopToolbar();
0310:            	return tb == null || tb === undefined ? null : @com.gwtext.client.widgets.ComponentFactory::getComponent(Lcom/google/gwt/core/client/JavaScriptObject;)(tb);
0311:               }-*/;
0312:
0313:            /**
0314:             * Get the UpdateManager for this panel. Enables you to perform Ajax updates of this panel's body.
0315:             *
0316:             * @return the UpdateManager
0317:             */
0318:            public native UpdateManager getUpdateManager()/*-{
0319:                    var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0320:                    var umJS = panel.getUpdater();
0321:                    return @com.gwtext.client.core.UpdateManager::instance(Lcom/google/gwt/core/client/JavaScriptObject;)(umJS);
0322:                }-*/;
0323:
0324:            /**
0325:             * Loads this content panel immediately with content returned from an XHR call.
0326:             *
0327:             * @param url the url to load the content from
0328:             */
0329:            public void load(String url) {
0330:                load(url, (UrlLoadConfig) null, (UrlLoadCallback) null);
0331:            }
0332:
0333:            /**
0334:             * Loads this content panel immediately with content returned from an XHR call.
0335:             *
0336:             * @param url         the url to load the content from
0337:             * @param params      the request URL params
0338:             * @param callback    callback function
0339:             * @param loadScripts whether to execute scripts from the laoded content.
0340:             */
0341:            public void load(String url, UrlParam[] params,
0342:                    UrlLoadCallback callback, boolean loadScripts) {
0343:                UrlLoadConfig config = new UrlLoadConfig();
0344:                config.setParams(params);
0345:                config.setCallback(callback);
0346:                config.setScripts(loadScripts);
0347:                load(url, config, callback);
0348:            }
0349:
0350:            /**
0351:             * Loads this content panel immediately with content returned from an XHR call.
0352:             *
0353:             * @param url      the url to load the content from
0354:             * @param params   the load configuration params
0355:             * @param callback the callback
0356:             */
0357:            private void load(String url, UrlLoadConfig params,
0358:                    UrlLoadCallback callback) {
0359:                if (params == null)
0360:                    params = new UrlLoadConfig();
0361:                params.setUrl(url);
0362:                params.setCallback(callback);
0363:                load(params.getJsObj());
0364:            }
0365:
0366:            private native void load(JavaScriptObject params)/*-{       
0367:                    var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();        
0368:                    panel.load(params);
0369:                }-*/;
0370:
0371:            /**
0372:             * Sets the CSS class that provides the icon image for this panel. This method will replace any existing icon class
0373:             * if one has already been set.
0374:             *
0375:             * @param cls the icon class
0376:             */
0377:            private native void setIconClsRendered(String cls) /*-{
0378:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0379:                   panel.setIconClass(cls);
0380:               }-*/;
0381:
0382:            /**
0383:             * Sets the title text for the panel.
0384:             *
0385:             * @param title the title
0386:             */
0387:            private native void setTitleRendered(String title) /*-{
0388:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0389:                   panel.setTitle(title);
0390:               }-*/;
0391:
0392:            /**
0393:             * Sets the title text for the panel and optioanlly the icon class.
0394:             *
0395:             * @param title   the title
0396:             * @param iconCls A CSS class that provides the icon image for this panel
0397:             */
0398:            public void setTitle(String title, String iconCls) {
0399:                if (title == null || title.equals("")) {
0400:                    title = " ";
0401:                }
0402:                if (!isRendered()) {
0403:                    setTitle(title);
0404:                    setIconCls(iconCls);
0405:                } else {
0406:                    setTitleRendered(title, iconCls);
0407:                }
0408:            }
0409:
0410:            private native void setTitleRendered(String title, String iconCls) /*-{
0411:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0412:                   panel.setTitle(title);
0413:               }-*/;
0414:
0415:            /**
0416:             * Shortcut for performing an expand or collapse based on the current state of the panel.
0417:             */
0418:            public native void toggleCollapse() /*-{
0419:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0420:                   panel.toggleCollapse();
0421:               }-*/;
0422:
0423:            /**
0424:             * Shortcut for performing an expand or collapse based on the current state of the panel.
0425:             *
0426:             * @param animate true to animate
0427:             */
0428:            public native void toggleCollapse(boolean animate) /*-{
0429:                   var panel = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
0430:                   panel.toggleCollapse(animate);
0431:               }-*/;
0432:
0433:            /**
0434:             * Add a Panel listener.
0435:             *
0436:             * @param listener the listener
0437:             */
0438:            public native void addListener(PanelListener listener) /*-{
0439:                   this.@com.gwtext.client.widgets.Container::addListener(Lcom/gwtext/client/widgets/event/ContainerListener;)(listener);
0440:                   var panelJ = this;
0441:
0442:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('activate',
0443:                           function(p) {
0444:                               listener.@com.gwtext.client.widgets.event.PanelListener::onActivate(Lcom/gwtext/client/widgets/Panel;)(panelJ);
0445:                           }
0446:                   );
0447:
0448:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeclose',
0449:                           function(p) {
0450:                               return listener.@com.gwtext.client.widgets.event.PanelListener::doBeforeClose(Lcom/gwtext/client/widgets/Panel;)(panelJ);
0451:                           }
0452:                   );
0453:
0454:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforecollapse',
0455:                           function(p, anim) {
0456:                               var animate = anim === true;
0457:                               return listener.@com.gwtext.client.widgets.event.PanelListener::doBeforeCollapse(Lcom/gwtext/client/widgets/Panel;Z)(panelJ, animate);
0458:                           }
0459:                   );                                                          
0460:
0461:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('beforeexpand',
0462:                           function(p, anim) {
0463:                               var animate = anim === true;
0464:                               return listener.@com.gwtext.client.widgets.event.PanelListener::doBeforeExpand(Lcom/gwtext/client/widgets/Panel;Z)(panelJ, animate);
0465:                           }
0466:                   );
0467:
0468:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('bodyresize',
0469:                           function(p, w, h) {
0470:                               if(w === undefined) w = 0;
0471:                               if(h === undefined) h = 0;
0472:                               listener.@com.gwtext.client.widgets.event.PanelListener::onBodyResize(Lcom/gwtext/client/widgets/Panel;Ljava/lang/String;Ljava/lang/String;)(panelJ, w.toString(), h.toString());
0473:                           }
0474:                   );
0475:               
0476:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('close',
0477:                           function(p) {
0478:                               listener.@com.gwtext.client.widgets.event.PanelListener::onClose(Lcom/gwtext/client/widgets/Panel;)(panelJ);
0479:                           }
0480:                   );
0481:
0482:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('collapse',
0483:                           function(p) {
0484:                               listener.@com.gwtext.client.widgets.event.PanelListener::onCollapse(Lcom/gwtext/client/widgets/Panel;)(panelJ);
0485:                           }
0486:                   );
0487:
0488:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('deactivate',
0489:                           function(p) {
0490:                               listener.@com.gwtext.client.widgets.event.PanelListener::onDeactivate(Lcom/gwtext/client/widgets/Panel;)(panelJ);
0491:                           }
0492:                   );
0493:
0494:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('expand',
0495:                           function(p) {
0496:                               listener.@com.gwtext.client.widgets.event.PanelListener::onExpand(Lcom/gwtext/client/widgets/Panel;)(panelJ);
0497:                           }
0498:                   );
0499:
0500:                  this.@com.gwtext.client.widgets.Component::addListener(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)('titlechange',
0501:                           function(p, title) {
0502:                               listener.@com.gwtext.client.widgets.event.PanelListener::onTitleChange(Lcom/gwtext/client/widgets/Panel;Ljava/lang/String;)(panelJ, title);
0503:                           }
0504:                   );    
0505:               }-*/;
0506:
0507:            // --- config properties
0508:
0509:            /**
0510:             * True to animate the transition when the panel is collapsed, false to skip the animation.
0511:             *
0512:             * @param animCollapse Defaults to true if the {@link Fx} class is available, otherwise false
0513:             */
0514:            public void setAnimCollapse(boolean animCollapse) {
0515:                setAttribute("animCollapse", animCollapse, true, true);
0516:            }
0517:
0518:            /**
0519:             * True to animate the transition when the panel is collapsed, false to skip the animation.
0520:             *
0521:             * @return true to animate the transition when the panel is collapsed,  false to skip the animation
0522:             */
0523:            public boolean isAnimCollapse() {
0524:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0525:                        "animCollapse");
0526:            }
0527:
0528:            /**
0529:             * If set, the panel will attempt to load its contents from the specified URL immediately upon
0530:             * render.
0531:             * <br><br>
0532:             *
0533:             * The URL will become the default URL for this panel's body element, so it may be refreshed at any time.
0534:             *
0535:             * @param url the URL to load the panel's content
0536:             */
0537:            public void setAutoLoad(String url) {
0538:                setAutoLoad(url, new UrlLoadConfig());
0539:            }
0540:
0541:            /**
0542:             * If set, the panel will attempt to load its contents from the specified URL immediately upon render.
0543:             * <br><br>
0544:             *
0545:             * The URL will become the default URL for this panel's body element, so it may be refreshed at any time.
0546:             *
0547:             * @param url the URL to load the panel's content
0548:             * @param loadConfig the URL load configuration
0549:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0550:             */
0551:            public void setAutoLoad(String url, UrlLoadConfig loadConfig)
0552:                    throws IllegalStateException {
0553:                loadConfig.setUrl(url);
0554:                setAttribute("autoLoad", loadConfig.getJsObj(), true);
0555:            }
0556:
0557:            /**
0558:             * True to use overflow:'auto' on the panel's body element and show scroll bars automatically when necessary,
0559:             * false to clip any overflowing content.
0560:             *
0561:             * @param autoScroll Defaults to false
0562:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0563:             */
0564:            public void setAutoScroll(boolean autoScroll)
0565:                    throws IllegalStateException {
0566:                setAttribute("autoScroll", autoScroll, true);
0567:            }
0568:
0569:            /**
0570:             * True to use overflow:'auto' on the panel's body element and show scroll bars automatically when necessary,
0571:             * false to clip any overflowing content.
0572:             *
0573:             * @return true to autoscroll
0574:             */
0575:            public boolean isAutoScroll() {
0576:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0577:                        "autoScroll");
0578:            }
0579:
0580:            /**
0581:             * The base CSS class to apply to this panel's element.
0582:             *
0583:             * @param baseCls Defaults to 'x-panel'
0584:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0585:             */
0586:            public void setBaseCls(String baseCls) throws IllegalStateException {
0587:                setAttribute("baseCls", baseCls, true);
0588:            }
0589:
0590:            /**
0591:             * The base CSS class to apply to this panel's element.
0592:             *
0593:             * @return the base CSS class to apply to this panel's element. Defaults to 'x-panel'
0594:             */
0595:            public String getBaseCls() {
0596:                return JavaScriptObjectHelper.getAttribute(config, "baseCls");
0597:            }
0598:
0599:            /**
0600:             * True to display an interior border on the body element of the panel, false to hide it.
0601:             * This only applies when border == true. If border == true and bodyBorder == false, the border will display as a
0602:             * 1px wide inset border, giving the entire body element an inset appearance.
0603:             *
0604:             * @param bodyBorder Defaults to true
0605:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0606:             */
0607:            public void setBodyBorder(boolean bodyBorder)
0608:                    throws IllegalStateException {
0609:                setAttribute("bodyBorder", bodyBorder, true);
0610:            }
0611:
0612:            /**
0613:             * @return true to display an interior border on the body element of the panel, false to hide it.
0614:             */
0615:            public boolean isBodyBorder() {
0616:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0617:                        "bodyBorder");
0618:            }
0619:
0620:            /**
0621:             * True to display the borders of the panel's body element, false to hide them.
0622:             * By default, the border is a 2px wide inset border, but this can be further altered by setting bodyBorder to false.
0623:             *
0624:             * @param border Defaults to true
0625:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0626:             */
0627:            public void setBorder(boolean border) throws IllegalStateException {
0628:                setAttribute("border", border, true);
0629:            }
0630:
0631:            /**
0632:             * True to display the borders of the panel's body element, false to hide them.
0633:             * By default, the border is a 2px wide inset border, but this can be further altered by setting bodyBorder to false.
0634:             *
0635:             * @return true to display the borders of the panel's body element, false to hide them.
0636:             */
0637:            public boolean isBorder() {
0638:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0639:                        "border");
0640:            }
0641:
0642:            /**
0643:             * Set padding on all sides.
0644:             *
0645:             * @param padding the  padding value in pixels
0646:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0647:             */
0648:            public void setPaddings(int padding) throws IllegalStateException {
0649:                setPaddings(padding, padding, padding, padding);
0650:            }
0651:
0652:            /**
0653:             * Set paddings to Panel.
0654:             *
0655:             * @param top    the top padding
0656:             * @param left   left padding
0657:             * @param right  right padding
0658:             * @param bottom bottom padding
0659:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0660:             */
0661:            public void setPaddings(int top, int left, int right, int bottom)
0662:                    throws IllegalStateException {
0663:                Paddings paddings = new Paddings(top, left, right, bottom);
0664:                String style = paddings.getStyleString();
0665:                String bodyStyle = getBodyStyle();
0666:                if (bodyStyle == null) {
0667:                    setBodyStyle(style);
0668:                } else {
0669:                    setBodyStyle(style + bodyStyle);
0670:                }
0671:            }
0672:
0673:            /**
0674:             * Set padding on all sides.
0675:             *
0676:             * @param margin the  padding value in pixels
0677:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0678:             */
0679:            public void setMargins(int margin) throws IllegalStateException {
0680:                setMargins(margin, margin, margin, margin);
0681:            }
0682:
0683:            /**
0684:             * Set paddings to Panel.
0685:             *
0686:             * @param top    the top padding
0687:             * @param left   left padding
0688:             * @param right  right padding
0689:             * @param bottom bottom padding
0690:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0691:             */
0692:            public void setMargins(int top, int left, int right, int bottom)
0693:                    throws IllegalStateException {
0694:                Margins margins = new Margins(top, left, right, bottom);
0695:                String style = margins.getStyleString();
0696:                String bodyStyle = getBodyStyle();
0697:                if (bodyStyle == null) {
0698:                    setBodyStyle(style);
0699:                } else {
0700:                    setBodyStyle(style + bodyStyle);
0701:                }
0702:            }
0703:
0704:            /**
0705:             * Custom CSS styles to be applied to the body element in the format expected by {@link ExtElement#applyStyles(String)}
0706:             *
0707:             * @param bodyStyle Defaults to null
0708:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0709:             */
0710:            public void setBodyStyle(String bodyStyle)
0711:                    throws IllegalStateException {
0712:                setAttribute("bodyStyle", bodyStyle, true);
0713:            }
0714:
0715:            /**
0716:             * Custom CSS styles to be applied to the body element in the format expected by {@link ExtElement#applyStyles(String)}
0717:             *
0718:             * @return the custom CSS styles to be applied to the body element
0719:             */
0720:            public String getBodyStyle() {
0721:                return JavaScriptObjectHelper.getAttribute(config, "bodyStyle");
0722:            }
0723:
0724:            /**
0725:             * The alignment of any buttons added to this panel. Valid values are {@link Position#RIGHT}, {@link Position#LEFT}, {@link Position#CENTER}.
0726:             *
0727:             * @param buttonAlign Defaults to {@link Position#RIGHT}
0728:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0729:             */
0730:            public void setButtonAlign(Position buttonAlign)
0731:                    throws IllegalStateException {
0732:                setAttribute("buttonAlign", buttonAlign.getPosition(), true);
0733:            }
0734:
0735:            /**
0736:             * Used to add buttons to the footer of this panel.
0737:             *
0738:             * @param buttons Array of {@link Button}
0739:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0740:             */
0741:            public void setButtons(Button[] buttons)
0742:                    throws IllegalStateException {
0743:                JavaScriptObject buttonsJS = JavaScriptObjectHelper
0744:                        .convertToJavaScriptConfigArray(buttons);
0745:                setAttribute("buttons", buttonsJS, true);
0746:            }
0747:
0748:            /**
0749:             * Whether the Panel is closable. This is applicable when a Panel is added to a TabPanel.
0750:             *
0751:             * @param closable true if closable
0752:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0753:             */
0754:            public void setClosable(boolean closable)
0755:                    throws IllegalStateException {
0756:                setAttribute("closable", closable, true);
0757:            }
0758:
0759:            /**
0760:             * Whether the Panel is closable. This is applicable when a Panel is added to a TabPanel.
0761:             *
0762:             * @return true if the Panel is closable
0763:             */
0764:            public boolean isClosable() {
0765:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0766:                        "closable");
0767:            }
0768:
0769:            /**
0770:             * True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools in the panel's title bar,
0771:             * false to render it last.
0772:             *
0773:             * @param collapseFirst Defaults to true
0774:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0775:             */
0776:            public void setCollapseFirst(boolean collapseFirst)
0777:                    throws IllegalStateException {
0778:                setAttribute("collapseFirst", collapseFirst, true);
0779:            }
0780:
0781:            /**
0782:             * True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools in the panel's title bar,
0783:             * false to render it last.
0784:             *
0785:             * @return true to make sure the collapse/expand toggle button always renders first
0786:             */
0787:            public boolean getCollapseFirst() {
0788:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0789:                        "collapseFirst");
0790:            }
0791:
0792:            /**
0793:             * True if panel collapsed, false if expanded
0794:             *
0795:             * @param collapsed Defaults to false
0796:             */
0797:            public void setCollapsed(boolean collapsed) {
0798:                if (!isRendered()) {
0799:                    setAttribute("collapsed", collapsed, true);
0800:                } else {
0801:                    if (collapsed) {
0802:                        collapse();
0803:                    } else {
0804:                        expand();
0805:                    }
0806:                }
0807:            }
0808:
0809:            /**
0810:             * True if panel collapsed, false if expanded.
0811:             *
0812:             * @return true to render the panel expanded, false to render it collapsed
0813:             */
0814:            public boolean isCollapsed() {
0815:                return getAttributeAsBoolean("collapsed");
0816:            }
0817:
0818:            /**
0819:             * A CSS class to add to the panel's element after it has been collapsed.
0820:             *
0821:             * @param collapsedCls Defaults to 'x-panel-collapsed'
0822:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0823:             */
0824:            public void setCollapsedCls(String collapsedCls)
0825:                    throws IllegalStateException {
0826:                setAttribute("collapsedCls", collapsedCls, true);
0827:            }
0828:
0829:            /**
0830:             * A CSS class to add to the panel's element after it has been collapsed.
0831:             *
0832:             * @return the CSS class to add to the panel's element after it has been collapsed.
0833:             */
0834:            public String getCollapsedCls() {
0835:                return JavaScriptObjectHelper.getAttribute(config,
0836:                        "collapsedCls");
0837:            }
0838:
0839:            /**
0840:             * True to make the panel collapsible and have the expand/collapse toggle button automatically rendered into the header tool button area,
0841:             * false to keep the panel statically sized with no button.
0842:             *
0843:             * @param collapsible Defaults to false
0844:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0845:             */
0846:            public void setCollapsible(boolean collapsible)
0847:                    throws IllegalStateException {
0848:                setAttribute("collapsible", collapsible, true);
0849:            }
0850:
0851:            /**
0852:             * True to make the panel collapsible and have the expand/collapse toggle button automatically rendered into the header tool button area,
0853:             * false to keep the panel statically sized with no button.
0854:             *
0855:             * @return true to make the panel collapsible and have the expand/collapse toggle button automatically rendered into
0856:             *         the header tool button area, false to keep the panel statically sized with no button
0857:             */
0858:            public boolean isCollapsible() {
0859:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0860:                        "collapsible");
0861:            }
0862:
0863:            /**
0864:             * The id of an existing HTML node to use as the panel's body content
0865:             *
0866:             * @param contentEl Defaults to null
0867:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0868:             */
0869:            public void setContentEl(Element contentEl)
0870:                    throws IllegalStateException {
0871:                setAttribute("contentEl", new ExtElement(contentEl).getJsObj(),
0872:                        true);
0873:            }
0874:
0875:            /**
0876:             * True to enable dragging of this Panel (defaults to false).
0877:             *
0878:             * @param draggable true to enable dragging of this panel
0879:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0880:             */
0881:            public void setDraggable(boolean draggable)
0882:                    throws IllegalStateException {
0883:                setAttribute("draggable", draggable, true);
0884:            }
0885:
0886:            /**
0887:             * True to float the panel (absolute position it with automatic shimming and shadow), false to display it inline where it is rendered.
0888:             * Note that by default, setting floating to true will cause the panel to display at negative offsets so that it is hidden -- because
0889:             * the panel is absolute positioned, the position must be set explicitly after render (e.g., myPanel.setPosition(100,100);).
0890:             * Also, when floating a panel you should always assign a fixed width, otherwise it will be auto width and will expand to fill to the
0891:             * right edge of the viewport.
0892:             *
0893:             * @param floating Defaults to false
0894:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0895:             */
0896:            public void setFloating(boolean floating)
0897:                    throws IllegalStateException {
0898:                setAttribute("floating", floating, true);
0899:            }
0900:
0901:            /**
0902:             * True to float the panel (absolute position it with automatic shimming and shadow), false to display it inline where it is rendered.
0903:             * Note that by default, setting floating to true will cause the panel to display at negative offsets so that it is hidden -- because
0904:             * the panel is absolute positioned, the position must be set explicitly after render (e.g., myPanel.setPosition(100,100);).
0905:             * Also, when floating a panel you should always assign a fixed width, otherwise it will be auto width and will expand to fill to the
0906:             * right edge of the viewport.
0907:             *
0908:             * @return true to float panel, false to display it inline where it is rendered
0909:             */
0910:            public boolean getFloating() {
0911:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0912:                        "floating");
0913:            }
0914:
0915:            /**
0916:             * True to create the footer element explicitly, false to skip creating it. By default, when footer is not specified, if one or more
0917:             * buttons have been added to the panel the footer will be created automatically, otherwise it will not.
0918:             *
0919:             * @param footer true to create footer
0920:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0921:             */
0922:            public void setFooter(boolean footer) throws IllegalStateException {
0923:                setAttribute("footer", footer, true);
0924:            }
0925:
0926:            /**
0927:             * True to render the panel with custom rounded borders, false to render with plain 1px square borders.
0928:             *
0929:             * @param frame Defaults to false
0930:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0931:             */
0932:            public void setFrame(boolean frame) throws IllegalStateException {
0933:                setAttribute("frame", frame, true);
0934:            }
0935:
0936:            /**
0937:             * @return true to render the panel with custom rounded borders
0938:             */
0939:            public boolean isFrame() {
0940:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0941:                        "frame");
0942:            }
0943:
0944:            /**
0945:             * True to create the header element explicitly, false to skip creating it. By default, when header is not specified, if a title is
0946:             * set the header will be created automatically, otherwise it will not. If a title is set but header is explicitly set to false, the
0947:             * header will not be rendered.
0948:             *
0949:             * @param header true to create header
0950:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0951:             */
0952:            public void setHeader(boolean header) throws IllegalStateException {
0953:                setAttribute("header", header, false);
0954:            }
0955:
0956:            /**
0957:             * True to create the header element explicitly, false to skip creating it. By default, when header is not specified, if a title is
0958:             * set the header will be created automatically, otherwise it will not. If a title is set but header is explicitly set to false, the
0959:             * header will not be rendered.
0960:             *
0961:             * @return true to create header
0962:             */
0963:            public boolean isHeader() {
0964:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0965:                        "header");
0966:            }
0967:
0968:            /**
0969:             * True to display the panel title in the header, false to hide it
0970:             *
0971:             * <br><br>
0972:             * <b>Note:</b> This property cannot be changed after the Component has been rendered.
0973:             *
0974:             * @param headerAsText Defaults to true
0975:             */
0976:            public void setHeaderAsText(boolean headerAsText) {
0977:                setAttribute("headerAsText", headerAsText, true, true);
0978:            }
0979:
0980:            /**
0981:             * @return true to display the panel title in the header, false to hide it
0982:             */
0983:            public boolean isHeaderAsText() {
0984:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
0985:                        "headerAsText");
0986:            }
0987:
0988:            /**
0989:             * True to hide the expand/collapse toggle button when collapsible = true, false to display it.
0990:             *
0991:             * @param hideCollapseTool Defaults to false
0992:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
0993:             */
0994:            public void setHideCollapseTool(boolean hideCollapseTool)
0995:                    throws IllegalStateException {
0996:                setAttribute("hideCollapseTool", hideCollapseTool, true);
0997:            }
0998:
0999:            /**
1000:             * True to hide the expand/collapse toggle button when collapsible = true, false to display it.
1001:             *
1002:             * @return true to hide the expand/collapse toggle button when collapsible = true, false to display it.
1003:             */
1004:            public boolean isHideCollapseTool() {
1005:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
1006:                        "hideCollapseTool");
1007:            }
1008:
1009:            /**
1010:             * An HTML fragment, or a DomHelper specification to use as the panel's body content.
1011:             *
1012:             * @param html Defaults to ""
1013:             */
1014:            public void setHtml(String html) {
1015:                if (isRendered()) {
1016:                    getBody().update(html);
1017:                } else {
1018:                    setAttribute("html", html, true);
1019:                }
1020:            }
1021:
1022:            /**
1023:             * An HTML fragment, or a DomHelper specification to use as the panel's body content.
1024:             *
1025:             * @return the HTML fragment, or a DomHelper specification to use as the panel's body content.
1026:             */
1027:            public String getHtml() {
1028:                if (isRendered()) {
1029:                    return getBody().getDOM().toString();
1030:                } else {
1031:                    return JavaScriptObjectHelper.getAttribute(config, "html");
1032:                }
1033:            }
1034:
1035:            /**
1036:             * A CSS class that will provide a background image to be used as the panel header icon
1037:             *
1038:             * @param iconCls Defaults to ""
1039:             */
1040:            public void setIconCls(String iconCls) {
1041:                if (!isRendered()) {
1042:                    setAttribute("iconCls", iconCls, true);
1043:                } else {
1044:                    setIconClsRendered(iconCls);
1045:                }
1046:            }
1047:
1048:            /**
1049:             * @return the  CSS class that will provide a background image to be used as the panel header icon
1050:             */
1051:            public String getIconCls() {
1052:                return getAttribute("iconCls");
1053:            }
1054:
1055:            /**
1056:             * True to mask the panel when it is disabled, false to not mask it. Either way, the panel will
1057:             * always tell its contained elements to disable themselves when it is disabled, but masking the
1058:             * panel can provide an additional visual cue that the panel is disabled.
1059:             *
1060:             * @param maskDisabled Defaults to true
1061:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1062:             */
1063:            public void setMaskDisabled(boolean maskDisabled)
1064:                    throws IllegalStateException {
1065:                setAttribute("maskDisabled", maskDisabled, true);
1066:            }
1067:
1068:            /**
1069:             * @return true to mask the panel when it is disabled, false to not mask it.
1070:             */
1071:            public boolean isMaskDisabled() {
1072:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
1073:                        "maskDisabled");
1074:            }
1075:
1076:            /**
1077:             * Minimum width in pixels of all buttons in this panel.
1078:             *
1079:             * @param minButtonWidth Defaults to 75
1080:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1081:             */
1082:            public void setMinButtonWidth(int minButtonWidth)
1083:                    throws IllegalStateException {
1084:                setAttribute("minButtonWidth", minButtonWidth, true);
1085:            }
1086:
1087:            /**
1088:             * Minimum width in pixels of all buttons in this panel.
1089:             *
1090:             * @return the minimum width in pixels of all buttons in this panel.
1091:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1092:             */
1093:            public int getMinButtonWidth() throws IllegalStateException {
1094:                return getAttributeAsInt("minButtonWidth");
1095:            }
1096:
1097:            //todo add string option for custom shadows
1098:            /**
1099:             * True to display a shadow behind the panel, false to display no shadow (defaults to 'sides').
1100:             * Note that this option only applies when floating = true.
1101:             *
1102:             * @param shadow true to display shadow
1103:             */
1104:            public void setShadow(boolean shadow) {
1105:                setAttribute("shadow", shadow, true);
1106:            }
1107:
1108:            /**
1109:             * Set the shadow behind the Panel.
1110:             * Note that this option only applies when floating = true.
1111:             *
1112:             * @param shadow true to display shadow
1113:             * @see com.gwtext.client.widgets.Shadow#SIDES
1114:             * @see com.gwtext.client.widgets.Shadow#FRAME
1115:             * @see com.gwtext.client.widgets.Shadow#DROP
1116:             */
1117:            public void setShadow(Shadow.Type shadow) {
1118:                setAttribute("shadow", shadow.getType(), true);
1119:            }
1120:
1121:            /**
1122:             * True to display a shadow behind the panel, false to display no shadow (defaults to 'sides').
1123:             *
1124:             * @return true to display a shadow behind the panel, false to display no shadow (defaults to 'sides').
1125:             */
1126:            public boolean isShadow() {
1127:                return getAttributeAsBoolean("shadow");
1128:            }
1129:
1130:            /**
1131:             * The number of pixels to offset the shadow if displayed. Note that this option only applies when floating = true.
1132:             *
1133:             * @param shadowOffset Defaults to 4
1134:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1135:             */
1136:            public void setShadowOffset(int shadowOffset)
1137:                    throws IllegalStateException {
1138:                setAttribute("shadowOffset", shadowOffset, true);
1139:            }
1140:
1141:            /**
1142:             * The number of pixels to offset the shadow if displayed. Note that this option only applies when floating = true.
1143:             * @return the number of pixels to offset the shadow if displayed. Note that this option only applies when floating = true.
1144:             */
1145:            public int getShadowOffset() {
1146:                return getAttributeAsInt("shadowOffset");
1147:            }
1148:
1149:            /**
1150:             * False to disable the iframe shim in browsers which need one. Note that this option only applies when floating = true.
1151:             *
1152:             * @param shim Defaults to true
1153:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1154:             */
1155:            public void setShim(boolean shim) throws IllegalStateException {
1156:                setAttribute("shim", shim, true);
1157:            }
1158:
1159:            /**
1160:             * False to disable the iframe shim in browsers which need one. Note that this option only applies when floating = true.
1161:             *
1162:             * @return false to disable the iframe shim in browsers which need one.
1163:             */
1164:            public boolean isShim() {
1165:                return getAttributeAsBoolean("shim");
1166:            }
1167:
1168:            /**
1169:             * The top toolbar of the panel. Note that this is not available as a property after render.
1170:             * To access the top toolbar after render, use getTopToolbar.
1171:             *
1172:             * @param toolbar the toolbar
1173:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1174:             */
1175:            public void setTopToolbar(Toolbar toolbar)
1176:                    throws IllegalStateException {
1177:                setAttribute("tbar", toolbar.getOrCreateJsObj(), false);
1178:            }
1179:
1180:            /**
1181:             * The top toolbar of the panel. Note that this is not available as a property after render.
1182:             * To access the top toolbar after render, use getTopToolbar.
1183:             *
1184:             * @param button the button
1185:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1186:             */
1187:            public void setTopToolbar(Button button)
1188:                    throws IllegalStateException {
1189:                setTopToolbar(new Button[] { button });
1190:            }
1191:
1192:            /**
1193:             * The top toolbar of the panel. Note that this is not available as a property after render.
1194:             * To access the top toolbar after render, use getTopToolbar.
1195:             *
1196:             * <br><br>
1197:             * <b>Note:</b> This property cannot be changed after the Component has been rendered. To add buttons after the Panel has been
1198:             * rendered, call {@link #getTopToolbar()} and then add Bottons directly to the toolbar.
1199:             *
1200:             * @param buttons the buttons
1201:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1202:             */
1203:            public void setTopToolbar(Button[] buttons)
1204:                    throws IllegalStateException {
1205:                JavaScriptObject buttonsJS = JavaScriptObjectHelper
1206:                        .convertToJavaScriptConfigArray(buttons);
1207:                setAttribute("tbar", buttonsJS, false);
1208:            }
1209:
1210:            /**
1211:             * The bottom toolbar of the panel. Note that this is not available as a property after render.
1212:             * To access the bottom toolbar after render, use @link #getBottomToolbar.
1213:             *
1214:             * @param toolbar the toolbar
1215:             */
1216:            public void setBottomToolbar(Toolbar toolbar) {
1217:                setAttribute("bbar", toolbar.getOrCreateJsObj(), false);
1218:            }
1219:
1220:            /**
1221:             * The bottom toolbar of the panel. Note that this is not available as a property after render.
1222:             * To access the bottom toolbar after render, use @link #getBottomToolbar.
1223:             *
1224:             * <br><br>
1225:             * <b>Note:</b> This property cannot be changed after the Component has been rendered. To add buttons after the Panel has been
1226:             * rendered, call {@link #getBottomToolbar()} and then add Bottons directly to the toolbar.
1227:             *
1228:             * @param button the button
1229:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1230:             */
1231:            public void setBottomToolbar(Button button)
1232:                    throws IllegalStateException {
1233:                setBottomToolbar(new Button[] { button });
1234:            }
1235:
1236:            /**
1237:             * The bottom toolbar of the panel. Note that this is not available as a property after render.
1238:             * To access the bottom toolbar after render, use @link #getBottomToolbar.
1239:             *
1240:             * <br><br>
1241:             * <b>Note:</b> This property cannot be changed after the Component has been rendered. To add buttons after the Panel has been
1242:             * rendered, call {@link #getBottomToolbar()} and then add Bottons directly to the toolbar.
1243:             *
1244:             * @param buttons the buttons
1245:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1246:             */
1247:            public void setBottomToolbar(Button[] buttons)
1248:                    throws IllegalStateException {
1249:                JavaScriptObject buttonsJS = JavaScriptObjectHelper
1250:                        .convertToJavaScriptConfigArray(buttons);
1251:                setAttribute("bbar", buttonsJS, false);
1252:            }
1253:
1254:            /**
1255:             * The title text to display in the panel header. When a title is specified the header
1256:             * element will automatically be created and displayed unless header is explicitly set to false. If you don't
1257:             * want to specify a title at config time, but you may want one later, you must either specify a non-empty
1258:             * title (a blank space " " will do) or call setHeader(true) so that the container element will get created.
1259:             *
1260:             * @param title Defaults to ""
1261:             */
1262:            public void setTitle(String title) {
1263:                if (title == null || title.equals("")) {
1264:                    title = " ";
1265:                }
1266:                if (!isRendered()) {
1267:                    setAttribute("title", title, true);
1268:                } else {
1269:                    setTitleRendered(title);
1270:                }
1271:            }
1272:
1273:            /**
1274:             * The title text to display in the panel header.
1275:             *
1276:             * @return the title text to display in the panel header.
1277:             */
1278:            public String getTitle() {
1279:                return getAttribute("title");
1280:            }
1281:
1282:            /**
1283:             * True to allow expanding and collapsing the panel (when collapsible = true) by clicking anywhere in the header bar,
1284:             * false to allow it only by clicking to tool button
1285:             *
1286:             * @param titleCollapse Defaults to false
1287:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1288:             */
1289:            public void setTitleCollapse(boolean titleCollapse)
1290:                    throws IllegalStateException {
1291:                setAttribute("titleCollapse", titleCollapse, true);
1292:            }
1293:
1294:            /**
1295:             * @return true to allow expanding and collapsing the panel (when collapsible = true) by clicking anywhere in the header bar,
1296:             *         false to allow it only by clicking to tool button
1297:             */
1298:            public boolean isTitleCollapse() {
1299:                return JavaScriptObjectHelper.getAttributeAsBoolean(config,
1300:                        "titleCollapse");
1301:            }
1302:
1303:            /**
1304:             * The tool to be added to the header tool area.
1305:             *
1306:             * @param tool the tool to add
1307:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1308:             */
1309:            public void addTool(Tool tool) throws IllegalStateException {
1310:                check();
1311:                addToolPreRender(tool);
1312:            }
1313:
1314:            /**
1315:             * The tools to be added to the header tool area.
1316:             *
1317:             * @param tools the tools to add
1318:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
1319:             */
1320:            public void setTools(Tool[] tools) throws IllegalStateException {
1321:                for (int i = 0; i < tools.length; i++) {
1322:                    Tool tool = tools[i];
1323:                    addTool(tool);
1324:                }
1325:            }
1326:
1327:            private native void addToolPreRender(Tool tool) /*-{
1328:                   var config = this.@com.gwtext.client.widgets.Component::config;
1329:                   if(!config.tools) config.tools = @com.gwtext.client.util.JavaScriptObjectHelper::createJavaScriptArray()();
1330:            	config.tools.push(tool.@com.gwtext.client.widgets.Tool::jsObj);
1331:               }-*/;
1332:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.