743227f2fcfd4a3af8564627e74d8e8c5fd0f4ee
[jalview.git] / src / jalview / binding / Setting.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.binding;
19
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
23
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
26
27 /**
28  * Class Setting.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class Setting implements java.io.Serializable
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * Field _type.
41    */
42   private java.lang.String _type;
43
44   /**
45    * Field _colour.
46    */
47   private int _colour;
48
49   /**
50    * keeps track of state for field: _colour
51    */
52   private boolean _has_colour;
53
54   /**
55    * Field _display.
56    */
57   private boolean _display;
58
59   /**
60    * keeps track of state for field: _display
61    */
62   private boolean _has_display;
63
64   // ----------------/
65   // - Constructors -/
66   // ----------------/
67
68   public Setting()
69   {
70     super();
71   }
72
73   // -----------/
74   // - Methods -/
75   // -----------/
76
77   /**
78      */
79   public void deleteColour()
80   {
81     this._has_colour = false;
82   }
83
84   /**
85      */
86   public void deleteDisplay()
87   {
88     this._has_display = false;
89   }
90
91   /**
92    * Returns the value of field 'colour'.
93    * 
94    * @return the value of field 'Colour'.
95    */
96   public int getColour()
97   {
98     return this._colour;
99   }
100
101   /**
102    * Returns the value of field 'display'.
103    * 
104    * @return the value of field 'Display'.
105    */
106   public boolean getDisplay()
107   {
108     return this._display;
109   }
110
111   /**
112    * Returns the value of field 'type'.
113    * 
114    * @return the value of field 'Type'.
115    */
116   public java.lang.String getType()
117   {
118     return this._type;
119   }
120
121   /**
122    * Method hasColour.
123    * 
124    * @return true if at least one Colour has been added
125    */
126   public boolean hasColour()
127   {
128     return this._has_colour;
129   }
130
131   /**
132    * Method hasDisplay.
133    * 
134    * @return true if at least one Display has been added
135    */
136   public boolean hasDisplay()
137   {
138     return this._has_display;
139   }
140
141   /**
142    * Returns the value of field 'display'.
143    * 
144    * @return the value of field 'Display'.
145    */
146   public boolean isDisplay()
147   {
148     return this._display;
149   }
150
151   /**
152    * Method isValid.
153    * 
154    * @return true if this object is valid according to the schema
155    */
156   public boolean isValid()
157   {
158     try
159     {
160       validate();
161     } catch (org.exolab.castor.xml.ValidationException vex)
162     {
163       return false;
164     }
165     return true;
166   }
167
168   /**
169    * 
170    * 
171    * @param out
172    * @throws org.exolab.castor.xml.MarshalException
173    *           if object is null or if any SAXException is thrown during
174    *           marshaling
175    * @throws org.exolab.castor.xml.ValidationException
176    *           if this object is an invalid instance according to the schema
177    */
178   public void marshal(final java.io.Writer out)
179           throws org.exolab.castor.xml.MarshalException,
180           org.exolab.castor.xml.ValidationException
181   {
182     Marshaller.marshal(this, out);
183   }
184
185   /**
186    * 
187    * 
188    * @param handler
189    * @throws java.io.IOException
190    *           if an IOException occurs during marshaling
191    * @throws org.exolab.castor.xml.ValidationException
192    *           if this object is an invalid instance according to the schema
193    * @throws org.exolab.castor.xml.MarshalException
194    *           if object is null or if any SAXException is thrown during
195    *           marshaling
196    */
197   public void marshal(final org.xml.sax.ContentHandler handler)
198           throws java.io.IOException,
199           org.exolab.castor.xml.MarshalException,
200           org.exolab.castor.xml.ValidationException
201   {
202     Marshaller.marshal(this, handler);
203   }
204
205   /**
206    * Sets the value of field 'colour'.
207    * 
208    * @param colour
209    *          the value of field 'colour'.
210    */
211   public void setColour(final int colour)
212   {
213     this._colour = colour;
214     this._has_colour = true;
215   }
216
217   /**
218    * Sets the value of field 'display'.
219    * 
220    * @param display
221    *          the value of field 'display'.
222    */
223   public void setDisplay(final boolean display)
224   {
225     this._display = display;
226     this._has_display = true;
227   }
228
229   /**
230    * Sets the value of field 'type'.
231    * 
232    * @param type
233    *          the value of field 'type'.
234    */
235   public void setType(final java.lang.String type)
236   {
237     this._type = type;
238   }
239
240   /**
241    * Method unmarshal.
242    * 
243    * @param reader
244    * @throws org.exolab.castor.xml.MarshalException
245    *           if object is null or if any SAXException is thrown during
246    *           marshaling
247    * @throws org.exolab.castor.xml.ValidationException
248    *           if this object is an invalid instance according to the schema
249    * @return the unmarshaled jalview.binding.Setting
250    */
251   public static jalview.binding.Setting unmarshal(
252           final java.io.Reader reader)
253           throws org.exolab.castor.xml.MarshalException,
254           org.exolab.castor.xml.ValidationException
255   {
256     return (jalview.binding.Setting) Unmarshaller.unmarshal(
257             jalview.binding.Setting.class, reader);
258   }
259
260   /**
261    * 
262    * 
263    * @throws org.exolab.castor.xml.ValidationException
264    *           if this object is an invalid instance according to the schema
265    */
266   public void validate() throws org.exolab.castor.xml.ValidationException
267   {
268     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
269     validator.validate(this);
270   }
271
272 }