Source Code Cross Referenced for DomConfig.java in  » Ajax » gwtext-2.01 » com » gwtext » client » core » 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.core 
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:        package com.gwtext.client.core;
009:
010:        import com.google.gwt.core.client.JavaScriptObject;
011:        import com.gwtext.client.util.JavaScriptObjectHelper;
012:
013:        import java.util.*;
014:
015:        /**
016:         * The Dom object spec. Can be configured with specs of children too. If no tag is specified then a div will
017:         * be automatically generated with the specified attributes.
018:         *
019:         * @see DomHelper#append(String, DomConfig)
020:         * @see ExtElement#createChild(DomConfig)
021:         */
022:        public class DomConfig {
023:
024:            private String tag;
025:            private String id;
026:            private String cls;
027:            private String style;
028:            private String html;
029:            private List children;
030:
031:            private Map otherConfig = new HashMap();
032:
033:            /**
034:             * Create a new DomConfig using a "div" tag.
035:             */
036:            public DomConfig() {
037:                this .tag = "div";
038:            }
039:
040:            /**
041:             * Create a new DomConfig.
042:             *
043:             * @param tag the tag name
044:             */
045:            public DomConfig(String tag) {
046:                this .tag = tag;
047:            }
048:
049:            /**
050:             * Constructor.
051:             *
052:             * @param tag the element tag name
053:             * @param id  the element id
054:             */
055:            public DomConfig(String tag, String id) {
056:                this .tag = tag;
057:                this .id = id;
058:            }
059:
060:            /**
061:             * Constructor.
062:             *
063:             * @param tag the element tag name
064:             * @param id  the element id
065:             * @param cls the element CSS class name
066:             */
067:            public DomConfig(String tag, String id, String cls) {
068:                this .tag = tag;
069:                this .id = id;
070:                this .cls = cls;
071:            }
072:
073:            /**
074:             * Constructor.
075:             *
076:             * @param tag  the element tag name
077:             * @param id   the element id
078:             * @param cls  the element CSS class name
079:             * @param html the innerHTML for the element.
080:             */
081:            public DomConfig(String tag, String id, String cls, String html) {
082:                this .tag = tag;
083:                this .id = id;
084:                this .cls = cls;
085:                this .html = html;
086:            }
087:
088:            /**
089:             * Set the CSS style.
090:             *
091:             * @param style the CSS style
092:             */
093:            public void setStyle(String style) {
094:                this .style = style;
095:            }
096:
097:            /**
098:             * Add a child element.
099:             *
100:             * @param child the child element config
101:             * @return this
102:             */
103:            public DomConfig addChild(DomConfig child) {
104:                if (html != null) {
105:                    throw new IllegalArgumentException(
106:                            "Dom spec cannot have inner html and child elelents");
107:                }
108:                if (children == null)
109:                    children = new ArrayList();
110:                children.add(child);
111:                return this ;
112:            }
113:
114:            public void addAttribute(String name, String value) {
115:                otherConfig.put(name, value);
116:            }
117:
118:            public JavaScriptObject getJsObject() {
119:                JavaScriptObject jsObj = JavaScriptObjectHelper.createObject();
120:                if (tag != null)
121:                    JavaScriptObjectHelper.setAttribute(jsObj, "tag", tag);
122:                if (id != null)
123:                    JavaScriptObjectHelper.setAttribute(jsObj, "id", id);
124:                if (cls != null)
125:                    JavaScriptObjectHelper.setAttribute(jsObj, "cls", cls);
126:                if (style != null)
127:                    JavaScriptObjectHelper.setAttribute(jsObj, "style", style);
128:                if (html != null)
129:                    JavaScriptObjectHelper.setAttribute(jsObj, "html", html);
130:
131:                for (Iterator iterator = otherConfig.keySet().iterator(); iterator
132:                        .hasNext();) {
133:                    String attribute = (String) iterator.next();
134:                    String value = (String) otherConfig.get(attribute);
135:                    JavaScriptObjectHelper
136:                            .setAttribute(jsObj, attribute, value);
137:                }
138:
139:                if (children != null) {
140:                    JavaScriptObject[] childrenJS = new JavaScriptObject[children
141:                            .size()];
142:                    int i = 0;
143:                    for (Iterator it = children.iterator(); it.hasNext(); i++) {
144:                        DomConfig config = (DomConfig) it.next();
145:                        childrenJS[i] = config.getJsObject();
146:                    }
147:                    JavaScriptObjectHelper.setAttribute(jsObj, "children",
148:                            childrenJS);
149:                }
150:                return jsObj;
151:            }
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.