2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML
\r
8 * Jalview - A Sequence Alignment Editor and Viewer
\r
9 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
11 * This program is free software; you can redistribute it and/or
\r
12 * modify it under the terms of the GNU General Public License
\r
13 * as published by the Free Software Foundation; either version 2
\r
14 * of the License, or (at your option) any later version.
\r
16 * This program is distributed in the hope that it will be useful,
\r
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
19 * GNU General Public License for more details.
\r
21 * You should have received a copy of the GNU General Public License
\r
22 * along with this program; if not, write to the Free Software
\r
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
25 package jalview.binding;
\r
27 import org.exolab.castor.xml.MarshalException;
\r
28 import org.exolab.castor.xml.Marshaller;
\r
29 import org.exolab.castor.xml.Unmarshaller;
\r
30 import org.exolab.castor.xml.ValidationException;
\r
32 import org.xml.sax.ContentHandler;
\r
34 //---------------------------------/
\r
35 //- Imported classes and packages -/
\r
36 //---------------------------------/
\r
37 import java.io.IOException;
\r
38 import java.io.Reader;
\r
39 import java.io.Serializable;
\r
40 import java.io.Writer;
\r
42 import java.util.Enumeration;
\r
43 import java.util.Vector;
\r
47 * Class JalviewUserColours.
\r
49 * @version $Revision$ $Date$
\r
51 public class JalviewUserColours implements java.io.Serializable {
\r
52 //--------------------------/
\r
53 //- Class/Member Variables -/
\r
54 //--------------------------/
\r
59 private java.util.Vector _colourList;
\r
64 public JalviewUserColours() {
\r
66 _colourList = new Vector();
\r
68 //-- jalview.binding.JalviewUserColours()
\r
71 public void addColour(jalview.binding.Colour vColour)
\r
72 throws java.lang.IndexOutOfBoundsException {
\r
73 _colourList.addElement(vColour);
\r
75 //-- void addColour(jalview.binding.Colour)
\r
85 public void addColour(int index, jalview.binding.Colour vColour)
\r
86 throws java.lang.IndexOutOfBoundsException {
\r
87 _colourList.insertElementAt(vColour, index);
\r
89 //-- void addColour(int, jalview.binding.Colour)
\r
92 * Method enumerateColour
\r
96 * @return Enumeration
\r
98 public java.util.Enumeration enumerateColour() {
\r
99 return _colourList.elements();
\r
101 //-- java.util.Enumeration enumerateColour()
\r
111 public jalview.binding.Colour getColour(int index)
\r
112 throws java.lang.IndexOutOfBoundsException {
\r
113 //-- check bounds for index
\r
114 if ((index < 0) || (index > _colourList.size())) {
\r
115 throw new IndexOutOfBoundsException();
\r
118 return (jalview.binding.Colour) _colourList.elementAt(index);
\r
120 //-- jalview.binding.Colour getColour(int)
\r
129 public jalview.binding.Colour[] getColour() {
\r
130 int size = _colourList.size();
\r
131 jalview.binding.Colour[] mArray = new jalview.binding.Colour[size];
\r
133 for (int index = 0; index < size; index++) {
\r
134 mArray[index] = (jalview.binding.Colour) _colourList.elementAt(index);
\r
139 //-- jalview.binding.Colour[] getColour()
\r
142 * Method getColourCount
\r
148 public int getColourCount() {
\r
149 return _colourList.size();
\r
151 //-- int getColourCount()
\r
160 public boolean isValid() {
\r
163 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
169 //-- boolean isValid()
\r
178 public void marshal(java.io.Writer out)
\r
179 throws org.exolab.castor.xml.MarshalException,
\r
180 org.exolab.castor.xml.ValidationException {
\r
181 Marshaller.marshal(this, out);
\r
183 //-- void marshal(java.io.Writer)
\r
192 public void marshal(org.xml.sax.ContentHandler handler)
\r
193 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
194 org.exolab.castor.xml.ValidationException {
\r
195 Marshaller.marshal(this, handler);
\r
197 //-- void marshal(org.xml.sax.ContentHandler)
\r
200 * Method removeAllColour
\r
203 public void removeAllColour() {
\r
204 _colourList.removeAllElements();
\r
206 //-- void removeAllColour()
\r
209 * Method removeColour
\r
216 public jalview.binding.Colour removeColour(int index) {
\r
217 java.lang.Object obj = _colourList.elementAt(index);
\r
218 _colourList.removeElementAt(index);
\r
220 return (jalview.binding.Colour) obj;
\r
222 //-- jalview.binding.Colour removeColour(int)
\r
232 public void setColour(int index, jalview.binding.Colour vColour)
\r
233 throws java.lang.IndexOutOfBoundsException {
\r
234 //-- check bounds for index
\r
235 if ((index < 0) || (index > _colourList.size())) {
\r
236 throw new IndexOutOfBoundsException();
\r
239 _colourList.setElementAt(vColour, index);
\r
241 //-- void setColour(int, jalview.binding.Colour)
\r
248 * @param colourArray
\r
250 public void setColour(jalview.binding.Colour[] colourArray) {
\r
252 _colourList.removeAllElements();
\r
254 for (int i = 0; i < colourArray.length; i++) {
\r
255 _colourList.addElement(colourArray[i]);
\r
258 //-- void setColour(jalview.binding.Colour)
\r
268 public static java.lang.Object unmarshal(java.io.Reader reader)
\r
269 throws org.exolab.castor.xml.MarshalException,
\r
270 org.exolab.castor.xml.ValidationException {
\r
271 return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class,
\r
274 //-- java.lang.Object unmarshal(java.io.Reader)
\r
280 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
281 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
282 validator.validate(this);
\r
284 //-- void validate()
\r