Source Code Cross Referenced for HTMLTableRowElementImpl.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.NodeList;
021:        import org.w3c.dom.html.HTMLCollection;
022:        import org.w3c.dom.html.HTMLElement;
023:        import org.w3c.dom.html.HTMLTableCellElement;
024:        import org.w3c.dom.html.HTMLTableElement;
025:        import org.w3c.dom.html.HTMLTableRowElement;
026:        import org.w3c.dom.html.HTMLTableSectionElement;
027:
028:        /**
029:         * @xerces.internal
030:         * @version $Revision: 449313 $ $Date: 2006-09-23 18:01:43 -0400 (Sat, 23 Sep 2006) $
031:         * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
032:         * @see org.w3c.dom.html.HTMLTableRowElement
033:         * @see org.apache.xerces.dom.ElementImpl
034:         */
035:        public class HTMLTableRowElementImpl extends HTMLElementImpl implements 
036:                HTMLTableRowElement {
037:
038:            private static final long serialVersionUID = 5409562635656244263L;
039:
040:            public int getRowIndex() {
041:                Node parent;
042:
043:                parent = getParentNode();
044:                if (parent instanceof  HTMLTableSectionElement) {
045:                    parent = parent.getParentNode();
046:                }
047:                if (parent instanceof  HTMLTableElement) {
048:                    return getRowIndex(parent);
049:                }
050:                return -1;
051:            }
052:
053:            public void setRowIndex(int rowIndex) {
054:                Node parent;
055:
056:                parent = getParentNode();
057:                if (parent instanceof  HTMLTableSectionElement) {
058:                    parent = parent.getParentNode();
059:                }
060:                if (parent instanceof  HTMLTableElement) {
061:                    ((HTMLTableElementImpl) parent).insertRowX(rowIndex, this );
062:                }
063:            }
064:
065:            public int getSectionRowIndex() {
066:                Node parent;
067:
068:                parent = getParentNode();
069:                if (parent instanceof  HTMLTableSectionElement) {
070:                    return getRowIndex(parent);
071:                }
072:                return -1;
073:            }
074:
075:            public void setSectionRowIndex(int sectionRowIndex) {
076:                Node parent;
077:
078:                parent = getParentNode();
079:                if (parent instanceof  HTMLTableSectionElement) {
080:                    ((HTMLTableSectionElementImpl) parent).insertRowX(
081:                            sectionRowIndex, this );
082:                }
083:            }
084:
085:            int getRowIndex(Node parent) {
086:                NodeList rows;
087:                int i;
088:
089:                // Use getElementsByTagName() which creates a snapshot of all the
090:                // TR elements under the TABLE/section. Access to the returned NodeList
091:                // is very fast and the snapshot solves many synchronization problems.
092:                rows = ((HTMLElement) parent).getElementsByTagName("TR");
093:                for (i = 0; i < rows.getLength(); ++i) {
094:                    if (rows.item(i) == this ) {
095:                        return i;
096:                    }
097:                }
098:                return -1;
099:            }
100:
101:            public HTMLCollection getCells() {
102:                if (_cells == null) {
103:                    _cells = new HTMLCollectionImpl(this ,
104:                            HTMLCollectionImpl.CELL);
105:                }
106:                return _cells;
107:            }
108:
109:            public void setCells(HTMLCollection cells) {
110:                Node child;
111:                int i;
112:
113:                child = getFirstChild();
114:                while (child != null) {
115:                    removeChild(child);
116:                    child = child.getNextSibling();
117:                }
118:                i = 0;
119:                child = cells.item(i);
120:                while (child != null) {
121:                    appendChild(child);
122:                    ++i;
123:                    child = cells.item(i);
124:                }
125:            }
126:
127:            public HTMLElement insertCell(int index) {
128:                Node child;
129:                HTMLElement newCell;
130:
131:                newCell = new HTMLTableCellElementImpl(
132:                        (HTMLDocumentImpl) getOwnerDocument(), "TD");
133:                child = getFirstChild();
134:                while (child != null) {
135:                    if (child instanceof  HTMLTableCellElement) {
136:                        if (index == 0) {
137:                            insertBefore(newCell, child);
138:                            return newCell;
139:                        }
140:                        --index;
141:                    }
142:                    child = child.getNextSibling();
143:                }
144:                appendChild(newCell);
145:                return newCell;
146:            }
147:
148:            public void deleteCell(int index) {
149:                Node child;
150:
151:                child = getFirstChild();
152:                while (child != null) {
153:                    if (child instanceof  HTMLTableCellElement) {
154:                        if (index == 0) {
155:                            removeChild(child);
156:                            return;
157:                        }
158:                        --index;
159:                    }
160:                    child = child.getNextSibling();
161:                }
162:            }
163:
164:            public String getAlign() {
165:                return capitalize(getAttribute("align"));
166:            }
167:
168:            public void setAlign(String align) {
169:                setAttribute("align", align);
170:            }
171:
172:            public String getBgColor() {
173:                return getAttribute("bgcolor");
174:            }
175:
176:            public void setBgColor(String bgColor) {
177:                setAttribute("bgcolor", bgColor);
178:            }
179:
180:            public String getCh() {
181:                String ch;
182:
183:                // Make sure that the access key is a single character.
184:                ch = getAttribute("char");
185:                if (ch != null && ch.length() > 1) {
186:                    ch = ch.substring(0, 1);
187:                }
188:                return ch;
189:            }
190:
191:            public void setCh(String ch) {
192:                // Make sure that the access key is a single character.
193:                if (ch != null && ch.length() > 1) {
194:                    ch = ch.substring(0, 1);
195:                }
196:                setAttribute("char", ch);
197:            }
198:
199:            public String getChOff() {
200:                return getAttribute("charoff");
201:            }
202:
203:            public void setChOff(String chOff) {
204:                setAttribute("charoff", chOff);
205:            }
206:
207:            public String getVAlign() {
208:                return capitalize(getAttribute("valign"));
209:            }
210:
211:            public void setVAlign(String vAlign) {
212:                setAttribute("valign", vAlign);
213:            }
214:
215:            /**
216:             * Explicit implementation of cloneNode() to ensure that cache used
217:             * for getCells() gets cleared.
218:             */
219:            public Node cloneNode(boolean deep) {
220:                HTMLTableRowElementImpl clonedNode = (HTMLTableRowElementImpl) super 
221:                        .cloneNode(deep);
222:                clonedNode._cells = null;
223:                return clonedNode;
224:            }
225:
226:            /**
227:             * Constructor requires owner document.
228:             * 
229:             * @param owner The owner HTML document
230:             */
231:            public HTMLTableRowElementImpl(HTMLDocumentImpl owner, String name) {
232:                super (owner, name);
233:            }
234:
235:            HTMLCollection _cells;
236:
237:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.