Source Code Cross Referenced for Tab.java in  » Ajax » dwr » jsx3 » gui » 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 » dwr » jsx3.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Joe Walker
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package jsx3.gui;
017:
018:        import org.directwebremoting.ScriptBuffer;
019:        import org.directwebremoting.proxy.ScriptProxy;
020:        import org.directwebremoting.proxy.io.Context;
021:
022:        /**
023:         * Renders a tab in a tabbed pane. An instance of this class must be child of an instance of
024:         jsx3.gui.TabbedPane. A tab should have exactly one child, usually a jsx3.gui.Block,
025:         which holds all of its content.
026:         * @author Joe Walker [joe at getahead dot org]
027:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
028:         */
029:        public class Tab extends jsx3.gui.Block {
030:            /**
031:             * All reverse ajax proxies need context to work from
032:             * @param scriptProxy The place we are writing scripts to
033:             * @param context The script that got us to where we are now
034:             */
035:            public Tab(Context context, String extension,
036:                    ScriptProxy scriptProxy) {
037:                super (context, extension, scriptProxy);
038:            }
039:
040:            /**
041:             * instance initializer
042:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
043:             * @param strText text to display within the given tab; if null, jsx3.gui.Tab.DEFAULTTEXT is used
044:             * @param vntWidth one of: 1) the width as an integer representing a fixed pixel width for the tab (e.g., 80) ; 2) the width as a percentage representing this tab's width as a percentage of how wide the entire tabbed pane should be (e.g., "25%"); 3) no value (null) to designate that this tab should be just large engough to contain the value of the parameter, @strText;
045:             * @param strHexActiveColor valid css property for defining the color to use when the tab is active (i.e., red, #ff0000, etc)
046:             * @param strHexInactiveColor valid css property for defining the color to use when the tab is inactive (i.e., red, #ff0000, etc)
047:             */
048:            public Tab(String strName, String strText, String vntWidth,
049:                    String strHexActiveColor, String strHexInactiveColor) {
050:                super ((Context) null, (String) null, (ScriptProxy) null);
051:                ScriptBuffer script = new ScriptBuffer();
052:                script.appendCall("new Tab", strName, strText, vntWidth,
053:                        strHexActiveColor, strHexInactiveColor);
054:                setInitScript(script);
055:            }
056:
057:            /**
058:             * instance initializer
059:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
060:             * @param strText text to display within the given tab; if null, jsx3.gui.Tab.DEFAULTTEXT is used
061:             * @param vntWidth one of: 1) the width as an integer representing a fixed pixel width for the tab (e.g., 80) ; 2) the width as a percentage representing this tab's width as a percentage of how wide the entire tabbed pane should be (e.g., "25%"); 3) no value (null) to designate that this tab should be just large engough to contain the value of the parameter, @strText;
062:             * @param strHexActiveColor valid css property for defining the color to use when the tab is active (i.e., red, #ff0000, etc)
063:             * @param strHexInactiveColor valid css property for defining the color to use when the tab is inactive (i.e., red, #ff0000, etc)
064:             */
065:            public Tab(String strName, String strText, int vntWidth,
066:                    String strHexActiveColor, String strHexInactiveColor) {
067:                super ((Context) null, (String) null, (ScriptProxy) null);
068:                ScriptBuffer script = new ScriptBuffer();
069:                script.appendCall("new Tab", strName, strText, vntWidth,
070:                        strHexActiveColor, strHexInactiveColor);
071:                setInitScript(script);
072:            }
073:
074:            /**
075:             * 
076:             */
077:            public static final String DEFAULTBEVELIMAGE = null;
078:
079:            /**
080:             * #e8e8f5
081:             */
082:            public static final String DEFAULTACTIVECOLOR = "#e8e8f5";
083:
084:            /**
085:             * #d8d8e5
086:             */
087:            public static final String DEFAULTINACTIVECOLOR = "#d8d8e5";
088:
089:            /**
090:             * 
091:             */
092:            public static final String ACTIVEBEVEL = null;
093:
094:            /**
095:             * 
096:             */
097:            public static final String INACTIVEBEVEL = null;
098:
099:            /**
100:             * #e8e8f5
101:             */
102:            public static final String CHILDBGCOLOR = "#e8e8f5";
103:
104:            /**
105:             * 0 : disabled
106:             */
107:            public static final int STATEDISABLED = 0;
108:
109:            /**
110:             * 1 : enabled (default)
111:             */
112:            public static final int STATEENABLED = 1;
113:
114:            /**
115:             * Returns background image that will underlay each tab to provide an outset-type border. Default: jsx3.gui.Tab.DEFAULTBEVELIMAGE
116:             * @param callback valid url (typically relative) to point to an image that can be used as a bacground image for the tab
117:             */
118:            @SuppressWarnings("unchecked")
119:            public void getBevel(
120:                    org.directwebremoting.proxy.Callback<String> callback) {
121:                ScriptBuffer script = new ScriptBuffer();
122:                String callbackPrefix = "";
123:
124:                if (callback != null) {
125:                    callbackPrefix = "var reply = ";
126:                }
127:
128:                script.appendCall(callbackPrefix + getContextPath()
129:                        + "getBevel");
130:
131:                if (callback != null) {
132:                    String key = org.directwebremoting.extend.CallbackHelper
133:                            .saveCallback(callback, String.class);
134:                    script
135:                            .appendCall("__System.activateCallback", key,
136:                                    "reply");
137:                }
138:
139:                getScriptProxy().addScript(script);
140:            }
141:
142:            /**
143:             * Sets background image that will underlay each tab to provide an outset-type border; if this value is not set or null is passed, the default background image for the jsx3.gui.Tab class will be use the contant value, jsx3.gui.Tab.DEFAULTBEVELIMAGE;
144:             * @param strURL valid url (typically relative) to point to an image that can be used as a bacground image for the tab
145:             * @return this object
146:             */
147:            public jsx3.gui.Tab setBevel(String strURL) {
148:                ScriptBuffer script = new ScriptBuffer();
149:                script.appendCall(getContextPath() + "setBevel", strURL);
150:                getScriptProxy().addScript(script);
151:                return this ;
152:            }
153:
154:            /**
155:             * Brings this tab and its associated pane forward in the stack among all sibling tabs.
156:             */
157:            public void doShow() {
158:                ScriptBuffer script = new ScriptBuffer();
159:                script.appendCall(getContextPath() + "doShow");
160:                getScriptProxy().addScript(script);
161:            }
162:
163:            /**
164:             * Returns valid CSS property value, (e.g., red, #ffffff) when tab is active. Default: jsx3.gui.Tab.DEFAULTACTIVECOLOR
165:             * @param callback valid CSS property value, (e.g., red, #ffffff)
166:             */
167:            @SuppressWarnings("unchecked")
168:            public void getActiveColor(
169:                    org.directwebremoting.proxy.Callback<String> callback) {
170:                ScriptBuffer script = new ScriptBuffer();
171:                String callbackPrefix = "";
172:
173:                if (callback != null) {
174:                    callbackPrefix = "var reply = ";
175:                }
176:
177:                script.appendCall(callbackPrefix + getContextPath()
178:                        + "getActiveColor");
179:
180:                if (callback != null) {
181:                    String key = org.directwebremoting.extend.CallbackHelper
182:                            .saveCallback(callback, String.class);
183:                    script
184:                            .appendCall("__System.activateCallback", key,
185:                                    "reply");
186:                }
187:
188:                getScriptProxy().addScript(script);
189:            }
190:
191:            /**
192:             * Sets valid CSS property value, (e.g., red, #ffffff) when tab is active;
193:             * @param strActiveColor valid CSS property value, (e.g., red, #ffffff)
194:             * @return this object
195:             */
196:            public jsx3.gui.Tab setActiveColor(String strActiveColor) {
197:                ScriptBuffer script = new ScriptBuffer();
198:                script.appendCall(getContextPath() + "setActiveColor",
199:                        strActiveColor);
200:                getScriptProxy().addScript(script);
201:                return this ;
202:            }
203:
204:            /**
205:             * Returns valid CSS property value, (e.g., red, #ffffff) when tab is inactive (not selected tab in the group). Default: jsx3.gui.Tab.DEFAULTINACTIVECOLOR
206:             * @param callback valid CSS property value, (e.g., red, #ffffff)
207:             */
208:            @SuppressWarnings("unchecked")
209:            public void getInactiveColor(
210:                    org.directwebremoting.proxy.Callback<String> callback) {
211:                ScriptBuffer script = new ScriptBuffer();
212:                String callbackPrefix = "";
213:
214:                if (callback != null) {
215:                    callbackPrefix = "var reply = ";
216:                }
217:
218:                script.appendCall(callbackPrefix + getContextPath()
219:                        + "getInactiveColor");
220:
221:                if (callback != null) {
222:                    String key = org.directwebremoting.extend.CallbackHelper
223:                            .saveCallback(callback, String.class);
224:                    script
225:                            .appendCall("__System.activateCallback", key,
226:                                    "reply");
227:                }
228:
229:                getScriptProxy().addScript(script);
230:            }
231:
232:            /**
233:             * Sets valid CSS property value, (e.g., red, #ffffff) when tab is inactive (not selected tab in the group);
234:             * @param strInactiveColor valid CSS property value, (e.g., red, #ffffff)
235:             * @return this object
236:             */
237:            public jsx3.gui.Tab setInactiveColor(String strInactiveColor) {
238:                ScriptBuffer script = new ScriptBuffer();
239:                script.appendCall(getContextPath() + "setInactiveColor",
240:                        strInactiveColor);
241:                getScriptProxy().addScript(script);
242:                return this ;
243:            }
244:
245:            /**
246:             * Returns the state for the tab control. Default: jsx3.gui.Tab.STATEENABLED
247:             * @param callback one of: jsx3.gui.Tab.STATEDISABLED, jsx3.gui.Tab.STATEENABLED
248:             */
249:            @SuppressWarnings("unchecked")
250:            public void getEnabled(
251:                    org.directwebremoting.proxy.Callback<Integer> callback) {
252:                ScriptBuffer script = new ScriptBuffer();
253:                String callbackPrefix = "";
254:
255:                if (callback != null) {
256:                    callbackPrefix = "var reply = ";
257:                }
258:
259:                script.appendCall(callbackPrefix + getContextPath()
260:                        + "getEnabled");
261:
262:                if (callback != null) {
263:                    String key = org.directwebremoting.extend.CallbackHelper
264:                            .saveCallback(callback, Integer.class);
265:                    script
266:                            .appendCall("__System.activateCallback", key,
267:                                    "reply");
268:                }
269:
270:                getScriptProxy().addScript(script);
271:            }
272:
273:            /**
274:             * Sets the enabled state for the tab control; returns reference to self to facilitate method chaining
275:             * @param STATE one of: jsx3.gui.Tab.STATEDISABLED, jsx3.gui.Tab.STATEENABLED
276:             * @return this object
277:             */
278:            public jsx3.gui.Tab setEnabled(int STATE) {
279:                ScriptBuffer script = new ScriptBuffer();
280:                script.appendCall(getContextPath() + "setEnabled", STATE);
281:                getScriptProxy().addScript(script);
282:                return this ;
283:            }
284:
285:            /**
286:             * Returns the child of this tab that will be painted as the content of this tab. This implementation returns the
287:            first child of this stack.
288:             */
289:            @SuppressWarnings("unchecked")
290:            public jsx3.app.Model getContentChild() {
291:                String extension = "getContentChild().";
292:                try {
293:                    java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
294:                            .getConstructor(Context.class, String.class,
295:                                    ScriptProxy.class);
296:                    return ctor.newInstance(this , extension, getScriptProxy());
297:                } catch (Exception ex) {
298:                    throw new IllegalArgumentException("Unsupported type: "
299:                            + jsx3.app.Model.class.getName());
300:                }
301:            }
302:
303:            /**
304:             * Returns the child of this tab that will be painted as the content of this tab. This implementation returns the
305:            first child of this stack.
306:             * @param returnType The expected return type
307:             */
308:            @SuppressWarnings("unchecked")
309:            public <T> T getContentChild(Class<T> returnType) {
310:                String extension = "getContentChild().";
311:                try {
312:                    java.lang.reflect.Constructor<T> ctor = returnType
313:                            .getConstructor(Context.class, String.class,
314:                                    ScriptProxy.class);
315:                    return ctor.newInstance(this , extension, getScriptProxy());
316:                } catch (Exception ex) {
317:                    throw new IllegalArgumentException(
318:                            "Unsupported return type: " + returnType.getName());
319:                }
320:            }
321:
322:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.