2002137aafe149d079bc32e0f38fa8ddfadf3e74
[jalview.git] / src / jalview / binding / UserColourScheme.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3  * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.binding;
20
21 // ---------------------------------/
22 // - Imported classes and packages -/
23 // ---------------------------------/
24
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
27
28 /**
29  * Class UserColourScheme.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class UserColourScheme extends JalviewUserColours implements
34         java.io.Serializable
35 {
36
37   // ----------------/
38   // - Constructors -/
39   // ----------------/
40
41   public UserColourScheme()
42   {
43     super();
44   }
45
46   // -----------/
47   // - Methods -/
48   // -----------/
49
50   /**
51    * Method isValid.
52    * 
53    * @return true if this object is valid according to the schema
54    */
55   public boolean isValid()
56   {
57     try
58     {
59       validate();
60     } catch (org.exolab.castor.xml.ValidationException vex)
61     {
62       return false;
63     }
64     return true;
65   }
66
67   /**
68    * 
69    * 
70    * @param out
71    * @throws org.exolab.castor.xml.MarshalException
72    *                 if object is null or if any SAXException is thrown during
73    *                 marshaling
74    * @throws org.exolab.castor.xml.ValidationException
75    *                 if this object is an invalid instance according to the
76    *                 schema
77    */
78   public void marshal(final java.io.Writer out)
79           throws org.exolab.castor.xml.MarshalException,
80           org.exolab.castor.xml.ValidationException
81   {
82     Marshaller.marshal(this, out);
83   }
84
85   /**
86    * 
87    * 
88    * @param handler
89    * @throws java.io.IOException
90    *                 if an IOException occurs during marshaling
91    * @throws org.exolab.castor.xml.ValidationException
92    *                 if this object is an invalid instance according to the
93    *                 schema
94    * @throws org.exolab.castor.xml.MarshalException
95    *                 if object is null or if any SAXException is thrown during
96    *                 marshaling
97    */
98   public void marshal(final org.xml.sax.ContentHandler handler)
99           throws java.io.IOException,
100           org.exolab.castor.xml.MarshalException,
101           org.exolab.castor.xml.ValidationException
102   {
103     Marshaller.marshal(this, handler);
104   }
105
106   /**
107    * Method unmarshal.
108    * 
109    * @param reader
110    * @throws org.exolab.castor.xml.MarshalException
111    *                 if object is null or if any SAXException is thrown during
112    *                 marshaling
113    * @throws org.exolab.castor.xml.ValidationException
114    *                 if this object is an invalid instance according to the
115    *                 schema
116    * @return the unmarshaled jalview.binding.JalviewUserColours
117    */
118   public static jalview.binding.JalviewUserColours unmarshal(
119           final java.io.Reader reader)
120           throws org.exolab.castor.xml.MarshalException,
121           org.exolab.castor.xml.ValidationException
122   {
123     return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(
124             jalview.binding.UserColourScheme.class, reader);
125   }
126
127   /**
128    * 
129    * 
130    * @throws org.exolab.castor.xml.ValidationException
131    *                 if this object is an invalid instance according to the
132    *                 schema
133    */
134   public void validate() throws org.exolab.castor.xml.ValidationException
135   {
136     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
137     validator.validate(this);
138   }
139
140 }