Source Code Cross Referenced for HtmlComponentVector.java in  » J2EE » Sofia » com » salmonllc » util » 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 » J2EE » Sofia » com.salmonllc.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //** Copyright Statement ***************************************************
002:        //The Salmon Open Framework for Internet Applications (SOFIA)
003:        // Copyright (C) 1999 - 2002, Salmon LLC
004:        //
005:        // This program is free software; you can redistribute it and/or
006:        // modify it under the terms of the GNU General Public License version 2
007:        // as published by the Free Software Foundation;
008:        // 
009:        // This program is distributed in the hope that it will be useful,
010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:        // GNU General Public License for more details.
013:        // 
014:        // You should have received a copy of the GNU General Public License
015:        // along with this program; if not, write to the Free Software
016:        // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:        // 
018:        // For more information please visit http://www.salmonllc.com
019:        //** End Copyright Statement ***************************************************
020:        package com.salmonllc.util;
021:
022:        /////////////////////////
023:        //$Archive: /JADE/SourceCode/com/salmonllc/util/HtmlComponentVector.java $
024:        //$Author: Dan $ 
025:        //$Revision: 6 $ 
026:        //$Modtime: 10/30/02 2:59p $ 
027:        /////////////////////////
028:        import java.util.Vector;
029:        import com.salmonllc.html.*;
030:
031:        /**
032:         * A type safe Vector that returns HtmlComponent and only accepts HtmlComponent
033:         */
034:        public class HtmlComponentVector implements  java.io.Serializable {
035:
036:            private Vector _elements;
037:
038:            /**
039:             * BaseListFormElementsVector constructor comment.
040:             */
041:            public HtmlComponentVector() {
042:                _elements = new Vector();
043:            }
044:
045:            /**
046:             * BaseListFormElementsVector constructor comment.
047:             * @param initialCapacity int
048:             */
049:            public HtmlComponentVector(int initialCapacity) {
050:                _elements = new Vector(initialCapacity);
051:            }
052:
053:            /**
054:             * BaseListFormElementsVector constructor comment.
055:             * @param initialCapacity int
056:             * @param capacityIncrement int
057:             */
058:            public HtmlComponentVector(int initialCapacity,
059:                    int capacityIncrement) {
060:                _elements = new Vector(initialCapacity, capacityIncrement);
061:            }
062:
063:            /**
064:             * Adds the specified HtmlComponent to the end of this vector, 
065:             * increasing its size by one. The capacity of this vector is 
066:             * increased if its size becomes greater than its capacity. 
067:             *
068:             * @param   comp   the HtmlComponent to be added.
069:             */
070:            public void addElement(HtmlComponent comp) {
071:                _elements.addElement(comp);
072:            }
073:
074:            /**
075:             * Tests if the specified HtmlComponent is a component in this vector.
076:             *
077:             * @param   elem   a HtmlComponent.
078:             * @return  <code>true</code> if the specified object is a HtmlComponent in
079:             *          this vector; <code>false</code> otherwise.
080:             */
081:            public final boolean contains(HtmlComponent elem) {
082:                return _elements.contains(elem);
083:            }
084:
085:            /**
086:             * Copies the HtmlComponent of this vector into the specified array. 
087:             * The array must be big enough to hold all the objects in this  vector.
088:             *
089:             * @param   anArray   the array into which the HtmlComponent get copied.
090:             */
091:            public void copyInto(HtmlComponent anArray[]) {
092:                _elements.copyInto(anArray);
093:            }
094:
095:            /**
096:             * Returns the HtmlComponent at the specified index.
097:             *
098:             * @param      index   an index into this vector.
099:             * @return     the HtmlComponent at the specified index.
100:             * @exception  ArrayIndexOutOfBoundsException  if an invalid index was
101:             *               given.
102:             */
103:            public HtmlComponent elementAt(int index) {
104:                return (HtmlComponent) _elements.elementAt(index);
105:            }
106:
107:            /**
108:             * Searches for the first occurence of the given argument, testing 
109:             * for equality using the <code>equals</code> method. 
110:             *
111:             * @param   elem   an HtmlComponent.
112:             * @return  the index of the first occurrence of the argument in this
113:             *          vector; returns <code>-1</code> if the HtmlComponent is not found.
114:             * @see     java.lang.Object#equals(java.lang.Object)
115:             */
116:            public final int indexOf(HtmlComponent elem) {
117:                return _elements.indexOf(elem);
118:            }
119:
120:            /**
121:             * Searches for the first occurence of the given argument, beginning 
122:             * the search at <code>index</code>, and testing for equality using 
123:             * the <code>equals</code> method. 
124:             *
125:             * @param   elem    an HtmlComponent.
126:             * @param   index   the index to start searching from.
127:             * @return  the index of the first occurrence of the HtmlComponent argument in
128:             *          this vector at position <code>index</code> or later in the
129:             *          vector; returns <code>-1</code> if the object is not found.
130:             * @see     java.lang.Object#equals(java.lang.Object)
131:             */
132:            public int indexOf(HtmlComponent elem, int index) {
133:                return _elements.indexOf(elem, index);
134:            }
135:
136:            /**
137:             * Inserts the specified HtmlComponent as a component in this vector at the 
138:             * specified <code>index</code>. Each component in this vector with 
139:             * an index greater or equal to the specified <code>index</code> is 
140:             * shifted upward to have an index one greater than the value it had 
141:             * previously. 
142:             * <p>
143:             * The index must be a value greater than or equal to <code>0</code> 
144:             * and less than or equal to the current size of the vector. 
145:             *
146:             * @param      comp     the HtmlComponent to insert.
147:             * @param      index   where to insert the new component.
148:             * @exception  ArrayIndexOutOfBoundsException  if the index was invalid.
149:             * @see        java.util.Vector#size()
150:             */
151:            public void insertElementAt(HtmlComponent comp, int index) {
152:                _elements.insertElementAt(comp, index);
153:            }
154:
155:            /**
156:             * Returns the index of the last occurrence of the specified HtmlComponent in
157:             * this vector.
158:             *
159:             * @param   elem   the desired HtmlComponent.
160:             * @return  the index of the last occurrence of the specified HtmlComponent in
161:             *          this vector; returns <code>-1</code> if the object is not found.
162:             */
163:            public final int lastIndexOf(HtmlComponent elem) {
164:                return _elements.lastIndexOf(elem);
165:            }
166:
167:            /**
168:             * Searches backwards for the specified HtmlComponent, starting from the 
169:             * specified index, and returns an index to it. 
170:             *
171:             * @param   elem    the desired HtmlComponent.
172:             * @param   index   the index to start searching from.
173:             * @return  the index of the last occurrence of the specified HtmlComponent in this
174:             *          vector at position less than <code>index</code> in the vector;
175:             *          <code>-1</code> if the object is not found.
176:             */
177:            public int lastIndexOf(HtmlComponent elem, int index) {
178:                return _elements.lastIndexOf(elem, index);
179:            }
180:
181:            /**
182:             * Removes the first occurrence of the argument from this vector. If 
183:             * the HtmlComponent is found in this vector, each component in the vector 
184:             * with an index greater or equal to the object's index is shifted 
185:             * downward to have an index one smaller than the value it had previously.
186:             *
187:             * @param   comp   the component to be removed.
188:             * @return  <code>true</code> if the argument was a component of this
189:             *          vector; <code>false</code> otherwise.
190:             * @since   JDK1.0
191:             */
192:            public boolean removeComp(HtmlComponent comp) {
193:                return _elements.removeElement(comp);
194:            }
195:
196:            /**
197:             * Sets the component at the specified <code>index</code> of this 
198:             * vector to be the specified HtmlComponent. The previous component at that 
199:             * position is discarded. 
200:             * <p>
201:             * The index must be a value greater than or equal to <code>0</code> 
202:             * and less than the current size of the vector. 
203:             *
204:             * @param      comp     what the component is to be set to.
205:             * @param      index   the specified index.
206:             * @exception  ArrayIndexOutOfBoundsException  if the index was invalid.
207:             * @see        java.util.Vector#size()
208:             */
209:            public void setElementAt(HtmlComponent comp, int index) {
210:                _elements.setElementAt(comp, index);
211:            }
212:
213:            /**
214:             * Returns the number of components in this vector.
215:             *
216:             * @return  the number of components in this vector.
217:             */
218:            public int size() {
219:                return _elements.size();
220:            }
221:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.