Source Code Cross Referenced for HTMLSelectElementImpl.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.HTMLOptionElement;
024:        import org.w3c.dom.html.HTMLSelectElement;
025:
026:        /**
027:         * @xerces.internal
028:         * @version $Revision: 447255 $ $Date: 2006-09-18 01:36:42 -0400 (Mon, 18 Sep 2006) $
029:         * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
030:         * @see org.w3c.dom.html.HTMLSelectElement
031:         * @see org.apache.xerces.dom.ElementImpl
032:         */
033:        public class HTMLSelectElementImpl extends HTMLElementImpl implements 
034:                HTMLSelectElement, HTMLFormControl {
035:
036:            private static final long serialVersionUID = -6998282711006968187L;
037:
038:            public String getType() {
039:                return getAttribute("type");
040:            }
041:
042:            public String getValue() {
043:                return getAttribute("value");
044:            }
045:
046:            public void setValue(String value) {
047:                setAttribute("value", value);
048:            }
049:
050:            public int getSelectedIndex() {
051:                NodeList options;
052:                int i;
053:
054:                // Use getElementsByTagName() which creates a snapshot of all the
055:                // OPTION elements under this SELECT. Access to the returned NodeList
056:                // is very fast and the snapshot solves many synchronization problems.
057:                // Locate the first selected OPTION and return its index. Note that
058:                // the OPTION might be under an OPTGROUP.
059:                options = getElementsByTagName("OPTION");
060:                for (i = 0; i < options.getLength(); ++i)
061:                    if (((HTMLOptionElement) options.item(i)).getSelected())
062:                        return i;
063:                return -1;
064:            }
065:
066:            public void setSelectedIndex(int selectedIndex) {
067:                NodeList options;
068:                int i;
069:
070:                // Use getElementsByTagName() which creates a snapshot of all the
071:                // OPTION elements under this SELECT. Access to the returned NodeList
072:                // is very fast and the snapshot solves many synchronization problems.
073:                // Change the select so all OPTIONs are off, except for the
074:                // selectIndex-th one.
075:                options = getElementsByTagName("OPTION");
076:                for (i = 0; i < options.getLength(); ++i)
077:                    ((HTMLOptionElementImpl) options.item(i))
078:                            .setSelected(i == selectedIndex);
079:            }
080:
081:            public HTMLCollection getOptions() {
082:                if (_options == null)
083:                    _options = new HTMLCollectionImpl(this ,
084:                            HTMLCollectionImpl.OPTION);
085:                return _options;
086:            }
087:
088:            public int getLength() {
089:                return getOptions().getLength();
090:            }
091:
092:            public boolean getDisabled() {
093:                return getBinary("disabled");
094:            }
095:
096:            public void setDisabled(boolean disabled) {
097:                setAttribute("disabled", disabled);
098:            }
099:
100:            public boolean getMultiple() {
101:                return getBinary("multiple");
102:            }
103:
104:            public void setMultiple(boolean multiple) {
105:                setAttribute("multiple", multiple);
106:            }
107:
108:            public String getName() {
109:                return getAttribute("name");
110:            }
111:
112:            public void setName(String name) {
113:                setAttribute("name", name);
114:            }
115:
116:            public int getSize() {
117:                return getInteger(getAttribute("size"));
118:            }
119:
120:            public void setSize(int size) {
121:                setAttribute("size", String.valueOf(size));
122:            }
123:
124:            public int getTabIndex() {
125:                return getInteger(getAttribute("tabindex"));
126:            }
127:
128:            public void setTabIndex(int tabIndex) {
129:                setAttribute("tabindex", String.valueOf(tabIndex));
130:            }
131:
132:            public void add(HTMLElement element, HTMLElement before) {
133:                insertBefore(element, before);
134:            }
135:
136:            public void remove(int index) {
137:                NodeList options;
138:                Node removed;
139:
140:                // Use getElementsByTagName() which creates a snapshot of all the
141:                // OPTION elements under this SELECT. Access to the returned NodeList
142:                // is very fast and the snapshot solves many synchronization problems.
143:                // Remove the indexed OPTION from it's parent, this might be this
144:                // SELECT or an OPTGROUP.
145:                options = getElementsByTagName("OPTION");
146:                removed = options.item(index);
147:                if (removed != null)
148:                    removed.getParentNode().removeChild(removed);
149:            }
150:
151:            public void blur() {
152:                // No scripting in server-side DOM. This method is moot.
153:            }
154:
155:            public void focus() {
156:                // No scripting in server-side DOM. This method is moot.
157:            }
158:
159:            /**
160:             * Explicit implementation of getChildNodes() to avoid problems with
161:             * overriding the getLength() method hidden in the super class.
162:             */
163:            public NodeList getChildNodes() {
164:                return getChildNodesUnoptimized();
165:            }
166:
167:            /**
168:             * Explicit implementation of cloneNode() to ensure that cache used
169:             * for getOptions() gets cleared.
170:             */
171:            public Node cloneNode(boolean deep) {
172:                HTMLSelectElementImpl clonedNode = (HTMLSelectElementImpl) super 
173:                        .cloneNode(deep);
174:                clonedNode._options = null;
175:                return clonedNode;
176:            }
177:
178:            /**
179:             * Constructor requires owner document.
180:             * 
181:             * @param owner The owner HTML document
182:             */
183:            public HTMLSelectElementImpl(HTMLDocumentImpl owner, String name) {
184:                super (owner, name);
185:            }
186:
187:            private HTMLCollection _options;
188:
189:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.