extended Colour element with additional optional attributes for graduated colour
[jalview.git] / src / jalview / binding / Setting.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.1)
3  * Copyright (C) 2009 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 Setting.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class Setting implements java.io.Serializable {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _type.
42      */
43     private java.lang.String _type;
44
45     /**
46      * Field _colour.
47      */
48     private int _colour;
49
50     /**
51      * keeps track of state for field: _colour
52      */
53     private boolean _has_colour;
54
55     /**
56      * Field _display.
57      */
58     private boolean _display;
59
60     /**
61      * keeps track of state for field: _display
62      */
63     private boolean _has_display;
64
65
66       //----------------/
67      //- Constructors -/
68     //----------------/
69
70     public Setting() {
71         super();
72     }
73
74
75       //-----------/
76      //- Methods -/
77     //-----------/
78
79     /**
80      */
81     public void deleteColour(
82     ) {
83         this._has_colour= false;
84     }
85
86     /**
87      */
88     public void deleteDisplay(
89     ) {
90         this._has_display= false;
91     }
92
93     /**
94      * Returns the value of field 'colour'.
95      * 
96      * @return the value of field 'Colour'.
97      */
98     public int getColour(
99     ) {
100         return this._colour;
101     }
102
103     /**
104      * Returns the value of field 'display'.
105      * 
106      * @return the value of field 'Display'.
107      */
108     public boolean getDisplay(
109     ) {
110         return this._display;
111     }
112
113     /**
114      * Returns the value of field 'type'.
115      * 
116      * @return the value of field 'Type'.
117      */
118     public java.lang.String getType(
119     ) {
120         return this._type;
121     }
122
123     /**
124      * Method hasColour.
125      * 
126      * @return true if at least one Colour has been added
127      */
128     public boolean hasColour(
129     ) {
130         return this._has_colour;
131     }
132
133     /**
134      * Method hasDisplay.
135      * 
136      * @return true if at least one Display has been added
137      */
138     public boolean hasDisplay(
139     ) {
140         return this._has_display;
141     }
142
143     /**
144      * Returns the value of field 'display'.
145      * 
146      * @return the value of field 'Display'.
147      */
148     public boolean isDisplay(
149     ) {
150         return this._display;
151     }
152
153     /**
154      * Method isValid.
155      * 
156      * @return true if this object is valid according to the schema
157      */
158     public boolean isValid(
159     ) {
160         try {
161             validate();
162         } catch (org.exolab.castor.xml.ValidationException vex) {
163             return false;
164         }
165         return true;
166     }
167
168     /**
169      * 
170      * 
171      * @param out
172      * @throws org.exolab.castor.xml.MarshalException if object is
173      * null or if any SAXException is thrown during marshaling
174      * @throws org.exolab.castor.xml.ValidationException if this
175      * object is an invalid instance according to the schema
176      */
177     public void marshal(
178             final java.io.Writer out)
179     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
180         Marshaller.marshal(this, out);
181     }
182
183     /**
184      * 
185      * 
186      * @param handler
187      * @throws java.io.IOException if an IOException occurs during
188      * marshaling
189      * @throws org.exolab.castor.xml.ValidationException if this
190      * object is an invalid instance according to the schema
191      * @throws org.exolab.castor.xml.MarshalException if object is
192      * null or if any SAXException is thrown during marshaling
193      */
194     public void marshal(
195             final org.xml.sax.ContentHandler handler)
196     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
197         Marshaller.marshal(this, handler);
198     }
199
200     /**
201      * Sets the value of field 'colour'.
202      * 
203      * @param colour the value of field 'colour'.
204      */
205     public void setColour(
206             final int colour) {
207         this._colour = colour;
208         this._has_colour = true;
209     }
210
211     /**
212      * Sets the value of field 'display'.
213      * 
214      * @param display the value of field 'display'.
215      */
216     public void setDisplay(
217             final boolean display) {
218         this._display = display;
219         this._has_display = true;
220     }
221
222     /**
223      * Sets the value of field 'type'.
224      * 
225      * @param type the value of field 'type'.
226      */
227     public void setType(
228             final java.lang.String type) {
229         this._type = type;
230     }
231
232     /**
233      * Method unmarshal.
234      * 
235      * @param reader
236      * @throws org.exolab.castor.xml.MarshalException if object is
237      * null or if any SAXException is thrown during marshaling
238      * @throws org.exolab.castor.xml.ValidationException if this
239      * object is an invalid instance according to the schema
240      * @return the unmarshaled jalview.binding.Setting
241      */
242     public static jalview.binding.Setting unmarshal(
243             final java.io.Reader reader)
244     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
245         return (jalview.binding.Setting) Unmarshaller.unmarshal(jalview.binding.Setting.class, reader);
246     }
247
248     /**
249      * 
250      * 
251      * @throws org.exolab.castor.xml.ValidationException if this
252      * object is an invalid instance according to the schema
253      */
254     public void validate(
255     )
256     throws org.exolab.castor.xml.ValidationException {
257         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
258         validator.validate(this);
259     }
260
261 }