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