Source Code Cross Referenced for Item.java in  » Ajax » gwtext-2.01 » com » gwtext » client » widgets » menu » 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.menu 
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.menu;
010:
011:        import com.google.gwt.core.client.JavaScriptObject;
012:        import com.gwtext.client.util.JavaScriptObjectHelper;
013:        import com.gwtext.client.widgets.menu.event.BaseItemListener;
014:
015:        /**
016:         * A base class for all menu items that require menu-related functionality (like sub-menus) and are not static display
017:         * items. Item extends the base functionality of {@link BaseItem} by adding menu-specific activation and click handling.
018:         */
019:        public class Item extends BaseItem {
020:
021:            private static JavaScriptObject configPrototype;
022:
023:            static {
024:                init();
025:            }
026:
027:            private static native void init()/*-{
028:                    $wnd.Ext.reg('menu-item', $wnd.Ext.menu.Item);
029:                    var c = new $wnd.Ext.menu.Item();
030:                    @com.gwtext.client.widgets.menu.Item::configPrototype = c.initialConfig;
031:                }-*/;
032:
033:            protected JavaScriptObject getConfigPrototype() {
034:                return configPrototype;
035:            }
036:
037:            public String getXType() {
038:                return "menu-tem";
039:            }
040:
041:            public Item() {
042:            }
043:
044:            public Item(String text) {
045:                if (text != null)
046:                    setText(text);
047:            }
048:
049:            public Item(String text, BaseItemListener listener) {
050:                if (text != null)
051:                    setText(text);
052:                addListener(listener);
053:            }
054:
055:            public Item(String text, BaseItemListener listener, String icon) {
056:                if (text != null)
057:                    setText(text);
058:                addListener(listener);
059:                setIcon(icon);
060:            }
061:
062:            public Item(JavaScriptObject jsObj) {
063:                super (jsObj);
064:            }
065:
066:            protected native JavaScriptObject create(JavaScriptObject config) /*-{
067:                   return new $wnd.Ext.menu.Item(config);
068:               }-*/;
069:
070:            /**
071:             * The text of the check item.
072:             *
073:             * @param text the text
074:             */
075:            public void setText(String text) {
076:                if (!isRendered()) {
077:                    setAttribute("text", text, true);
078:                } else {
079:                    setTextRendered(text);
080:                }
081:            }
082:
083:            /**
084:             * Sets the text of the item.
085:             *
086:             * @param text the item text
087:             */
088:            private native void setTextRendered(String text) /*-{
089:                   var item = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
090:                   item.setText(text);
091:               }-*/;
092:
093:            /**
094:             * Retrun the text of the item.
095:             *
096:             * @return the item text
097:             */
098:            public String getText() {
099:                if (!isRendered()) {
100:                    return JavaScriptObjectHelper.getAttribute(config, "text");
101:                } else {
102:                    return getTextRendered();
103:                }
104:            }
105:
106:            /**
107:             * Return the item text.
108:             *
109:             * @return the item text
110:             */
111:            private native String getTextRendered() /*-{
112:                   var item = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
113:                   return item.text;
114:               }-*/;
115:
116:            public void setIconCls(String iconCls) {
117:                if (!isRendered()) {
118:                    setAttribute("iconCls", iconCls, true);
119:                } else {
120:                    setIconClsRendered(iconCls);
121:                }
122:
123:            }
124:
125:            private native void setIconClsRendered(String iconCls) /*-{
126:                   var item = this.@com.gwtext.client.widgets.Component::getOrCreateJsObj()();
127:                   item.setIconClass(iconCls);
128:               }-*/;
129:
130:            /**
131:             * @return the icon CSS class
132:             */
133:            public String getIconCls() {
134:                if (!isRendered()) {
135:                    return JavaScriptObjectHelper.getAttribute(config,
136:                            "iconCls");
137:                } else {
138:                    return JavaScriptObjectHelper.getAttribute(getJsObj(),
139:                            "iconCls");
140:                }
141:            }
142:
143:            // -- config properties ---
144:
145:            /**
146:             * The href attribute to use for the underlying anchor link (defaults to '#').
147:             *
148:             * @param href the href attribute
149:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
150:             */
151:            public void setHref(String href) throws IllegalStateException {
152:                JavaScriptObjectHelper.setAttribute(config, "href", href);
153:            }
154:
155:            /**
156:             * The href attribute to use for the underlying anchor link (defaults to '#').
157:             *
158:             * @return the href attribute
159:             *
160:             */
161:            public String getHref() {
162:                return JavaScriptObjectHelper.getAttribute(config, "href");
163:            }
164:
165:            /**
166:             * The target attribute to use for the underlying anchor link (defaults to '').
167:             *
168:             * @param hrefTarget the href target
169:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
170:             */
171:            public void setHrefTarget(String hrefTarget)
172:                    throws IllegalStateException {
173:                JavaScriptObjectHelper.setAttribute(config, "hrefTarget",
174:                        hrefTarget);
175:            }
176:
177:            /**
178:             * The target attribute to use for the underlying anchor link (defaults to '').
179:             *
180:             * @return the href target
181:             */
182:            public String getHrefTarget() {
183:                return JavaScriptObjectHelper
184:                        .getAttribute(config, "hrefTarget");
185:            }
186:
187:            /**
188:             * The item's icon.
189:             *
190:             * @param icon the icon
191:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
192:             */
193:            public void setIcon(String icon) throws IllegalStateException {
194:                JavaScriptObjectHelper.setAttribute(config, "icon", icon);
195:            }
196:
197:            /**
198:             * The default CSS class to use for menu items (defaults to 'x-menu-item')
199:             *
200:             * @param itemCls the CSS clas
201:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
202:             */
203:            public void setItemCls(String itemCls) throws IllegalStateException {
204:                JavaScriptObjectHelper.setAttribute(config, "itemCls", itemCls);
205:            }
206:
207:            /**
208:             * The default CSS class to use for menu items.
209:             * 
210:             * @return the default CSS class to use for menu items
211:             * @throws IllegalStateException this property cannot be changed after the Component has been rendered
212:             */
213:            public String getItemCls() throws IllegalStateException {
214:                return JavaScriptObjectHelper.getAttribute(config, "itemCls");
215:            }
216:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.