Source Code Cross Referenced for HTMLTableElementImpl.java in  » XML » xerces-2_9_1 » org » apache » html » dom » 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 » XML » xerces 2_9_1 » org.apache.html.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.html.dom;
018:
019:        import org.w3c.dom.Node;
020:        import org.w3c.dom.html.HTMLCollection;
021:        import org.w3c.dom.html.HTMLElement;
022:        import org.w3c.dom.html.HTMLTableCaptionElement;
023:        import org.w3c.dom.html.HTMLTableElement;
024:        import org.w3c.dom.html.HTMLTableRowElement;
025:        import org.w3c.dom.html.HTMLTableSectionElement;
026:
027:        /**
028:         * @xerces.internal
029:         * @version $Revision: 447255 $ $Date: 2006-09-18 01:36:42 -0400 (Mon, 18 Sep 2006) $
030:         * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
031:         * @see org.w3c.dom.html.HTMLAnchorElement
032:         * @see org.apache.xerces.dom.ElementImpl
033:         */
034:        public class HTMLTableElementImpl extends HTMLElementImpl implements 
035:                HTMLTableElement {
036:
037:            private static final long serialVersionUID = -1824053099870917532L;
038:
039:            public synchronized HTMLTableCaptionElement getCaption() {
040:                Node child;
041:
042:                child = getFirstChild();
043:                while (child != null) {
044:                    if (child instanceof  HTMLTableCaptionElement
045:                            && child.getNodeName().equals("CAPTION"))
046:                        return (HTMLTableCaptionElement) child;
047:                    child = child.getNextSibling();
048:                }
049:                return null;
050:            }
051:
052:            public synchronized void setCaption(HTMLTableCaptionElement caption) {
053:                if (caption != null && !caption.getTagName().equals("CAPTION"))
054:                    throw new IllegalArgumentException(
055:                            "HTM016 Argument 'caption' is not an element of type <CAPTION>.");
056:                deleteCaption();
057:                if (caption != null)
058:                    appendChild(caption);
059:            }
060:
061:            public synchronized HTMLElement createCaption() {
062:                HTMLElement section;
063:
064:                section = getCaption();
065:                if (section != null)
066:                    return section;
067:                section = new HTMLTableCaptionElementImpl(
068:                        (HTMLDocumentImpl) getOwnerDocument(), "CAPTION");
069:                appendChild(section);
070:                return section;
071:            }
072:
073:            public synchronized void deleteCaption() {
074:                Node old;
075:
076:                old = getCaption();
077:                if (old != null)
078:                    removeChild(old);
079:            }
080:
081:            public synchronized HTMLTableSectionElement getTHead() {
082:                Node child;
083:
084:                child = getFirstChild();
085:                while (child != null) {
086:                    if (child instanceof  HTMLTableSectionElement
087:                            && child.getNodeName().equals("THEAD"))
088:                        return (HTMLTableSectionElement) child;
089:                    child = child.getNextSibling();
090:                }
091:                return null;
092:            }
093:
094:            public synchronized void setTHead(HTMLTableSectionElement tHead) {
095:                if (tHead != null && !tHead.getTagName().equals("THEAD"))
096:                    throw new IllegalArgumentException(
097:                            "HTM017 Argument 'tHead' is not an element of type <THEAD>.");
098:                deleteTHead();
099:                if (tHead != null)
100:                    appendChild(tHead);
101:            }
102:
103:            public synchronized HTMLElement createTHead() {
104:                HTMLElement section;
105:
106:                section = getTHead();
107:                if (section != null)
108:                    return section;
109:                section = new HTMLTableSectionElementImpl(
110:                        (HTMLDocumentImpl) getOwnerDocument(), "THEAD");
111:                appendChild(section);
112:                return section;
113:            }
114:
115:            public synchronized void deleteTHead() {
116:                Node old;
117:
118:                old = getTHead();
119:                if (old != null)
120:                    removeChild(old);
121:            }
122:
123:            public synchronized HTMLTableSectionElement getTFoot() {
124:                Node child;
125:
126:                child = getFirstChild();
127:                while (child != null) {
128:                    if (child instanceof  HTMLTableSectionElement
129:                            && child.getNodeName().equals("TFOOT"))
130:                        return (HTMLTableSectionElement) child;
131:                    child = child.getNextSibling();
132:                }
133:                return null;
134:            }
135:
136:            public synchronized void setTFoot(HTMLTableSectionElement tFoot) {
137:                if (tFoot != null && !tFoot.getTagName().equals("TFOOT"))
138:                    throw new IllegalArgumentException(
139:                            "HTM018 Argument 'tFoot' is not an element of type <TFOOT>.");
140:                deleteTFoot();
141:                if (tFoot != null)
142:                    appendChild(tFoot);
143:            }
144:
145:            public synchronized HTMLElement createTFoot() {
146:                HTMLElement section;
147:
148:                section = getTFoot();
149:                if (section != null)
150:                    return section;
151:                section = new HTMLTableSectionElementImpl(
152:                        (HTMLDocumentImpl) getOwnerDocument(), "TFOOT");
153:                appendChild(section);
154:                return section;
155:            }
156:
157:            public synchronized void deleteTFoot() {
158:                Node old;
159:
160:                old = getTFoot();
161:                if (old != null)
162:                    removeChild(old);
163:            }
164:
165:            public HTMLCollection getRows() {
166:                if (_rows == null)
167:                    _rows = new HTMLCollectionImpl(this , HTMLCollectionImpl.ROW);
168:                return _rows;
169:            }
170:
171:            public HTMLCollection getTBodies() {
172:                if (_bodies == null)
173:                    _bodies = new HTMLCollectionImpl(this ,
174:                            HTMLCollectionImpl.TBODY);
175:                return _bodies;
176:            }
177:
178:            public String getAlign() {
179:                return capitalize(getAttribute("align"));
180:            }
181:
182:            public void setAlign(String align) {
183:                setAttribute("align", align);
184:            }
185:
186:            public String getBgColor() {
187:                return getAttribute("bgcolor");
188:            }
189:
190:            public void setBgColor(String bgColor) {
191:                setAttribute("bgcolor", bgColor);
192:            }
193:
194:            public String getBorder() {
195:                return getAttribute("border");
196:            }
197:
198:            public void setBorder(String border) {
199:                setAttribute("border", border);
200:            }
201:
202:            public String getCellPadding() {
203:                return getAttribute("cellpadding");
204:            }
205:
206:            public void setCellPadding(String cellPadding) {
207:                setAttribute("cellpadding", cellPadding);
208:            }
209:
210:            public String getCellSpacing() {
211:                return getAttribute("cellspacing");
212:            }
213:
214:            public void setCellSpacing(String cellSpacing) {
215:                setAttribute("cellspacing", cellSpacing);
216:            }
217:
218:            public String getFrame() {
219:                return capitalize(getAttribute("frame"));
220:            }
221:
222:            public void setFrame(String frame) {
223:                setAttribute("frame", frame);
224:            }
225:
226:            public String getRules() {
227:                return capitalize(getAttribute("rules"));
228:            }
229:
230:            public void setRules(String rules) {
231:                setAttribute("rules", rules);
232:            }
233:
234:            public String getSummary() {
235:                return getAttribute("summary");
236:            }
237:
238:            public void setSummary(String summary) {
239:                setAttribute("summary", summary);
240:            }
241:
242:            public String getWidth() {
243:                return getAttribute("width");
244:            }
245:
246:            public void setWidth(String width) {
247:                setAttribute("width", width);
248:            }
249:
250:            public HTMLElement insertRow(int index) {
251:                HTMLTableRowElementImpl newRow;
252:
253:                newRow = new HTMLTableRowElementImpl(
254:                        (HTMLDocumentImpl) getOwnerDocument(), "TR");
255:                //newRow.insertCell( 0 );
256:                insertRowX(index, newRow);
257:                return newRow;
258:            }
259:
260:            void insertRowX(int index, HTMLTableRowElementImpl newRow) {
261:                Node child;
262:                Node lastSection = null;
263:
264:                child = getFirstChild();
265:                while (child != null) {
266:                    if (child instanceof  HTMLTableRowElement) {
267:                        if (index == 0) {
268:                            insertBefore(newRow, child);
269:                            return;
270:                        }
271:                    } else if (child instanceof  HTMLTableSectionElementImpl) {
272:                        lastSection = child;
273:                        index = ((HTMLTableSectionElementImpl) child)
274:                                .insertRowX(index, newRow);
275:                        if (index < 0)
276:                            return;
277:                    }
278:                    child = child.getNextSibling();
279:                }
280:                if (lastSection != null)
281:                    lastSection.appendChild(newRow);
282:                else
283:                    appendChild(newRow);
284:            }
285:
286:            public synchronized void deleteRow(int index) {
287:                Node child;
288:
289:                child = getFirstChild();
290:                while (child != null) {
291:                    if (child instanceof  HTMLTableRowElement) {
292:                        if (index == 0) {
293:                            removeChild(child);
294:                            return;
295:                        }
296:                        --index;
297:                    } else if (child instanceof  HTMLTableSectionElementImpl) {
298:                        index = ((HTMLTableSectionElementImpl) child)
299:                                .deleteRowX(index);
300:                        if (index < 0)
301:                            return;
302:                    }
303:                    child = child.getNextSibling();
304:                }
305:            }
306:
307:            /**
308:             * Explicit implementation of cloneNode() to ensure that cache used
309:             * for getRows() and getTBodies() gets cleared.
310:             */
311:            public Node cloneNode(boolean deep) {
312:                HTMLTableElementImpl clonedNode = (HTMLTableElementImpl) super 
313:                        .cloneNode(deep);
314:                clonedNode._rows = null;
315:                clonedNode._bodies = null;
316:                return clonedNode;
317:            }
318:
319:            /**
320:             * Constructor requires owner document.
321:             * 
322:             * @param owner The owner HTML document
323:             */
324:            public HTMLTableElementImpl(HTMLDocumentImpl owner, String name) {
325:                super (owner, name);
326:            }
327:
328:            private HTMLCollectionImpl _rows;
329:
330:            private HTMLCollectionImpl _bodies;
331:
332:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.